< prev index next >

src/hotspot/share/c1/c1_LIR.hpp

Print this page

 860 class    LIR_Op0;
 861 class      LIR_OpLabel;
 862 class    LIR_Op1;
 863 class      LIR_OpBranch;
 864 class      LIR_OpConvert;
 865 class      LIR_OpAllocObj;
 866 class      LIR_OpReturn;
 867 class      LIR_OpRoundFP;
 868 class    LIR_Op2;
 869 class    LIR_OpDelay;
 870 class    LIR_Op3;
 871 class      LIR_OpAllocArray;
 872 class    LIR_OpCall;
 873 class      LIR_OpJavaCall;
 874 class      LIR_OpRTCall;
 875 class    LIR_OpArrayCopy;
 876 class    LIR_OpUpdateCRC32;
 877 class    LIR_OpLock;
 878 class    LIR_OpTypeCheck;
 879 class    LIR_OpCompareAndSwap;

 880 class    LIR_OpProfileCall;
 881 class    LIR_OpProfileType;
 882 #ifdef ASSERT
 883 class    LIR_OpAssert;
 884 #endif
 885 
 886 // LIR operation codes
 887 enum LIR_Code {
 888     lir_none
 889   , begin_op0
 890       , lir_label
 891       , lir_nop
 892       , lir_backwardbranch_target
 893       , lir_std_entry
 894       , lir_osr_entry
 895       , lir_fpop_raw
 896       , lir_breakpoint
 897       , lir_rtcall
 898       , lir_membar
 899       , lir_membar_acquire

 905       , lir_get_thread
 906       , lir_on_spin_wait
 907   , end_op0
 908   , begin_op1
 909       , lir_fxch
 910       , lir_fld
 911       , lir_push
 912       , lir_pop
 913       , lir_null_check
 914       , lir_return
 915       , lir_leal
 916       , lir_branch
 917       , lir_cond_float_branch
 918       , lir_move
 919       , lir_convert
 920       , lir_alloc_object
 921       , lir_monaddr
 922       , lir_roundfp
 923       , lir_safepoint
 924       , lir_unwind

 925   , end_op1
 926   , begin_op2
 927       , lir_cmp
 928       , lir_cmp_l2i
 929       , lir_ucmp_fd2i
 930       , lir_cmp_fd2i
 931       , lir_cmove
 932       , lir_add
 933       , lir_sub
 934       , lir_mul
 935       , lir_div
 936       , lir_rem
 937       , lir_sqrt
 938       , lir_abs
 939       , lir_neg
 940       , lir_tan
 941       , lir_log10
 942       , lir_logic_and
 943       , lir_logic_or
 944       , lir_logic_xor

1115   virtual LIR_OpCall* as_OpCall() { return NULL; }
1116   virtual LIR_OpJavaCall* as_OpJavaCall() { return NULL; }
1117   virtual LIR_OpLabel* as_OpLabel() { return NULL; }
1118   virtual LIR_OpDelay* as_OpDelay() { return NULL; }
1119   virtual LIR_OpLock* as_OpLock() { return NULL; }
1120   virtual LIR_OpAllocArray* as_OpAllocArray() { return NULL; }
1121   virtual LIR_OpAllocObj* as_OpAllocObj() { return NULL; }
1122   virtual LIR_OpRoundFP* as_OpRoundFP() { return NULL; }
1123   virtual LIR_OpBranch* as_OpBranch() { return NULL; }
1124   virtual LIR_OpReturn* as_OpReturn() { return NULL; }
1125   virtual LIR_OpRTCall* as_OpRTCall() { return NULL; }
1126   virtual LIR_OpConvert* as_OpConvert() { return NULL; }
1127   virtual LIR_Op0* as_Op0() { return NULL; }
1128   virtual LIR_Op1* as_Op1() { return NULL; }
1129   virtual LIR_Op2* as_Op2() { return NULL; }
1130   virtual LIR_Op3* as_Op3() { return NULL; }
1131   virtual LIR_OpArrayCopy* as_OpArrayCopy() { return NULL; }
1132   virtual LIR_OpUpdateCRC32* as_OpUpdateCRC32() { return NULL; }
1133   virtual LIR_OpTypeCheck* as_OpTypeCheck() { return NULL; }
1134   virtual LIR_OpCompareAndSwap* as_OpCompareAndSwap() { return NULL; }

1135   virtual LIR_OpProfileCall* as_OpProfileCall() { return NULL; }
1136   virtual LIR_OpProfileType* as_OpProfileType() { return NULL; }
1137 #ifdef ASSERT
1138   virtual LIR_OpAssert* as_OpAssert() { return NULL; }
1139 #endif
1140 
1141   virtual void verify() const {}
1142 };
1143 
1144 // for calls
1145 class LIR_OpCall: public LIR_Op {
1146  friend class LIR_OpVisitState;
1147 
1148  protected:
1149   address      _addr;
1150   LIR_OprList* _arguments;
1151  protected:
1152   LIR_OpCall(LIR_Code code, address addr, LIR_Opr result,
1153              LIR_OprList* arguments, CodeEmitInfo* info = NULL)
1154     : LIR_Op(code, result, info)

1787  public:
1788   LIR_OpLock(LIR_Code code, LIR_Opr hdr, LIR_Opr obj, LIR_Opr lock, LIR_Opr scratch, CodeStub* stub, CodeEmitInfo* info)
1789     : LIR_Op(code, LIR_OprFact::illegalOpr, info)
1790     , _hdr(hdr)
1791     , _obj(obj)
1792     , _lock(lock)
1793     , _scratch(scratch)
1794     , _stub(stub)                      {}
1795 
1796   LIR_Opr hdr_opr() const                        { return _hdr; }
1797   LIR_Opr obj_opr() const                        { return _obj; }
1798   LIR_Opr lock_opr() const                       { return _lock; }
1799   LIR_Opr scratch_opr() const                    { return _scratch; }
1800   CodeStub* stub() const                         { return _stub; }
1801 
1802   virtual void emit_code(LIR_Assembler* masm);
1803   virtual LIR_OpLock* as_OpLock() { return this; }
1804   void print_instr(outputStream* out) const PRODUCT_RETURN;
1805 };
1806 



















