src/share/vm/prims/jvmtiRedefineClasses.cpp

Print this page


   1 /*
   2  * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


4094     bool trace_name_printed = false;
4095     mnt->adjust_method_entries(_matching_old_methods,
4096                                _matching_new_methods,
4097                                _matching_methods_length,
4098                                &trace_name_printed);
4099   }
4100 
4101   // Fix Resolution Error table also to remove old constant pools
4102   SystemDictionary::delete_resolution_error(old_constants);
4103 
4104   if (the_class->oop_map_cache() != NULL) {
4105     // Flush references to any obsolete methods from the oop map cache
4106     // so that obsolete methods are not pinned.
4107     the_class->oop_map_cache()->flush_obsolete_entries();
4108   }
4109 
4110   // increment the classRedefinedCount field in the_class and in any
4111   // direct and indirect subclasses of the_class
4112   increment_class_counter((InstanceKlass *)the_class(), THREAD);
4113 






4114   // RC_TRACE macro has an embedded ResourceMark
4115   RC_TRACE_WITH_THREAD(0x00000001, THREAD,
4116     ("redefined name=%s, count=%d (avail_mem=" UINT64_FORMAT "K)",
4117     the_class->external_name(),
4118     java_lang_Class::classRedefinedCount(the_class_mirror),
4119     os::available_memory() >> 10));
4120 
4121   RC_TIMER_STOP(_timer_rsc_phase2);
4122 } // end redefine_single_class()
4123 
4124 
4125 // Increment the classRedefinedCount field in the specific InstanceKlass
4126 // and in all direct and indirect subclasses.
4127 void VM_RedefineClasses::increment_class_counter(InstanceKlass *ik, TRAPS) {
4128   oop class_mirror = ik->java_mirror();
4129   Klass* class_oop = java_lang_Class::as_Klass(class_mirror);
4130   int new_count = java_lang_Class::classRedefinedCount(class_mirror) + 1;
4131   java_lang_Class::set_classRedefinedCount(class_mirror, new_count);
4132 
4133   if (class_oop != _the_class_oop) {


   1 /*
   2  * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


4094     bool trace_name_printed = false;
4095     mnt->adjust_method_entries(_matching_old_methods,
4096                                _matching_new_methods,
4097                                _matching_methods_length,
4098                                &trace_name_printed);
4099   }
4100 
4101   // Fix Resolution Error table also to remove old constant pools
4102   SystemDictionary::delete_resolution_error(old_constants);
4103 
4104   if (the_class->oop_map_cache() != NULL) {
4105     // Flush references to any obsolete methods from the oop map cache
4106     // so that obsolete methods are not pinned.
4107     the_class->oop_map_cache()->flush_obsolete_entries();
4108   }
4109 
4110   // increment the classRedefinedCount field in the_class and in any
4111   // direct and indirect subclasses of the_class
4112   increment_class_counter((InstanceKlass *)the_class(), THREAD);
4113 
4114   if (the_class() == SystemDictionary::misc_Unsafe_klass()) {
4115     // Update old Unsafe.throwIllegalAccessError() itable entries
4116     UpdateITableThrowIllegalAccessErrorEntries updater;
4117     ClassLoaderDataGraph::classes_do(&updater);
4118   }
4119 
4120   // RC_TRACE macro has an embedded ResourceMark
4121   RC_TRACE_WITH_THREAD(0x00000001, THREAD,
4122     ("redefined name=%s, count=%d (avail_mem=" UINT64_FORMAT "K)",
4123     the_class->external_name(),
4124     java_lang_Class::classRedefinedCount(the_class_mirror),
4125     os::available_memory() >> 10));
4126 
4127   RC_TIMER_STOP(_timer_rsc_phase2);
4128 } // end redefine_single_class()
4129 
4130 
4131 // Increment the classRedefinedCount field in the specific InstanceKlass
4132 // and in all direct and indirect subclasses.
4133 void VM_RedefineClasses::increment_class_counter(InstanceKlass *ik, TRAPS) {
4134   oop class_mirror = ik->java_mirror();
4135   Klass* class_oop = java_lang_Class::as_Klass(class_mirror);
4136   int new_count = java_lang_Class::classRedefinedCount(class_mirror) + 1;
4137   java_lang_Class::set_classRedefinedCount(class_mirror, new_count);
4138 
4139   if (class_oop != _the_class_oop) {