Skip to content

Commit bf28f92

Browse files
committed
8259713: Fix comments about ResetNoHandleMark in deoptimization
Reviewed-by: lfoltan, dcubed, dholmes
1 parent 4f881ba commit bf28f92

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

src/hotspot/share/runtime/deoptimization.cpp

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -150,15 +150,10 @@ void Deoptimization::UnrollBlock::print() {
150150

151151

152152
// In order to make fetch_unroll_info work properly with escape
153-
// analysis, The method was changed from JRT_LEAF to JRT_BLOCK_ENTRY and
154-
// ResetNoHandleMark and HandleMark were removed from it. The actual reallocation
155-
// of previously eliminated objects occurs in realloc_objects, which is
156-
// called from the method fetch_unroll_info_helper below.
153+
// analysis, the method was changed from JRT_LEAF to JRT_BLOCK_ENTRY.
154+
// The actual reallocation of previously eliminated objects occurs in realloc_objects,
155+
// which is called from the method fetch_unroll_info_helper below.
157156
JRT_BLOCK_ENTRY(Deoptimization::UnrollBlock*, Deoptimization::fetch_unroll_info(JavaThread* thread, int exec_mode))
158-
// It is actually ok to allocate handles in a leaf method. It causes no safepoints,
159-
// but makes the entry a little slower. There is however a little dance we have to
160-
// do in debug mode to get around the NoHandleMark code in the JRT_LEAF macro
161-
162157
// fetch_unroll_info() is called at the beginning of the deoptimization
163158
// handler. Note this fact before we start generating temporary frames
164159
// that can confuse an asynchronous stack walker. This counter is
@@ -689,10 +684,13 @@ JRT_LEAF(BasicType, Deoptimization::unpack_frames(JavaThread* thread, int exec_m
689684
// We are already active in the special DeoptResourceMark any ResourceObj's we
690685
// allocate will be freed at the end of the routine.
691686

692-
// It is actually ok to allocate handles in a leaf method. It causes no safepoints,
693-
// but makes the entry a little slower. There is however a little dance we have to
694-
// do in debug mode to get around the NoHandleMark code in the JRT_LEAF macro
695-
ResetNoHandleMark rnhm; // No-op in release/product versions
687+
// JRT_LEAF methods don't normally allocate handles and there is a
688+
// NoHandleMark to enforce that. It is actually safe to use Handles
689+
// in a JRT_LEAF method, and sometimes desirable, but to do so we
690+
// must use ResetNoHandleMark to bypass the NoHandleMark, and
691+
// then use a HandleMark to ensure any Handles we do create are
692+
// cleaned up in this scope.
693+
ResetNoHandleMark rnhm;
696694
HandleMark hm(thread);
697695

698696
frame stub_frame = thread->last_frame();

0 commit comments

Comments
 (0)