< prev index next >
src/hotspot/share/oops/arrayOop.hpp
Print this page
*** 23,33 ****
*/
#ifndef SHARE_VM_OOPS_ARRAYOOP_HPP
#define SHARE_VM_OOPS_ARRAYOOP_HPP
! #include "memory/universe.inline.hpp"
#include "oops/oop.hpp"
#include "utilities/align.hpp"
// arrayOopDesc is the abstract baseclass for all arrays. It doesn't
// declare pure virtual to enforce this because that would allocate a vtbl
--- 23,33 ----
*/
#ifndef SHARE_VM_OOPS_ARRAYOOP_HPP
#define SHARE_VM_OOPS_ARRAYOOP_HPP
! #include "memory/universe.hpp"
#include "oops/oop.hpp"
#include "utilities/align.hpp"
// arrayOopDesc is the abstract baseclass for all arrays. It doesn't
// declare pure virtual to enforce this because that would allocate a vtbl
*** 60,69 ****
--- 60,76 ----
assert(arrayoopdesc_hs == hs, "header size can't change");
#endif // ASSERT
return (int)hs;
}
+ // Check whether an element of a typeArrayOop with the given type must be
+ // aligned 0 mod 8. The typeArrayOop itself must be aligned at least this
+ // strongly.
+ static bool element_type_should_be_aligned(BasicType type) {
+ return type == T_DOUBLE || type == T_LONG;
+ }
+
public:
// The _length field is not declared in C++. It is allocated after the
// declared nonstatic fields in arrayOopDesc if not compressed, otherwise
// it occupies the second half of the _klass field in oopDesc.
static int length_offset_in_bytes() {
*** 97,107 ****
// (will not constant fold otherwise)
// Returns the header size in words aligned to the requirements of the
// array object type.
static int header_size(BasicType type) {
size_t typesize_in_bytes = header_size_in_bytes();
! return (int)(Universe::element_type_should_be_aligned(type)
? align_object_offset(typesize_in_bytes/HeapWordSize)
: typesize_in_bytes/HeapWordSize);
}
// Return the maximum length of an array of BasicType. The length can passed
--- 104,114 ----
// (will not constant fold otherwise)
// Returns the header size in words aligned to the requirements of the
// array object type.
static int header_size(BasicType type) {
size_t typesize_in_bytes = header_size_in_bytes();
! return (int)(element_type_should_be_aligned(type)
? align_object_offset(typesize_in_bytes/HeapWordSize)
: typesize_in_bytes/HeapWordSize);
}
// Return the maximum length of an array of BasicType. The length can passed
< prev index next >