Execute read barrier for constrained TX within the GS event handler #2790
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We currently only take advantage of constrained transactions (TX) in
ConcurrentLinkedQueue methods we recognize. The problem for the
constrained TX is that the return address the hardware populates for us
in
J9GSParameters.returnAddr
points to theTBEGIC
instructionbecause the constrained transaction has no fall back path!
The very first thing we do inside of the transactions in the
ConcurrentLinkedQueue methods we recognize is load a field which
requires the read barrier. So the control flow ends up looping forever
failing on the read barrier in the
TBEGIC
region, then the handleraborts the read barrier because we are in a TX and we loop again, etc.
This causes a hang in the JVM. There is another bit in
J9GSParameters
which tells us whether the TX that triggered the guarded storage event
was constrained or not. Currently there are two read barriers in each
of the two methods we recognize and inline. The read barriers are both
of the form
o.f.g
i.e. two field indirections both requiring hardwareread barrier instructions. Given that if we reach the hardware read
barrier event handler the transaction would have already aborted there
should be no functional issue to executing the read barrier at that
point for either the read of
f
org
because the JIT has ensuredthere are no side-effects (stores) before the hardware read barriers,
only after.
The fix here is to execute the read barriers for constrained
transactions but avoid executing them for non-constrained transactions
since we have a fall back path in that case.
Signed-off-by: Filip Jeremic fjeremic@ca.ibm.com