1807 
1808 class LIR_OpDelay: public LIR_Op {
1809  friend class LIR_OpVisitState;
1810 
1811  private:
1812   LIR_Op* _op;
1813 
1814  public:
1815   LIR_OpDelay(LIR_Op* op, CodeEmitInfo* info):
1816     LIR_Op(lir_delay_slot, LIR_OprFact::illegalOpr, info),
1817     _op(op) {
1818     assert(op->code() == lir_nop, "should be filling with nops");
1819   }
1820   virtual void emit_code(LIR_Assembler* masm);
1821   virtual LIR_OpDelay* as_OpDelay() { return this; }
1822   void print_instr(outputStream* out) const PRODUCT_RETURN;
1823   LIR_Op* delay_op() const { return _op; }
1824   CodeEmitInfo* call_info() const { return info(); }
1825 };
1826 

2232 
2233   void update_crc32(LIR_Opr crc, LIR_Opr val, LIR_Opr res)  { append(new LIR_OpUpdateCRC32(crc, val, res)); }
2234 
2235   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);
2236   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);
2237 
2238   void checkcast (LIR_Opr result, LIR_Opr object, ciKlass* klass,
2239                   LIR_Opr tmp1, LIR_Opr tmp2, LIR_Opr tmp3, bool fast_check,
2240                   CodeEmitInfo* info_for_exception, CodeEmitInfo* info_for_patch, CodeStub* stub,
2241                   ciMethod* profiled_method, int profiled_bci);
2242   // MethodData* profiling
2243   void profile_call(ciMethod* method, int bci, ciMethod* callee, LIR_Opr mdo, LIR_Opr recv, LIR_Opr t1, ciKlass* cha_klass) {
2244     append(new LIR_OpProfileCall(method, bci, callee, mdo, recv, t1, cha_klass));
2245   }
2246   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) {
2247     append(new LIR_OpProfileType(LIR_OprFact::address(mdp), obj, exact_klass, current_klass, tmp, not_null, no_conflict));
2248   }
2249 
2250   void xadd(LIR_Opr src, LIR_Opr add, LIR_Opr res, LIR_Opr tmp) { append(new LIR_Op2(lir_xadd, src, add, res, tmp)); }
2251   void xchg(LIR_Opr src, LIR_Opr set, LIR_Opr res, LIR_Opr tmp) { append(new LIR_Op2(lir_xchg, src, set, res, tmp)); }



