Entry point publishing in Truffle OptimizedCallTarget, on AArch64
Aleksandar Prokopec
aleksandar.prokopec at oracle.com
Wed Jun 14 08:09:30 UTC 2017
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://github.com/graalvm/graal/commit/28b5474a1f6882f30c883c33012cd1bac8c2a646
[2]
https://github.com/graalvm/graal/blob/master/compiler/src/org.graalvm.compiler.truffle/src/org/graalvm/compiler/truffle/TruffleCompiler.java#L234
[3]
https://github.com/graalvm/graal/commit/28b5474a1f6882f30c883c33012cd1bac8c2a646#diff-d53ecccd225be6a6ece41d8c64579c7a
[4]
https://github.com/graalvm/graal/commit/28b5474a1f6882f30c883c33012cd1bac8c2a646#diff-7a3deff5793b399e8a3b008e14fb14cf
[5]
https://github.com/graalvm/graal/commit/28b5474a1f6882f30c883c33012cd1bac8c2a646#diff-6a1d15e2ba69aa5ed34a906ecf895a1f
[6]
https://github.com/graalvm/graal/commit/28b5474a1f6882f30c883c33012cd1bac8c2a646#diff-b171c7113ea386f9a5af29d46cd4e7bcR238
More information about the graal-dev
mailing list