Skip to content

Commit 22dd0da

Browse files
committed
8249869: [lworld] Remove LW2 specific code from the JIT
1 parent d5187c5 commit 22dd0da

37 files changed

+170
-347
lines changed

src/hotspot/cpu/aarch64/c1_LIRAssembler_aarch64.cpp

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -498,20 +498,19 @@ void LIR_Assembler::return_op(LIR_Opr result) {
498498

499499
ciMethod* method = compilation()->method();
500500

501-
if (InlineTypeReturnedAsFields && method->signature()->returns_never_null()) {
502-
ciType* return_type = method->return_type();
503-
if (return_type->is_valuetype()) {
504-
ciValueKlass* vk = return_type->as_value_klass();
505-
if (vk->can_be_returned_as_fields()) {
506-
address unpack_handler = vk->unpack_handler();
507-
assert(unpack_handler != NULL, "must be");
508-
__ far_call(RuntimeAddress(unpack_handler));
509-
// At this point, rax points to the value object (for interpreter or C1 caller).
510-
// The fields of the object are copied into registers (for C2 caller).
511-
}
501+
ciType* return_type = method->return_type();
502+
if (InlineTypeReturnedAsFields && return_type->is_valuetype()) {
503+
ciValueKlass* vk = return_type->as_value_klass();
504+
if (vk->can_be_returned_as_fields()) {
505+
address unpack_handler = vk->unpack_handler();
506+
assert(unpack_handler != NULL, "must be");
507+
__ far_call(RuntimeAddress(unpack_handler));
508+
// At this point, rax points to the value object (for interpreter or C1 caller).
509+
// The fields of the object are copied into registers (for C2 caller).
512510
}
513511
}
514512

513+
515514
// Pop the stack before the safepoint code
516515
__ remove_frame(initial_frame_size_in_bytes(), needs_stack_repair());
517516

@@ -1586,7 +1585,7 @@ void LIR_Assembler::emit_opFlattenedArrayCheck(LIR_OpFlattenedArrayCheck* op) {
15861585

15871586
void LIR_Assembler::emit_opNullFreeArrayCheck(LIR_OpNullFreeArrayCheck* op) {
15881587
// This is called when we use aastore into a an array declared as "[LVT;",
1589-
// where we know VT is not flattenable (due to InlineArrayElemMaxFlatSize, etc).
1588+
// where we know VT is not flattened (due to InlineArrayElemMaxFlatSize, etc).
15901589
// However, we need to do a NULL check if the actual array is a "[QVT;".
15911590

15921591
__ load_storage_props(op->tmp()->as_register(), op->array()->as_register());

src/hotspot/cpu/x86/c1_LIRAssembler_x86.cpp

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -528,21 +528,19 @@ void LIR_Assembler::return_op(LIR_Opr result) {
528528
}
529529

530530
ciMethod* method = compilation()->method();
531-
if (InlineTypeReturnedAsFields && method->signature()->returns_never_null()) {
532-
ciType* return_type = method->return_type();
533-
if (return_type->is_valuetype()) {
534-
ciValueKlass* vk = return_type->as_value_klass();
535-
if (vk->can_be_returned_as_fields()) {
531+
ciType* return_type = method->return_type();
532+
if (InlineTypeReturnedAsFields && return_type->is_valuetype()) {
533+
ciValueKlass* vk = return_type->as_value_klass();
534+
if (vk->can_be_returned_as_fields()) {
536535
#ifndef _LP64
537-
Unimplemented();
536+
Unimplemented();
538537
#else
539-
address unpack_handler = vk->unpack_handler();
540-
assert(unpack_handler != NULL, "must be");
541-
__ call(RuntimeAddress(unpack_handler));
542-
// At this point, rax points to the value object (for interpreter or C1 caller).
543-
// The fields of the object are copied into registers (for C2 caller).
538+
address unpack_handler = vk->unpack_handler();
539+
assert(unpack_handler != NULL, "must be");
540+
__ call(RuntimeAddress(unpack_handler));
541+
// At this point, rax points to the value object (for interpreter or C1 caller).
542+
// The fields of the object are copied into registers (for C2 caller).
544543
#endif
545-
}
546544
}
547545
}
548546

src/hotspot/share/c1/c1_Canonicalizer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -647,7 +647,7 @@ void Canonicalizer::do_NewMultiArray (NewMultiArray* x) {}
647647
void Canonicalizer::do_WithField (WithField* x) {}
648648
void Canonicalizer::do_DefaultValue (DefaultValue* x) {}
649649
void Canonicalizer::do_CheckCast (CheckCast* x) {
650-
if (x->klass()->is_loaded() && !x->is_never_null()) {
650+
if (x->klass()->is_loaded() && !x->klass()->is_valuetype()) {
651651
// Don't canonicalize for non-nullable types -- we need to throw NPE.
652652
Value obj = x->obj();
653653
ciType* klass = obj->exact_type();

src/hotspot/share/c1/c1_GraphBuilder.cpp

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1779,9 +1779,6 @@ void GraphBuilder::access_field(Bytecodes::Code code) {
17791779
}
17801780
LoadField* load_field = new LoadField(append(obj), offset, field, true,
17811781
state_before, needs_patching);
1782-
if (field->is_flattenable()) {
1783-
load_field->set_never_null(true);
1784-
}
17851782
push(type, append(load_field));
17861783
}
17871784
break;
@@ -1792,7 +1789,7 @@ void GraphBuilder::access_field(Bytecodes::Code code) {
17921789
if (state_before == NULL) {
17931790
state_before = copy_state_for_exception();
17941791
}
1795-
if (field->type()->basic_type() == T_BOOLEAN) {
1792+
if (field_type == T_BOOLEAN) {
17961793
Value mask = append(new Constant(new IntConstant(1)));
17971794
val = append(new LogicOp(Bytecodes::_iand, val, mask));
17981795
}
@@ -1814,8 +1811,8 @@ void GraphBuilder::access_field(Bytecodes::Code code) {
18141811
if (!const_oop->is_null_object() && const_oop->is_loaded()) {
18151812
ciConstant field_value = field->constant_value_of(const_oop);
18161813
if (field_value.is_valid()) {
1817-
if (field->is_flattenable() && field_value.is_null_or_zero()) {
1818-
// Non-flattened but flattenable inline type field. Replace null by the default value.
1814+
if (field->signature()->is_Q_signature() && field_value.is_null_or_zero()) {
1815+
// Non-flattened inline type field. Replace null by the default value.
18191816
constant = new Constant(new InstanceConstant(field->type()->as_value_klass()->default_value_instance()));
18201817
} else {
18211818
constant = make_constant(field_value, field);
@@ -2372,7 +2369,7 @@ void GraphBuilder::invoke(Bytecodes::Code code) {
23722369
}
23732370

23742371
Invoke* result = new Invoke(code, result_type, recv, args, vtable_index, target, state_before,
2375-
declared_signature->returns_never_null());
2372+
declared_signature->return_type()->is_valuetype());
23762373
// push result
23772374
append_split(result);
23782375

@@ -2420,7 +2417,7 @@ void GraphBuilder::new_type_array() {
24202417
void GraphBuilder::new_object_array() {
24212418
bool will_link;
24222419
ciKlass* klass = stream()->get_klass(will_link);
2423-
bool never_null = stream()->is_klass_never_null();
2420+
bool never_null = stream()->is_inline_klass();
24242421
ValueStack* state_before = !klass->is_loaded() || PatchALot ? copy_state_before() : copy_state_exhandling();
24252422
NewArray* n = new NewObjectArray(klass, ipop(), state_before, never_null);
24262423
apush(append_split(n));
@@ -2447,7 +2444,7 @@ bool GraphBuilder::direct_compare(ciKlass* k) {
24472444
void GraphBuilder::check_cast(int klass_index) {
24482445
bool will_link;
24492446
ciKlass* klass = stream()->get_klass(will_link);
2450-
bool never_null = stream()->is_klass_never_null();
2447+
bool never_null = stream()->is_inline_klass();
24512448
ValueStack* state_before = !klass->is_loaded() || PatchALot ? copy_state_before() : copy_state_for_exception();
24522449
CheckCast* c = new CheckCast(klass, apop(), state_before, never_null);
24532450
apush(append_split(c));
@@ -3471,7 +3468,7 @@ ValueStack* GraphBuilder::state_at_entry() {
34713468
// don't allow T_ARRAY to propagate into locals types
34723469
if (is_reference_type(basic_type)) basic_type = T_OBJECT;
34733470
ValueType* vt = as_ValueType(basic_type);
3474-
state->store_local(idx, new Local(type, vt, idx, false, sig->is_never_null_at(i)));
3471+
state->store_local(idx, new Local(type, vt, idx, false, type->is_valuetype()));
34753472
idx += type->size();
34763473
}
34773474

src/hotspot/share/c1/c1_Instruction.hpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -871,7 +871,9 @@ LEAF(LoadField, AccessField)
871871
ValueStack* state_before, bool needs_patching,
872872
ciValueKlass* value_klass = NULL, Value default_value = NULL )
873873
: AccessField(obj, offset, field, is_static, state_before, needs_patching)
874-
{}
874+
{
875+
set_never_null(field->signature()->is_Q_signature());
876+
}
875877

876878
ciType* declared_type() const;
877879

src/hotspot/share/c1/c1_LIR.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1040,7 +1040,7 @@ void LIR_OpJavaCall::emit_code(LIR_Assembler* masm) {
10401040

10411041
bool LIR_OpJavaCall::maybe_return_as_fields(ciValueKlass** vk_ret) const {
10421042
if (InlineTypeReturnedAsFields) {
1043-
if (method()->signature()->maybe_returns_never_null()) {
1043+
if (method()->signature()->maybe_returns_value_type()) {
10441044
ciType* return_type = method()->return_type();
10451045
if (return_type->is_valuetype()) {
10461046
ciValueKlass* vk = return_type->as_value_klass();

src/hotspot/share/c1/c1_LIRGenerator.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1554,7 +1554,7 @@ void LIRGenerator::do_StoreField(StoreField* x) {
15541554
if (x->needs_null_check() &&
15551555
(needs_patching ||
15561556
MacroAssembler::needs_explicit_null_check(x->offset()))) {
1557-
if (needs_patching && x->field()->is_flattenable()) {
1557+
if (needs_patching && x->field()->signature()->is_Q_signature()) {
15581558
// We are storing a field of type "QT;" into holder class H, but H is not yet
15591559
// loaded. (If H had been loaded, then T must also have already been loaded
15601560
// due to the "Q" signature, and needs_patching would be false).
@@ -1693,7 +1693,7 @@ bool LIRGenerator::needs_flattened_array_store_check(StoreIndexed* x) {
16931693
if (type != NULL && type->is_klass()) {
16941694
ciKlass* klass = type->as_klass();
16951695
if (!klass->can_be_value_klass() || (klass->is_valuetype() && !klass->as_value_klass()->flatten_array())) {
1696-
// This is known to be a non-flattenable object. If the array is flattened,
1696+
// This is known to be a non-flattened object. If the array is flattened,
16971697
// it will be caught by the code generated by array_store_check().
16981698
return false;
16991699
}
@@ -1900,7 +1900,7 @@ LIR_Opr LIRGenerator::access_resolve(DecoratorSet decorators, LIR_Opr obj) {
19001900
return _barrier_set->resolve(this, decorators, obj);
19011901
}
19021902

1903-
Constant* LIRGenerator::flattenable_load_field_prolog(LoadField* x, CodeEmitInfo* info) {
1903+
Constant* LIRGenerator::flattened_field_load_prolog(LoadField* x, CodeEmitInfo* info) {
19041904
ciField* field = x->field();
19051905
ciInstanceKlass* holder = field->holder();
19061906
Constant* default_value = NULL;
@@ -2004,8 +2004,8 @@ void LIRGenerator::do_LoadField(LoadField* x) {
20042004
#endif
20052005

20062006
Constant* default_value = NULL;
2007-
if (x->field()->is_flattenable()) {
2008-
default_value = flattenable_load_field_prolog(x, info);
2007+
if (x->field()->signature()->is_Q_signature()) {
2008+
default_value = flattened_field_load_prolog(x, info);
20092009
}
20102010

20112011
bool stress_deopt = StressLoopInvariantCodeMotion && info && info->deoptimize_on_exception();

src/hotspot/share/c1/c1_LIRGenerator.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ class LIRGenerator: public InstructionVisitor, public BlockClosure {
268268
void do_update_CRC32C(Intrinsic* x);
269269
void do_vectorizedMismatch(Intrinsic* x);
270270

271-
Constant* flattenable_load_field_prolog(LoadField* x, CodeEmitInfo* info);
271+
Constant* flattened_field_load_prolog(LoadField* x, CodeEmitInfo* info);
272272
void access_flattened_array(bool is_load, LIRItem& array, LIRItem& index, LIRItem& obj_item);
273273
bool needs_flattened_array_store_check(StoreIndexed* x);
274274
void check_flattened_array(LIR_Opr array, LIR_Opr value, CodeStub* slow_path);

src/hotspot/share/ci/ciClassList.hpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ class ciArrayKlass;
6767
class ciValueArrayKlass;
6868
class ciObjArrayKlass;
6969
class ciTypeArrayKlass;
70-
class ciWrapper;
7170

7271
// Simulate Java Language style package-private access with
7372
// friend declarations.
@@ -115,7 +114,6 @@ friend class ciReplay; \
115114
friend class ciTypeArray; \
116115
friend class ciType; \
117116
friend class ciReturnAddress; \
118-
friend class ciWrapper; \
119117
friend class ciKlass; \
120118
friend class ciInstanceKlass; \
121119
friend class ciValueKlass; \

src/hotspot/share/ci/ciEnv.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -608,10 +608,10 @@ ciKlass* ciEnv::get_klass_by_index(const constantPoolHandle& cpool,
608608
}
609609

610610
// ------------------------------------------------------------------
611-
// ciEnv::is_klass_never_null
611+
// ciEnv::is_inline_klass
612612
//
613-
// Get information about nullability from the constant pool.
614-
bool ciEnv::is_klass_never_null(const constantPoolHandle& cpool, int index) {
613+
// Check if the klass is an inline klass.
614+
bool ciEnv::is_inline_klass(const constantPoolHandle& cpool, int index) {
615615
GUARDED_VM_ENTRY(return cpool->klass_name_at(index)->is_Q_signature();)
616616
}
617617

0 commit comments

Comments
 (0)