< prev index next >

src/hotspot/share/oops/instanceKlass.hpp

Print this page
*** 73,10 ***
--- 73,11 ---
  class nmethodBucket;
  class OopMapCache;
  class InterpreterOopMap;
  class PackageEntry;
  class ModuleEntry;
+ class KlassTrainingData;
  
  // This is used in iterators below.
  class FieldClosure: public StackObj {
  public:
    virtual void do_field(fieldDescriptor* fd) = 0;

*** 233,10 ***
--- 234,11 ---
    // State is set either at parse time or while executing, atomically to not disturb other state
    InstanceKlassFlags _misc_flags;
  
    Monitor*             _init_monitor;       // mutual exclusion to _init_state and _init_thread.
    JavaThread* volatile _init_thread;        // Pointer to current thread doing initialization (to handle recursive initialization)
+   KlassTrainingData*   _training_data;      // Null except in training mode.
  
    OopMapCache*    volatile _oop_map_cache;   // OopMapCache for all methods in the klass (allocated lazily)
    JNIid*          _jni_ids;              // First JNI identifier for static fields in this class
    jmethodID*      volatile _methods_jmethod_ids;  // jmethodIDs corresponding to method_idnum, or null if none
    nmethodBucket*  volatile _dep_context;          // packed DependencyContext structure

*** 317,10 ***
--- 319,11 ---
    bool shared_loading_failed() const { return _misc_flags.shared_loading_failed(); }
  
    void set_shared_loading_failed() { _misc_flags.set_shared_loading_failed(true); }
  
  #if INCLUDE_CDS
+   int  shared_class_loader_type() const;
    void set_shared_class_loader_type(s2 loader_type) { _misc_flags.set_shared_class_loader_type(loader_type); }
    void assign_class_loader_type() { _misc_flags.assign_class_loader_type(_class_loader_data); }
  #endif
  
    bool has_nonstatic_fields() const        { return _misc_flags.has_nonstatic_fields(); }

*** 515,10 ***
--- 518,28 ---
    bool is_init_thread(JavaThread *thread)  { return thread == init_thread(); }
    ClassState  init_state() const           { return Atomic::load(&_init_state); }
    const char* init_state_name() const;
    bool is_rewritten() const                { return _misc_flags.rewritten(); }
  
+   KlassTrainingData* training_data_or_null() const {
+     // there is a lot of concurrent state around classes, so let's use atomics
+     return Atomic::load_acquire(&_training_data);
+   }
+   bool init_training_data(KlassTrainingData* tdata) {
+     return (_training_data == tdata ||
+             Atomic::replace_if_null(&_training_data, tdata));
+   }
+   KlassTrainingData* training_data() const {
+     KlassTrainingData* tdata = training_data_or_null();
+     assert(tdata != nullptr, "call alloc_training_data first");
+     return tdata;
+   }
+   // return existing if there is one, else allocate
+   KlassTrainingData* alloc_training_data(TRAPS);
+ 
+   static const char* state2name(ClassState state);
+ 
    class LockLinkState : public StackObj {
      InstanceKlass* _ik;
      JavaThread*    _current;
     public:
      LockLinkState(InstanceKlass* ik, JavaThread* current) : _ik(ik), _current(current) {

*** 543,10 ***
--- 564,11 ---
    bool is_marked_dependent() const         { return _misc_flags.is_marked_dependent(); }
    void set_is_marked_dependent(bool value) { _misc_flags.set_is_marked_dependent(value); }
  
    // initialization (virtuals from Klass)
    bool should_be_initialized() const;  // means that initialize should be called
+   void initialize_from_cds(TRAPS);
    void initialize(TRAPS);
    void link_class(TRAPS);
    bool link_class_or_fail(TRAPS); // returns false on failure
    void rewrite_class(TRAPS);
    void link_methods(TRAPS);

*** 819,11 ***
    Array<AnnotationArray*>* fields_type_annotations() const {
      return (_annotations != nullptr) ? _annotations->fields_type_annotations() : nullptr;
    }
    // allocation
    instanceOop allocate_instance(TRAPS);
!   static instanceOop allocate_instance(oop cls, TRAPS);
  
    // additional member function to return a handle
    instanceHandle allocate_instance_handle(TRAPS);
  
    objArrayOop allocate_objArray(int n, int length, TRAPS);
--- 841,11 ---
    Array<AnnotationArray*>* fields_type_annotations() const {
      return (_annotations != nullptr) ? _annotations->fields_type_annotations() : nullptr;
    }
    // allocation
    instanceOop allocate_instance(TRAPS);
!   static instanceOop allocate_instance(oop cls, const char* who, TRAPS);
  
    // additional member function to return a handle
    instanceHandle allocate_instance_handle(TRAPS);
  
    objArrayOop allocate_objArray(int n, int length, TRAPS);

*** 835,10 ***
--- 857,17 ---
    virtual void check_valid_for_instantiation(bool throwError, TRAPS);
  
    // initialization
    void call_class_initializer(TRAPS);
    void set_initialization_state_and_notify(ClassState state, JavaThread* current);
+   void record_initialization_touch(const char* request,
+                                    Symbol* name,  // or nullptr if not a member
+                                    Symbol* sig,   // or nullptr if not a method
+                                    Klass* requesting_klass,  // or nullptr
+                                    const char* context,      // or nullptr
+                                    TRAPS);
+   bool has_initialization_touch() const;
  
    // OopMapCache support
    OopMapCache* oop_map_cache()               { return _oop_map_cache; }
    void set_oop_map_cache(OopMapCache *cache) { _oop_map_cache = cache; }
    void mask_for(const methodHandle& method, int bci, InterpreterOopMap* entry);

*** 1099,11 ***
  private:
    void check_link_state_and_wait(JavaThread* current);
    bool link_class_impl                           (TRAPS);
    bool verify_code                               (TRAPS);
    void initialize_impl                           (TRAPS);
!   void initialize_super_interfaces               (TRAPS);
  
    void add_initialization_error(JavaThread* current, Handle exception);
    oop get_initialization_error(JavaThread* current);
  
    // find a local method (returns null if not found)
--- 1128,11 ---
  private:
    void check_link_state_and_wait(JavaThread* current);
    bool link_class_impl                           (TRAPS);
    bool verify_code                               (TRAPS);
    void initialize_impl                           (TRAPS);
!   void initialize_super_interfaces(Klass* requester, TRAPS);
  
    void add_initialization_error(JavaThread* current, Handle exception);
    oop get_initialization_error(JavaThread* current);
  
    // find a local method (returns null if not found)
< prev index next >