< prev index next >

src/hotspot/share/oops/cpCache.cpp

Print this page
rev 50453 : imported patch 02.removeInArchiveRoot


  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  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "classfile/resolutionErrors.hpp"
  27 #include "interpreter/bytecodeStream.hpp"
  28 #include "interpreter/bytecodes.hpp"
  29 #include "interpreter/interpreter.hpp"
  30 #include "interpreter/linkResolver.hpp"
  31 #include "interpreter/rewriter.hpp"
  32 #include "logging/log.hpp"
  33 #include "memory/metadataFactory.hpp"
  34 #include "memory/metaspaceClosure.hpp"

  35 #include "memory/resourceArea.hpp"
  36 #include "memory/universe.hpp"
  37 #include "oops/access.inline.hpp"
  38 #include "oops/constantPool.inline.hpp"
  39 #include "oops/cpCache.inline.hpp"
  40 #include "oops/objArrayOop.inline.hpp"
  41 #include "oops/oop.inline.hpp"
  42 #include "prims/methodHandles.hpp"
  43 #include "runtime/atomic.hpp"
  44 #include "runtime/handles.inline.hpp"
  45 #include "runtime/orderAccess.hpp"
  46 #include "utilities/macros.hpp"
  47 
  48 // Implementation of ConstantPoolCacheEntry
  49 
  50 void ConstantPoolCacheEntry::initialize_entry(int index) {
  51   assert(0 < index && index < 0x10000, "sanity check");
  52   _indices = index;
  53   _f1 = NULL;
  54   _f2 = _flags = 0;


 726       for (int i=0; i<length(); i++) {
 727         entry_at(i)->verify_just_initialized(f2_used[i]);
 728       })
 729   } else {
 730     for (int i=0; i<length(); i++) {
 731       entry_at(i)->reinitialize(f2_used[i]);
 732     }
 733   }
 734 }
 735 
 736 void ConstantPoolCache::deallocate_contents(ClassLoaderData* data) {
 737   assert(!is_shared(), "shared caches are not deallocated");
 738   data->remove_handle(_resolved_references);
 739   set_resolved_references(NULL);
 740   MetadataFactory::free_array<u2>(data, _reference_map);
 741   set_reference_map(NULL);
 742 }
 743 
 744 #if INCLUDE_CDS_JAVA_HEAP
 745 oop ConstantPoolCache::archived_references() {
 746   // Loading an archive root forces the oop to become strongly reachable.
 747   // For example, if it is loaded during concurrent marking in a SATB
 748   // collector, it will be enqueued to the SATB queue, effectively
 749   // shading the previously white object gray.
 750   return RootAccess<IN_ARCHIVE_ROOT>::oop_load(&_archived_references);
 751 }
 752 
 753 void ConstantPoolCache::set_archived_references(oop o) {
 754   assert(DumpSharedSpaces, "called only during runtime");
 755   RootAccess<IN_ARCHIVE_ROOT>::oop_store(&_archived_references, o);
 756 }
 757 #endif
 758 
 759 #if INCLUDE_JVMTI
 760 // RedefineClasses() API support:
 761 // If any entry of this ConstantPoolCache points to any of
 762 // old_methods, replace it with the corresponding new_method.
 763 void ConstantPoolCache::adjust_method_entries(InstanceKlass* holder, bool * trace_name_printed) {
 764   for (int i = 0; i < length(); i++) {
 765     ConstantPoolCacheEntry* entry = entry_at(i);
 766     Method* old_method = entry->get_interesting_method_entry(holder);
 767     if (old_method == NULL || !old_method->is_old()) {
 768       continue; // skip uninteresting entries
 769     }
 770     if (old_method->is_deleted()) {
 771       // clean up entries with deleted methods
 772       entry->initialize_entry(entry->constant_pool_index());
 773       continue;
 774     }
 775     Method* new_method = holder->method_with_idnum(old_method->orig_method_idnum());




  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  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "classfile/resolutionErrors.hpp"
  27 #include "interpreter/bytecodeStream.hpp"
  28 #include "interpreter/bytecodes.hpp"
  29 #include "interpreter/interpreter.hpp"
  30 #include "interpreter/linkResolver.hpp"
  31 #include "interpreter/rewriter.hpp"
  32 #include "logging/log.hpp"
  33 #include "memory/metadataFactory.hpp"
  34 #include "memory/metaspaceClosure.hpp"
  35 #include "memory/metaspaceShared.hpp"
  36 #include "memory/resourceArea.hpp"
  37 #include "memory/universe.hpp"
  38 #include "oops/access.inline.hpp"
  39 #include "oops/constantPool.inline.hpp"
  40 #include "oops/cpCache.inline.hpp"
  41 #include "oops/objArrayOop.inline.hpp"
  42 #include "oops/oop.inline.hpp"
  43 #include "prims/methodHandles.hpp"
  44 #include "runtime/atomic.hpp"
  45 #include "runtime/handles.inline.hpp"
  46 #include "runtime/orderAccess.hpp"
  47 #include "utilities/macros.hpp"
  48 
  49 // Implementation of ConstantPoolCacheEntry
  50 
  51 void ConstantPoolCacheEntry::initialize_entry(int index) {
  52   assert(0 < index && index < 0x10000, "sanity check");
  53   _indices = index;
  54   _f1 = NULL;
  55   _f2 = _flags = 0;


 727       for (int i=0; i<length(); i++) {
 728         entry_at(i)->verify_just_initialized(f2_used[i]);
 729       })
 730   } else {
 731     for (int i=0; i<length(); i++) {
 732       entry_at(i)->reinitialize(f2_used[i]);
 733     }
 734   }
 735 }
 736 
 737 void ConstantPoolCache::deallocate_contents(ClassLoaderData* data) {
 738   assert(!is_shared(), "shared caches are not deallocated");
 739   data->remove_handle(_resolved_references);
 740   set_resolved_references(NULL);
 741   MetadataFactory::free_array<u2>(data, _reference_map);
 742   set_reference_map(NULL);
 743 }
 744 
 745 #if INCLUDE_CDS_JAVA_HEAP
 746 oop ConstantPoolCache::archived_references() {
 747   if (CompressedOops::is_null(_archived_references)) {
 748     return NULL;
 749   }
 750   return MetaspaceShared::unarchive_heap_object(CompressedOops::decode_not_null(_archived_references));

 751 }
 752 
 753 void ConstantPoolCache::set_archived_references(oop o) {
 754   assert(DumpSharedSpaces, "called only during runtime");
 755   _archived_references = CompressedOops::encode(o);
 756 }
 757 #endif
 758 
 759 #if INCLUDE_JVMTI
 760 // RedefineClasses() API support:
 761 // If any entry of this ConstantPoolCache points to any of
 762 // old_methods, replace it with the corresponding new_method.
 763 void ConstantPoolCache::adjust_method_entries(InstanceKlass* holder, bool * trace_name_printed) {
 764   for (int i = 0; i < length(); i++) {
 765     ConstantPoolCacheEntry* entry = entry_at(i);
 766     Method* old_method = entry->get_interesting_method_entry(holder);
 767     if (old_method == NULL || !old_method->is_old()) {
 768       continue; // skip uninteresting entries
 769     }
 770     if (old_method->is_deleted()) {
 771       // clean up entries with deleted methods
 772       entry->initialize_entry(entry->constant_pool_index());
 773       continue;
 774     }
 775     Method* new_method = holder->method_with_idnum(old_method->orig_method_idnum());


< prev index next >