Entry point publishing in Truffle OptimizedCallTarget, on AArch64

Aleksandar Prokopec aleksandar.prokopec at oracle.com
Wed Jun 14 12:09:38 UTC 2017


Hi Andrew,

Thanks a lot!

Yes, pulling out the check in TruffleCompiler should enable this on 
AArch64. To make it even easier, I added a change with a flag that turns 
the new functionality on and off on AArch64 (should land on github in 
half an hour or so).

On SPARC and x86, I was testing the fix with plain "mx unittest", and 
this helped me detect correctness issues.

Best,
Alex


On 14.06.2017 12:54, Andrew Dinn wrote:
> Hi Aleksander,
>
> I have quickly eyeballed your patch and it looks ok. I'll try applying
> the patch and building it this afternoon (once I have got some other
> graal fixes I am working on out of the way).
>
> If it builds ok I will then take out the disabling check and try to run
> it. Is there a specific test I can use to ensure I exercise the changed
> code?
>
> regards,
>
>
> Andrew Dinn
> -----------
>
> On 14/06/17 09:09, Aleksandar Prokopec wrote:
>> Dear Andrew,
>>
>> I have yesterday submitted a pull request to the Graal compiler, which
>> should resolve a rare race condition that happens during Truffle's code
>> installation. In short, the race condition existed because: after the
>> code got installed with JVMCI, the "entryPoint" field in the
>> "InstalledCode" class became visible to other threads, but the
>> Truffle-level assumptions were not yet associated with that code [2].
>>
>> My fix solves this by introducing the rule that Truffle
>> OptimizedCallTarget's entry points addresses can only be jumped to if
>> the lowest bit of the "entryPoint" field is set to "1". In other words,
>> setting the lowest bit means that the "entryPoint" is published. The
>> tail call code that gets patched at the beginning of the code of every
>> OptimizedCallTarget must now not only check that the "entryPoint" is
>> non-null, but also check that the lowest bit is "1".
>>
>> I have implemented the fix on x86, SPARC and AArch64. However, I was
>> only able to run and test this x86 and SPARC, since we have no AArch64
>> machines. Since you've been involved with a lot of AArch64 maintenance
>> in the past, I am assuming that you have access to a proper machine. If
>> so, could you perhaps validate that my fix on AArch64 is correct (files
>> under links [3] [4] [5]), or suggest changes?
>>
>> Note that the new functionality, "entryPoint" tagging, is currently
>> disabled [6] on AArch64, since I was not sure about my fix.
>>
>> Thanks a lot,
>> Alex
>>
>> [1]
>> https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_graalvm_graal_commit_28b5474a1f6882f30c883c33012cd1bac8c2a646&d=DwIDaQ&c=RoP1YumCXCgaWHvlZYR8PQcxBKCX5YTpkKY057SbK10&r=F9qKVJ7-WS5ke7QixbHuGLRTnPdc51bZWn_11BBmt4s&m=nqpBoAHLwE9FcNDH-mvEOCWhxi3DPd5KVv87hCYV0fs&s=xR_uGNp9T1nrrYUvnneQ8qumHggTC_2Kyf_k8HgZHOE&e=
>>
>>
>> [2]
>> https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_graalvm_graal_blob_master_compiler_src_org.graalvm.compiler.truffle_src_org_graalvm_compiler_truffle_TruffleCompiler.java-23L234&d=DwIDaQ&c=RoP1YumCXCgaWHvlZYR8PQcxBKCX5YTpkKY057SbK10&r=F9qKVJ7-WS5ke7QixbHuGLRTnPdc51bZWn_11BBmt4s&m=nqpBoAHLwE9FcNDH-mvEOCWhxi3DPd5KVv87hCYV0fs&s=hHnh-d6lrCrovDLAqoxgojcuxMEwILqk3U9z6W-rCgc&e=
>>
>>
>> [3]
>> https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_graalvm_graal_commit_28b5474a1f6882f30c883c33012cd1bac8c2a646-23diff-2Dd53ecccd225be6a6ece41d8c64579c7a&d=DwIDaQ&c=RoP1YumCXCgaWHvlZYR8PQcxBKCX5YTpkKY057SbK10&r=F9qKVJ7-WS5ke7QixbHuGLRTnPdc51bZWn_11BBmt4s&m=nqpBoAHLwE9FcNDH-mvEOCWhxi3DPd5KVv87hCYV0fs&s=QFoNpzZDa5btWFKI7vrfPzOq4f39eqNtrVpCzXcs2m0&e=
>>
>>
>> [4]
>> https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_graalvm_graal_commit_28b5474a1f6882f30c883c33012cd1bac8c2a646-23diff-2D7a3deff5793b399e8a3b008e14fb14cf&d=DwIDaQ&c=RoP1YumCXCgaWHvlZYR8PQcxBKCX5YTpkKY057SbK10&r=F9qKVJ7-WS5ke7QixbHuGLRTnPdc51bZWn_11BBmt4s&m=nqpBoAHLwE9FcNDH-mvEOCWhxi3DPd5KVv87hCYV0fs&s=EJMEqOujL_qiUKdJZ2CtGPCpbt7z8dqEQEsjpPPvWt0&e=
>>
>>
>> [5]
>> https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_graalvm_graal_commit_28b5474a1f6882f30c883c33012cd1bac8c2a646-23diff-2D6a1d15e2ba69aa5ed34a906ecf895a1f&d=DwIDaQ&c=RoP1YumCXCgaWHvlZYR8PQcxBKCX5YTpkKY057SbK10&r=F9qKVJ7-WS5ke7QixbHuGLRTnPdc51bZWn_11BBmt4s&m=nqpBoAHLwE9FcNDH-mvEOCWhxi3DPd5KVv87hCYV0fs&s=vIJBLetDqbnS5RKo0TMXdCxKuzQNRGFOMBPTZ_XJ0kI&e=
>>
>>
>> [6]
>> https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_graalvm_graal_commit_28b5474a1f6882f30c883c33012cd1bac8c2a646-23diff-2Db171c7113ea386f9a5af29d46cd4e7bcR238&d=DwIDaQ&c=RoP1YumCXCgaWHvlZYR8PQcxBKCX5YTpkKY057SbK10&r=F9qKVJ7-WS5ke7QixbHuGLRTnPdc51bZWn_11BBmt4s&m=nqpBoAHLwE9FcNDH-mvEOCWhxi3DPd5KVv87hCYV0fs&s=lcRjsxWQo2lOr4GSwtqMdRQjd6gicBorHLaauTaFlcU&e=
>>
>>
>>



More information about the graal-dev mailing list