JDK-8360540 : nmethod entry barriers of new nmethods should be disarmed
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: gc
  • Affected Version: 25,26
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2025-06-25
  • Updated: 2025-09-03
  • Resolved: 2025-08-22
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 26
26 b13Fixed
Related Reports
Blocks :  
Causes :  
Relates :  
Description
We're using nmethod entry barriers regardless of GC selection since JDK-8290025.
ZGC calls disarm(nm) in ZNMethod::register_nmethod(nmethod* nm). That disables the barrier for new nmethods before their first execution.
ShenandoahGC also calls a disarm function in ShenandoahNMethodTable::register_nmethod(nmethod* nm).

Such a disarm is missing for other GCs. That causes unnecessary execution of the barriers after new nmethods are installed into the code cache.

Total execution of nmethod entry barrier code and patching during concurrent execution can be reduced significantly.

Comments
BTW, for CompileTheWorld or -Xcomp, when we may be registering a lot of nmethods that will never execute, it might actually be slightly better to leave them armed. The cut-off where it stops being profitable is probably when the ratio of executed vs registered approaches the cost ratio of disarm vs entry barrier.
27-08-2025

Changeset: e1c58f85 Branch: master Author: Martin Doerr <mdoerr@openjdk.org> Date: 2025-08-22 09:01:21 +0000 URL: https://git.openjdk.org/jdk/commit/e1c58f858a64853c2d454fd00a84455ca6700055
22-08-2025

A pull request was submitted for review. Branch: master URL: https://git.openjdk.org/jdk/pull/25982 Date: 2025-06-25 14:55:03 +0000
25-06-2025