< prev index next >

src/hotspot/share/oops/cpCache.cpp

Print this page
rev 48471 : [mq]: RFE_Access_constantPoolCache_new_decorator


  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/rewriter.hpp"
  31 #include "logging/log.hpp"
  32 #include "memory/metadataFactory.hpp"
  33 #include "memory/metaspaceClosure.hpp"
  34 #include "memory/resourceArea.hpp"
  35 #include "memory/universe.inline.hpp"

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


 736       for (int i=0; i<length(); i++) {
 737         entry_at(i)->verify_just_initialized(f2_used[i]);
 738       })
 739   } else {
 740     for (int i=0; i<length(); i++) {
 741       entry_at(i)->reinitialize(f2_used[i]);
 742     }
 743   }
 744 }
 745 
 746 void ConstantPoolCache::deallocate_contents(ClassLoaderData* data) {
 747   assert(!is_shared(), "shared caches are not deallocated");
 748   data->remove_handle(_resolved_references);
 749   set_resolved_references(NULL);
 750   MetadataFactory::free_array<u2>(data, _reference_map);
 751   set_reference_map(NULL);
 752 }
 753 
 754 #if INCLUDE_CDS_JAVA_HEAP
 755 oop ConstantPoolCache::archived_references() {
 756   assert(UseSharedSpaces, "UseSharedSpaces expected.");
 757   return oopDesc::decode_heap_oop(_archived_references);



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




  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/rewriter.hpp"
  31 #include "logging/log.hpp"
  32 #include "memory/metadataFactory.hpp"
  33 #include "memory/metaspaceClosure.hpp"
  34 #include "memory/resourceArea.hpp"
  35 #include "memory/universe.inline.hpp"
  36 #include "oops/access.inline.hpp"
  37 #include "oops/cpCache.hpp"
  38 #include "oops/objArrayOop.inline.hpp"
  39 #include "oops/oop.inline.hpp"
  40 #include "prims/methodHandles.hpp"
  41 #include "runtime/atomic.hpp"
  42 #include "runtime/handles.inline.hpp"
  43 #include "runtime/orderAccess.inline.hpp"
  44 #include "utilities/macros.hpp"
  45 
  46 // Implementation of ConstantPoolCacheEntry
  47 
  48 void ConstantPoolCacheEntry::initialize_entry(int index) {
  49   assert(0 < index && index < 0x10000, "sanity check");
  50   _indices = index;
  51   _f1 = NULL;
  52   _f2 = _flags = 0;
  53   assert(constant_pool_index() == index, "");
  54 }
  55 
  56 void ConstantPoolCacheEntry::verify_just_initialized(bool f2_used) {


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


< prev index next >