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

Rename nullfree to null_free #416

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
@@ -1630,7 +1630,7 @@ void LIR_Assembler::emit_opNullFreeArrayCheck(LIR_OpNullFreeArrayCheck* op) {
__ br(Assembler::NE, test_mark_word);
__ load_prototype_header(tmp, op->array()->as_register());
__ bind(test_mark_word);
__ tst(tmp, markWord::nullfree_array_bit_in_place);
__ tst(tmp, markWord::null_free_array_bit_in_place);
} else {
Register klass = op->tmp()->as_register();
__ load_klass(klass, op->array()->as_register());
@@ -1594,11 +1594,11 @@ void MacroAssembler::test_non_flattened_array_oop(Register oop, Register temp_re
}

void MacroAssembler::test_null_free_array_oop(Register oop, Register temp_reg, Label& is_null_free_array) {
test_oop_prototype_bit(oop, temp_reg, markWord::nullfree_array_bit_in_place, true, is_null_free_array);
test_oop_prototype_bit(oop, temp_reg, markWord::null_free_array_bit_in_place, true, is_null_free_array);
}

void MacroAssembler::test_non_null_free_array_oop(Register oop, Register temp_reg, Label&is_non_null_free_array) {
test_oop_prototype_bit(oop, temp_reg, markWord::nullfree_array_bit_in_place, false, is_non_null_free_array);
test_oop_prototype_bit(oop, temp_reg, markWord::null_free_array_bit_in_place, false, is_non_null_free_array);
}

void MacroAssembler::test_flattened_array_layout(Register lh, Label& is_flattened_array) {
@@ -2030,7 +2030,7 @@ void LIR_Assembler::emit_opNullFreeArrayCheck(LIR_OpNullFreeArrayCheck* op) {
__ jccb(Assembler::notZero, test_mark_word);
__ load_prototype_header(tmp, op->array()->as_register(), rscratch1);
__ bind(test_mark_word);
__ testl(tmp, markWord::nullfree_array_bit_in_place);
__ testl(tmp, markWord::null_free_array_bit_in_place);
} else {
Register tmp_load_klass = LP64_ONLY(rscratch1) NOT_LP64(noreg);
Register klass = op->tmp()->as_register();
@@ -2804,7 +2804,7 @@ void MacroAssembler::test_non_flattened_array_oop(Register oop, Register temp_re

void MacroAssembler::test_null_free_array_oop(Register oop, Register temp_reg, Label&is_null_free_array) {
#ifdef _LP64
test_oop_prototype_bit(oop, temp_reg, markWord::nullfree_array_bit_in_place, true, is_null_free_array);
test_oop_prototype_bit(oop, temp_reg, markWord::null_free_array_bit_in_place, true, is_null_free_array);
#else
load_klass(temp_reg, oop, noreg);
movl(temp_reg, Address(temp_reg, Klass::layout_helper_offset()));
@@ -2814,7 +2814,7 @@ void MacroAssembler::test_null_free_array_oop(Register oop, Register temp_reg, L

void MacroAssembler::test_non_null_free_array_oop(Register oop, Register temp_reg, Label&is_non_null_free_array) {
#ifdef _LP64
test_oop_prototype_bit(oop, temp_reg, markWord::nullfree_array_bit_in_place, false, is_non_null_free_array);
test_oop_prototype_bit(oop, temp_reg, markWord::null_free_array_bit_in_place, false, is_non_null_free_array);
#else
load_klass(temp_reg, oop, noreg);
movl(temp_reg, Address(temp_reg, Klass::layout_helper_offset()));
@@ -142,7 +142,7 @@ arrayOop oopFactory::new_flatArray(Klass* k, int length, TRAPS) {
oop = (arrayOop) ObjArrayKlass::cast(array_klass)->allocate(length, THREAD);
}
assert(oop == NULL || oop->klass()->is_null_free_array_klass(), "sanity");
assert(oop == NULL || oop->is_nullfreeArray(), "sanity");
assert(oop == NULL || oop->is_null_free_array(), "sanity");
return oop;
}

@@ -137,9 +137,9 @@
//
// 64 bits:
// --------
// unused:1 | <-- hash:31 -->| unused:22 larval:1 age:4 flat_array:1 nullfree_array:1 inline_type:1 lock:2
// unused:1 | <-- hash:31 -->| unused:22 larval:1 age:4 flat_array:1 null_free_array:1 inline_type:1 lock:2
//
// The "fast" static type bits (flat_array, nullfree_array, and inline_type)
// The "fast" static type bits (flat_array, null_free_array, and inline_type)
// are placed lowest next to lock bits to more easily decode forwarding pointers.
// G1 for example, implicitly clears age bits ("G1FullGCCompactionPoint::forward()")
// using "oopDesc->forwardee()", so it necessary for "markWord::decode_pointer()"
@@ -199,12 +199,12 @@ class markWord {
static const int biased_lock_bits = 1; // Valhalla: unused
// static prototype header bits (fast path instead of klass layout_helper)
static const int inline_type_bits = 1;
static const int nullfree_array_bits = LP64_ONLY(1) NOT_LP64(0);
static const int null_free_array_bits = LP64_ONLY(1) NOT_LP64(0);
static const int flat_array_bits = LP64_ONLY(1) NOT_LP64(0);
// instance state
static const int age_bits = 4;
static const int larval_bits = 1;
static const int max_hash_bits = BitsPerWord - age_bits - lock_bits - inline_type_bits - larval_bits - flat_array_bits - nullfree_array_bits;
static const int max_hash_bits = BitsPerWord - age_bits - lock_bits - inline_type_bits - larval_bits - flat_array_bits - null_free_array_bits;
static const int hash_bits = max_hash_bits > 31 ? 31 : max_hash_bits;
static const int unused_gap_bits = LP64_ONLY(1) NOT_LP64(0); // Valhalla: unused
static const int epoch_bits = 2; // Valhalla: unused
@@ -214,8 +214,8 @@ class markWord {
static const int lock_shift = 0;
static const int biased_lock_shift = lock_bits;
static const int inline_type_shift = lock_bits;
static const int nullfree_array_shift = inline_type_shift + inline_type_bits;
static const int flat_array_shift = nullfree_array_shift + nullfree_array_bits;
static const int null_free_array_shift = inline_type_shift + inline_type_bits;
static const int flat_array_shift = null_free_array_shift + null_free_array_bits;
static const int age_shift = flat_array_shift + flat_array_bits;
static const int unused_gap_shift = age_shift + age_bits; // Valhalla: unused
static const int larval_shift = age_shift + age_bits;
@@ -230,11 +230,11 @@ class markWord {
static const uintptr_t inline_type_mask = right_n_bits(lock_bits + inline_type_bits);
static const uintptr_t inline_type_mask_in_place = inline_type_mask << lock_shift;
static const uintptr_t inline_type_bit_in_place = 1 << inline_type_shift;
static const uintptr_t nullfree_array_mask = right_n_bits(nullfree_array_bits);
static const uintptr_t nullfree_array_mask_in_place = (nullfree_array_mask << nullfree_array_shift) | lock_mask_in_place;
static const uintptr_t nullfree_array_bit_in_place = (1 << nullfree_array_shift);
static const uintptr_t null_free_array_mask = right_n_bits(null_free_array_bits);
static const uintptr_t null_free_array_mask_in_place = (null_free_array_mask << null_free_array_shift) | lock_mask_in_place;
static const uintptr_t null_free_array_bit_in_place = (1 << null_free_array_shift);
static const uintptr_t flat_array_mask = right_n_bits(flat_array_bits);
static const uintptr_t flat_array_mask_in_place = (flat_array_mask << flat_array_shift) | nullfree_array_mask_in_place | lock_mask_in_place;
static const uintptr_t flat_array_mask_in_place = (flat_array_mask << flat_array_shift) | null_free_array_mask_in_place | lock_mask_in_place;
static const uintptr_t flat_array_bit_in_place = (1 << flat_array_shift);

static const uintptr_t age_mask = right_n_bits(age_bits);
@@ -260,9 +260,9 @@ class markWord {
static const uintptr_t biased_lock_pattern = 5; // Valhalla: unused

static const uintptr_t inline_type_pattern = inline_type_bit_in_place | unlocked_value;
static const uintptr_t nullfree_array_pattern = nullfree_array_bit_in_place | unlocked_value;
static const uintptr_t flat_array_pattern = flat_array_bit_in_place | nullfree_array_pattern;
static const uintptr_t static_prototype_mask = LP64_ONLY(right_n_bits(inline_type_bits + flat_array_bits + nullfree_array_bits)) NOT_LP64(right_n_bits(inline_type_bits));
static const uintptr_t null_free_array_pattern = null_free_array_bit_in_place | unlocked_value;
static const uintptr_t flat_array_pattern = flat_array_bit_in_place | null_free_array_pattern;
static const uintptr_t static_prototype_mask = LP64_ONLY(right_n_bits(inline_type_bits + flat_array_bits + null_free_array_bits)) NOT_LP64(right_n_bits(inline_type_bits));
static const uintptr_t static_prototype_mask_in_place = static_prototype_mask << lock_bits;
static const uintptr_t static_prototype_value_max = (1 << age_shift) - 1;

@@ -471,8 +471,8 @@ class markWord {
return (mask_bits(value(), flat_array_mask_in_place) == flat_array_pattern);
}

bool is_nullfree_array() const {
return (mask_bits(value(), nullfree_array_mask_in_place) == nullfree_array_pattern);
bool is_null_free_array() const {
return (mask_bits(value(), null_free_array_mask_in_place) == null_free_array_pattern);
}
#endif
// Prototype mark for initialization
@@ -489,8 +489,8 @@ class markWord {
return markWord(flat_array_pattern);
}

static markWord nullfree_array_prototype() {
return markWord(nullfree_array_pattern);
static markWord null_free_array_prototype() {
return markWord(null_free_array_pattern);
}
#endif
// Helper function for restoration of unmarked mark oops during GC
@@ -74,7 +74,7 @@ inline markWord markWord::prototype_for_klass(const Klass* klass) {
(UseBiasedLocking && prototype_header.has_bias_pattern()) ||
prototype_header.is_inline_type() ||
prototype_header.is_flat_array() ||
prototype_header.is_nullfree_array(), "corrupt prototype header");
prototype_header.is_null_free_array(), "corrupt prototype header");

return prototype_header;
}
@@ -162,8 +162,8 @@ ObjArrayKlass::ObjArrayKlass(int n, Klass* element_klass, Symbol* name, bool nul
if (null_free) {
assert(n == 1, "Bytecode does not support null-free multi-dim");
lh = layout_helper_set_null_free(lh);
set_prototype_header(markWord::nullfree_array_prototype());
assert(prototype_header().is_nullfree_array(), "sanity");
set_prototype_header(markWord::null_free_array_prototype());
assert(prototype_header().is_null_free_array(), "sanity");
}
set_layout_helper(lh);
assert(is_array_klass(), "sanity");
@@ -543,7 +543,7 @@ void ObjArrayKlass::verify_on(outputStream* st) {
void ObjArrayKlass::oop_verify_on(oop obj, outputStream* st) {
ArrayKlass::oop_verify_on(obj, st);
guarantee(obj->is_objArray(), "must be objArray");
guarantee(obj->is_nullfreeArray() || (!is_null_free_array_klass()), "null-free klass but not object");
guarantee(obj->is_null_free_array() || (!is_null_free_array_klass()), "null-free klass but not object");
objArrayOop oa = objArrayOop(obj);
for(int index = 0; index < oa->length(); index++) {
guarantee(oopDesc::is_oop_or_null(oa->obj_at(index)), "should be oop");
@@ -137,9 +137,8 @@ bool oopDesc::is_instance_noinline() const { return is_instance();
bool oopDesc::is_array_noinline() const { return is_array(); }
bool oopDesc::is_objArray_noinline() const { return is_objArray(); }
bool oopDesc::is_typeArray_noinline() const { return is_typeArray(); }
bool oopDesc::is_value_noinline() const { return is_inline_type(); }
bool oopDesc::is_flatArray_noinline() const { return is_flatArray(); }
bool oopDesc::is_nullfreeArray_noinline() const { return is_nullfreeArray(); }
bool oopDesc::is_null_free_array_noinline() const { return is_null_free_array(); }

bool oopDesc::has_klass_gap() {
// Only has a klass gap when compressed class pointers are used.
@@ -115,16 +115,15 @@ class oopDesc {
inline bool is_typeArray() const;
inline bool is_inline_type() const;
inline bool is_flatArray() const;
inline bool is_nullfreeArray() const;
inline bool is_null_free_array() const;

// type test operations that don't require inclusion of oop.inline.hpp.
bool is_instance_noinline() const;
bool is_array_noinline() const;
bool is_objArray_noinline() const;
bool is_typeArray_noinline() const;
bool is_value_noinline() const;
bool is_flatArray_noinline() const;
bool is_nullfreeArray_noinline() const;
bool is_null_free_array_noinline() const;

protected:
inline oop as_oop() const { return const_cast<oopDesc*>(this); }
@@ -211,13 +211,13 @@ bool oopDesc::is_flatArray() const {
markWord mrk = mark();
return (mrk.is_unlocked()) ? mrk.is_flat_array() : klass()->is_flatArray_klass();
}
bool oopDesc::is_nullfreeArray() const {
bool oopDesc::is_null_free_array() const {
markWord mrk = mark();
return (mrk.is_unlocked()) ? mrk.is_nullfree_array() : klass()->is_null_free_array_klass();
return (mrk.is_unlocked()) ? mrk.is_null_free_array() : klass()->is_null_free_array_klass();
}
#else
bool oopDesc::is_flatArray() const { return klass()->is_flatArray_klass(); }
bool oopDesc::is_nullfreeArray() const { return klass()->is_null_free_array_klass(); }
bool oopDesc::is_flatArray() const { return klass()->is_flatArray_klass(); }
bool oopDesc::is_null_free_array() const { return klass()->is_null_free_array_klass(); }
#endif

void* oopDesc::field_addr(int offset) const { return reinterpret_cast<void*>(cast_from_oop<intptr_t>(as_oop()) + offset); }
@@ -162,7 +162,7 @@ static void assert_type(markWord mark) {
EXPECT_FALSE(mark.is_flat_array());
EXPECT_FALSE(mark.is_inline_type());
EXPECT_FALSE(mark.is_larval_state());
EXPECT_FALSE(mark.is_nullfree_array());
EXPECT_FALSE(mark.is_null_free_array());
}

TEST_VM(markWord, prototype) {
@@ -183,7 +183,7 @@ TEST_VM(markWord, prototype) {
static void assert_inline_type(markWord mark) {
EXPECT_FALSE(mark.is_flat_array());
EXPECT_TRUE(mark.is_inline_type());
EXPECT_FALSE(mark.is_nullfree_array());
EXPECT_FALSE(mark.is_null_free_array());
}

TEST_VM(markWord, inline_type_prototype) {
@@ -216,7 +216,7 @@ static void assert_flat_array_type(markWord mark) {
EXPECT_TRUE(mark.is_flat_array());
EXPECT_FALSE(mark.is_inline_type());
EXPECT_FALSE(mark.is_larval_state());
EXPECT_TRUE(mark.is_nullfree_array());
EXPECT_TRUE(mark.is_null_free_array());
}

TEST_VM(markWord, flat_array_prototype) {
@@ -234,26 +234,26 @@ TEST_VM(markWord, flat_array_prototype) {
assert_flat_array_type(mark);
}

static void assert_nullfree_array_type(markWord mark) {
static void assert_null_free_array_type(markWord mark) {
EXPECT_FALSE(mark.is_flat_array());
EXPECT_FALSE(mark.is_inline_type());
EXPECT_FALSE(mark.is_larval_state());
EXPECT_TRUE(mark.is_nullfree_array());
EXPECT_TRUE(mark.is_null_free_array());
}

TEST_VM(markWord, nullfree_array_prototype) {
markWord mark = markWord::nullfree_array_prototype();
TEST_VM(markWord, null_free_array_prototype) {
markWord mark = markWord::null_free_array_prototype();
assert_unlocked_state(mark);
EXPECT_TRUE(mark.is_neutral());

assert_nullfree_array_type(mark);
assert_null_free_array_type(mark);

EXPECT_TRUE(mark.has_no_hash());
EXPECT_FALSE(mark.is_marked());
EXPECT_TRUE(mark.decode_pointer() == NULL);

assert_copy_set_hash(mark);
assert_nullfree_array_type(mark);
assert_null_free_array_type(mark);
}
#endif // _LP64