1545 };
1546
1547 // LIR_OpTypeCheck
1548 class LIR_OpTypeCheck: public LIR_Op {
1549 friend class LIR_OpVisitState;
1550
1551 private:
1552 LIR_Opr _object;
1553 LIR_Opr _array;
1554 ciKlass* _klass;
1555 LIR_Opr _tmp1;
1556 LIR_Opr _tmp2;
1557 LIR_Opr _tmp3;
1558 bool _fast_check;
1559 CodeEmitInfo* _info_for_patch;
1560 CodeEmitInfo* _info_for_exception;
1561 CodeStub* _stub;
1562 ciMethod* _profiled_method;
1563 int _profiled_bci;
1564 bool _should_profile;
1565
1566 public:
1567 LIR_OpTypeCheck(LIR_Code code, LIR_Opr result, LIR_Opr object, ciKlass* klass,
1568 LIR_Opr tmp1, LIR_Opr tmp2, LIR_Opr tmp3, bool fast_check,
1569 CodeEmitInfo* info_for_exception, CodeEmitInfo* info_for_patch, CodeStub* stub);
1570 LIR_OpTypeCheck(LIR_Code code, LIR_Opr object, LIR_Opr array,
1571 LIR_Opr tmp1, LIR_Opr tmp2, LIR_Opr tmp3, CodeEmitInfo* info_for_exception);
1572
1573 LIR_Opr object() const { return _object; }
1574 LIR_Opr array() const { assert(code() == lir_store_check, "not valid"); return _array; }
1575 LIR_Opr tmp1() const { return _tmp1; }
1576 LIR_Opr tmp2() const { return _tmp2; }
1577 LIR_Opr tmp3() const { return _tmp3; }
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
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;
2240 void load_stack_address_monitor(int monitor_ix, LIR_Opr dst) { append(new LIR_Op1(lir_monaddr, LIR_OprFact::intConst(monitor_ix), dst)); }
2241 void unlock_object(LIR_Opr hdr, LIR_Opr obj, LIR_Opr lock, LIR_Opr scratch, CodeStub* stub);
2242 void lock_object(LIR_Opr hdr, LIR_Opr obj, LIR_Opr lock, LIR_Opr scratch, CodeStub* stub, CodeEmitInfo* info);
2243
2244 void set_24bit_fpu() { append(new LIR_Op0(lir_24bit_FPU )); }
2245 void restore_fpu() { append(new LIR_Op0(lir_reset_FPU )); }
2246 void breakpoint() { append(new LIR_Op0(lir_breakpoint)); }
2247
2248 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)); }
2249
2250 void update_crc32(LIR_Opr crc, LIR_Opr val, LIR_Opr res) { append(new LIR_OpUpdateCRC32(crc, val, res)); }
2251
2252 void fpop_raw() { append(new LIR_Op0(lir_fpop_raw)); }
2253
2254 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);
2255 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);
2256
2257 void checkcast (LIR_Opr result, LIR_Opr object, ciKlass* klass,
2258 LIR_Opr tmp1, LIR_Opr tmp2, LIR_Opr tmp3, bool fast_check,
2259 CodeEmitInfo* info_for_exception, CodeEmitInfo* info_for_patch, CodeStub* stub,
2260 ciMethod* profiled_method, int profiled_bci);
2261 // MethodData* profiling
2262 void profile_call(ciMethod* method, int bci, ciMethod* callee, LIR_Opr mdo, LIR_Opr recv, LIR_Opr t1, ciKlass* cha_klass) {
2263 append(new LIR_OpProfileCall(method, bci, callee, mdo, recv, t1, cha_klass));
2264 }
2265 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) {
2266 append(new LIR_OpProfileType(LIR_OprFact::address(mdp), obj, exact_klass, current_klass, tmp, not_null, no_conflict));
2267 }
2268
2269 void xadd(LIR_Opr src, LIR_Opr add, LIR_Opr res, LIR_Opr tmp) { append(new LIR_Op2(lir_xadd, src, add, res, tmp)); }
2270 void xchg(LIR_Opr src, LIR_Opr set, LIR_Opr res, LIR_Opr tmp) { append(new LIR_Op2(lir_xchg, src, set, res, tmp)); }
2271 #ifdef ASSERT
2272 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)); }
2273 #endif
2274 };
2275
2276 void print_LIR(BlockList* blocks);
2277
2278 class LIR_InsertionBuffer : public CompilationResourceObj {
2279 private:
2280 LIR_List* _lir; // the lir list where ops of this buffer should be inserted later (NULL when uninitialized)
|
1545 };
1546
1547 // LIR_OpTypeCheck
1548 class LIR_OpTypeCheck: public LIR_Op {
1549 friend class LIR_OpVisitState;
1550
1551 private:
1552 LIR_Opr _object;
1553 LIR_Opr _array;
1554 ciKlass* _klass;
1555 LIR_Opr _tmp1;
1556 LIR_Opr _tmp2;
1557 LIR_Opr _tmp3;
1558 bool _fast_check;
1559 CodeEmitInfo* _info_for_patch;
1560 CodeEmitInfo* _info_for_exception;
1561 CodeStub* _stub;
1562 ciMethod* _profiled_method;
1563 int _profiled_bci;
1564 bool _should_profile;
1565 bool _need_null_check;
1566
1567 public:
1568 LIR_OpTypeCheck(LIR_Code code, LIR_Opr result, LIR_Opr object, ciKlass* klass,
1569 LIR_Opr tmp1, LIR_Opr tmp2, LIR_Opr tmp3, bool fast_check,
1570 CodeEmitInfo* info_for_exception, CodeEmitInfo* info_for_patch, CodeStub* stub, bool need_null_check = true);
1571 LIR_OpTypeCheck(LIR_Code code, LIR_Opr object, LIR_Opr array,
1572 LIR_Opr tmp1, LIR_Opr tmp2, LIR_Opr tmp3, CodeEmitInfo* info_for_exception);
1573
1574 LIR_Opr object() const { return _object; }
1575 LIR_Opr array() const { assert(code() == lir_store_check, "not valid"); return _array; }
1576 LIR_Opr tmp1() const { return _tmp1; }
1577 LIR_Opr tmp2() const { return _tmp2; }
1578 LIR_Opr tmp3() const { return _tmp3; }
1579 ciKlass* klass() const { assert(code() == lir_instanceof || code() == lir_checkcast, "not valid"); return _klass; }
1580 bool fast_check() const { assert(code() == lir_instanceof || code() == lir_checkcast, "not valid"); return _fast_check; }
1581 CodeEmitInfo* info_for_patch() const { return _info_for_patch; }
1582 CodeEmitInfo* info_for_exception() const { return _info_for_exception; }
1583 CodeStub* stub() const { return _stub; }
1584
1585 // MethodData* profiling
1586 void set_profiled_method(ciMethod *method) { _profiled_method = method; }
1587 void set_profiled_bci(int bci) { _profiled_bci = bci; }
1588 void set_should_profile(bool b) { _should_profile = b; }
1589 ciMethod* profiled_method() const { return _profiled_method; }
1590 int profiled_bci() const { return _profiled_bci; }
1591 bool should_profile() const { return _should_profile; }
1592 bool need_null_check() const { return _need_null_check; }
1593 virtual bool is_patching() { return _info_for_patch != NULL; }
1594 virtual void emit_code(LIR_Assembler* masm);
1595 virtual LIR_OpTypeCheck* as_OpTypeCheck() { return this; }
1596 void print_instr(outputStream* out) const PRODUCT_RETURN;
1597 };
1598
1599 // LIR_Op2
1600 class LIR_Op2: public LIR_Op {
1601 friend class LIR_OpVisitState;
1602
1603 int _fpu_stack_size; // for sin/cos implementation on Intel
1604
1605 protected:
1606 LIR_Opr _opr1;
1607 LIR_Opr _opr2;
1608 BasicType _type;
1609 LIR_Opr _tmp1;
1610 LIR_Opr _tmp2;
1611 LIR_Opr _tmp3;
1612 LIR_Opr _tmp4;
2241 void load_stack_address_monitor(int monitor_ix, LIR_Opr dst) { append(new LIR_Op1(lir_monaddr, LIR_OprFact::intConst(monitor_ix), dst)); }
2242 void unlock_object(LIR_Opr hdr, LIR_Opr obj, LIR_Opr lock, LIR_Opr scratch, CodeStub* stub);
2243 void lock_object(LIR_Opr hdr, LIR_Opr obj, LIR_Opr lock, LIR_Opr scratch, CodeStub* stub, CodeEmitInfo* info);
2244
2245 void set_24bit_fpu() { append(new LIR_Op0(lir_24bit_FPU )); }
2246 void restore_fpu() { append(new LIR_Op0(lir_reset_FPU )); }
2247 void breakpoint() { append(new LIR_Op0(lir_breakpoint)); }
2248
2249 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)); }
2250
2251 void update_crc32(LIR_Opr crc, LIR_Opr val, LIR_Opr res) { append(new LIR_OpUpdateCRC32(crc, val, res)); }
2252
2253 void fpop_raw() { append(new LIR_Op0(lir_fpop_raw)); }
2254
2255 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);
2256 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);
2257
2258 void checkcast (LIR_Opr result, LIR_Opr object, ciKlass* klass,
2259 LIR_Opr tmp1, LIR_Opr tmp2, LIR_Opr tmp3, bool fast_check,
2260 CodeEmitInfo* info_for_exception, CodeEmitInfo* info_for_patch, CodeStub* stub,
2261 ciMethod* profiled_method, int profiled_bci, bool is_never_null);
2262 // MethodData* profiling
2263 void profile_call(ciMethod* method, int bci, ciMethod* callee, LIR_Opr mdo, LIR_Opr recv, LIR_Opr t1, ciKlass* cha_klass) {
2264 append(new LIR_OpProfileCall(method, bci, callee, mdo, recv, t1, cha_klass));
2265 }
2266 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) {
2267 append(new LIR_OpProfileType(LIR_OprFact::address(mdp), obj, exact_klass, current_klass, tmp, not_null, no_conflict));
2268 }
2269
2270 void xadd(LIR_Opr src, LIR_Opr add, LIR_Opr res, LIR_Opr tmp) { append(new LIR_Op2(lir_xadd, src, add, res, tmp)); }
2271 void xchg(LIR_Opr src, LIR_Opr set, LIR_Opr res, LIR_Opr tmp) { append(new LIR_Op2(lir_xchg, src, set, res, tmp)); }
2272 #ifdef ASSERT
2273 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)); }
2274 #endif
2275 };
2276
2277 void print_LIR(BlockList* blocks);
2278
2279 class LIR_InsertionBuffer : public CompilationResourceObj {
2280 private:
2281 LIR_List* _lir; // the lir list where ops of this buffer should be inserted later (NULL when uninitialized)
|