RFR: 8207345: AArch64: Trampoline generation code reads from uninitialized memory

Andrew Dinn adinn at redhat.com
Mon Jul 16 20:55:59 UTC 2018


On 16/07/18 18:58, Aleksey Shipilev wrote:
> On 07/16/2018 07:48 PM, Andrew Haley wrote:
>> LOL!  It's simpler because it's actually wrong!  :-)
>>
>> Using the form above, it actually should be
>>
>>   // We need a trampoline if branches are far.
>>   if (far_branches()) {
>>     // We don't want to emit a trampoline if C2 is generating dummy
>>     // code during its branch shortening phase.
>>     CompileTask* task = ciEnv::current()->task();
>>     if (task != NULL
>>         && ! (is_c2_compile(task->comp_level())
>>               && Compile::current()->in_scratch_emit_size())) {
>>       address stub = emit_trampoline_stub(offset(), entry.target());
>>       if (stub == NULL) {
>>         return NULL; // CodeCache is full
>>       }
>>     }
>>   }
>>
>> i.e. we want a trampoline if we're using C1 or (we're using C2 and not in scratch emit).
> 
> Ah, dang. So this captures the intent better?
> 
>    // We need a trampoline if branches are far.
>    if (far_branches()) {
>      // We don't want to emit a trampoline if C2 is generating dummy
>      // code during its branch shortening phase.
>      CompileTask* task = ciEnv::current()->task();
>      bool is_c2 = (task != NULL) && is_c2_compile(task->comp_level());
>      if (!in_c2 || !Compile::current()->in_scratch_emit_size()) {
>        address stub = emit_trampoline_stub(offset(), entry.target());
>        if (stub == NULL) {
>          return NULL; // CodeCache is full
>        }
>      }
>    }
> 
> But I have no problems with the original patch too.

Aargh, note to self: no more late-night reviews from a hotel room!

regards,


Andrew Dinn
-----------
Senior Principal Software Engineer
Red Hat UK Ltd
Registered in England and Wales under Company Registration No. 03798903
Directors: Michael Cunningham, Michael ("Mike") O'Neill, Eric Shander

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://mail.openjdk.java.net/pipermail/hotspot-compiler-dev/attachments/20180716/79645d83/signature-0001.asc>


More information about the hotspot-compiler-dev mailing list