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

Aleksey Shipilev shade at redhat.com
Mon Jul 16 16:38:30 UTC 2018


On 07/16/2018 06:28 PM, Andrew Haley wrote:
>>    // 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.
>>      if (ciEnv::current()->task() != NULL &&
>>          is_c2_compile(ciEnv::current()->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
>>        }
>>      }
>>    }
> 
> Hmm.  Maybe I can compromise there somewhere.  That's more or less what
> I started with, but I changed it because it was too complex a conditional...

Your choice, really. I used to frown about conditionals like this all around Hotspot, but then I
started to see the appeal: you can clearly see (A && B && C) here, even if A, B, C are not trivial.
But structurally, you immediately grasp that if A fails, we don't enter the block; if B fails, we
don't enter the block, if C fails, we don't enter the block. It takes some time to read through
chain of local variables to reach the same verdict.

-Aleksey


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


More information about the hotspot-compiler-dev mailing list