856 //
857 class LIR_Op;
858 class LIR_Op0;
859 class LIR_OpLabel;
860 class LIR_Op1;
861 class LIR_OpBranch;
862 class LIR_OpConvert;
863 class LIR_OpAllocObj;
864 class LIR_OpRoundFP;
865 class LIR_Op2;
866 class LIR_OpDelay;
867 class LIR_Op3;
868 class LIR_OpAllocArray;
869 class LIR_OpCall;
870 class LIR_OpJavaCall;
871 class LIR_OpRTCall;
872 class LIR_OpArrayCopy;
873 class LIR_OpUpdateCRC32;
874 class LIR_OpLock;
875 class LIR_OpTypeCheck;
876 class LIR_OpCompareAndSwap;
877 class LIR_OpProfileCall;
878 class LIR_OpProfileType;
879 #ifdef ASSERT
880 class LIR_OpAssert;
881 #endif
882
883 // LIR operation codes
884 enum LIR_Code {
885 lir_none
886 , begin_op0
887 , lir_word_align
888 , lir_label
889 , lir_nop
890 , lir_backwardbranch_target
891 , lir_std_entry
892 , lir_osr_entry
893 , lir_build_frame
894 , lir_fpop_raw
895 , lir_24bit_FPU
970 , lir_dynamic_call
971 , end_opJavaCall
972 , begin_opArrayCopy
973 , lir_arraycopy
974 , end_opArrayCopy
975 , begin_opUpdateCRC32
976 , lir_updatecrc32
977 , end_opUpdateCRC32
978 , begin_opLock
979 , lir_lock
980 , lir_unlock
981 , end_opLock
982 , begin_delay_slot
983 , lir_delay_slot
984 , end_delay_slot
985 , begin_opTypeCheck
986 , lir_instanceof
987 , lir_checkcast
988 , lir_store_check
989 , end_opTypeCheck
990 , begin_opCompareAndSwap
991 , lir_cas_long
992 , lir_cas_obj
993 , lir_cas_int
994 , end_opCompareAndSwap
995 , begin_opMDOProfile
996 , lir_profile_call
997 , lir_profile_type
998 , end_opMDOProfile
999 , begin_opAssert
1000 , lir_assert
1001 , end_opAssert
1002 };
1003
1004
1005 enum LIR_Condition {
1006 lir_cond_equal
1007 , lir_cond_notEqual
1008 , lir_cond_less
1009 , lir_cond_lessEqual
1120
1121 virtual bool is_patching() { return false; }
1122 virtual LIR_OpCall* as_OpCall() { return NULL; }
1123 virtual LIR_OpJavaCall* as_OpJavaCall() { return NULL; }
1124 virtual LIR_OpLabel* as_OpLabel() { return NULL; }
1125 virtual LIR_OpDelay* as_OpDelay() { return NULL; }
1126 virtual LIR_OpLock* as_OpLock() { return NULL; }
1127 virtual LIR_OpAllocArray* as_OpAllocArray() { return NULL; }
1128 virtual LIR_OpAllocObj* as_OpAllocObj() { return NULL; }
1129 virtual LIR_OpRoundFP* as_OpRoundFP() { return NULL; }
1130 virtual LIR_OpBranch* as_OpBranch() { return NULL; }
1131 virtual LIR_OpRTCall* as_OpRTCall() { return NULL; }
1132 virtual LIR_OpConvert* as_OpConvert() { return NULL; }
1133 virtual LIR_Op0* as_Op0() { return NULL; }
1134 virtual LIR_Op1* as_Op1() { return NULL; }
1135 virtual LIR_Op2* as_Op2() { return NULL; }
1136 virtual LIR_Op3* as_Op3() { return NULL; }
1137 virtual LIR_OpArrayCopy* as_OpArrayCopy() { return NULL; }
1138 virtual LIR_OpUpdateCRC32* as_OpUpdateCRC32() { return NULL; }
1139 virtual LIR_OpTypeCheck* as_OpTypeCheck() { return NULL; }
1140 virtual LIR_OpCompareAndSwap* as_OpCompareAndSwap() { return NULL; }
1141 virtual LIR_OpProfileCall* as_OpProfileCall() { return NULL; }
1142 virtual LIR_OpProfileType* as_OpProfileType() { return NULL; }
1143 #ifdef ASSERT
1144 virtual LIR_OpAssert* as_OpAssert() { return NULL; }
1145 #endif
1146
1147 virtual void verify() const {}
1148 };
1149
1150 // for calls
1151 class LIR_OpCall: public LIR_Op {
1152 friend class LIR_OpVisitState;
1153
1154 protected:
1155 address _addr;
1156 LIR_OprList* _arguments;
1157 protected:
1158 LIR_OpCall(LIR_Code code, address addr, LIR_Opr result,
1159 LIR_OprList* arguments, CodeEmitInfo* info = NULL)
1578 ciKlass* klass() const { assert(code() == lir_instanceof || code() == lir_checkcast, "not valid"); return _klass; }
1579 bool fast_check() const { assert(code() == lir_instanceof || code() == lir_checkcast, "not valid"); return _fast_check; }
1580 CodeEmitInfo* info_for_patch() const { return _info_for_patch; }
1581 CodeEmitInfo* info_for_exception() const { return _info_for_exception; }
1582 CodeStub* stub() const { return _stub; }
1583
1584 // MethodData* profiling
1585 void set_profiled_method(ciMethod *method) { _profiled_method = method; }
1586 void set_profiled_bci(int bci) { _profiled_bci = bci; }
1587 void set_should_profile(bool b) { _should_profile = b; }
1588 ciMethod* profiled_method() const { return _profiled_method; }
1589 int profiled_bci() const { return _profiled_bci; }
1590 bool should_profile() const { return _should_profile; }
1591 bool need_null_check() const { return _need_null_check; }
1592 virtual bool is_patching() { return _info_for_patch != NULL; }
1593 virtual void emit_code(LIR_Assembler* masm);
1594 virtual LIR_OpTypeCheck* as_OpTypeCheck() { return this; }
1595 void print_instr(outputStream* out) const PRODUCT_RETURN;
1596 };
1597
1598 // LIR_Op2
1599 class LIR_Op2: public LIR_Op {
1600 friend class LIR_OpVisitState;
1601
1602 int _fpu_stack_size; // for sin/cos implementation on Intel
1603
1604 protected:
1605 LIR_Opr _opr1;
1606 LIR_Opr _opr2;
1607 BasicType _type;
1608 LIR_Opr _tmp1;
1609 LIR_Opr _tmp2;
1610 LIR_Opr _tmp3;
1611 LIR_Opr _tmp4;
1612 LIR_Opr _tmp5;
1613 LIR_Condition _condition;
1614
1615 void verify() const;
1616
1617 public:
2235 LIR_OprList* arguments, CodeEmitInfo* info) {
2236 append(new LIR_OpRTCall(routine, tmp, result, arguments, info));
2237 }
2238
2239 void load_stack_address_monitor(int monitor_ix, LIR_Opr dst) { append(new LIR_Op1(lir_monaddr, LIR_OprFact::intConst(monitor_ix), dst)); }
2240 void unlock_object(LIR_Opr hdr, LIR_Opr obj, LIR_Opr lock, LIR_Opr scratch, CodeStub* stub);
2241 void lock_object(LIR_Opr hdr, LIR_Opr obj, LIR_Opr lock, LIR_Opr scratch, CodeStub* stub, CodeEmitInfo* info, CodeStub* throw_imse_stub=NULL);
2242
2243 void set_24bit_fpu() { append(new LIR_Op0(lir_24bit_FPU )); }
2244 void restore_fpu() { append(new LIR_Op0(lir_reset_FPU )); }
2245 void breakpoint() { append(new LIR_Op0(lir_breakpoint)); }
2246
2247 void arraycopy(LIR_Opr src, LIR_Opr src_pos, LIR_Opr dst, LIR_Opr dst_pos, LIR_Opr length, LIR_Opr tmp, ciArrayKlass* expected_type, int flags, CodeEmitInfo* info) { append(new LIR_OpArrayCopy(src, src_pos, dst, dst_pos, length, tmp, expected_type, flags, info)); }
2248
2249 void update_crc32(LIR_Opr crc, LIR_Opr val, LIR_Opr res) { append(new LIR_OpUpdateCRC32(crc, val, res)); }
2250
2251 void fpop_raw() { append(new LIR_Op0(lir_fpop_raw)); }
2252
2253 void instanceof(LIR_Opr result, LIR_Opr object, ciKlass* klass, LIR_Opr tmp1, LIR_Opr tmp2, LIR_Opr tmp3, bool fast_check, CodeEmitInfo* info_for_patch, ciMethod* profiled_method, int profiled_bci);
2254 void store_check(LIR_Opr object, LIR_Opr array, LIR_Opr tmp1, LIR_Opr tmp2, LIR_Opr tmp3, CodeEmitInfo* info_for_exception, ciMethod* profiled_method, int profiled_bci);
2255
2256 void checkcast (LIR_Opr result, LIR_Opr object, ciKlass* klass,
2257 LIR_Opr tmp1, LIR_Opr tmp2, LIR_Opr tmp3, bool fast_check,
2258 CodeEmitInfo* info_for_exception, CodeEmitInfo* info_for_patch, CodeStub* stub,
2259 ciMethod* profiled_method, int profiled_bci, bool is_never_null);
2260 // MethodData* profiling
2261 void profile_call(ciMethod* method, int bci, ciMethod* callee, LIR_Opr mdo, LIR_Opr recv, LIR_Opr t1, ciKlass* cha_klass) {
2262 append(new LIR_OpProfileCall(method, bci, callee, mdo, recv, t1, cha_klass));
2263 }
2264 void profile_type(LIR_Address* mdp, LIR_Opr obj, ciKlass* exact_klass, intptr_t current_klass, LIR_Opr tmp, bool not_null, bool no_conflict) {
2265 append(new LIR_OpProfileType(LIR_OprFact::address(mdp), obj, exact_klass, current_klass, tmp, not_null, no_conflict));
2266 }
2267
2268 void xadd(LIR_Opr src, LIR_Opr add, LIR_Opr res, LIR_Opr tmp) { append(new LIR_Op2(lir_xadd, src, add, res, tmp)); }
2269 void xchg(LIR_Opr src, LIR_Opr set, LIR_Opr res, LIR_Opr tmp) { append(new LIR_Op2(lir_xchg, src, set, res, tmp)); }
2270 #ifdef ASSERT
2271 void lir_assert(LIR_Condition condition, LIR_Opr opr1, LIR_Opr opr2, const char* msg, bool halt) { append(new LIR_OpAssert(condition, opr1, opr2, msg, halt)); }
2272 #endif
2273 };
2274
|
856 //
857 class LIR_Op;
858 class LIR_Op0;
859 class LIR_OpLabel;
860 class LIR_Op1;
861 class LIR_OpBranch;
862 class LIR_OpConvert;
863 class LIR_OpAllocObj;
864 class LIR_OpRoundFP;
865 class LIR_Op2;
866 class LIR_OpDelay;
867 class LIR_Op3;
868 class LIR_OpAllocArray;
869 class LIR_OpCall;
870 class LIR_OpJavaCall;
871 class LIR_OpRTCall;
872 class LIR_OpArrayCopy;
873 class LIR_OpUpdateCRC32;
874 class LIR_OpLock;
875 class LIR_OpTypeCheck;
876 class LIR_OpFlattenedStoreCheck;
877 class LIR_OpCompareAndSwap;
878 class LIR_OpProfileCall;
879 class LIR_OpProfileType;
880 #ifdef ASSERT
881 class LIR_OpAssert;
882 #endif
883
884 // LIR operation codes
885 enum LIR_Code {
886 lir_none
887 , begin_op0
888 , lir_word_align
889 , lir_label
890 , lir_nop
891 , lir_backwardbranch_target
892 , lir_std_entry
893 , lir_osr_entry
894 , lir_build_frame
895 , lir_fpop_raw
896 , lir_24bit_FPU
971 , lir_dynamic_call
972 , end_opJavaCall
973 , begin_opArrayCopy
974 , lir_arraycopy
975 , end_opArrayCopy
976 , begin_opUpdateCRC32
977 , lir_updatecrc32
978 , end_opUpdateCRC32
979 , begin_opLock
980 , lir_lock
981 , lir_unlock
982 , end_opLock
983 , begin_delay_slot
984 , lir_delay_slot
985 , end_delay_slot
986 , begin_opTypeCheck
987 , lir_instanceof
988 , lir_checkcast
989 , lir_store_check
990 , end_opTypeCheck
991 , begin_opFlattenedStoreCheck
992 , lir_flattened_store_check
993 , end_opFlattenedStoreCheck
994 , begin_opCompareAndSwap
995 , lir_cas_long
996 , lir_cas_obj
997 , lir_cas_int
998 , end_opCompareAndSwap
999 , begin_opMDOProfile
1000 , lir_profile_call
1001 , lir_profile_type
1002 , end_opMDOProfile
1003 , begin_opAssert
1004 , lir_assert
1005 , end_opAssert
1006 };
1007
1008
1009 enum LIR_Condition {
1010 lir_cond_equal
1011 , lir_cond_notEqual
1012 , lir_cond_less
1013 , lir_cond_lessEqual
1124
1125 virtual bool is_patching() { return false; }
1126 virtual LIR_OpCall* as_OpCall() { return NULL; }
1127 virtual LIR_OpJavaCall* as_OpJavaCall() { return NULL; }
1128 virtual LIR_OpLabel* as_OpLabel() { return NULL; }
1129 virtual LIR_OpDelay* as_OpDelay() { return NULL; }
1130 virtual LIR_OpLock* as_OpLock() { return NULL; }
1131 virtual LIR_OpAllocArray* as_OpAllocArray() { return NULL; }
1132 virtual LIR_OpAllocObj* as_OpAllocObj() { return NULL; }
1133 virtual LIR_OpRoundFP* as_OpRoundFP() { return NULL; }
1134 virtual LIR_OpBranch* as_OpBranch() { return NULL; }
1135 virtual LIR_OpRTCall* as_OpRTCall() { return NULL; }
1136 virtual LIR_OpConvert* as_OpConvert() { return NULL; }
1137 virtual LIR_Op0* as_Op0() { return NULL; }
1138 virtual LIR_Op1* as_Op1() { return NULL; }
1139 virtual LIR_Op2* as_Op2() { return NULL; }
1140 virtual LIR_Op3* as_Op3() { return NULL; }
1141 virtual LIR_OpArrayCopy* as_OpArrayCopy() { return NULL; }
1142 virtual LIR_OpUpdateCRC32* as_OpUpdateCRC32() { return NULL; }
1143 virtual LIR_OpTypeCheck* as_OpTypeCheck() { return NULL; }
1144 virtual LIR_OpFlattenedStoreCheck* as_OpFlattenedStoreCheck() { return NULL; }
1145 virtual LIR_OpCompareAndSwap* as_OpCompareAndSwap() { return NULL; }
1146 virtual LIR_OpProfileCall* as_OpProfileCall() { return NULL; }
1147 virtual LIR_OpProfileType* as_OpProfileType() { return NULL; }
1148 #ifdef ASSERT
1149 virtual LIR_OpAssert* as_OpAssert() { return NULL; }
1150 #endif
1151
1152 virtual void verify() const {}
1153 };
1154
1155 // for calls
1156 class LIR_OpCall: public LIR_Op {
1157 friend class LIR_OpVisitState;
1158
1159 protected:
1160 address _addr;
1161 LIR_OprList* _arguments;
1162 protected:
1163 LIR_OpCall(LIR_Code code, address addr, LIR_Opr result,
1164 LIR_OprList* arguments, CodeEmitInfo* info = NULL)
1583 ciKlass* klass() const { assert(code() == lir_instanceof || code() == lir_checkcast, "not valid"); return _klass; }
1584 bool fast_check() const { assert(code() == lir_instanceof || code() == lir_checkcast, "not valid"); return _fast_check; }
1585 CodeEmitInfo* info_for_patch() const { return _info_for_patch; }
1586 CodeEmitInfo* info_for_exception() const { return _info_for_exception; }
1587 CodeStub* stub() const { return _stub; }
1588
1589 // MethodData* profiling
1590 void set_profiled_method(ciMethod *method) { _profiled_method = method; }
1591 void set_profiled_bci(int bci) { _profiled_bci = bci; }
1592 void set_should_profile(bool b) { _should_profile = b; }
1593 ciMethod* profiled_method() const { return _profiled_method; }
1594 int profiled_bci() const { return _profiled_bci; }
1595 bool should_profile() const { return _should_profile; }
1596 bool need_null_check() const { return _need_null_check; }
1597 virtual bool is_patching() { return _info_for_patch != NULL; }
1598 virtual void emit_code(LIR_Assembler* masm);
1599 virtual LIR_OpTypeCheck* as_OpTypeCheck() { return this; }
1600 void print_instr(outputStream* out) const PRODUCT_RETURN;
1601 };
1602
1603 // LIR_OpFlattenedStoreCheck
1604 class LIR_OpFlattenedStoreCheck: public LIR_Op {
1605 friend class LIR_OpVisitState;
1606
1607 private:
1608 LIR_Opr _object;
1609 ciKlass* _element_klass;
1610 LIR_Opr _tmp1;
1611 LIR_Opr _tmp2;
1612 CodeEmitInfo* _info_for_exception;
1613 CodeStub* _stub;
1614
1615 public:
1616 LIR_OpFlattenedStoreCheck(LIR_Opr object, ciKlass* element_klass, LIR_Opr tmp1, LIR_Opr tmp2,
1617 CodeEmitInfo* info_for_exception);
1618
1619 LIR_Opr object() const { return _object; }
1620 LIR_Opr tmp1() const { return _tmp1; }
1621 LIR_Opr tmp2() const { return _tmp2; }
1622 ciKlass* element_klass() const { return _element_klass; }
1623 CodeEmitInfo* info_for_exception() const { return _info_for_exception; }
1624 CodeStub* stub() const { return _stub; }
1625
1626 virtual void emit_code(LIR_Assembler* masm);
1627 virtual LIR_OpFlattenedStoreCheck* as_OpFlattenedStoreCheck() { return this; }
1628 virtual void print_instr(outputStream* out) const PRODUCT_RETURN;
1629 };
1630
1631 // LIR_Op2
1632 class LIR_Op2: public LIR_Op {
1633 friend class LIR_OpVisitState;
1634
1635 int _fpu_stack_size; // for sin/cos implementation on Intel
1636
1637 protected:
1638 LIR_Opr _opr1;
1639 LIR_Opr _opr2;
1640 BasicType _type;
1641 LIR_Opr _tmp1;
1642 LIR_Opr _tmp2;
1643 LIR_Opr _tmp3;
1644 LIR_Opr _tmp4;
1645 LIR_Opr _tmp5;
1646 LIR_Condition _condition;
1647
1648 void verify() const;
1649
1650 public:
2268 LIR_OprList* arguments, CodeEmitInfo* info) {
2269 append(new LIR_OpRTCall(routine, tmp, result, arguments, info));
2270 }
2271
2272 void load_stack_address_monitor(int monitor_ix, LIR_Opr dst) { append(new LIR_Op1(lir_monaddr, LIR_OprFact::intConst(monitor_ix), dst)); }
2273 void unlock_object(LIR_Opr hdr, LIR_Opr obj, LIR_Opr lock, LIR_Opr scratch, CodeStub* stub);
2274 void lock_object(LIR_Opr hdr, LIR_Opr obj, LIR_Opr lock, LIR_Opr scratch, CodeStub* stub, CodeEmitInfo* info, CodeStub* throw_imse_stub=NULL);
2275
2276 void set_24bit_fpu() { append(new LIR_Op0(lir_24bit_FPU )); }
2277 void restore_fpu() { append(new LIR_Op0(lir_reset_FPU )); }
2278 void breakpoint() { append(new LIR_Op0(lir_breakpoint)); }
2279
2280 void arraycopy(LIR_Opr src, LIR_Opr src_pos, LIR_Opr dst, LIR_Opr dst_pos, LIR_Opr length, LIR_Opr tmp, ciArrayKlass* expected_type, int flags, CodeEmitInfo* info) { append(new LIR_OpArrayCopy(src, src_pos, dst, dst_pos, length, tmp, expected_type, flags, info)); }
2281
2282 void update_crc32(LIR_Opr crc, LIR_Opr val, LIR_Opr res) { append(new LIR_OpUpdateCRC32(crc, val, res)); }
2283
2284 void fpop_raw() { append(new LIR_Op0(lir_fpop_raw)); }
2285
2286 void instanceof(LIR_Opr result, LIR_Opr object, ciKlass* klass, LIR_Opr tmp1, LIR_Opr tmp2, LIR_Opr tmp3, bool fast_check, CodeEmitInfo* info_for_patch, ciMethod* profiled_method, int profiled_bci);
2287 void store_check(LIR_Opr object, LIR_Opr array, LIR_Opr tmp1, LIR_Opr tmp2, LIR_Opr tmp3, CodeEmitInfo* info_for_exception, ciMethod* profiled_method, int profiled_bci);
2288 void flattened_store_check(LIR_Opr object, ciKlass* element_klass, LIR_Opr tmp1, LIR_Opr tmp2, CodeEmitInfo* info_for_exception);
2289
2290 void checkcast (LIR_Opr result, LIR_Opr object, ciKlass* klass,
2291 LIR_Opr tmp1, LIR_Opr tmp2, LIR_Opr tmp3, bool fast_check,
2292 CodeEmitInfo* info_for_exception, CodeEmitInfo* info_for_patch, CodeStub* stub,
2293 ciMethod* profiled_method, int profiled_bci, bool is_never_null);
2294 // MethodData* profiling
2295 void profile_call(ciMethod* method, int bci, ciMethod* callee, LIR_Opr mdo, LIR_Opr recv, LIR_Opr t1, ciKlass* cha_klass) {
2296 append(new LIR_OpProfileCall(method, bci, callee, mdo, recv, t1, cha_klass));
2297 }
2298 void profile_type(LIR_Address* mdp, LIR_Opr obj, ciKlass* exact_klass, intptr_t current_klass, LIR_Opr tmp, bool not_null, bool no_conflict) {
2299 append(new LIR_OpProfileType(LIR_OprFact::address(mdp), obj, exact_klass, current_klass, tmp, not_null, no_conflict));
2300 }
2301
2302 void xadd(LIR_Opr src, LIR_Opr add, LIR_Opr res, LIR_Opr tmp) { append(new LIR_Op2(lir_xadd, src, add, res, tmp)); }
2303 void xchg(LIR_Opr src, LIR_Opr set, LIR_Opr res, LIR_Opr tmp) { append(new LIR_Op2(lir_xchg, src, set, res, tmp)); }
2304 #ifdef ASSERT
2305 void lir_assert(LIR_Condition condition, LIR_Opr opr1, LIR_Opr opr2, const char* msg, bool halt) { append(new LIR_OpAssert(condition, opr1, opr2, msg, halt)); }
2306 #endif
2307 };
2308
|