hotspot/src/share/vm/prims/jvmtiRedefineClasses.cpp
changeset 46505 fd4bc78630b1
parent 46427 54713555867e
child 46630 75aa3e39d02c
equal deleted inserted replaced
46504:38048d4d20e7 46505:fd4bc78630b1
    41 #include "oops/fieldStreams.hpp"
    41 #include "oops/fieldStreams.hpp"
    42 #include "oops/klassVtable.hpp"
    42 #include "oops/klassVtable.hpp"
    43 #include "oops/oop.inline.hpp"
    43 #include "oops/oop.inline.hpp"
    44 #include "prims/jvmtiImpl.hpp"
    44 #include "prims/jvmtiImpl.hpp"
    45 #include "prims/jvmtiRedefineClasses.hpp"
    45 #include "prims/jvmtiRedefineClasses.hpp"
       
    46 #include "prims/resolvedMethodTable.hpp"
    46 #include "prims/methodComparator.hpp"
    47 #include "prims/methodComparator.hpp"
    47 #include "runtime/deoptimization.hpp"
    48 #include "runtime/deoptimization.hpp"
    48 #include "runtime/relocator.hpp"
    49 #include "runtime/relocator.hpp"
    49 #include "utilities/bitMap.inline.hpp"
    50 #include "utilities/bitMap.inline.hpp"
    50 #include "utilities/events.hpp"
    51 #include "utilities/events.hpp"
    65                                        const jvmtiClassDefinition *class_defs,
    66                                        const jvmtiClassDefinition *class_defs,
    66                                        JvmtiClassLoadKind class_load_kind) {
    67                                        JvmtiClassLoadKind class_load_kind) {
    67   _class_count = class_count;
    68   _class_count = class_count;
    68   _class_defs = class_defs;
    69   _class_defs = class_defs;
    69   _class_load_kind = class_load_kind;
    70   _class_load_kind = class_load_kind;
       
    71   _any_class_has_resolved_methods = false;
    70   _res = JVMTI_ERROR_NONE;
    72   _res = JVMTI_ERROR_NONE;
    71 }
    73 }
    72 
    74 
    73 static inline InstanceKlass* get_ik(jclass def) {
    75 static inline InstanceKlass* get_ik(jclass def) {
    74   oop mirror = JNIHandles::resolve_non_null(def);
    76   oop mirror = JNIHandles::resolve_non_null(def);
   198   // Clean out MethodData pointing to old Method*
   200   // Clean out MethodData pointing to old Method*
   199   // Have to do this after all classes are redefined and all methods that
   201   // Have to do this after all classes are redefined and all methods that
   200   // are redefined are marked as old.
   202   // are redefined are marked as old.
   201   MethodDataCleaner clean_weak_method_links;
   203   MethodDataCleaner clean_weak_method_links;
   202   ClassLoaderDataGraph::classes_do(&clean_weak_method_links);
   204   ClassLoaderDataGraph::classes_do(&clean_weak_method_links);
       
   205 
       
   206   // JSR-292 support
       
   207   if (_any_class_has_resolved_methods) {
       
   208     bool trace_name_printed = false;
       
   209     ResolvedMethodTable::adjust_method_entries(&trace_name_printed);
       
   210   }
   203 
   211 
   204   // Disable any dependent concurrent compilations
   212   // Disable any dependent concurrent compilations
   205   SystemDictionary::notice_modification();
   213   SystemDictionary::notice_modification();
   206 
   214 
   207   // Set flag indicating that some invariants are no longer true.
   215   // Set flag indicating that some invariants are no longer true.
  3821   _new_methods = scratch_class->methods();
  3829   _new_methods = scratch_class->methods();
  3822   _the_class = the_class;
  3830   _the_class = the_class;
  3823   compute_added_deleted_matching_methods();
  3831   compute_added_deleted_matching_methods();
  3824   update_jmethod_ids();
  3832   update_jmethod_ids();
  3825 
  3833 
       
  3834   _any_class_has_resolved_methods = the_class->has_resolved_methods() || _any_class_has_resolved_methods;
       
  3835 
  3826   // Attach new constant pool to the original klass. The original
  3836   // Attach new constant pool to the original klass. The original
  3827   // klass still refers to the old constant pool (for now).
  3837   // klass still refers to the old constant pool (for now).
  3828   scratch_class->constants()->set_pool_holder(the_class);
  3838   scratch_class->constants()->set_pool_holder(the_class);
  3829 
  3839 
  3830 #if 0
  3840 #if 0
  4035   // Adjust constantpool caches and vtables for all classes
  4045   // Adjust constantpool caches and vtables for all classes
  4036   // that reference methods of the evolved class.
  4046   // that reference methods of the evolved class.
  4037   AdjustCpoolCacheAndVtable adjust_cpool_cache_and_vtable(THREAD);
  4047   AdjustCpoolCacheAndVtable adjust_cpool_cache_and_vtable(THREAD);
  4038   ClassLoaderDataGraph::classes_do(&adjust_cpool_cache_and_vtable);
  4048   ClassLoaderDataGraph::classes_do(&adjust_cpool_cache_and_vtable);
  4039 
  4049 
  4040   // JSR-292 support
       
  4041   MemberNameTable* mnt = the_class->member_names();
       
  4042   if (mnt != NULL) {
       
  4043     bool trace_name_printed = false;
       
  4044     mnt->adjust_method_entries(the_class, &trace_name_printed);
       
  4045   }
       
  4046 
       
  4047   if (the_class->oop_map_cache() != NULL) {
  4050   if (the_class->oop_map_cache() != NULL) {
  4048     // Flush references to any obsolete methods from the oop map cache
  4051     // Flush references to any obsolete methods from the oop map cache
  4049     // so that obsolete methods are not pinned.
  4052     // so that obsolete methods are not pinned.
  4050     the_class->oop_map_cache()->flush_obsolete_entries();
  4053     the_class->oop_map_cache()->flush_obsolete_entries();
  4051   }
  4054   }