Entry point publishing in Truffle OptimizedCallTarget, on AArch64

Aleksandar Prokopec aleksandar.prokopec at oracle.com
Thu Jun 15 09:17:07 UTC 2017


Hi Andrew,

Of course, I should have taken a look at the patching code more closely. 
It looks like this will definitely require adding the 
TEST_BRANCH_CONDITIONALLY value, and doing a different emit during 
patching based on that.

Btw, you probably saw it, but in my latest push, the new functionality 
is enabled with the "-Dgraal. AArch64EntryPointTagging=true" option.

Thanks a lot for taking a look at this,
Alex

On 14.06.2017 18:37, Andrew Dinn wrote:
> On 14/06/17 17:09, Andrew Dinn wrote:
>> Correction:
>>
>> Looking at the details of the test failures it appears that many of them
>> are caused by an error that might be related to your code.
>>
>> Many of the tests are manifesting exceptions under method
>> AArch64MacroAssembler.patchJumpTarget in a call to
>> ConditionFlag.fromEncoding. Here is the offending code:
>>
>>          int instruction = getInt(branch);
>>          int branchOffset = jumpTarget - branch;
>>          PatchLabelKind type = PatchLabelKind.fromEncoding(instruction);
>>          switch (type) {
>>              case BRANCH_CONDITIONALLY:
>>                  ConditionFlag cf =
>> ConditionFlag.fromEncoding(instruction >>>
>> PatchLabelKind.INFORMATION_OFFSET);
>>                  super.b(cf, branchOffset, branch);
>>                  break;
>>              case BRANCH_UNCONDITIONALLY:
>>                  super.b(branchOffset, branch);
>>          . . .
>>
>> So, there is something in the format of a generated branch that the
>> assembler does not understand. If you are generating a TBZ that is
>> susceptible to patching -- even if it is not actually installed -- then
>> that might account for why I am seeing these specific unit test
>> failures. I'll take a deeper look to see if I can diagnose whether the
>> offending instruction is a TBZ and where it is being generated from.
> This is certainly the problem that is causing some of the unit tests to
> fail (I don't yet know about all of them).
>
> The implementation of tbz/nz is using the same encoding as cbz/nz to
> encode patch details into the instruction slot for a branch with an as
> yet unbound label. This is use later y the jump patch routine to
> construct the required jump instruction. So, with the current
> implementation of tbz that fails for two reasons. The patch info doesn't
> include the uimm6 argument needed to provide the test bit position. It
> also means that the patch code tries to patch the jump as a cbz/nz
> rather than a tbz/nz.
>
> I'll see if I can come up with a correct implementation and then see
> what that does to the failing unit test count. This probably requires a
> new type of patch info encoding (TEST_BRANCH_CONDITIONALLY.encoding)
> with a new layout for the other data that includes the uimm6 but
> position value. I'll let you know when I have a suitable patch.
>
> 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



More information about the graal-dev mailing list