< prev index next >

src/hotspot/share/oops/arrayKlass.hpp

Print this page
*** 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.
--- 1,7 ---
  /*
!  * Copyright (c) 1997, 2026, 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.

*** 23,35 ***
   */
  
  #ifndef SHARE_OOPS_ARRAYKLASS_HPP
  #define SHARE_OOPS_ARRAYKLASS_HPP
  
  #include "oops/klass.hpp"
  
  class fieldDescriptor;
  class klassVtable;
  class ObjArrayKlass;
  
  // 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();
  
   public:
    // Testing operation
    DEBUG_ONLY(bool is_array_klass_slow() const override { return true; })
  
    // Returns the ObjArrayKlass for n'th dimension.
    ArrayKlass* array_klass(int n, TRAPS) override;
--- 23,46 ---
   */
  
  #ifndef SHARE_OOPS_ARRAYKLASS_HPP
  #define SHARE_OOPS_ARRAYKLASS_HPP
  
+ #include "oops/arrayProperties.hpp"
  #include "oops/klass.hpp"
+ #include "oops/layoutKind.hpp"
  
  class fieldDescriptor;
  class klassVtable;
  class ObjArrayKlass;
  
  // ArrayKlass is the abstract baseclass for all array classes
  
  class ArrayKlass: public Klass {
    friend class VMStructs;
+ 
+  public:
+   static ArrayProperties array_properties_from_layout(LayoutKind lk);
+ 
   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);
+ 
   public:
+ 
    // Testing operation
    DEBUG_ONLY(bool is_array_klass_slow() const override { return true; })
  
    // Returns the ObjArrayKlass for n'th dimension.
    ArrayKlass* array_klass(int n, TRAPS) override;

*** 63,10 ***
--- 74,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
  

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

*** 137,6 ***
--- 154,25 ---
    void verify_on(outputStream* st) override;
  
    void oop_verify_on(oop obj, outputStream* st) override;
  };
  
+ class ArrayDescription : public StackObj {
+ public:
+   Klass::KlassKind _kind;
+   ArrayProperties  _properties;
+   LayoutKind       _layout_kind;
+ 
+   ArrayDescription(Klass::KlassKind k, ArrayProperties p, LayoutKind lk) {
+     _kind = k;
+     _layout_kind = lk;
+     assert(lk == LayoutKind::REFERENCE || k != Klass::KlassKind::RefArrayKlassKind, "Sanity check");
+     assert(lk != LayoutKind::UNKNOWN, "Sanity check");
+ 
+     // Atomicity depends on the layout kind, which might be different than what
+     // the given properties says
+     const bool non_atomic = lk != LayoutKind::REFERENCE && !LayoutKindHelper::is_atomic_flat(lk);
+     _properties = p.with_non_atomic(non_atomic);
+   }
+  };
+ 
  #endif // SHARE_OOPS_ARRAYKLASS_HPP
< prev index next >