From e4d0bae87cf2bc01b213ee72d81cbdbd137d9cc8 Mon Sep 17 00:00:00 2001 From: Neethu Prasad Date: Wed, 3 Jul 2024 20:26:08 +0000 Subject: [PATCH] 8334232: Optimize C1 classes layout --- src/hotspot/share/c1/c1_Instruction.hpp | 7 ++-- src/hotspot/share/c1/c1_LIR.cpp | 4 +-- src/hotspot/share/c1/c1_LIR.hpp | 47 +++++++++++++------------ 3 files changed, 30 insertions(+), 28 deletions(-) diff --git a/src/hotspot/share/c1/c1_Instruction.hpp b/src/hotspot/share/c1/c1_Instruction.hpp index 32ff3d9f61cab..b009d7617b484 100644 --- a/src/hotspot/share/c1/c1_Instruction.hpp +++ b/src/hotspot/share/c1/c1_Instruction.hpp @@ -281,11 +281,12 @@ class Instruction: public CompilationResourceObj { #endif int _use_count; // the number of instructions referring to this value (w/o prev/next); only roots can have use count = 0 or > 1 int _pin_state; // set of PinReason describing the reason for pinning + + unsigned int _flags; // Flag bits ValueType* _type; // the instruction value type Instruction* _next; // the next instruction if any (null for BlockEnd instructions) Instruction* _subst; // the substitution instruction if any LIR_Opr _operand; // LIR specific information - unsigned int _flags; // Flag bits ValueStack* _state_before; // Copy of state with input operands still on stack (or null) ValueStack* _exception_state; // Copy of state for exception handling @@ -403,11 +404,11 @@ class Instruction: public CompilationResourceObj { #endif _use_count(0) , _pin_state(0) + , _flags(0) , _type(type) , _next(nullptr) , _subst(nullptr) , _operand(LIR_OprFact::illegalOpr) - , _flags(0) , _state_before(state_before) , _exception_handlers(nullptr) , _block(nullptr) @@ -1518,9 +1519,9 @@ LEAF(MonitorExit, AccessMonitor) LEAF(Intrinsic, StateSplit) private: vmIntrinsics::ID _id; + ArgsNonNullState _nonnull_state; Values* _args; Value _recv; - ArgsNonNullState _nonnull_state; public: // preserves_state can be set to true for Intrinsics diff --git a/src/hotspot/share/c1/c1_LIR.cpp b/src/hotspot/share/c1/c1_LIR.cpp index 3f53011024b01..f03ed38284c97 100644 --- a/src/hotspot/share/c1/c1_LIR.cpp +++ b/src/hotspot/share/c1/c1_LIR.cpp @@ -296,13 +296,13 @@ LIR_OpTypeCheck::LIR_OpTypeCheck(LIR_Code code, LIR_Opr result, LIR_Opr object, , _tmp1(tmp1) , _tmp2(tmp2) , _tmp3(tmp3) - , _fast_check(fast_check) , _info_for_patch(info_for_patch) , _info_for_exception(info_for_exception) , _stub(stub) , _profiled_method(nullptr) , _profiled_bci(-1) , _should_profile(false) + , _fast_check(fast_check) { if (code == lir_checkcast) { assert(info_for_exception != nullptr, "checkcast throws exceptions"); @@ -323,13 +323,13 @@ LIR_OpTypeCheck::LIR_OpTypeCheck(LIR_Code code, LIR_Opr object, LIR_Opr array, L , _tmp1(tmp1) , _tmp2(tmp2) , _tmp3(tmp3) - , _fast_check(false) , _info_for_patch(nullptr) , _info_for_exception(info_for_exception) , _stub(nullptr) , _profiled_method(nullptr) , _profiled_bci(-1) , _should_profile(false) + , _fast_check(false) { if (code == lir_store_check) { _stub = new ArrayStoreExceptionStub(object, info_for_exception); diff --git a/src/hotspot/share/c1/c1_LIR.hpp b/src/hotspot/share/c1/c1_LIR.hpp index c69d29f8d619d..4047621023601 100644 --- a/src/hotspot/share/c1/c1_LIR.hpp +++ b/src/hotspot/share/c1/c1_LIR.hpp @@ -528,44 +528,44 @@ class LIR_Address: public LIR_OprPtr { private: LIR_Opr _base; LIR_Opr _index; - Scale _scale; intx _disp; + Scale _scale; BasicType _type; public: LIR_Address(LIR_Opr base, LIR_Opr index, BasicType type): _base(base) , _index(index) - , _scale(times_1) , _disp(0) + , _scale(times_1) , _type(type) { verify(); } LIR_Address(LIR_Opr base, intx disp, BasicType type): _base(base) , _index(LIR_Opr::illegalOpr()) - , _scale(times_1) , _disp(disp) + , _scale(times_1) , _type(type) { verify(); } LIR_Address(LIR_Opr base, BasicType type): _base(base) , _index(LIR_Opr::illegalOpr()) - , _scale(times_1) , _disp(0) + , _scale(times_1) , _type(type) { verify(); } LIR_Address(LIR_Opr base, LIR_Opr index, intx disp, BasicType type): _base(base) , _index(index) - , _scale(times_1) , _disp(disp) + , _scale(times_1) , _type(type) { verify(); } LIR_Address(LIR_Opr base, LIR_Opr index, Scale scale, intx disp, BasicType type): _base(base) , _index(index) - , _scale(scale) , _disp(disp) + , _scale(scale) , _type(type) { verify(); } LIR_Opr base() const { return _base; } @@ -1544,13 +1544,13 @@ class LIR_OpTypeCheck: public LIR_Op { LIR_Opr _tmp1; LIR_Opr _tmp2; LIR_Opr _tmp3; - bool _fast_check; CodeEmitInfo* _info_for_patch; CodeEmitInfo* _info_for_exception; CodeStub* _stub; ciMethod* _profiled_method; int _profiled_bci; bool _should_profile; + bool _fast_check; public: LIR_OpTypeCheck(LIR_Code code, LIR_Opr result, LIR_Opr object, ciKlass* klass, @@ -1588,18 +1588,18 @@ class LIR_OpTypeCheck: public LIR_Op { class LIR_Op2: public LIR_Op { friend class LIR_OpVisitState; - int _fpu_stack_size; // for sin/cos implementation on Intel + int _fpu_stack_size; // for sin/cos implementation on Intel protected: LIR_Opr _opr1; LIR_Opr _opr2; - BasicType _type; LIR_Opr _tmp1; LIR_Opr _tmp2; LIR_Opr _tmp3; LIR_Opr _tmp4; LIR_Opr _tmp5; LIR_Condition _condition; + BasicType _type; void verify() const; @@ -1609,13 +1609,13 @@ class LIR_Op2: public LIR_Op { , _fpu_stack_size(0) , _opr1(opr1) , _opr2(opr2) - , _type(type) , _tmp1(LIR_OprFact::illegalOpr) , _tmp2(LIR_OprFact::illegalOpr) , _tmp3(LIR_OprFact::illegalOpr) , _tmp4(LIR_OprFact::illegalOpr) , _tmp5(LIR_OprFact::illegalOpr) - , _condition(condition) { + , _condition(condition) + , _type(type) { assert(code == lir_cmp || code == lir_branch || code == lir_cond_float_branch || code == lir_assert, "code check"); } @@ -1624,13 +1624,13 @@ class LIR_Op2: public LIR_Op { , _fpu_stack_size(0) , _opr1(opr1) , _opr2(opr2) - , _type(type) , _tmp1(LIR_OprFact::illegalOpr) , _tmp2(LIR_OprFact::illegalOpr) , _tmp3(LIR_OprFact::illegalOpr) , _tmp4(LIR_OprFact::illegalOpr) , _tmp5(LIR_OprFact::illegalOpr) - , _condition(condition) { + , _condition(condition) + , _type(type) { assert(code == lir_cmove, "code check"); assert(type != T_ILLEGAL, "cmove should have type"); } @@ -1641,13 +1641,13 @@ class LIR_Op2: public LIR_Op { , _fpu_stack_size(0) , _opr1(opr1) , _opr2(opr2) - , _type(type) , _tmp1(LIR_OprFact::illegalOpr) , _tmp2(LIR_OprFact::illegalOpr) , _tmp3(LIR_OprFact::illegalOpr) , _tmp4(LIR_OprFact::illegalOpr) , _tmp5(LIR_OprFact::illegalOpr) - , _condition(lir_cond_unknown) { + , _condition(lir_cond_unknown) + , _type(type) { assert(code != lir_cmp && code != lir_branch && code != lir_cond_float_branch && is_in_range(code, begin_op2, end_op2), "code check"); } @@ -1657,13 +1657,13 @@ class LIR_Op2: public LIR_Op { , _fpu_stack_size(0) , _opr1(opr1) , _opr2(opr2) - , _type(T_ILLEGAL) , _tmp1(tmp1) , _tmp2(tmp2) , _tmp3(tmp3) , _tmp4(tmp4) , _tmp5(tmp5) - , _condition(lir_cond_unknown) { + , _condition(lir_cond_unknown) + , _type(T_ILLEGAL) { assert(code != lir_cmp && code != lir_branch && code != lir_cond_float_branch && is_in_range(code, begin_op2, end_op2), "code check"); } @@ -1748,8 +1748,8 @@ class LIR_OpAllocArray : public LIR_Op { LIR_Opr _tmp2; LIR_Opr _tmp3; LIR_Opr _tmp4; - BasicType _type; CodeStub* _stub; + BasicType _type; bool _zero_array; public: @@ -1761,8 +1761,8 @@ class LIR_OpAllocArray : public LIR_Op { , _tmp2(t2) , _tmp3(t3) , _tmp4(t4) - , _type(type) , _stub(stub) + , _type(type) , _zero_array(zero_array) {} LIR_Opr klass() const { return _klass; } @@ -1811,13 +1811,13 @@ class LIR_Op4: public LIR_Op { LIR_Opr _opr2; LIR_Opr _opr3; LIR_Opr _opr4; - BasicType _type; LIR_Opr _tmp1; LIR_Opr _tmp2; LIR_Opr _tmp3; LIR_Opr _tmp4; LIR_Opr _tmp5; LIR_Condition _condition; + BasicType _type; public: LIR_Op4(LIR_Code code, LIR_Condition condition, LIR_Opr opr1, LIR_Opr opr2, LIR_Opr opr3, LIR_Opr opr4, @@ -1827,13 +1827,13 @@ class LIR_Op4: public LIR_Op { , _opr2(opr2) , _opr3(opr3) , _opr4(opr4) - , _type(type) , _tmp1(LIR_OprFact::illegalOpr) , _tmp2(LIR_OprFact::illegalOpr) , _tmp3(LIR_OprFact::illegalOpr) , _tmp4(LIR_OprFact::illegalOpr) , _tmp5(LIR_OprFact::illegalOpr) - , _condition(condition) { + , _condition(condition) + , _type(type) { assert(code == lir_cmove, "code check"); assert(type != T_ILLEGAL, "cmove should have type"); } @@ -1842,7 +1842,6 @@ class LIR_Op4: public LIR_Op { LIR_Opr in_opr2() const { return _opr2; } LIR_Opr in_opr3() const { return _opr3; } LIR_Opr in_opr4() const { return _opr4; } - BasicType type() const { return _type; } LIR_Opr tmp1_opr() const { return _tmp1; } LIR_Opr tmp2_opr() const { return _tmp2; } LIR_Opr tmp3_opr() const { return _tmp3; } @@ -1850,6 +1849,8 @@ class LIR_Op4: public LIR_Op { LIR_Opr tmp5_opr() const { return _tmp5; } LIR_Condition condition() const { return _condition; } + BasicType type() const { return _type; } + void set_condition(LIR_Condition condition) { _condition = condition; } void set_in_opr1(LIR_Opr opr) { _opr1 = opr; }