< prev index next >

src/hotspot/share/oops/arrayKlass.hpp

Print this page
*** 1,7 ***
  /*
!  * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved.
   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   *
   * This code is free software; you can redistribute it and/or modify it
   * under the terms of the GNU General Public License version 2 only, as
   * published by the Free Software Foundation.
--- 1,7 ---
  /*
!  * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved.
   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   *
   * This code is free software; you can redistribute it and/or modify it
   * under the terms of the GNU General Public License version 2 only, as
   * published by the Free Software Foundation.

*** 33,27 ***
  
  // ArrayKlass is the abstract baseclass for all array classes
  
  class ArrayKlass: public Klass {
    friend class VMStructs;
   private:
    // If you add a new field that points to any metaspace object, you
    // must add this field to ArrayKlass::metaspace_pointers_do().
    int      _dimension;         // This is n'th-dimensional array.
    ObjArrayKlass* volatile _higher_dimension;  // Refers the (n+1)'th-dimensional array (if present).
    ArrayKlass* volatile    _lower_dimension;   // Refers the (n-1)'th-dimensional array (if present).
  
   protected:
    // Constructors
    // The constructor with the Symbol argument does the real array
    // initialization, the other is a dummy
!   ArrayKlass(Symbol* name, KlassKind kind);
    ArrayKlass();
  
    void* operator new(size_t size, ClassLoaderData* loader_data, size_t word_size, TRAPS) throw();
  
   public:
    // Testing operation
    DEBUG_ONLY(bool is_array_klass_slow() const { return true; })
  
    // Returns the ObjArrayKlass for n'th dimension.
    ArrayKlass* array_klass(int n, TRAPS);
--- 33,47 ---
  
  // ArrayKlass is the abstract baseclass for all array classes
  
  class ArrayKlass: public Klass {
    friend class VMStructs;
+ 
+  public:
+   enum ArrayProperties : uint32_t {
+     DEFAULT         = 0,
+     NULL_RESTRICTED = 1 << 0,
+     NON_ATOMIC      = 1 << 1,
+     // FINAL           = 1 << 2,
+     // VOLATILE        = 1 << 3
+     INVALID         = 1 << 4,
+     DUMMY           = 1 << 5      // Just to transition the code, to be removed ASAP
+   };
+ 
+   static bool is_null_restricted(ArrayProperties props) { return (props & NULL_RESTRICTED) != 0; }
+   static bool is_non_atomic(ArrayProperties props) { return (props & NON_ATOMIC) != 0; }
+ 
   private:
    // If you add a new field that points to any metaspace object, you
    // must add this field to ArrayKlass::metaspace_pointers_do().
    int      _dimension;         // This is n'th-dimensional array.
+   ArrayProperties _properties;
    ObjArrayKlass* volatile _higher_dimension;  // Refers the (n+1)'th-dimensional array (if present).
    ArrayKlass* volatile    _lower_dimension;   // Refers the (n-1)'th-dimensional array (if present).
  
   protected:
    // Constructors
    // The constructor with the Symbol argument does the real array
    // initialization, the other is a dummy
!   ArrayKlass(Symbol* name, KlassKind kind, ArrayProperties props, markWord prototype_header = markWord::prototype());
    ArrayKlass();
  
+   // Create array_name for element klass
+   static Symbol* create_element_klass_array_name(Klass* element_klass, TRAPS);
+ 
    void* operator new(size_t size, ClassLoaderData* loader_data, size_t word_size, TRAPS) throw();
  
   public:
+ 
    // Testing operation
    DEBUG_ONLY(bool is_array_klass_slow() const { return true; })
  
    // Returns the ObjArrayKlass for n'th dimension.
    ArrayKlass* array_klass(int n, TRAPS);

*** 65,10 ***
--- 85,14 ---
  
    // Instance variables
    int dimension() const                 { return _dimension;      }
    void set_dimension(int dimension)     { _dimension = dimension; }
  
+   ArrayProperties properties() const { return _properties; }
+   void set_properties(ArrayProperties props) { _properties = props; }
+   static ByteSize properties_offset() { return byte_offset_of(ArrayKlass, _properties); }
+ 
    ObjArrayKlass* higher_dimension() const     { return _higher_dimension; }
    inline ObjArrayKlass* higher_dimension_acquire() const; // load with acquire semantics
    void set_higher_dimension(ObjArrayKlass* k) { _higher_dimension = k; }
    inline void release_set_higher_dimension(ObjArrayKlass* k); // store with release semantics
  

*** 85,11 ***
  
    // Allocation
    // Sizes points to the first dimension of the array, subsequent dimensions
    // are always in higher memory.  The callers of these set that up.
    virtual oop multi_allocate(int rank, jint* sizes, TRAPS);
-   objArrayOop allocate_arrayArray(int n, int length, TRAPS);
  
    // find field according to JVM spec 5.4.3.2, returns the klass in which the field is defined
    Klass* find_field(Symbol* name, Symbol* sig, fieldDescriptor* fd) const;
  
    // Lookup operations
--- 109,10 ---

*** 108,10 ***
--- 131,12 ---
    }
  
    GrowableArray<Klass*>* compute_secondary_supers(int num_extra_slots,
                                                    Array<InstanceKlass*>* transitive_interfaces);
  
+   oop component_mirror() const;
+ 
    // Sizing
    static int static_size(int header_size);
  
    virtual void metaspace_pointers_do(MetaspaceClosure* iter);
  

*** 140,6 ***
--- 165,14 ---
    void verify_on(outputStream* st);
  
    void oop_verify_on(oop obj, outputStream* st);
  };
  
+ class ArrayDescription : public StackObj {
+   public:
+    Klass::KlassKind _kind;
+    ArrayKlass::ArrayProperties _properties;
+    LayoutKind _layout_kind;
+    ArrayDescription(Klass::KlassKind k, ArrayKlass::ArrayProperties p, LayoutKind lk) { _kind = k; _properties = p; _layout_kind = lk; }
+  };
+ 
  #endif // SHARE_OOPS_ARRAYKLASS_HPP
< prev index next >