LWN.net Logo

Linux now an equal Flash player (Linux-Watch)

Linux now an equal Flash player (Linux-Watch)

Posted Oct 20, 2008 10:06 UTC (Mon) by alankila (subscriber, #47141)
In reply to: Linux now an equal Flash player (Linux-Watch) by jengelh
Parent article: Linux now an equal Flash player (Linux-Watch)

Okay, so it does it somehow by magic. By your words the automatic decision made by GCC has to be a compile-time one. For runtime, all code generated by GCC will be 64-bit safe; in other words, doing a malloc() say always returns a 64-bit value and there is no way this will be optimized at runtime?


(Log in to post comments)

Linux now an equal Flash player (Linux-Watch)

Posted Oct 20, 2008 15:41 UTC (Mon) by jengelh (subscriber, #33263) [Link]

By my words, GCC internally could have something like:

if ((signed long)operand <= 0x7fffffff)
    spewout(short opcode version, operand);
else
    /* default */
    spewout(long opcode version, operand);

With no option to tune it. Why would you even use the slower one when you can avoid it? It's not going to change anything... unless there is a bug in the CPU that causes the short opcode to go haywire.

Yes, malloc always returns a 64-bit quantity, and it does so in a register, which makes accesses cheap with small values: int *x = malloc(sizeof(int)); *x = 5; equates to mov dword ptr [rax], 5 which is the c7 00 code with a 32-bit operand for the "5".

Copyright © 2012, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds