@@ -150,15 +150,10 @@ void Deoptimization::UnrollBlock::print() {
150
150
151
151
152
152
// 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.
157
156
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
-
162
157
// fetch_unroll_info() is called at the beginning of the deoptimization
163
158
// handler. Note this fact before we start generating temporary frames
164
159
// 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
689
684
// We are already active in the special DeoptResourceMark any ResourceObj's we
690
685
// allocate will be freed at the end of the routine.
691
686
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;
696
694
HandleMark hm (thread);
697
695
698
696
frame stub_frame = thread->last_frame ();
0 commit comments