< prev index next >

src/share/vm/c1/c1_LIR.hpp

Print this page




 859 //-------------------------------------------------------------------------------
 860 //                   LIR Instructions
 861 //-------------------------------------------------------------------------------
 862 //
 863 // Note:
 864 //  - every instruction has a result operand
 865 //  - every instruction has an CodeEmitInfo operand (can be revisited later)
 866 //  - every instruction has a LIR_OpCode operand
 867 //  - LIR_OpN, means an instruction that has N input operands
 868 //
 869 // class hierarchy:
 870 //
 871 class  LIR_Op;
 872 class    LIR_Op0;
 873 class      LIR_OpLabel;
 874 class    LIR_Op1;
 875 class      LIR_OpBranch;
 876 class      LIR_OpConvert;
 877 class      LIR_OpAllocObj;
 878 class      LIR_OpRoundFP;

 879 class    LIR_Op2;
 880 class    LIR_OpDelay;
 881 class    LIR_Op3;
 882 class      LIR_OpAllocArray;
 883 class    LIR_OpCall;
 884 class      LIR_OpJavaCall;
 885 class      LIR_OpRTCall;
 886 class    LIR_OpArrayCopy;
 887 class    LIR_OpUpdateCRC32;
 888 class    LIR_OpLock;
 889 class    LIR_OpTypeCheck;
 890 class    LIR_OpCompareAndSwap;
 891 class    LIR_OpProfileCall;
 892 class    LIR_OpProfileType;
 893 #ifdef ASSERT
 894 class    LIR_OpAssert;
 895 #endif
 896 
 897 // LIR operation codes
 898 enum LIR_Code {


 923       , lir_fxch
 924       , lir_fld
 925       , lir_ffree
 926       , lir_push
 927       , lir_pop
 928       , lir_null_check
 929       , lir_return
 930       , lir_leal
 931       , lir_neg
 932       , lir_branch
 933       , lir_cond_float_branch
 934       , lir_move
 935       , lir_convert
 936       , lir_alloc_object
 937       , lir_monaddr
 938       , lir_roundfp
 939       , lir_safepoint
 940       , lir_pack64
 941       , lir_unpack64
 942       , lir_unwind

 943   , end_op1
 944   , begin_op2
 945       , lir_cmp
 946       , lir_cmp_l2i
 947       , lir_ucmp_fd2i
 948       , lir_cmp_fd2i
 949       , lir_cmove
 950       , lir_add
 951       , lir_sub
 952       , lir_mul
 953       , lir_mul_strictfp
 954       , lir_div
 955       , lir_div_strictfp
 956       , lir_rem
 957       , lir_sqrt
 958       , lir_abs
 959       , lir_sin
 960       , lir_cos
 961       , lir_tan
 962       , lir_log


1137   virtual LIR_OpJavaCall* as_OpJavaCall() { return NULL; }
1138   virtual LIR_OpLabel* as_OpLabel() { return NULL; }
1139   virtual LIR_OpDelay* as_OpDelay() { return NULL; }
1140   virtual LIR_OpLock* as_OpLock() { return NULL; }
1141   virtual LIR_OpAllocArray* as_OpAllocArray() { return NULL; }
1142   virtual LIR_OpAllocObj* as_OpAllocObj() { return NULL; }
1143   virtual LIR_OpRoundFP* as_OpRoundFP() { return NULL; }
1144   virtual LIR_OpBranch* as_OpBranch() { return NULL; }
1145   virtual LIR_OpRTCall* as_OpRTCall() { return NULL; }
1146   virtual LIR_OpConvert* as_OpConvert() { return NULL; }
1147   virtual LIR_Op0* as_Op0() { return NULL; }
1148   virtual LIR_Op1* as_Op1() { return NULL; }
1149   virtual LIR_Op2* as_Op2() { return NULL; }
1150   virtual LIR_Op3* as_Op3() { return NULL; }
1151   virtual LIR_OpArrayCopy* as_OpArrayCopy() { return NULL; }
1152   virtual LIR_OpUpdateCRC32* as_OpUpdateCRC32() { return NULL; }
1153   virtual LIR_OpTypeCheck* as_OpTypeCheck() { return NULL; }
1154   virtual LIR_OpCompareAndSwap* as_OpCompareAndSwap() { return NULL; }
1155   virtual LIR_OpProfileCall* as_OpProfileCall() { return NULL; }
1156   virtual LIR_OpProfileType* as_OpProfileType() { return NULL; }

1157 #ifdef ASSERT
1158   virtual LIR_OpAssert* as_OpAssert() { return NULL; }
1159 #endif
1160 
1161   virtual void verify() const {}
1162 };
1163 
1164 // for calls
1165 class LIR_OpCall: public LIR_Op {
1166  friend class LIR_OpVisitState;
1167 
1168  protected:
1169   address      _addr;
1170   LIR_OprList* _arguments;
1171  protected:
1172   LIR_OpCall(LIR_Code code, address addr, LIR_Opr result,
1173              LIR_OprList* arguments, CodeEmitInfo* info = NULL)
1174     : LIR_Op(code, result, info)
1175     , _arguments(arguments)
1176     , _addr(addr) {}


1451 
1452   // for unordered comparisons
1453   LIR_OpBranch(LIR_Condition cond, BasicType type, BlockBegin* block, BlockBegin* ublock);
1454 
1455   LIR_Condition cond()        const              { return _cond;        }
1456   BasicType     type()        const              { return _type;        }
1457   Label*        label()       const              { return _label;       }
1458   BlockBegin*   block()       const              { return _block;       }
1459   BlockBegin*   ublock()      const              { return _ublock;      }
1460   CodeStub*     stub()        const              { return _stub;       }
1461 
1462   void          change_block(BlockBegin* b);
1463   void          change_ublock(BlockBegin* b);
1464   void          negate_cond();
1465 
1466   virtual void emit_code(LIR_Assembler* masm);
1467   virtual LIR_OpBranch* as_OpBranch() { return this; }
1468   virtual void print_instr(outputStream* out) const PRODUCT_RETURN;
1469 };
1470 



