2252 #ifdef ASSERT
2253   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)); }
2254 #endif
2255 };
2256 
2257 void print_LIR(BlockList* blocks);
2258 
2259 class LIR_InsertionBuffer : public CompilationResourceObj {
2260  private:
2261   LIR_List*   _lir;   // the lir list where ops of this buffer should be inserted later (NULL when uninitialized)
2262 
2263   // list of insertion points. index and count are stored alternately:
2264   // _index_and_count[i * 2]:     the index into lir list where "count" ops should be inserted
2265   // _index_and_count[i * 2 + 1]: the number of ops to be inserted at index
2266   intStack    _index_and_count;
2267 
2268   // the LIR_Ops to be inserted
2269   LIR_OpList  _ops;
2270 
2271   void append_new(int index, int count)  { _index_and_count.append(index); _index_and_count.append(count); }

 860 class    LIR_Op0;
 861 class      LIR_OpLabel;
 862 class    LIR_Op1;
 863 class      LIR_OpBranch;
 864 class      LIR_OpConvert;
 865 class      LIR_OpAllocObj;
 866 class      LIR_OpReturn;
 867 class      LIR_OpRoundFP;
 868 class    LIR_Op2;
 869 class    LIR_OpDelay;
 870 class    LIR_Op3;
 871 class      LIR_OpAllocArray;
 872 class    LIR_OpCall;
 873 class      LIR_OpJavaCall;
 874 class      LIR_OpRTCall;
 875 class    LIR_OpArrayCopy;
 876 class    LIR_OpUpdateCRC32;
 877 class    LIR_OpLock;
 878 class    LIR_OpTypeCheck;
 879 class    LIR_OpCompareAndSwap;
 880 class    LIR_OpLoadKlass;
 881 class    LIR_OpProfileCall;
 882 class    LIR_OpProfileType;
 883 #ifdef ASSERT
 884 class    LIR_OpAssert;
 885 #endif
 886 
 887 // LIR operation codes
 888 enum LIR_Code {
 889     lir_none
 890   , begin_op0
 891       , lir_label
 892       , lir_nop
 893       , lir_backwardbranch_target
 894       , lir_std_entry
 895       , lir_osr_entry
 896       , lir_fpop_raw
 897       , lir_breakpoint
 898       , lir_rtcall
 899       , lir_membar
 900       , lir_membar_acquire

 906       , lir_get_thread
 907       , lir_on_spin_wait
 908   , end_op0
 909   , begin_op1
 910       , lir_fxch
 911       , lir_fld
 912       , lir_push
 913       , lir_pop
 914       , lir_null_check
 915       , lir_return
 916       , lir_leal
 917       , lir_branch
 918       , lir_cond_float_branch
 919       , lir_move
 920       , lir_convert
 921       , lir_alloc_object
 922       , lir_monaddr
 923       , lir_roundfp
 924       , lir_safepoint
 925       , lir_unwind
 926       , lir_load_klass
 927   , end_op1
 928   , begin_op2
 929       , lir_cmp
 930       , lir_cmp_l2i
 931       , lir_ucmp_fd2i
 932       , lir_cmp_fd2i
 933       , lir_cmove
 934       , lir_add
 935       , lir_sub
 936       , lir_mul
 937       , lir_div
 938       , lir_rem
 939       , lir_sqrt
 940       , lir_abs
 941       , lir_neg
 942       , lir_tan
 943       , lir_log10
 944       , lir_logic_and
 945       , lir_logic_or
 946       , lir_logic_xor

1117   virtual LIR_OpCall* as_OpCall() { return NULL; }
1118   virtual LIR_OpJavaCall* as_OpJavaCall() { return NULL; }
1119   virtual LIR_OpLabel* as_OpLabel() { return NULL; }
1120   virtual LIR_OpDelay* as_OpDelay() { return NULL; }
1121   virtual LIR_OpLock* as_OpLock() { return NULL; }
1122   virtual LIR_OpAllocArray* as_OpAllocArray() { return NULL; }
1123   virtual LIR_OpAllocObj* as_OpAllocObj() { return NULL; }
1124   virtual LIR_OpRoundFP* as_OpRoundFP() { return NULL; }
1125   virtual LIR_OpBranch* as_OpBranch() { return NULL; }
1126   virtual LIR_OpReturn* as_OpReturn() { return NULL; }
1127   virtual LIR_OpRTCall* as_OpRTCall() { return NULL; }
1128   virtual LIR_OpConvert* as_OpConvert() { return NULL; }
1129   virtual LIR_Op0* as_Op0() { return NULL; }
1130   virtual LIR_Op1* as_Op1() { return NULL; }
1131   virtual LIR_Op2* as_Op2() { return NULL; }
1132   virtual LIR_Op3* as_Op3() { return NULL; }
1133   virtual LIR_OpArrayCopy* as_OpArrayCopy() { return NULL; }
1134   virtual LIR_OpUpdateCRC32* as_OpUpdateCRC32() { return NULL; }
1135   virtual LIR_OpTypeCheck* as_OpTypeCheck() { return NULL; }
1136   virtual LIR_OpCompareAndSwap* as_OpCompareAndSwap() { return NULL; }
1137   virtual LIR_OpLoadKlass* as_OpLoadKlass() { return NULL; }
1138   virtual LIR_OpProfileCall* as_OpProfileCall() { return NULL; }
1139   virtual LIR_OpProfileType* as_OpProfileType() { return NULL; }
1140 #ifdef ASSERT
1141   virtual LIR_OpAssert* as_OpAssert() { return NULL; }
1142 #endif
1143 
1144   virtual void verify() const {}
1145 };
1146 
1147 // for calls
1148 class LIR_OpCall: public LIR_Op {
1149  friend class LIR_OpVisitState;
1150 
1151  protected:
1152   address      _addr;
1153   LIR_OprList* _arguments;
1154  protected:
1155   LIR_OpCall(LIR_Code code, address addr, LIR_Opr result,
1156              LIR_OprList* arguments, CodeEmitInfo* info = NULL)
1157     : LIR_Op(code, result, info)

1790  public:
1791   LIR_OpLock(LIR_Code code, LIR_Opr hdr, LIR_Opr obj, LIR_Opr lock, LIR_Opr scratch, CodeStub* stub, CodeEmitInfo* info)
1792     : LIR_Op(code, LIR_OprFact::illegalOpr, info)
1793     , _hdr(hdr)
1794     , _obj(obj)
1795     , _lock(lock)
1796     , _scratch(scratch)
1797     , _stub(stub)                      {}
1798 
1799   LIR_Opr hdr_opr() const                        { return _hdr; }
1800   LIR_Opr obj_opr() const                        { return _obj; }
1801   LIR_Opr lock_opr() const                       { return _lock; }
1802   LIR_Opr scratch_opr() const                    { return _scratch; }
1803   CodeStub* stub() const                         { return _stub; }
1804 
1805   virtual void emit_code(LIR_Assembler* masm);
1806   virtual LIR_OpLock* as_OpLock() { return this; }
1807   void print_instr(outputStream* out) const PRODUCT_RETURN;
1808 };
1809 
1810 class LIR_OpLoadKlass: public LIR_Op {
1811   friend class LIR_OpVisitState;
1812 
1813  private:
1814   LIR_Opr _obj;
1815   CodeStub* _stub;
1816  public:
1817   LIR_OpLoadKlass(LIR_Opr obj, LIR_Opr result, CodeEmitInfo* info, CodeStub* stub)
1818     : LIR_Op(lir_load_klass, result, info)
1819     , _obj(obj)
1820     , _stub(stub) {}
1821 
1822   LIR_Opr obj()    const { return _obj;  }
1823   CodeStub* stub() const { return _stub; }
1824 
1825   virtual LIR_OpLoadKlass* as_OpLoadKlass() { return this; }
1826   virtual void emit_code(LIR_Assembler* masm);
1827   void print_instr(outputStream* out) const PRODUCT_RETURN;
1828 };
1829 
1830 class LIR_OpDelay: public LIR_Op {
1831  friend class LIR_OpVisitState;
1832 
1833  private:
1834   LIR_Op* _op;
1835 
1836  public:
1837   LIR_OpDelay(LIR_Op* op, CodeEmitInfo* info):
1838     LIR_Op(lir_delay_slot, LIR_OprFact::illegalOpr, info),
1839     _op(op) {
1840     assert(op->code() == lir_nop, "should be filling with nops");
1841   }
1842   virtual void emit_code(LIR_Assembler* masm);
1843   virtual LIR_OpDelay* as_OpDelay() { return this; }
1844   void print_instr(outputStream* out) const PRODUCT_RETURN;
1845   LIR_Op* delay_op() const { return _op; }
1846   CodeEmitInfo* call_info() const { return info(); }
1847 };
1848 

2254 
2255   void update_crc32(LIR_Opr crc, LIR_Opr val, LIR_Opr res)  { append(new LIR_OpUpdateCRC32(crc, val, res)); }
2256 
2257   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);
2258   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);
2259 
2260   void checkcast (LIR_Opr result, LIR_Opr object, ciKlass* klass,
2261                   LIR_Opr tmp1, LIR_Opr tmp2, LIR_Opr tmp3, bool fast_check,
2262                   CodeEmitInfo* info_for_exception, CodeEmitInfo* info_for_patch, CodeStub* stub,
2263                   ciMethod* profiled_method, int profiled_bci);
2264   // MethodData* profiling
2265   void profile_call(ciMethod* method, int bci, ciMethod* callee, LIR_Opr mdo, LIR_Opr recv, LIR_Opr t1, ciKlass* cha_klass) {
2266     append(new LIR_OpProfileCall(method, bci, callee, mdo, recv, t1, cha_klass));
2267   }
2268   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) {
2269     append(new LIR_OpProfileType(LIR_OprFact::address(mdp), obj, exact_klass, current_klass, tmp, not_null, no_conflict));
2270   }
2271 
2272   void xadd(LIR_Opr src, LIR_Opr add, LIR_Opr res, LIR_Opr tmp) { append(new LIR_Op2(lir_xadd, src, add, res, tmp)); }
2273   void xchg(LIR_Opr src, LIR_Opr set, LIR_Opr res, LIR_Opr tmp) { append(new LIR_Op2(lir_xchg, src, set, res, tmp)); }
2274 
2275   void load_klass(LIR_Opr obj, LIR_Opr result, CodeEmitInfo* info, CodeStub* stub) { append(new LIR_OpLoadKlass(obj, result, info, stub)); }
2276 
2277 #ifdef ASSERT
2278   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)); }
2279 #endif
2280 };
2281 
2282 void print_LIR(BlockList* blocks);
2283 
2284 class LIR_InsertionBuffer : public CompilationResourceObj {
2285  private:
2286   LIR_List*   _lir;   // the lir list where ops of this buffer should be inserted later (NULL when uninitialized)
2287 
2288   // list of insertion points. index and count are stored alternately:
2289   // _index_and_count[i * 2]:     the index into lir list where "count" ops should be inserted
2290   // _index_and_count[i * 2 + 1]: the number of ops to be inserted at index
2291   intStack    _index_and_count;
2292 
2293   // the LIR_Ops to be inserted
2294   LIR_OpList  _ops;
2295 
2296   void append_new(int index, int count)  { _index_and_count.append(index); _index_and_count.append(count); }
< prev index next >