< prev index next >

src/share/vm/oops/cpCache.cpp

Print this page




   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  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "interpreter/interpreter.hpp"
  27 #include "interpreter/rewriter.hpp"
  28 #include "logging/log.hpp"

  29 #include "memory/metaspaceClosure.hpp"
  30 #include "memory/resourceArea.hpp"
  31 #include "memory/universe.inline.hpp"
  32 #include "oops/cpCache.hpp"
  33 #include "oops/objArrayOop.inline.hpp"
  34 #include "oops/oop.inline.hpp"
  35 #include "prims/methodHandles.hpp"
  36 #include "runtime/atomic.hpp"
  37 #include "runtime/handles.inline.hpp"
  38 #include "runtime/orderAccess.inline.hpp"
  39 #include "utilities/macros.hpp"
  40 
  41 // Implementation of ConstantPoolCacheEntry
  42 
  43 void ConstantPoolCacheEntry::initialize_entry(int index) {
  44   assert(0 < index && index < 0x10000, "sanity check");
  45   _indices = index;
  46   _f1 = NULL;
  47   _f2 = _flags = 0;
  48   assert(constant_pool_index() == index, "");


 589     int original_index = invokedynamic_inverse_index_map.at(i);
 590     e->initialize_entry(original_index);
 591     assert(entry_at(offset) == e, "sanity");
 592   }
 593 
 594   for (int ref = 0; ref < invokedynamic_references_map.length(); ref++) {
 595     const int cpci = invokedynamic_references_map.at(ref);
 596     if (cpci >= 0) {
 597 #ifdef ASSERT
 598       // invokedynamic and invokehandle have more entries; check if they
 599       // all point to the same constant pool cache entry.
 600       for (int entry = 1; entry < ConstantPoolCacheEntry::_indy_resolved_references_entries; entry++) {
 601         const int cpci_next = invokedynamic_references_map.at(ref + entry);
 602         assert(cpci == cpci_next, "%d == %d", cpci, cpci_next);
 603       }
 604 #endif
 605       entry_at(cpci)->initialize_resolved_reference_index(ref);
 606       ref += ConstantPoolCacheEntry::_indy_resolved_references_entries - 1;  // skip extra entries
 607     }
 608   }







 609 }
 610 
 611 #if INCLUDE_CDS_JAVA_HEAP
 612 oop ConstantPoolCache::archived_references() {
 613   assert(UseSharedSpaces, "UseSharedSpaces expected.");
 614   return oopDesc::decode_heap_oop(_archived_references);
 615 }
 616 
 617 void ConstantPoolCache::set_archived_references(oop o) {
 618   assert(DumpSharedSpaces, "called only during runtime");
 619   _archived_references = oopDesc::encode_heap_oop(o);
 620 }
 621 #endif
 622 
 623 #if INCLUDE_JVMTI
 624 // RedefineClasses() API support:
 625 // If any entry of this ConstantPoolCache points to any of
 626 // old_methods, replace it with the corresponding new_method.
 627 void ConstantPoolCache::adjust_method_entries(InstanceKlass* holder, bool * trace_name_printed) {
 628   for (int i = 0; i < length(); i++) {




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


 590     int original_index = invokedynamic_inverse_index_map.at(i);
 591     e->initialize_entry(original_index);
 592     assert(entry_at(offset) == e, "sanity");
 593   }
 594 
 595   for (int ref = 0; ref < invokedynamic_references_map.length(); ref++) {
 596     const int cpci = invokedynamic_references_map.at(ref);
 597     if (cpci >= 0) {
 598 #ifdef ASSERT
 599       // invokedynamic and invokehandle have more entries; check if they
 600       // all point to the same constant pool cache entry.
 601       for (int entry = 1; entry < ConstantPoolCacheEntry::_indy_resolved_references_entries; entry++) {
 602         const int cpci_next = invokedynamic_references_map.at(ref + entry);
 603         assert(cpci == cpci_next, "%d == %d", cpci, cpci_next);
 604       }
 605 #endif
 606       entry_at(cpci)->initialize_resolved_reference_index(ref);
 607       ref += ConstantPoolCacheEntry::_indy_resolved_references_entries - 1;  // skip extra entries
 608     }
 609   }
 610 }
 611 
 612 void ConstantPoolCache::deallocate_contents(ClassLoaderData* data) {
 613   data->remove_handle(_resolved_references);
 614   set_resolved_references(NULL);
 615   MetadataFactory::free_array<u2>(data, _reference_map);
 616   set_reference_map(NULL);
 617 }
 618 
 619 #if INCLUDE_CDS_JAVA_HEAP
 620 oop ConstantPoolCache::archived_references() {
 621   assert(UseSharedSpaces, "UseSharedSpaces expected.");
 622   return oopDesc::decode_heap_oop(_archived_references);
 623 }
 624 
 625 void ConstantPoolCache::set_archived_references(oop o) {
 626   assert(DumpSharedSpaces, "called only during runtime");
 627   _archived_references = oopDesc::encode_heap_oop(o);
 628 }
 629 #endif
 630 
 631 #if INCLUDE_JVMTI
 632 // RedefineClasses() API support:
 633 // If any entry of this ConstantPoolCache points to any of
 634 // old_methods, replace it with the corresponding new_method.
 635 void ConstantPoolCache::adjust_method_entries(InstanceKlass* holder, bool * trace_name_printed) {
 636   for (int i = 0; i < length(); i++) {


< prev index next >