1471 
1472 class ConversionStub;
1473 
1474 class LIR_OpConvert: public LIR_Op1 {
1475  friend class LIR_OpVisitState;
1476 
1477  private:
1478    Bytecodes::Code _bytecode;
1479    ConversionStub* _stub;
1480 #ifdef PPC
1481   LIR_Opr _tmp1;
1482   LIR_Opr _tmp2;
1483 #endif
1484 
1485  public:
1486    LIR_OpConvert(Bytecodes::Code code, LIR_Opr opr, LIR_Opr result, ConversionStub* stub)
1487      : LIR_Op1(lir_convert, opr, result)
1488      , _stub(stub)
1489 #ifdef PPC
1490      , _tmp1(LIR_OprDesc::illegalOpr())


2131     } else {
2132       move(src, dst, info);
2133     }
2134   }
2135   void volatile_move(LIR_Opr src, LIR_Opr dst, BasicType type, CodeEmitInfo* info = NULL, LIR_PatchCode patch_code = lir_patch_none) { append(new LIR_Op1(lir_move, src, dst, type, patch_code, info, lir_move_volatile)); }
2136 
2137   void oop2reg  (jobject o, LIR_Opr reg)         { assert(reg->type() == T_OBJECT, "bad reg"); append(new LIR_Op1(lir_move, LIR_OprFact::oopConst(o),    reg));   }
2138   void oop2reg_patch(jobject o, LIR_Opr reg, CodeEmitInfo* info);
2139 
2140   void metadata2reg  (Metadata* o, LIR_Opr reg)  { assert(reg->type() == T_METADATA, "bad reg"); append(new LIR_Op1(lir_move, LIR_OprFact::metadataConst(o), reg));   }
2141   void klass2reg_patch(Metadata* o, LIR_Opr reg, CodeEmitInfo* info);
2142 
2143   void return_op(LIR_Opr result)                 { append(new LIR_Op1(lir_return, result)); }
2144 
2145   void safepoint(LIR_Opr tmp, CodeEmitInfo* info)  { append(new LIR_Op1(lir_safepoint, tmp, info)); }
2146 
2147 #ifdef PPC
2148   void convert(Bytecodes::Code code, LIR_Opr left, LIR_Opr dst, LIR_Opr tmp1, LIR_Opr tmp2) { append(new LIR_OpConvert(code, left, dst, NULL, tmp1, tmp2)); }
2149 #endif
2150   void convert(Bytecodes::Code code, LIR_Opr left, LIR_Opr dst, ConversionStub* stub = NULL/*, bool is_32bit = false*/) { append(new LIR_OpConvert(code, left, dst, stub)); }


