Mercurial > hg > graal-compiler
comparison src/share/vm/prims/jvmtiRedefineClasses.hpp @ 10408:836a62f43af9
Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Wed, 19 Jun 2013 10:45:56 +0200 |
parents | 43083e670adf |
children | 825e6cb66923 |
comparison
equal
deleted
inserted
replaced
10086:e0fb8a213650 | 10408:836a62f43af9 |
---|---|
85 // - replacing parts in the_class with parts from scratch_class | 85 // - replacing parts in the_class with parts from scratch_class |
86 // - adding weak reference(s) to track the obsolete but interesting | 86 // - adding weak reference(s) to track the obsolete but interesting |
87 // parts of the_class | 87 // parts of the_class |
88 // - adjusting constant pool caches and vtables in other classes | 88 // - adjusting constant pool caches and vtables in other classes |
89 // that refer to methods in the_class. These adjustments use the | 89 // that refer to methods in the_class. These adjustments use the |
90 // SystemDictionary::classes_do() facility which only allows | 90 // ClassLoaderDataGraph::classes_do() facility which only allows |
91 // a helper method to be specified. The interesting parameters | 91 // a helper method to be specified. The interesting parameters |
92 // that we would like to pass to the helper method are saved in | 92 // that we would like to pass to the helper method are saved in |
93 // static global fields in the VM operation. | 93 // static global fields in the VM operation. |
94 // - telling the SystemDictionary to notice our changes | 94 // - telling the SystemDictionary to notice our changes |
95 // | 95 // |
331 // coordinate a cleanup of these constants with Runtime. | 331 // coordinate a cleanup of these constants with Runtime. |
332 // | 332 // |
333 | 333 |
334 class VM_RedefineClasses: public VM_Operation { | 334 class VM_RedefineClasses: public VM_Operation { |
335 private: | 335 private: |
336 // These static fields are needed by SystemDictionary::classes_do() | 336 // These static fields are needed by ClassLoaderDataGraph::classes_do() |
337 // facility and the adjust_cpool_cache_and_vtable() helper: | 337 // facility and the AdjustCpoolCacheAndVtable helper: |
338 static Array<Method*>* _old_methods; | 338 static Array<Method*>* _old_methods; |
339 static Array<Method*>* _new_methods; | 339 static Array<Method*>* _new_methods; |
340 static Method** _matching_old_methods; | 340 static Method** _matching_old_methods; |
341 static Method** _matching_new_methods; | 341 static Method** _matching_new_methods; |
342 static Method** _deleted_methods; | 342 static Method** _deleted_methods; |
357 | 357 |
358 // _index_map_count is just an optimization for knowing if | 358 // _index_map_count is just an optimization for knowing if |
359 // _index_map_p contains any entries. | 359 // _index_map_p contains any entries. |
360 int _index_map_count; | 360 int _index_map_count; |
361 intArray * _index_map_p; | 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 | |
362 // ptr to _class_count scratch_classes | 369 // ptr to _class_count scratch_classes |
363 Klass** _scratch_classes; | 370 Klass** _scratch_classes; |
364 jvmtiError _res; | 371 jvmtiError _res; |
365 | 372 |
366 // Performance measurement support. These timers do not cover all | 373 // Performance measurement support. These timers do not cover all |
367 // the work done for JVM/TI RedefineClasses() but they do cover | 374 // the work done for JVM/TI RedefineClasses() but they do cover |
368 // the heavy lifting. | 375 // the heavy lifting. |
399 // is squirreled away. | 406 // is squirreled away. |
400 void check_methods_and_mark_as_obsolete(BitMap *emcp_methods, | 407 void check_methods_and_mark_as_obsolete(BitMap *emcp_methods, |
401 int * emcp_method_count_p); | 408 int * emcp_method_count_p); |
402 void transfer_old_native_function_registrations(instanceKlassHandle the_class); | 409 void transfer_old_native_function_registrations(instanceKlassHandle the_class); |
403 | 410 |
404 // Unevolving classes may point to methods of the_class directly | |
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 | 411 // Install the redefinition of a class |
412 void redefine_single_class(jclass the_jclass, | 412 void redefine_single_class(jclass the_jclass, |
413 Klass* scratch_class_oop, TRAPS); | 413 Klass* scratch_class_oop, TRAPS); |
414 | 414 |
415 void swap_annotations(instanceKlassHandle new_class, | 415 void swap_annotations(instanceKlassHandle new_class, |
420 void increment_class_counter(InstanceKlass *ik, TRAPS); | 420 void increment_class_counter(InstanceKlass *ik, TRAPS); |
421 | 421 |
422 // Support for constant pool merging (these routines are in alpha order): | 422 // Support for constant pool merging (these routines are in alpha order): |
423 void append_entry(constantPoolHandle scratch_cp, int scratch_i, | 423 void append_entry(constantPoolHandle scratch_cp, int scratch_i, |
424 constantPoolHandle *merge_cp_p, int *merge_cp_length_p, TRAPS); | 424 constantPoolHandle *merge_cp_p, int *merge_cp_length_p, TRAPS); |
425 void append_operand(constantPoolHandle scratch_cp, int scratch_bootstrap_spec_index, | |
426 constantPoolHandle *merge_cp_p, int *merge_cp_length_p, TRAPS); | |
427 void finalize_operands_merge(constantPoolHandle merge_cp, TRAPS); | |
425 int find_or_append_indirect_entry(constantPoolHandle scratch_cp, int scratch_i, | 428 int find_or_append_indirect_entry(constantPoolHandle scratch_cp, int scratch_i, |
426 constantPoolHandle *merge_cp_p, int *merge_cp_length_p, TRAPS); | 429 constantPoolHandle *merge_cp_p, int *merge_cp_length_p, TRAPS); |
430 int find_or_append_operand(constantPoolHandle scratch_cp, int scratch_bootstrap_spec_index, | |
431 constantPoolHandle *merge_cp_p, int *merge_cp_length_p, TRAPS); | |
427 int find_new_index(int old_index); | 432 int find_new_index(int old_index); |
433 int find_new_operand_index(int old_bootstrap_spec_index); | |
428 bool is_unresolved_class_mismatch(constantPoolHandle cp1, int index1, | 434 bool is_unresolved_class_mismatch(constantPoolHandle cp1, int index1, |
429 constantPoolHandle cp2, int index2); | 435 constantPoolHandle cp2, int index2); |
430 void map_index(constantPoolHandle scratch_cp, int old_index, int new_index); | 436 void map_index(constantPoolHandle scratch_cp, int old_index, int new_index); |
437 void map_operand_index(int old_bootstrap_spec_index, int new_bootstrap_spec_index); | |
431 bool merge_constant_pools(constantPoolHandle old_cp, | 438 bool merge_constant_pools(constantPoolHandle old_cp, |
432 constantPoolHandle scratch_cp, constantPoolHandle *merge_cp_p, | 439 constantPoolHandle scratch_cp, constantPoolHandle *merge_cp_p, |
433 int *merge_cp_length_p, TRAPS); | 440 int *merge_cp_length_p, TRAPS); |
434 jvmtiError merge_cp_and_rewrite(instanceKlassHandle the_class, | 441 jvmtiError merge_cp_and_rewrite(instanceKlassHandle the_class, |
435 instanceKlassHandle scratch_class, TRAPS); | 442 instanceKlassHandle scratch_class, TRAPS); |
464 instanceKlassHandle scratch_class, | 471 instanceKlassHandle scratch_class, |
465 constantPoolHandle scratch_cp, int scratch_cp_length, TRAPS); | 472 constantPoolHandle scratch_cp, int scratch_cp_length, TRAPS); |
466 | 473 |
467 void flush_dependent_code(instanceKlassHandle k_h, TRAPS); | 474 void flush_dependent_code(instanceKlassHandle k_h, TRAPS); |
468 | 475 |
469 static void check_class(Klass* k_oop, ClassLoaderData* initiating_loader, | |
470 TRAPS); | |
471 static void dump_methods(); | 476 static void dump_methods(); |
477 | |
478 // Check that there are no old or obsolete methods | |
479 class CheckClass : public KlassClosure { | |
480 Thread* _thread; | |
481 public: | |
482 CheckClass(Thread* t) : _thread(t) {} | |
483 void do_klass(Klass* k); | |
484 }; | |
485 | |
486 // Unevolving classes may point to methods of the_class directly | |
487 // from their constant pool caches, itables, and/or vtables. We | |
488 // use the ClassLoaderDataGraph::classes_do() facility and this helper | |
489 // to fix up these pointers. | |
490 class AdjustCpoolCacheAndVtable : public KlassClosure { | |
491 Thread* _thread; | |
492 public: | |
493 AdjustCpoolCacheAndVtable(Thread* t) : _thread(t) {} | |
494 void do_klass(Klass* k); | |
495 }; | |
472 | 496 |
473 public: | 497 public: |
474 VM_RedefineClasses(jint class_count, | 498 VM_RedefineClasses(jint class_count, |
475 const jvmtiClassDefinition *class_defs, | 499 const jvmtiClassDefinition *class_defs, |
476 JvmtiClassLoadKind class_load_kind); | 500 JvmtiClassLoadKind class_load_kind); |