7127032: fix for 7122253 adds a JvmtiThreadState earlier than necessary

Use JavaThread::jvmti_thread_state() instead of JvmtiThreadState::state_for().

Reviewed-by: coleenp, poonam, acorn
This commit is contained in:
Daniel D. Daugherty 2012-01-05 06:24:52 -08:00
parent 5782866b28
commit 743a35d2dc

View File

@ -2664,9 +2664,13 @@ instanceKlassHandle ClassFileParser::parseClassFile(Symbol* name,
_max_bootstrap_specifier_index = -1;
if (JvmtiExport::should_post_class_file_load_hook()) {
// Get the cached class file bytes (if any) from the
// class that is being redefined.
JvmtiThreadState *state = JvmtiThreadState::state_for(jt);
// Get the cached class file bytes (if any) from the class that
// is being redefined or retransformed. We use jvmti_thread_state()
// instead of JvmtiThreadState::state_for(jt) so we don't allocate
// a JvmtiThreadState any earlier than necessary. This will help
// avoid the bug described by 7126851.
JvmtiThreadState *state = jt->jvmti_thread_state();
if (state != NULL) {
KlassHandle *h_class_being_redefined =
state->get_class_being_redefined();
if (h_class_being_redefined != NULL) {
@ -2677,6 +2681,7 @@ instanceKlassHandle ClassFileParser::parseClassFile(Symbol* name,
cached_class_file_length =
ikh_class_being_redefined->get_cached_class_file_len();
}
}
unsigned char* ptr = cfs->buffer();
unsigned char* end_ptr = cfs->buffer() + cfs->length();