question about stubRoutines

Vladimir Kozlov vladimir.kozlov at oracle.com
Thu Jul 5 16:25:16 PDT 2012


Look on MacroAssembler::testl() comment:

   // Import other testl() methods from the parent class or else
   // they will be hidden by the following overriding declaration.
   using Assembler::testl;
   void testl(Register dst, AddressLiteral src);

Also build from scratch: generated precompiled header file may be not updated 
correctly.

Vladimir

Venkatachalam, Vasanth wrote:
> How do you handle the case where instructions in assembler_x86.cpp don't have overloaded versions that take an AddressLiteral as a source argument? Below is how I'm handling this case. Is this correct?
> 
> Take for example, the andl instruction. I defined an overloaded version taking an AddressLiteral in MacroAssembler:
> 
> void MacroAssembler::andl(Register dst, AddressLiteral src) {
>   if(reachable(src)) {
>     Assembler::andl(dst, as_Address(src));
>   } 
>   else {
>     lea(rscratch1, src);
>     Assembler::andl(dst, Address(rscratch1, 0));
>     }
> 
> When I want to use the instruction (in StubGenerator_x86_64.cpp), I do it as follows:
> 
> ExternalAddress foo_address(StubRoutines::x86::mask_mant_all8());
> 
>  __ andl(rax, foo_address);
> 
> When I do this I get the build errors below:  
> 
> /home/tester/hotspot/hotspot-bd-dev/src/cpu/x86/vm/x86_64.ad: In member function 'virtual void loadUB2L_immI8Node::emit(CodeBuffer&, PhaseRegAlloc*) const':
> /home/tester/hotspot/hotspot-bd-dev/src/cpu/x86/vm/x86_64.ad:4850:44: error: no matching function for call to 'MacroAssembler::andl(RegisterImpl*&, intptr_t)'
> /home/tester/hotspot/hotspot-bd-dev/src/cpu/x86/vm/x86_64.ad:4850:44: note: candidate is:
> In file included from /home/tester/hotspot/hotspot-bd-dev/src/share/vm/asm/assembler.hpp:448:0,
>                  from /home/tester/hotspot/hotspot-bd-dev/src/share/vm/precompiled/precompiled.hpp:29:
> /home/tester/hotspot/hotspot-bd-dev/src/cpu/x86/vm/assembler_x86.hpp:2256:8: note: void MacroAssembler::andl(Register, AddressLiteral)
> /home/tester/hotspot/hotspot-bd-dev/src/cpu/x86/vm/assembler_x86.hpp:2256:8: note:   no known conversion for argument 2 from 'intptr_t {aka long int}' to 'AddressLiteral'
> 
> -----Original Message-----
> From: Vladimir Kozlov [mailto:vladimir.kozlov at oracle.com] 
> Sent: Monday, June 25, 2012 7:47 PM
> To: Venkatachalam, Vasanth
> Cc: hotspot-dev at openjdk.java.net
> Subject: Re: question about stubRoutines
> 
> Look how StubRoutines::x86::float_sign_mask() is done. Then you can access it as 
> external address:
> 
>    ExternalAddress foostart_adr(StubRoutines::x86::foostart());
>    __ lea(r9, foostart_Adr);
> 
> Vladimir
> 
> Venkatachalam, Vasanth wrote:
>> Hi,
>>
>>  
>>
>> I'm trying to write a new stub routine in Hotspot's 
>> stubGenerator_x86_64.cpp. The original code for the routine is in a MASM 
>> file. I'm trying to translate this code into calls to Hotspot's 
>> assembler so that the code can be implemented into a stub routine.
>>
>>  
>>
>> The original MASM file has a large data segment (aligned to 16 bytes) 
>> which looks like:
>>
>>  
>>
>> ALIGN 16
>>
>> __foostart:
>>
>>                     DQ 0000000000000000h
>>
>>                     DQ 3f6ff00aa0000000h
>>
>>                     DQ 3f7fe02a60000000h
>>
>>                     DQ 3f87dc4750000000h
>>
>>                     DQ 3f8fc0a8b0000000h
>>
>>                     DQ 3f93cea440000000h
>>
>>                     DQ 3f97b91b00000000h
>>
>>                                                     <several hundred 
>> more entries...>
>>
>>  
>>
>> This data segment is used in one of the instructions:
>>
>> lea r9, QWORD PTR __foostart
>>
>>  
>>
>> Can anyone explain how to handle this data segment when writing a new 
>> StubRoutine in Hotspot?
>>
>>  
>>
>> Vasanth
>>
>>  
>>
>> --
>>
>> Vasanth Venkatachalam
>>
>> AMD Runtimes
>>
>> (512)602-6177
>>
>>  
>>
> 
> 


More information about the hotspot-dev mailing list