You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For monitorenter/monitorexit, JIT generates the code for searching a monitor from the cache in J9VMThread if the object does not have a lockword.
Monitors are cached in objectMonitorLookupCache field, which is an array of j9objectmonitor_t.
When running in compressed refs mode in mixed refs build, all existing platform seem to generate incorrect code to access to the entry of this array. I think it does not cause any functional problem but the cache is never hit. I suppose it is an oversight when OpenJ9 switched to mixed refs builds.
In mixed refs build, both OMR_GC_COMPRESSED_POINTERS and OMR_GC_FULL_POINTERS are defined as in #8847 (comment).
Thus, objectMonitorLookupCache in J9VMThread is an array of UDATA as j9objectmonitor_t is UDATA when OMR_GC_FULL_POINTERS is defined.
However, p/x/z codegen calculate the offset of the entry in the array assuming the element size is TR::Compiler->om.sizeofReferenceField(), which is not the same as UDATA when running in compressed refs mode. Thus, the calculated offset is wrong and the cache is never hit (except for the first slot whose offset is 0).
I noticed this problem when implementing #9240 for AArch64. When debugging with gdb, I observed the generated code failing to find the existing entry in the cache array if using TR::Compiler->om.sizeofReferenceField() as the element size.
For monitorenter/monitorexit, JIT generates the code for searching a monitor from the cache in J9VMThread if the object does not have a lockword.
Monitors are cached in
objectMonitorLookupCache
field, which is an array ofj9objectmonitor_t
.When running in compressed refs mode in mixed refs build, all existing platform seem to generate incorrect code to access to the entry of this array. I think it does not cause any functional problem but the cache is never hit. I suppose it is an oversight when OpenJ9 switched to mixed refs builds.
In mixed refs build, both
OMR_GC_COMPRESSED_POINTERS
andOMR_GC_FULL_POINTERS
are defined as in #8847 (comment).Thus,
objectMonitorLookupCache
in J9VMThread is an array ofUDATA
asj9objectmonitor_t
isUDATA
whenOMR_GC_FULL_POINTERS
is defined.openj9/runtime/oti/j9accessbarrier.h
Lines 39 to 46 in c332ee2
openj9/runtime/oti/j9nonbuilder.h
Line 4986 in c332ee2
However, p/x/z codegen calculate the offset of the entry in the array assuming the element size is
TR::Compiler->om.sizeofReferenceField()
, which is not the same asUDATA
when running in compressed refs mode. Thus, the calculated offset is wrong and the cache is never hit (except for the first slot whose offset is 0).openj9/runtime/compiler/p/codegen/J9TreeEvaluator.cpp
Line 7447 in c332ee2
openj9/runtime/compiler/x/codegen/J9TreeEvaluator.cpp
Line 965 in c332ee2
openj9/runtime/compiler/z/codegen/J9TreeEvaluator.cpp
Line 8445 in c332ee2
I noticed this problem when implementing #9240 for AArch64. When debugging with gdb, I observed the generated code failing to find the existing entry in the cache array if using
TR::Compiler->om.sizeofReferenceField()
as the element size.FYI @0xdaryl @knn-k
The text was updated successfully, but these errors were encountered: