Note
Enhancement 8386858: [lworld] Omit load_prototype_header When UseObjectMonitorTable Is Used
When UseObjectMonitorTable is enabled, I have modified it to avoid loading the prototype header in the path that reads the Valhalla-specific mark word flag.
Overview#
In the lworld branch of Valhalla, when an object appears to be locked, the prototype header is read from klass, and the Valhalla-specific markWord flags are checked.
However, if UseObjectMonitorTable is enabled, the object monitor is not represented as a markWord on the object header. In this case, the necessary mark word bits remain in the object header, so there's no need to proceed with load_prototype_header; the read-in header can be inspected directly.
This fix modifies the code such that test_oop_prototype_bit reads the prototype header only when !UseObjectMonitorTable. The affected architectures are aarch64, ppc, riscv, and x86. This change makes the process more lightweight.
ldr(temp_reg, Address(oop, oopDesc::mark_offset_in_bytes()));
-tst(temp_reg, markWord::unlocked_value);
-br(Assembler::NE, test_mark_word);
-load_prototype_header(temp_reg, oop);
+if (!UseObjectMonitorTable) {
+ tst(temp_reg, markWord::unlocked_value);
+ br(Assembler::NE, test_mark_word);
+ load_prototype_header(temp_reg, oop);
+}
As a result, when UseObjectMonitorTable is enabled, unnecessary prototype header reads are avoided, and flags can be directly inspected from the object header.
PR Created on June 29, 2026#
In the PR, I explained that with UseObjectMonitorTable enabled, the object monitor does not get placed as a displaced mark word in the object header. Therefore, bits can be obtained directly from the read-in header1.
The fix applies the same logic to each CPU's MacroAssembler::test_oop_prototype_bit. First, it loads the mark word and executes the previous behavior when UseObjectMonitorTable is disabled.
Review on June 29-30, 2026#
Coleen Phillimore2 approved the PR. She noted that ObjectMonitorTable will be removed in the future, and this change results in faster code.
Afterward, /integrate was performed, putting it into a sponsor-waiting state.
Integration on June 30, 2026#
David Holmes3 also approved the PR and proceeded with /sponsor. The final commit 28b617e4 integrated this change into the Valhalla lworld branch.
Footnotes#
-
8386858: [lworld] omit load_prototype_header when UseObjectMonitorTable is used by PeyaPeyaPeyang · Pull Request #2591 …https://openjdk.org/projects/valhalla. Contribute to openjdk/valhalla development by creating an account on GitHub.GitHub
↩
-
https://openjdk.org/census#coleenpopenjdk.org↩
-
https://openjdk.org/census#dholmesopenjdk.org↩
-
8386858: [lworld] omit load_prototype_header when UseObjectMonitorTab… · openjdk/valhalla@28b617ehttps://openjdk.org/projects/valhalla. Contribute to openjdk/valhalla development by creating an account on GitHub.GitHub
↩