< prev index next >

src/hotspot/share/oops/arrayOop.hpp

Print this page
@@ -1,7 +1,7 @@
  /*
-  * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved.
+  * 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.

@@ -24,10 +24,11 @@
  
  #ifndef SHARE_OOPS_ARRAYOOP_HPP
  #define SHARE_OOPS_ARRAYOOP_HPP
  
  #include "oops/oop.hpp"
+ #include "runtime/globals.hpp"
  #include "utilities/align.hpp"
  #include "utilities/globalDefinitions.hpp"
  
  // arrayOopDesc is the abstract baseclass for all arrays.  It doesn't
  // declare pure virtual to enforce this because that would allocate a vtbl

@@ -53,10 +54,13 @@
      return reinterpret_cast<int*>(ptr + length_offset_in_bytes());
    }
  
    // Given a type, return true if elements of that type must be aligned to 64-bit.
    static bool element_type_should_be_aligned(BasicType type) {
+     if (EnableValhalla && type == T_FLAT_ELEMENT) {
+       return true; //CMH: tighten the alignment when removing T_FLAT_ELEMENT
+     }
  #ifdef _LP64
      if (type == T_OBJECT || type == T_ARRAY) {
        return !UseCompressedOops;
      }
  #endif

@@ -71,11 +75,11 @@
      int hs = length_offset_in_bytes() + (int)sizeof(int);
  #ifdef ASSERT
      // make sure it isn't called before UseCompressedOops is initialized.
      static int arrayoopdesc_hs = 0;
      if (arrayoopdesc_hs == 0) arrayoopdesc_hs = hs;
-     assert(arrayoopdesc_hs == hs, "header size can't change");
+     // assert(arrayoopdesc_hs == hs, "header size can't change");
  #endif // ASSERT
      return (int)hs;
    }
  
    // The _length field is not declared in C++.  It is allocated after the
< prev index next >