/* * Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. *
*/
// Get the cached class file bytes (if any) from the class that // is being retransformed. If class file load hook provides // modified class data during class loading or redefinition, // new cached class file buffer should be allocated. // 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) {
Klass* k = state->get_class_being_redefined(); if (k != NULL && state->get_class_load_kind() == jvmti_class_load_kind_retransform) {
InstanceKlass* class_being_redefined = InstanceKlass::cast(k);
*cached_class_file = class_being_redefined->get_cached_class_file();
}
}
if (ptr != stream->buffer()) { // JVMTI agent has modified class file data. // Set new class file stream using JVMTI agent modified class file data.
stream = new ClassFileStream(ptr,
end_ptr - ptr,
stream->source(),
stream->need_verify());
}
}
// Skip this processing for VM hidden classes if (!cl_info.is_hidden()) {
stream = check_class_file_load_hook(stream,
name,
loader_data,
cl_info.protection_domain(),
&cached_class_file,
CHECK_NULL);
}
const ClassInstanceInfo* cl_inst_info = cl_info.class_hidden_info_ptr();
InstanceKlass* result = parser.create_instance_klass(old_stream != stream, *cl_inst_info, CHECK_NULL);
assert(result != NULL, "result cannot be null with no pending exception");
if (cached_class_file != NULL) { // JVMTI: we have an InstanceKlass now, tell it about the cached bytes
result->set_cached_class_file(cached_class_file);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.