review request for 6787106
Xiaobin Lu
Xiaobin.Lu at Sun.COM
Fri Dec 19 11:42:34 PST 2008
http://webrev.invokedynamic.info/xiaobin.lu/6787106/webrev/
CR 6787106: Hotspot 32 bit build fails on platforms having different
definitions for intptr_t & int32_t
Details:
This bug was filed to fix the build failure on Mac OS X and I believe it
is a good practice to put back the fix in Openjdk so that the BSD folks
or whoever maintain the BSD port could merge the fix into their tree.
Basically on Mac OS X, intptr_t & int32_t are not the same type on 32
bit platform and intptr_t and int64_t are not the same either. The
former is typedefed as "long" and the latter is typedefed as "int" (or
long long for int64_t). Those are usually same types on platforms such
as Windows, Solaris and different flavors of Linux. Somewhere in our
code, we assume they are the same type and that is where the problem
arouse. In assembler_x86.hpp, we have the following definitions in
MacroAssembler class:
void movptr(Address dst, intptr_t src);
void movptr(Address dst, Reigster src); (Register is defined as RegisterImpl*)
And when we want to clear some destination address, we simply call
"movptr(dest, (int32_t)NULL_WORD);". The cast is necessary to resolve
the call to the one which accepts intptr_t as the second parameter.
Well, this works on platforms which treat intptr_t & int32_t the same,
but will break on other platforms which do not, hence, the build
failed. My fix is to redefine NULL_WORD on 32 bit a little bit
different, instead of define NULL_WORD as "0", I defined it as
"(intptr_t)0". With that, in the places where we want to call
"movptr(dest, (int32_t)NULL_WORD);", we can simply call "movptr(dest,
NULL_WORD);", therefore, no ambiguity.
Tom has a better solution which might address this in a more elegant
way, but I don't believe we have enough time to address that in short
term and I believe the solution I am suggesting here is ok at least to
give a good build on Mac.
Reviewed by:
Verified by:
JPRT
Build passed on 32 bit & 64 bit Mac OS 10.5.5.
Thanks,
-Xiaobin
More information about the hotspot-dev
mailing list