Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8245809: [lworld] Remove the last traces of arrayStorageProperties #56

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -1403,14 +1403,8 @@ void LIR_Assembler::mem2reg(LIR_Opr src, LIR_Opr dest, BasicType type, LIR_Patch
// TODO remove clear_prop_bits bits stuff once the runtime does not set it anymore
#ifdef _LP64
if (UseCompressedClassPointers) {
__ andl(dest->as_register(), oopDesc::compressed_klass_mask());
__ decode_klass_not_null(dest->as_register());
} else {
__ shlq(dest->as_register(), oopDesc::storage_props_nof_bits);
__ shrq(dest->as_register(), oopDesc::storage_props_nof_bits);
}
#else
__ andl(dest->as_register(), oopDesc::wide_klass_mask());
#endif
}
}
@@ -4617,21 +4617,13 @@ void MacroAssembler::load_method_holder(Register holder, Register method) {
}

void MacroAssembler::load_klass(Register dst, Register src) {
load_metadata(dst, src);
#ifdef _LP64
if (UseCompressedClassPointers) {
andl(dst, oopDesc::compressed_klass_mask());
movl(dst, Address(src, oopDesc::klass_offset_in_bytes()));
decode_klass_not_null(dst);
} else
#endif
{
#ifdef _LP64
shlq(dst, oopDesc::storage_props_nof_bits);
shrq(dst, oopDesc::storage_props_nof_bits);
#else
andl(dst, oopDesc::wide_klass_mask());
#endif
}
movptr(dst, Address(src, oopDesc::klass_offset_in_bytes()));
}

