@@ -141,52 +141,25 @@ class JvmtiEventMark : public StackObj {
141
141
JavaThread *_thread;
142
142
JNIEnv* _jni_env;
143
143
JvmtiThreadState::ExceptionState _saved_exception_state;
144
- #if 0
145
- JNIHandleBlock* _hblock;
146
- #endif
147
144
148
145
public:
149
146
JvmtiEventMark (JavaThread *thread) : _thread(thread),
150
147
_jni_env (thread->jni_environment ()),
151
148
_saved_exception_state(JvmtiThreadState::ES_CLEARED) {
152
- #if 0
153
- _hblock = thread->active_handles();
154
- _hblock->clear_thoroughly(); // so we can be safe
155
- #else
156
- // we want to use the code above - but that needs the JNIHandle changes - later...
157
- // for now, steal JNI push local frame code
158
149
JvmtiThreadState *state = thread->jvmti_thread_state ();
159
150
// we are before an event.
160
151
// Save current jvmti thread exception state.
161
152
if (state != NULL ) {
162
153
_saved_exception_state = state->get_exception_state ();
163
154
}
164
155
165
- JNIHandleBlock* old_handles = thread->active_handles ();
166
- JNIHandleBlock* new_handles = JNIHandleBlock::allocate_block (thread);
167
- assert (new_handles != NULL , " should not be NULL" );
168
- new_handles->set_pop_frame_link (old_handles);
169
- thread->set_active_handles (new_handles);
170
- #endif
156
+ thread->push_jni_handle_block ();
171
157
assert (thread == JavaThread::current (), " thread must be current!" );
172
158
thread->frame_anchor ()->make_walkable (thread);
173
159
};
174
160
175
161
~JvmtiEventMark () {
176
- #if 0
177
- _hblock->clear(); // for consistency with future correct behavior
178
- #else
179
- // we want to use the code above - but that needs the JNIHandle changes - later...
180
- // for now, steal JNI pop local frame code
181
- JNIHandleBlock* old_handles = _thread->active_handles ();
182
- JNIHandleBlock* new_handles = old_handles->pop_frame_link ();
183
- assert (new_handles != NULL , " should not be NULL" );
184
- _thread->set_active_handles (new_handles);
185
- // Note that we set the pop_frame_link to NULL explicitly, otherwise
186
- // the release_block call will release the blocks.
187
- old_handles->set_pop_frame_link (NULL );
188
- JNIHandleBlock::release_block (old_handles, _thread); // may block
189
- #endif
162
+ _thread->pop_jni_handle_block ();
190
163
191
164
JvmtiThreadState* state = _thread->jvmti_thread_state ();
192
165
// we are continuing after an event.
@@ -196,13 +169,7 @@ class JvmtiEventMark : public StackObj {
196
169
}
197
170
}
198
171
199
- #if 0
200
- jobject to_jobject(oop obj) { return obj == NULL? NULL : _hblock->allocate_handle_fast(obj); }
201
- #else
202
- // we want to use the code above - but that needs the JNIHandle changes - later...
203
- // for now, use regular make_local
204
172
jobject to_jobject (oop obj) { return JNIHandles::make_local (_thread,obj); }
205
- #endif
206
173
207
174
jclass to_jclass (Klass* klass) { return (klass == NULL ? NULL : (jclass)to_jobject (klass->java_mirror ())); }
208
175
0 commit comments