342 static Method** _deleted_methods; 343 static Method** _added_methods; 344 static int _matching_methods_length; 345 static int _deleted_methods_length; 346 static int _added_methods_length; 347 static Klass* _the_class_oop; 348 349 // The instance fields are used to pass information from 350 // doit_prologue() to doit() and doit_epilogue(). 351 jint _class_count; 352 const jvmtiClassDefinition *_class_defs; // ptr to _class_count defs 353 354 // This operation is used by both RedefineClasses and 355 // RetransformClasses. Indicate which. 356 JvmtiClassLoadKind _class_load_kind; 357 358 // _index_map_count is just an optimization for knowing if 359 // _index_map_p contains any entries. 360 int _index_map_count; 361 intArray * _index_map_p; 362 // ptr to _class_count scratch_classes 363 Klass** _scratch_classes; 364 jvmtiError _res; 365 366 // Performance measurement support. These timers do not cover all 367 // the work done for JVM/TI RedefineClasses() but they do cover 368 // the heavy lifting. 369 elapsedTimer _timer_rsc_phase1; 370 elapsedTimer _timer_rsc_phase2; 371 elapsedTimer _timer_vm_op_prologue; 372 373 // These routines are roughly in call order unless otherwise noted. 374 375 // Load the caller's new class definition(s) into _scratch_classes. 376 // Constant pool merging work is done here as needed. Also calls 377 // compare_and_normalize_class_versions() to verify the class 378 // definition(s). 379 jvmtiError load_new_class_versions(TRAPS); 380 381 // Verify that the caller provided class definition(s) that meet 405 // from their constant pool caches, itables, and/or vtables. We 406 // use the SystemDictionary::classes_do() facility and this helper 407 // to fix up these pointers. 408 static void adjust_cpool_cache_and_vtable(Klass* k_oop, ClassLoaderData* initiating_loader, TRAPS); 409 static void adjust_array_vtable(Klass* k_oop); 410 411 // Install the redefinition of a class 412 void redefine_single_class(jclass the_jclass, 413 Klass* scratch_class_oop, TRAPS); 414 415 void swap_annotations(instanceKlassHandle new_class, 416 instanceKlassHandle scratch_class); 417 418 // Increment the classRedefinedCount field in the specific InstanceKlass 419 // and in all direct and indirect subclasses. 420 void increment_class_counter(InstanceKlass *ik, TRAPS); 421 422 // Support for constant pool merging (these routines are in alpha order): 423 void append_entry(constantPoolHandle scratch_cp, int scratch_i, 424 constantPoolHandle *merge_cp_p, int *merge_cp_length_p, TRAPS); 425 int find_or_append_indirect_entry(constantPoolHandle scratch_cp, int scratch_i, 426 constantPoolHandle *merge_cp_p, int *merge_cp_length_p, TRAPS); 427 int find_new_index(int old_index); 428 bool is_unresolved_class_mismatch(constantPoolHandle cp1, int index1, 429 constantPoolHandle cp2, int index2); 430 void map_index(constantPoolHandle scratch_cp, int old_index, int new_index); 431 bool merge_constant_pools(constantPoolHandle old_cp, 432 constantPoolHandle scratch_cp, constantPoolHandle *merge_cp_p, 433 int *merge_cp_length_p, TRAPS); 434 jvmtiError merge_cp_and_rewrite(instanceKlassHandle the_class, 435 instanceKlassHandle scratch_class, TRAPS); 436 u2 rewrite_cp_ref_in_annotation_data( 437 AnnotationArray* annotations_typeArray, int &byte_i_ref, 438 const char * trace_mesg, TRAPS); 439 bool rewrite_cp_refs(instanceKlassHandle scratch_class, TRAPS); 440 bool rewrite_cp_refs_in_annotation_struct( 441 AnnotationArray* class_annotations, int &byte_i_ref, TRAPS); 442 bool rewrite_cp_refs_in_annotations_typeArray( 443 AnnotationArray* annotations_typeArray, int &byte_i_ref, TRAPS); 444 bool rewrite_cp_refs_in_class_annotations( 445 instanceKlassHandle scratch_class, TRAPS); 446 bool rewrite_cp_refs_in_element_value( 447 AnnotationArray* class_annotations, int &byte_i_ref, TRAPS); 448 bool rewrite_cp_refs_in_fields_annotations( 449 instanceKlassHandle scratch_class, TRAPS); 450 void rewrite_cp_refs_in_method(methodHandle method, | 342 static Method** _deleted_methods; 343 static Method** _added_methods; 344 static int _matching_methods_length; 345 static int _deleted_methods_length; 346 static int _added_methods_length; 347 static Klass* _the_class_oop; 348 349 // The instance fields are used to pass information from 350 // doit_prologue() to doit() and doit_epilogue(). 351 jint _class_count; 352 const jvmtiClassDefinition *_class_defs; // ptr to _class_count defs 353 354 // This operation is used by both RedefineClasses and 355 // RetransformClasses. Indicate which. 356 JvmtiClassLoadKind _class_load_kind; 357 358 // _index_map_count is just an optimization for knowing if 359 // _index_map_p contains any entries. 360 int _index_map_count; 361 intArray * _index_map_p; 362 363 // _operands_index_map_count is just an optimization for knowing if 364 // _operands_index_map_p contains any entries. 365 int _operands_cur_length; 366 int _operands_index_map_count; 367 intArray * _operands_index_map_p; 368 369 // ptr to _class_count scratch_classes 370 Klass** _scratch_classes; 371 jvmtiError _res; 372 373 // Performance measurement support. These timers do not cover all 374 // the work done for JVM/TI RedefineClasses() but they do cover 375 // the heavy lifting. 376 elapsedTimer _timer_rsc_phase1; 377 elapsedTimer _timer_rsc_phase2; 378 elapsedTimer _timer_vm_op_prologue; 379 380 // These routines are roughly in call order unless otherwise noted. 381 382 // Load the caller's new class definition(s) into _scratch_classes. 383 // Constant pool merging work is done here as needed. Also calls 384 // compare_and_normalize_class_versions() to verify the class 385 // definition(s). 386 jvmtiError load_new_class_versions(TRAPS); 387 388 // Verify that the caller provided class definition(s) that meet 412 // from their constant pool caches, itables, and/or vtables. We 413 // use the SystemDictionary::classes_do() facility and this helper 414 // to fix up these pointers. 415 static void adjust_cpool_cache_and_vtable(Klass* k_oop, ClassLoaderData* initiating_loader, TRAPS); 416 static void adjust_array_vtable(Klass* k_oop); 417 418 // Install the redefinition of a class 419 void redefine_single_class(jclass the_jclass, 420 Klass* scratch_class_oop, TRAPS); 421 422 void swap_annotations(instanceKlassHandle new_class, 423 instanceKlassHandle scratch_class); 424 425 // Increment the classRedefinedCount field in the specific InstanceKlass 426 // and in all direct and indirect subclasses. 427 void increment_class_counter(InstanceKlass *ik, TRAPS); 428 429 // Support for constant pool merging (these routines are in alpha order): 430 void append_entry(constantPoolHandle scratch_cp, int scratch_i, 431 constantPoolHandle *merge_cp_p, int *merge_cp_length_p, TRAPS); 432 void append_operand(constantPoolHandle scratch_cp, int scratch_bootstrap_spec_index, 433 constantPoolHandle *merge_cp_p, int *merge_cp_length_p, TRAPS); 434 void finalize_operands_merge(constantPoolHandle merge_cp, TRAPS); 435 int find_or_append_indirect_entry(constantPoolHandle scratch_cp, int scratch_i, 436 constantPoolHandle *merge_cp_p, int *merge_cp_length_p, TRAPS); 437 int find_or_append_operand(constantPoolHandle scratch_cp, int scratch_bootstrap_spec_index, 438 constantPoolHandle *merge_cp_p, int *merge_cp_length_p, TRAPS); 439 int find_new_index(int old_index); 440 int find_new_operand_index(int old_bootstrap_spec_index); 441 bool is_unresolved_class_mismatch(constantPoolHandle cp1, int index1, 442 constantPoolHandle cp2, int index2); 443 void map_index(constantPoolHandle scratch_cp, int old_index, int new_index); 444 void map_operand_index(int old_bootstrap_spec_index, int new_bootstrap_spec_index); 445 bool merge_constant_pools(constantPoolHandle old_cp, 446 constantPoolHandle scratch_cp, constantPoolHandle *merge_cp_p, 447 int *merge_cp_length_p, TRAPS); 448 jvmtiError merge_cp_and_rewrite(instanceKlassHandle the_class, 449 instanceKlassHandle scratch_class, TRAPS); 450 u2 rewrite_cp_ref_in_annotation_data( 451 AnnotationArray* annotations_typeArray, int &byte_i_ref, 452 const char * trace_mesg, TRAPS); 453 bool rewrite_cp_refs(instanceKlassHandle scratch_class, TRAPS); 454 bool rewrite_cp_refs_in_annotation_struct( 455 AnnotationArray* class_annotations, int &byte_i_ref, TRAPS); 456 bool rewrite_cp_refs_in_annotations_typeArray( 457 AnnotationArray* annotations_typeArray, int &byte_i_ref, TRAPS); 458 bool rewrite_cp_refs_in_class_annotations( 459 instanceKlassHandle scratch_class, TRAPS); 460 bool rewrite_cp_refs_in_element_value( 461 AnnotationArray* class_annotations, int &byte_i_ref, TRAPS); 462 bool rewrite_cp_refs_in_fields_annotations( 463 instanceKlassHandle scratch_class, TRAPS); 464 void rewrite_cp_refs_in_method(methodHandle method, |