void MacroAssembler::load_prototype_header(Register dst, Register src) {
@@ -390,12 +390,6 @@ oop MemAllocator::finish(HeapWord* mem) const {
return oop(mem);
}

oop MemAllocator::finish_with_properties(HeapWord* mem, ArrayStorageProperties storage_props) const {
oop res = finish(mem); // finish() returns on purpose (can be overloaded, clearing memory might safepoint)
oopDesc::release_set_metadata(cast_from_oop<HeapWord*>(res), storage_props, _klass);
return res;
}

oop ObjAllocator::initialize(HeapWord* mem) const {
mem_clear(mem);
return finish(mem);
@@ -425,9 +419,7 @@ oop ObjArrayAllocator::initialize(HeapWord* mem) const {
mem_clear(mem);
}
arrayOopDesc::set_length(mem, _length);
assert(ArrayKlass::cast(_klass)->storage_properties().is_empty() ||
ArrayKlass::cast(_klass)->dimension() == 1, "Multidim should have no storage props");
return finish_with_properties(mem, ArrayKlass::cast(_klass)->storage_properties());
return finish(mem);
}

oop ClassAllocator::initialize(HeapWord* mem) const {
@@ -60,8 +60,6 @@ class MemAllocator: StackObj {
// last. At the point when the Klass pointer is initialized, this is a constructed object
// that must be parseable as an oop by concurrent collectors.
virtual oop finish(HeapWord* mem) const;
// Encode any extra metadata properties for arrays
oop finish_with_properties(HeapWord* mem, ArrayStorageProperties storage_props) const;

// Raw memory allocation. This will try to do a TLAB allocation, and otherwise fall
// back to calling CollectedHeap::mem_allocate().
@@ -973,7 +973,7 @@ bool Metaspace::_initialized = false;
#define VIRTUALSPACEMULTIPLIER 2

#ifdef _LP64
static uint64_t UnscaledClassSpaceMax = (uint64_t(max_juint) + 1);
static const uint64_t UnscaledClassSpaceMax = (uint64_t(max_juint) + 1);

void Metaspace::set_narrow_klass_base_and_shift(ReservedSpace metaspace_rs, address cds_base) {
assert(!DumpSharedSpaces, "narrow_klass is set by MetaspaceShared class.");
@@ -987,8 +987,8 @@ void Metaspace::set_narrow_klass_base_and_shift(ReservedSpace metaspace_rs, addr
assert(UseSharedSpaces, "must be");
lower_base = MIN2(lower_base, cds_base);
} else {
uint64_t klass_encoding_max = UnscaledClassSpaceMax << LogKlassAlignmentInBytes;
// Using oopDesc::_metadata high bits so LogKlassAlignmentInBytes shift is no longer possible
uint64_t klass_encoding_max = UnscaledClassSpaceMax;
// If compressed class space fits in lower 32G, we don't need a base.
if (higher_address <= (address)klass_encoding_max) {
lower_base = 0; // Effectively lower base is zero.
@@ -1230,11 +1230,6 @@ void Metaspace::ergo_initialize() {
void Metaspace::global_initialize() {
MetaspaceGC::initialize();
bool class_space_inited = false;
#ifdef _LP64
if (EnableValhalla) {
UnscaledClassSpaceMax >>= oopDesc::storage_props_nof_bits;
}
#endif
#if INCLUDE_CDS
if (DumpSharedSpaces) {
MetaspaceShared::initialize_dumptime_shared_and_meta_spaces();
@@ -145,7 +145,7 @@ arrayOop oopFactory::new_valueArray(Klass* klass, int length, TRAPS) {
} else {
oop = (arrayOop) ObjArrayKlass::cast(array_klass)->allocate(length, THREAD);
}
assert(oop == NULL || oop->array_storage_properties().is_null_free(), "Bad array storage encoding");
assert(oop == NULL || oop->klass()->is_null_free_array_klass(), "Bad array storage encoding");
return oop;
}

@@ -26,7 +26,6 @@
#define SHARE_OOPS_ARRAYKLASS_HPP

#include "oops/klass.hpp"
#include "oops/arrayStorageProperties.hpp"

class fieldDescriptor;
class klassVtable;
@@ -67,9 +66,6 @@ class ArrayKlass: public Klass {
// Compiler/Interpreter offset
static ByteSize element_klass_offset() { return in_ByteSize(offset_of(ArrayKlass, _element_klass)); }

// Presented with an ArrayKlass, which storage_properties should be encoded into arrayOop
virtual ArrayStorageProperties storage_properties() { return ArrayStorageProperties::empty; }

// Are loads and stores to this concrete array type atomic?
// Note that Object[] is naturally atomic, but its subtypes may not be.
virtual bool element_access_is_atomic() { return true; }

This file was deleted.

This file was deleted.

@@ -156,7 +156,7 @@ int ObjArrayKlass::oop_size(oop obj) const {
objArrayOop ObjArrayKlass::allocate(int length, TRAPS) {
check_array_allocation_length(length, arrayOopDesc::max_array_length(T_OBJECT), CHECK_NULL);
int size = objArrayOopDesc::object_size(length);
bool populate_null_free = storage_properties().is_null_free();
bool populate_null_free = is_null_free_array_klass();
objArrayOop array = (objArrayOop)Universe::heap()->array_allocate(this, size, length,
/* do_zero */ true, THREAD);
if (populate_null_free) {
@@ -178,7 +178,7 @@ objArrayOop ObjArrayKlass::allocate(int length, TRAPS) {
oop ObjArrayKlass::multi_allocate(int rank, jint* sizes, TRAPS) {
int length = *sizes;
if (rank == 1) { // last dim may be valueArray, check if we have any special storage requirements
if ((!element_klass()->is_array_klass()) && storage_properties().is_null_free()) {
if (element_klass()->is_value()) {
return oopFactory::new_valueArray(element_klass(), length, CHECK_NULL);
} else {
return oopFactory::new_objArray(element_klass(), length, CHECK_NULL);
@@ -211,10 +211,6 @@ oop ObjArrayKlass::multi_allocate(int rank, jint* sizes, TRAPS) {
return h_array();
}

ArrayStorageProperties ObjArrayKlass::storage_properties() {
return name()->is_Q_singledim_array_signature() ? ArrayStorageProperties::null_free : ArrayStorageProperties::empty;
}

// Either oop or narrowOop depending on UseCompressedOops.
void ObjArrayKlass::do_copy(arrayOop s, size_t src_offset,
arrayOop d, size_t dst_offset, int length, TRAPS) {
@@ -50,10 +50,6 @@ class ObjArrayKlass : public ArrayKlass {
// For dummy objects
ObjArrayKlass() {}

// if ObjArrayKlass is used to represent an LWorld "Q-type" value type array, the only thing we can give null-free (i.e. not flattened)
// ArrayStorageProperties::empty meaning nothing special, array of references (possibly even to value types)
ArrayStorageProperties storage_properties();

Klass* bottom_klass() const { return _bottom_klass; }
void set_bottom_klass(Klass* k) { _bottom_klass = k; }
Klass** bottom_klass_addr() { return &_bottom_klass; }
@@ -28,7 +28,6 @@
#include "memory/iterator.hpp"
#include "memory/memRegion.hpp"
#include "oops/access.hpp"
#include "oops/arrayStorageProperties.hpp"
#include "oops/markWord.hpp"
#include "oops/metadata.hpp"
#include "runtime/atomic.hpp"
@@ -43,38 +42,12 @@
//
// oopDesc::_mark - the "oop mark word" encoding to be found separately in markWord.hpp
//
// oopDesc::_metadata - encodes both the object's klass pointer and potentially
// "storage properties" (currently confined to arrays in the form of
// ArrayStorageProperties). Storage properties are peculiar to the
// *instance*, and not necessarily the "type".
// oopDesc::_metadata - encodes the object's klass pointer, as a raw pointer in "_klass"
// or compressed pointer in "_compressed_klass"
//
// The overall size of the _metadata field is dependent on "UseCompressedClassPointers",
// hence the terms "narrow" (32 bits) vs "wide" (64 bits).
//
// "Wide" encoding of _metadata:
// bit number |63 0|
// bit length |--3|-----61-----|
// --------------------------------------
// _klass [xxx| Klass* ]
// _wide_storage_props [ sp| ]
// --------------------------------------
// with:
// xxx = klass_mask(), Klass* = Klass pointer to be masked
// sp = storage properties, bit number: wide_storage_props_shift
//
// "Narrow" encoding of _metadata:
// bit number |31 0|
// bit length |--3|-----29-----|
// ----------------------------------------
// _compressed_klass [xxx| narrowKlass]
// _narrow_storage_props [ sp| ]
// ----------------------------------------
// with:
// xxx = compressed_klass_mask(), narrowKlass = compressed Klass pointer to be masked
// narrowKlass may be further decoded (Klass::decode_klass()) to produce Klass*
// sp = storage properties, bit number: narrow_storage_props_shift
//
// Storage properties encodings are current confined to arrayStorageProperties.hpp


// Forward declarations.
@@ -94,8 +67,6 @@ class oopDesc {
union _metadata {
Klass* _klass;
narrowKlass _compressed_klass;
uintptr_t _wide_storage_props;
uint32_t _narrow_storage_props;
} _metadata;

public:
@@ -116,17 +87,6 @@ class oopDesc {
inline void init_mark();
inline void init_mark_raw();

enum {
storage_props_nof_bits = LogKlassAlignmentInBytes, // This alignment gives us some "free bits"
narrow_storage_props_shift = (sizeof(narrowKlass) << 3) - storage_props_nof_bits,
wide_storage_props_shift = (sizeof(Klass*) << 3) - storage_props_nof_bits
};

static inline narrowKlass compressed_klass_mask();
static inline narrowKlass compressed_klass_masked(narrowKlass raw);
static inline uintptr_t klass_mask();
static inline Klass* klass_masked(uintptr_t raw);

inline Klass* klass() const;
inline Klass* klass_or_null() const volatile;
inline Klass* klass_or_null_acquire() const volatile;
@@ -138,13 +98,6 @@ class oopDesc {
inline void set_klass(Klass* k);
static inline void release_set_klass(HeapWord* mem, Klass* klass);

// Extra container metadata specific to arrays (encoded into high bits of _metadata)
static inline uintptr_t* wide_metadata_addr(HeapWord* mem);
inline ArrayStorageProperties array_storage_properties() const;
inline void set_metadata(ArrayStorageProperties storage_props, Klass* k);
static inline void release_set_metadata(HeapWord* mem, ArrayStorageProperties storage_props, Klass* klass);


// For klass field compression
inline int klass_gap() const;
inline void set_klass_gap(int z);