< prev index next >

src/hotspot/share/oops/cpCache.hpp

Print this page

395 // A constant pool cache is a runtime data structure set aside to a constant pool. The cache
396 // holds interpreter runtime information for all field access and invoke bytecodes. The cache
397 // is created and initialized before a class is actively used (i.e., initialized), the indivi-
398 // dual cache entries are filled at resolution (i.e., "link") time (see also: rewriter.*).
399 
400 class ConstantPoolCache: public MetaspaceObj {
401   friend class VMStructs;
402   friend class MetadataFactory;
403  private:
404   // If you add a new field that points to any metaspace object, you
405   // must add this field to ConstantPoolCache::metaspace_pointers_do().
406   int             _length;
407   ConstantPool*   _constant_pool;          // the corresponding constant pool
408 
409   // The following fields need to be modified at runtime, so they cannot be
410   // stored in the ConstantPool, which is read-only.
411   // Array of resolved objects from the constant pool and map from resolved
412   // object index to original constant pool index
413   OopHandle            _resolved_references;
414   Array<u2>*           _reference_map;




415   // The narrowOop pointer to the archived resolved_references. Set at CDS dump
416   // time when caching java heap object is supported.
417   CDS_JAVA_HEAP_ONLY(int _archived_references_index;)
418 
419   // Sizing
420   debug_only(friend class ClassVerifier;)
421 
422   // Constructor
423   ConstantPoolCache(int length,
424                     const intStack& inverse_index_map,
425                     const intStack& invokedynamic_inverse_index_map,
426                     const intStack& invokedynamic_references_map);
427 
428   // Initialization
429   void initialize(const intArray& inverse_index_map,
430                   const intArray& invokedynamic_inverse_index_map,
431                   const intArray& invokedynamic_references_map);
432  public:
433   static ConstantPoolCache* allocate(ClassLoaderData* loader_data,
434                                      const intStack& cp_cache_map,

488     int index = raw_index;
489     return (base_offset() + ConstantPoolCacheEntry::size_in_bytes() * index);
490   }
491 
492 #if INCLUDE_JVMTI
493   // RedefineClasses() API support:
494   // If any entry of this ConstantPoolCache points to any of
495   // old_methods, replace it with the corresponding new_method.
496   // trace_name_printed is set to true if the current call has
497   // printed the klass name so that other routines in the adjust_*
498   // group don't print the klass name.
499   void adjust_method_entries(bool* trace_name_printed);
500   bool check_no_old_or_obsolete_entries();
501   void dump_cache();
502 #endif // INCLUDE_JVMTI
503 
504   // RedefineClasses support
505   DEBUG_ONLY(bool on_stack() { return false; })
506   void deallocate_contents(ClassLoaderData* data);
507   bool is_klass() const { return false; }


508 
509   // Printing
510   void print_on(outputStream* st) const;
511   void print_value_on(outputStream* st) const;
512 
513   const char* internal_name() const { return "{constant pool cache}"; }
514 
515   // Verify
516   void verify_on(outputStream* st);
517 };
518 
519 #endif // SHARE_OOPS_CPCACHE_HPP

395 // A constant pool cache is a runtime data structure set aside to a constant pool. The cache
396 // holds interpreter runtime information for all field access and invoke bytecodes. The cache
397 // is created and initialized before a class is actively used (i.e., initialized), the indivi-
398 // dual cache entries are filled at resolution (i.e., "link") time (see also: rewriter.*).
399 
400 class ConstantPoolCache: public MetaspaceObj {
401   friend class VMStructs;
402   friend class MetadataFactory;
403  private:
404   // If you add a new field that points to any metaspace object, you
405   // must add this field to ConstantPoolCache::metaspace_pointers_do().
406   int             _length;
407   ConstantPool*   _constant_pool;          // the corresponding constant pool
408 
409   // The following fields need to be modified at runtime, so they cannot be
410   // stored in the ConstantPool, which is read-only.
411   // Array of resolved objects from the constant pool and map from resolved
412   // object index to original constant pool index
413   OopHandle            _resolved_references;
414   Array<u2>*           _reference_map;
415 
416   // RedefineClasses support
417   uint64_t             _marking_cycle;
418 
419   // The narrowOop pointer to the archived resolved_references. Set at CDS dump
420   // time when caching java heap object is supported.
421   CDS_JAVA_HEAP_ONLY(int _archived_references_index;)
422 
423   // Sizing
424   debug_only(friend class ClassVerifier;)
425 
426   // Constructor
427   ConstantPoolCache(int length,
428                     const intStack& inverse_index_map,
429                     const intStack& invokedynamic_inverse_index_map,
430                     const intStack& invokedynamic_references_map);
431 
432   // Initialization
433   void initialize(const intArray& inverse_index_map,
434                   const intArray& invokedynamic_inverse_index_map,
435                   const intArray& invokedynamic_references_map);
436  public:
437   static ConstantPoolCache* allocate(ClassLoaderData* loader_data,
438                                      const intStack& cp_cache_map,

492     int index = raw_index;
493     return (base_offset() + ConstantPoolCacheEntry::size_in_bytes() * index);
494   }
495 
496 #if INCLUDE_JVMTI
497   // RedefineClasses() API support:
498   // If any entry of this ConstantPoolCache points to any of
499   // old_methods, replace it with the corresponding new_method.
500   // trace_name_printed is set to true if the current call has
501   // printed the klass name so that other routines in the adjust_*
502   // group don't print the klass name.
503   void adjust_method_entries(bool* trace_name_printed);
504   bool check_no_old_or_obsolete_entries();
505   void dump_cache();
506 #endif // INCLUDE_JVMTI
507 
508   // RedefineClasses support
509   DEBUG_ONLY(bool on_stack() { return false; })
510   void deallocate_contents(ClassLoaderData* data);
511   bool is_klass() const { return false; }
512   void record_marking_cycle();
513   uint64_t marking_cycle() { return _marking_cycle; }
514 
515   // Printing
516   void print_on(outputStream* st) const;
517   void print_value_on(outputStream* st) const;
518 
519   const char* internal_name() const { return "{constant pool cache}"; }
520 
521   // Verify
522   void verify_on(outputStream* st);
523 };
524 
525 #endif // SHARE_OOPS_CPCACHE_HPP
< prev index next >