本文整理汇总了C++中instanceKlassHandle::enclosing_method_class_index方法的典型用法代码示例。如果您正苦于以下问题:C++ instanceKlassHandle::enclosing_method_class_index方法的具体用法?C++ instanceKlassHandle::enclosing_method_class_index怎么用?C++ instanceKlassHandle::enclosing_method_class_index使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类instanceKlassHandle
的用法示例。
在下文中一共展示了instanceKlassHandle::enclosing_method_class_index方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: redefine_single_class
//.........这里部分代码省略.........
// Patch the indexes into the constantpool from the array of fields of the evolving
// class. This is required, because the layout of the new constantpool can be different,
// so old indexes corresponding to field names and signatures can become invalid.
patch_indexes_for_fields(k_h, k_h_new);
// Make new constantpool object (and methodOops via it) point to the original class object
k_h_new->constants()->set_pool_holder(k_h());
// Replace methods and constantpool
k_h->set_methods(_new_methods);
k_h_new->set_methods(_old_methods); // To prevent potential GCing of the old methods,
// and to be able to undo operation easily.
constantPoolOop old_constants = k_h->constants();
k_h->set_constants(k_h_new->constants());
k_h_new->set_constants(old_constants); // See the previous comment.
check_methods_and_mark_as_old();
transfer_old_native_function_registrations();
// Replace inner_classes
typeArrayOop old_inner_classes = k_h->inner_classes();
k_h->set_inner_classes(k_h_new->inner_classes());
k_h_new->set_inner_classes(old_inner_classes);
// Initialize the vtable and interface table after
// methods have been rewritten
{ ResourceMark rm(THREAD);
k_h->vtable()->initialize_vtable(THREAD); // No exception can happen here
k_h->itable()->initialize_itable();
}
// Copy the "source file name" attribute from new class version
k_h->set_source_file_name(k_h_new->source_file_name());
// Copy the "source debug extension" attribute from new class version
k_h->set_source_debug_extension(k_h_new->source_debug_extension());
// Use of javac -g could be different in the old and the new
if (k_h_new->access_flags().has_localvariable_table() !=
k_h->access_flags().has_localvariable_table()) {
AccessFlags flags = k_h->access_flags();
if (k_h_new->access_flags().has_localvariable_table()) {
flags.set_has_localvariable_table();
} else {
flags.clear_has_localvariable_table();
}
k_h->set_access_flags(flags);
}
// Replace class annotation fields values
typeArrayOop old_class_annotations = k_h->class_annotations();
k_h->set_class_annotations(k_h_new->class_annotations());
k_h_new->set_class_annotations(old_class_annotations);
// Replace fields annotation fields values
objArrayOop old_fields_annotations = k_h->fields_annotations();
k_h->set_fields_annotations(k_h_new->fields_annotations());
k_h_new->set_fields_annotations(old_fields_annotations);
// Replace methods annotation fields values
objArrayOop old_methods_annotations = k_h->methods_annotations();
k_h->set_methods_annotations(k_h_new->methods_annotations());
k_h_new->set_methods_annotations(old_methods_annotations);
// Replace methods parameter annotation fields values
objArrayOop old_methods_parameter_annotations = k_h->methods_parameter_annotations();
k_h->set_methods_parameter_annotations(k_h_new->methods_parameter_annotations());
k_h_new->set_methods_parameter_annotations(old_methods_parameter_annotations);
// Replace methods default annotation fields values
objArrayOop old_methods_default_annotations = k_h->methods_default_annotations();
k_h->set_methods_default_annotations(k_h_new->methods_default_annotations());
k_h_new->set_methods_default_annotations(old_methods_default_annotations);
// Replace major version number of class file
u2 old_major_version = k_h->major_version();
k_h->set_major_version(k_h_new->major_version());
k_h_new->set_major_version(old_major_version);
// Replace CP indexes for class and name+type of enclosing method
u2 old_class_idx = k_h->enclosing_method_class_index();
u2 old_method_idx = k_h->enclosing_method_method_index();
k_h->set_enclosing_method_indices(k_h_new->enclosing_method_class_index(),
k_h_new->enclosing_method_method_index());
k_h_new->set_enclosing_method_indices(old_class_idx, old_method_idx);
// Maintain a linked list of versions of this class.
// List is in ascending age order. Current version (k_h) is the head.
if (k_h->has_previous_version()) {
k_h_new->set_previous_version(k_h->previous_version());
}
k_h->set_previous_version(k_h_new);
// Adjust constantpool caches and vtables for all classes
// that reference methods of the evolved class.
SystemDictionary::classes_do(adjust_cpool_cache_and_vtable);
k_h->set_rewritten_by_redefine(true);
}