_LP64, int32_t and intptr_t

Xiaobin Lu Xiaobin.Lu at Sun.COM
Thu Dec 18 12:20:36 PST 2008


FYI, bug "6787106: Created P3 hotspot/other Hotspot 32 bit build fails 
on platforms having different definitions for intptr_t & int32_t" has 
been filed and the fix is on the way.

-Xiaobin

On 12/17/08 16:48, Xiaobin Lu wrote:
> I am now working on a short term solution (I believe we can live with 
> that for now). A bug will be filed and if that works well on other 
> platforms, I am going to put back the change and let your folks know.
>
> Thanks,
> -Xiaobin
>
> On 12/13/08 18:34, Michael Franz wrote:
>   
>> Hi,
>>
>> Looking at assembler_x86.hpp and the usage of _LP64.  It seems that 
>> _LP64 is used to decide whether or not to define 32 bit version of
>>   void movptr(Address dst, int32_t imm32);
>>   void movptr(Register dst, int32_t imm32);
>> to work around casting calls when imm32 would be zero or NULL on 64 
>> bit platforms.  Wouldn't it be better to use the NOT_LP64 and 
>> LP64_ONLY macros with
>> void MacroAssembler::movptr(Address dst, intptr_t src)
>> void MacroAssembler::movptr(Register dst, intptr_t src)
>> instead?  This would change the casting to use the intptr_t instead of 
>> int32_t.  This would allow the compiler to pick the correct method and 
>> reduce the need for 32 bit only versions.
>>
>> The the implementation would be:
>> void MacroAssembler::movptr(Address dst, intptr_t src) {
>> #ifdef _LP64
>>   mov64(rscratch1, src);
>>   movq(dst, rscratch1);   
>> #else
>>   movslq(dst, src);
>> #endif
>> }
>>
>> void MacroAssembler::movptr(Register dst, intptr_t src) {
>>   LP64_ONLY(mov64(dst, src)) NOT_LP64(movl(dst, src));
>> }
>> would not need to be changed as it already uses the LP64 macros.
>>
>> What is interesting that
>> void MacroAssembler::movptr(Register dst, int32_t src) {
>>   mov64(dst, (intptr_t)src);
>> }
>> uses mov64 instead of movl.
>>
>>
>> I have attached the changes I did to get the OS X build to work again.
>>
>> Michael
>>     
>
>
>   

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/bsd-port-dev/attachments/20081218/2a50e892/attachment.html 


More information about the bsd-port-dev mailing list