2151 
2152   void logical_and (LIR_Opr left, LIR_Opr right, LIR_Opr dst) { append(new LIR_Op2(lir_logic_and,  left, right, dst)); }
2153   void logical_or  (LIR_Opr left, LIR_Opr right, LIR_Opr dst) { append(new LIR_Op2(lir_logic_or,   left, right, dst)); }
2154   void logical_xor (LIR_Opr left, LIR_Opr right, LIR_Opr dst) { append(new LIR_Op2(lir_logic_xor,  left, right, dst)); }
2155 
2156   void   pack64(LIR_Opr src, LIR_Opr dst) { append(new LIR_Op1(lir_pack64,   src, dst, T_LONG, lir_patch_none, NULL)); }
2157   void unpack64(LIR_Opr src, LIR_Opr dst) { append(new LIR_Op1(lir_unpack64, src, dst, T_LONG, lir_patch_none, NULL)); }
2158 
2159   void null_check(LIR_Opr opr, CodeEmitInfo* info)         { append(new LIR_Op1(lir_null_check, opr, info)); }
2160   void throw_exception(LIR_Opr exceptionPC, LIR_Opr exceptionOop, CodeEmitInfo* info) {
2161     append(new LIR_Op2(lir_throw, exceptionPC, exceptionOop, LIR_OprFact::illegalOpr, info));
2162   }
2163   void unwind_exception(LIR_Opr exceptionOop) {
2164     append(new LIR_Op1(lir_unwind, exceptionOop));
2165   }
2166 
2167   void compare_to (LIR_Opr left, LIR_Opr right, LIR_Opr dst) {
2168     append(new LIR_Op2(lir_compare_to,  left, right, dst));
2169   }
2170 




 859 //-------------------------------------------------------------------------------
 860 //                   LIR Instructions
 861 //-------------------------------------------------------------------------------
 862 //
 863 // Note:
 864 //  - every instruction has a result operand
 865 //  - every instruction has an CodeEmitInfo operand (can be revisited later)
 866 //  - every instruction has a LIR_OpCode operand
 867 //  - LIR_OpN, means an instruction that has N input operands
 868 //
 869 // class hierarchy:
 870 //
 871 class  LIR_Op;
 872 class    LIR_Op0;
 873 class      LIR_OpLabel;
 874 class    LIR_Op1;
 875 class      LIR_OpBranch;
 876 class      LIR_OpConvert;
 877 class      LIR_OpAllocObj;
 878 class      LIR_OpRoundFP;
 879 class      LIR_OpShenandoahWriteBarrier;
 880 class    LIR_Op2;
 881 class    LIR_OpDelay;
 882 class    LIR_Op3;
 883 class      LIR_OpAllocArray;
 884 class    LIR_OpCall;
 885 class      LIR_OpJavaCall;
 886 class      LIR_OpRTCall;
 887 class    LIR_OpArrayCopy;
 888 class    LIR_OpUpdateCRC32;
 889 class    LIR_OpLock;
 890 class    LIR_OpTypeCheck;
 891 class    LIR_OpCompareAndSwap;
 892 class    LIR_OpProfileCall;
 893 class    LIR_OpProfileType;
 894 #ifdef ASSERT
 895 class    LIR_OpAssert;
 896 #endif
 897 
 898 // LIR operation codes
 899 enum LIR_Code {


 924       , lir_fxch
 925       , lir_fld
 926       , lir_ffree
 927       , lir_push
 928       , lir_pop
 929       , lir_null_check
 930       , lir_return
 931       , lir_leal
 932       , lir_neg
 933       , lir_branch
 934       , lir_cond_float_branch
 935       , lir_move
 936       , lir_convert
 937       , lir_alloc_object
 938       , lir_monaddr
 939       , lir_roundfp
 940       , lir_safepoint
 941       , lir_pack64
 942       , lir_unpack64
 943       , lir_unwind
 944       , lir_shenandoah_wb
 945   , end_op1
 946   , begin_op2
 947       , lir_cmp
 948       , lir_cmp_l2i
 949       , lir_ucmp_fd2i
 950       , lir_cmp_fd2i
 951       , lir_cmove
 952       , lir_add
 953       , lir_sub
 954       , lir_mul
 955       , lir_mul_strictfp
 956       , lir_div
 957       , lir_div_strictfp
 958       , lir_rem
 959       , lir_sqrt
 960       , lir_abs
 961       , lir_sin
 962       , lir_cos
 963       , lir_tan
 964       , lir_log


1139   virtual LIR_OpJavaCall* as_OpJavaCall() { return NULL; }
1140   virtual LIR_OpLabel* as_OpLabel() { return NULL; }
1141   virtual LIR_OpDelay* as_OpDelay() { return NULL; }
1142   virtual LIR_OpLock* as_OpLock() { return NULL; }
1143   virtual LIR_OpAllocArray* as_OpAllocArray() { return NULL; }
1144   virtual LIR_OpAllocObj* as_OpAllocObj() { return NULL; }
1145   virtual LIR_OpRoundFP* as_OpRoundFP() { return NULL; }
1146   virtual LIR_OpBranch* as_OpBranch() { return NULL; }
1147   virtual LIR_OpRTCall* as_OpRTCall() { return NULL; }
1148   virtual LIR_OpConvert* as_OpConvert() { return NULL; }
1149   virtual LIR_Op0* as_Op0() { return NULL; }
1150   virtual LIR_Op1* as_Op1() { return NULL; }
1151   virtual LIR_Op2* as_Op2() { return NULL; }
1152   virtual LIR_Op3* as_Op3() { return NULL; }
1153   virtual LIR_OpArrayCopy* as_OpArrayCopy() { return NULL; }
1154   virtual LIR_OpUpdateCRC32* as_OpUpdateCRC32() { return NULL; }
1155   virtual LIR_OpTypeCheck* as_OpTypeCheck() { return NULL; }
1156   virtual LIR_OpCompareAndSwap* as_OpCompareAndSwap() { return NULL; }
1157   virtual LIR_OpProfileCall* as_OpProfileCall() { return NULL; }
1158   virtual LIR_OpProfileType* as_OpProfileType() { return NULL; }
1159   virtual LIR_OpShenandoahWriteBarrier* as_OpShenandoahWriteBarrier() { return NULL; }
1160 #ifdef ASSERT
1161   virtual LIR_OpAssert* as_OpAssert() { return NULL; }
1162 #endif
1163 
1164   virtual void verify() const {}
1165 };
1166 
1167 // for calls
1168 class LIR_OpCall: public LIR_Op {
1169  friend class LIR_OpVisitState;
1170 
1171  protected:
1172   address      _addr;
1173   LIR_OprList* _arguments;
1174  protected:
1175   LIR_OpCall(LIR_Code code, address addr, LIR_Opr result,
1176              LIR_OprList* arguments, CodeEmitInfo* info = NULL)
1177     : LIR_Op(code, result, info)
1178     , _arguments(arguments)
1179     , _addr(addr) {}


1454 
1455   // for unordered comparisons
1456   LIR_OpBranch(LIR_Condition cond, BasicType type, BlockBegin* block, BlockBegin* ublock);
1457 
1458   LIR_Condition cond()        const              { return _cond;        }
1459   BasicType     type()        const              { return _type;        }
1460   Label*        label()       const              { return _label;       }
1461   BlockBegin*   block()       const              { return _block;       }
1462   BlockBegin*   ublock()      const              { return _ublock;      }
1463   CodeStub*     stub()        const              { return _stub;       }
1464 
1465   void          change_block(BlockBegin* b);
1466   void          change_ublock(BlockBegin* b);
1467   void          negate_cond();
1468 
1469   virtual void emit_code(LIR_Assembler* masm);
1470   virtual LIR_OpBranch* as_OpBranch() { return this; }
1471   virtual void print_instr(outputStream* out) const PRODUCT_RETURN;
1472 };
1473 
1474 class LIR_OpShenandoahWriteBarrier : public LIR_Op1 {
1475  friend class LIR_OpVisitState;
1476 
1477 private:
1478   bool _need_null_check;
1479   LIR_Opr _tmp1;
1480   LIR_Opr _tmp2;
1481 
1482 public:
1483   LIR_OpShenandoahWriteBarrier(LIR_Opr obj, LIR_Opr result, LIR_Opr tmp1, LIR_Opr tmp2, CodeEmitInfo* info, bool need_null_check) : LIR_Op1(lir_shenandoah_wb, obj, result, T_OBJECT, lir_patch_none, info), _tmp1(tmp1), _tmp2(tmp2), _need_null_check(need_null_check) {
1484   }
1485   LIR_Opr tmp1_opr() const { return _tmp1; }
1486   LIR_Opr tmp2_opr() const { return _tmp2; }
1487   bool need_null_check() const { return _need_null_check; }
1488   virtual void emit_code(LIR_Assembler* masm);
1489   virtual LIR_OpShenandoahWriteBarrier* as_OpShenandoahWriteBarrier() { return this; }
1490   virtual void print_instr(outputStream* out) const PRODUCT_RETURN;
1491 
1492 };
1493 
1494 class ConversionStub;
1495 
1496 class LIR_OpConvert: public LIR_Op1 {
1497  friend class LIR_OpVisitState;
1498 
1499  private:
1500    Bytecodes::Code _bytecode;
1501    ConversionStub* _stub;
1502 #ifdef PPC
1503   LIR_Opr _tmp1;
1504   LIR_Opr _tmp2;
1505 #endif
1506 
1507  public:
1508    LIR_OpConvert(Bytecodes::Code code, LIR_Opr opr, LIR_Opr result, ConversionStub* stub)
1509      : LIR_Op1(lir_convert, opr, result)
1510      , _stub(stub)
1511 #ifdef PPC
1512      , _tmp1(LIR_OprDesc::illegalOpr())


2153     } else {
2154       move(src, dst, info);
2155     }
2156   }
2157   void volatile_move(LIR_Opr src, LIR_Opr dst, BasicType type, CodeEmitInfo* info = NULL, LIR_PatchCode patch_code = lir_patch_none) { append(new LIR_Op1(lir_move, src, dst, type, patch_code, info, lir_move_volatile)); }
2158 
2159   void oop2reg  (jobject o, LIR_Opr reg)         { assert(reg->type() == T_OBJECT, "bad reg"); append(new LIR_Op1(lir_move, LIR_OprFact::oopConst(o),    reg));   }
2160   void oop2reg_patch(jobject o, LIR_Opr reg, CodeEmitInfo* info);
2161 
2162   void metadata2reg  (Metadata* o, LIR_Opr reg)  { assert(reg->type() == T_METADATA, "bad reg"); append(new LIR_Op1(lir_move, LIR_OprFact::metadataConst(o), reg));   }
2163   void klass2reg_patch(Metadata* o, LIR_Opr reg, CodeEmitInfo* info);
2164 
2165   void return_op(LIR_Opr result)                 { append(new LIR_Op1(lir_return, result)); }
2166 
2167   void safepoint(LIR_Opr tmp, CodeEmitInfo* info)  { append(new LIR_Op1(lir_safepoint, tmp, info)); }
2168 
2169 #ifdef PPC
2170   void convert(Bytecodes::Code code, LIR_Opr left, LIR_Opr dst, LIR_Opr tmp1, LIR_Opr tmp2) { append(new LIR_OpConvert(code, left, dst, NULL, tmp1, tmp2)); }
2171 #endif
2172   void convert(Bytecodes::Code code, LIR_Opr left, LIR_Opr dst, ConversionStub* stub = NULL/*, bool is_32bit = false*/) { append(new LIR_OpConvert(code, left, dst, stub)); }
2173 
2174   void shenandoah_wb(LIR_Opr obj, LIR_Opr result, LIR_Opr tmp1, LIR_Opr tmp2, CodeEmitInfo* info, bool need_null_check) { append(new LIR_OpShenandoahWriteBarrier(obj, result, tmp1, tmp2, info, need_null_check)); }
2175 
2176   void logical_and (LIR_Opr left, LIR_Opr right, LIR_Opr dst) { append(new LIR_Op2(lir_logic_and,  left, right, dst)); }
2177   void logical_or  (LIR_Opr left, LIR_Opr right, LIR_Opr dst) { append(new LIR_Op2(lir_logic_or,   left, right, dst)); }
2178   void logical_xor (LIR_Opr left, LIR_Opr right, LIR_Opr dst) { append(new LIR_Op2(lir_logic_xor,  left, right, dst)); }
2179 
2180   void   pack64(LIR_Opr src, LIR_Opr dst) { append(new LIR_Op1(lir_pack64,   src, dst, T_LONG, lir_patch_none, NULL)); }
2181   void unpack64(LIR_Opr src, LIR_Opr dst) { append(new LIR_Op1(lir_unpack64, src, dst, T_LONG, lir_patch_none, NULL)); }
2182 
2183   void null_check(LIR_Opr opr, CodeEmitInfo* info)         { append(new LIR_Op1(lir_null_check, opr, info)); }
2184   void throw_exception(LIR_Opr exceptionPC, LIR_Opr exceptionOop, CodeEmitInfo* info) {
2185     append(new LIR_Op2(lir_throw, exceptionPC, exceptionOop, LIR_OprFact::illegalOpr, info));
2186   }
2187   void unwind_exception(LIR_Opr exceptionOop) {
2188     append(new LIR_Op1(lir_unwind, exceptionOop));
2189   }
2190 
2191   void compare_to (LIR_Opr left, LIR_Opr right, LIR_Opr dst) {
2192     append(new LIR_Op2(lir_compare_to,  left, right, dst));
2193   }
2194 


< prev index next >