On 32 bit Mac OS, intptr_t is typedefed as long and int32_t is typedefed as int. This is not true on other platforms such as Solaris & most of Linux distributions including BSD. In some hotspot code, we rely on the assumption that intptr_t & int32_t are same so cast from one to another automatically works. This will certainly fail on platforms which does not have that assumption.
Here is an example. In assembler_x86.hpp, we have the following definitions in class MacroAssembler:
void movptr(Address dst, intptr_t src);
void movptr(Address dst, Reigster src); (Register is defined as RegisterImpl*)
In the places we want to clear the destination address, we simply call movptr(dest, (int32_t)NULL); the cast is necessary to make the compiler to resolve the ambiguity which we believe it will pick up the intptr_t version. This will break on platforms such as Mac OS X since the cast still hasn't made it clear which one to choose.
|