< prev index next >

src/hotspot/share/c1/c1_LIR.hpp

Print this page




 299   friend BasicType as_BasicType(OprType t);
 300 
 301   OprType type_field_valid() const               { assert(is_register() || is_stack(), "should not be called otherwise"); return (OprType)(value() & type_mask); }
 302   OprType type_field() const                     { return is_illegal() ? unknown_type : (OprType)(value() & type_mask); }
 303 
 304   static OprSize size_for(BasicType t) {
 305     switch (t) {
 306       case T_LONG:
 307       case T_DOUBLE:
 308         return double_size;
 309         break;
 310 
 311       case T_FLOAT:
 312       case T_BOOLEAN:
 313       case T_CHAR:
 314       case T_BYTE:
 315       case T_SHORT:
 316       case T_INT:
 317       case T_ADDRESS:
 318       case T_OBJECT:

 319       case T_ARRAY:
 320       case T_METADATA:
 321         return single_size;
 322         break;
 323 
 324       default:
 325         ShouldNotReachHere();
 326         return single_size;
 327       }
 328   }
 329 
 330 
 331   void validate_type() const PRODUCT_RETURN;
 332 
 333   BasicType type() const {
 334     if (is_pointer()) {
 335       return pointer()->type();
 336     }
 337     return as_BasicType(type_field());
 338   }


 449 #endif
 450 
 451   jint      as_jint()    const { return as_constant_ptr()->as_jint(); }
 452   jlong     as_jlong()   const { return as_constant_ptr()->as_jlong(); }
 453   jfloat    as_jfloat()  const { return as_constant_ptr()->as_jfloat(); }
 454   jdouble   as_jdouble() const { return as_constant_ptr()->as_jdouble(); }
 455   jobject   as_jobject() const { return as_constant_ptr()->as_jobject(); }
 456 
 457   void print() const PRODUCT_RETURN;
 458   void print(outputStream* out) const PRODUCT_RETURN;
 459 };
 460 
 461 
 462 inline LIR_OprDesc::OprType as_OprType(BasicType type) {
 463   switch (type) {
 464   case T_INT:      return LIR_OprDesc::int_type;
 465   case T_LONG:     return LIR_OprDesc::long_type;
 466   case T_FLOAT:    return LIR_OprDesc::float_type;
 467   case T_DOUBLE:   return LIR_OprDesc::double_type;
 468   case T_OBJECT:

 469   case T_ARRAY:    return LIR_OprDesc::object_type;
 470   case T_ADDRESS:  return LIR_OprDesc::address_type;
 471   case T_METADATA: return LIR_OprDesc::metadata_type;
 472   case T_ILLEGAL:  // fall through
 473   default: ShouldNotReachHere(); return LIR_OprDesc::unknown_type;
 474   }
 475 }
 476 
 477 inline BasicType as_BasicType(LIR_OprDesc::OprType t) {
 478   switch (t) {
 479   case LIR_OprDesc::int_type:     return T_INT;
 480   case LIR_OprDesc::long_type:    return T_LONG;
 481   case LIR_OprDesc::float_type:   return T_FLOAT;
 482   case LIR_OprDesc::double_type:  return T_DOUBLE;
 483   case LIR_OprDesc::object_type:  return T_OBJECT;
 484   case LIR_OprDesc::address_type: return T_ADDRESS;
 485   case LIR_OprDesc::metadata_type:return T_METADATA;
 486   case LIR_OprDesc::unknown_type: // fall through
 487   default: ShouldNotReachHere();  return T_ILLEGAL;
 488   }


 634     return (LIR_Opr)(intptr_t)((reg << LIR_OprDesc::reg1_shift) |
 635                                LIR_OprDesc::float_type          |
 636                                LIR_OprDesc::fpu_register        |
 637                                LIR_OprDesc::single_size         |
 638                                LIR_OprDesc::is_xmm_mask);
 639   }
 640   static LIR_Opr double_xmm(int reg) {
 641     return (LIR_Opr)(intptr_t)((reg << LIR_OprDesc::reg1_shift) |
 642                                (reg << LIR_OprDesc::reg2_shift) |
 643                                LIR_OprDesc::double_type         |
 644                                LIR_OprDesc::fpu_register        |
 645                                LIR_OprDesc::double_size         |
 646                                LIR_OprDesc::is_xmm_mask);
 647   }
 648 #endif // X86
 649 
 650   static LIR_Opr virtual_register(int index, BasicType type) {
 651     LIR_Opr res;
 652     switch (type) {
 653       case T_OBJECT: // fall through

 654       case T_ARRAY:
 655         res = (LIR_Opr)(intptr_t)((index << LIR_OprDesc::data_shift)  |
 656                                             LIR_OprDesc::object_type  |
 657                                             LIR_OprDesc::cpu_register |
 658                                             LIR_OprDesc::single_size  |
 659                                             LIR_OprDesc::virtual_mask);
 660         break;
 661 
 662       case T_METADATA:
 663         res = (LIR_Opr)(intptr_t)((index << LIR_OprDesc::data_shift)  |
 664                                             LIR_OprDesc::metadata_type|
 665                                             LIR_OprDesc::cpu_register |
 666                                             LIR_OprDesc::single_size  |
 667                                             LIR_OprDesc::virtual_mask);
 668         break;
 669 
 670       case T_INT:
 671         res = (LIR_Opr)(intptr_t)((index << LIR_OprDesc::data_shift) |
 672                                   LIR_OprDesc::int_type              |
 673                                   LIR_OprDesc::cpu_register          |


 739                                t |
 740                                LIR_OprDesc::cpu_register |
 741                                LIR_OprDesc::size_for(type) | LIR_OprDesc::virtual_mask);
 742 #else // __SOFTFP__
 743     LIR_Opr old_res = (LIR_Opr)(intptr_t)((index << LIR_OprDesc::data_shift) | t |
 744                                           ((type == T_FLOAT || type == T_DOUBLE) ?  LIR_OprDesc::fpu_register : LIR_OprDesc::cpu_register) |
 745                                LIR_OprDesc::size_for(type) | LIR_OprDesc::virtual_mask);
 746     assert(res == old_res, "old and new method not equal");
 747 #endif // __SOFTFP__
 748 #endif // ASSERT
 749 
 750     return res;
 751   }
 752 
 753   // 'index' is computed by FrameMap::local_stack_pos(index); do not use other parameters as
 754   // the index is platform independent; a double stack useing indeces 2 and 3 has always
 755   // index 2.
 756   static LIR_Opr stack(int index, BasicType type) {
 757     LIR_Opr res;
 758     switch (type) {

 759       case T_OBJECT: // fall through
 760       case T_ARRAY:
 761         res = (LIR_Opr)(intptr_t)((index << LIR_OprDesc::data_shift) |
 762                                   LIR_OprDesc::object_type           |
 763                                   LIR_OprDesc::stack_value           |
 764                                   LIR_OprDesc::single_size);
 765         break;
 766 
 767       case T_METADATA:
 768         res = (LIR_Opr)(intptr_t)((index << LIR_OprDesc::data_shift) |
 769                                   LIR_OprDesc::metadata_type         |
 770                                   LIR_OprDesc::stack_value           |
 771                                   LIR_OprDesc::single_size);
 772         break;
 773       case T_INT:
 774         res = (LIR_Opr)(intptr_t)((index << LIR_OprDesc::data_shift) |
 775                                   LIR_OprDesc::int_type              |
 776                                   LIR_OprDesc::stack_value           |
 777                                   LIR_OprDesc::single_size);
 778         break;


 852 //
 853 class  LIR_Op;
 854 class    LIR_Op0;
 855 class      LIR_OpLabel;
 856 class    LIR_Op1;
 857 class      LIR_OpBranch;
 858 class      LIR_OpConvert;
 859 class      LIR_OpAllocObj;
 860 class      LIR_OpRoundFP;
 861 class    LIR_Op2;
 862 class    LIR_OpDelay;
 863 class    LIR_Op3;
 864 class      LIR_OpAllocArray;
 865 class    LIR_OpCall;
 866 class      LIR_OpJavaCall;
 867 class      LIR_OpRTCall;
 868 class    LIR_OpArrayCopy;
 869 class    LIR_OpUpdateCRC32;
 870 class    LIR_OpLock;
 871 class    LIR_OpTypeCheck;

 872 class    LIR_OpCompareAndSwap;
 873 class    LIR_OpProfileCall;
 874 class    LIR_OpProfileType;
 875 #ifdef ASSERT
 876 class    LIR_OpAssert;
 877 #endif
 878 
 879 // LIR operation codes
 880 enum LIR_Code {
 881     lir_none
 882   , begin_op0
 883       , lir_word_align
 884       , lir_label
 885       , lir_nop
 886       , lir_backwardbranch_target
 887       , lir_std_entry
 888       , lir_osr_entry
 889       , lir_build_frame
 890       , lir_fpop_raw
 891       , lir_24bit_FPU


 966       , lir_dynamic_call
 967   , end_opJavaCall
 968   , begin_opArrayCopy
 969       , lir_arraycopy
 970   , end_opArrayCopy
 971   , begin_opUpdateCRC32
 972       , lir_updatecrc32
 973   , end_opUpdateCRC32
 974   , begin_opLock
 975     , lir_lock
 976     , lir_unlock
 977   , end_opLock
 978   , begin_delay_slot
 979     , lir_delay_slot
 980   , end_delay_slot
 981   , begin_opTypeCheck
 982     , lir_instanceof
 983     , lir_checkcast
 984     , lir_store_check
 985   , end_opTypeCheck



 986   , begin_opCompareAndSwap
 987     , lir_cas_long
 988     , lir_cas_obj
 989     , lir_cas_int
 990   , end_opCompareAndSwap
 991   , begin_opMDOProfile
 992     , lir_profile_call
 993     , lir_profile_type
 994   , end_opMDOProfile
 995   , begin_opAssert
 996     , lir_assert
 997   , end_opAssert
 998 };
 999 
1000 
1001 enum LIR_Condition {
1002     lir_cond_equal
1003   , lir_cond_notEqual
1004   , lir_cond_less
1005   , lir_cond_lessEqual


1116 
1117   virtual bool is_patching() { return false; }
1118   virtual LIR_OpCall* as_OpCall() { return NULL; }
1119   virtual LIR_OpJavaCall* as_OpJavaCall() { return NULL; }
1120   virtual LIR_OpLabel* as_OpLabel() { return NULL; }
1121   virtual LIR_OpDelay* as_OpDelay() { return NULL; }
1122   virtual LIR_OpLock* as_OpLock() { return NULL; }
1123   virtual LIR_OpAllocArray* as_OpAllocArray() { return NULL; }
1124   virtual LIR_OpAllocObj* as_OpAllocObj() { return NULL; }
1125   virtual LIR_OpRoundFP* as_OpRoundFP() { return NULL; }
1126   virtual LIR_OpBranch* as_OpBranch() { 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_OpProfileCall* as_OpProfileCall() { return NULL; }
1138   virtual LIR_OpProfileType* as_OpProfileType() { return NULL; }
1139 #ifdef ASSERT
1140   virtual LIR_OpAssert* as_OpAssert() { return NULL; }
1141 #endif
1142 
1143   virtual void verify() const {}
1144 };
1145 
1146 // for calls
1147 class LIR_OpCall: public LIR_Op {
1148  friend class LIR_OpVisitState;
1149 
1150  protected:
1151   address      _addr;
1152   LIR_OprList* _arguments;
1153  protected:
1154   LIR_OpCall(LIR_Code code, address addr, LIR_Opr result,
1155              LIR_OprList* arguments, CodeEmitInfo* info = NULL)


1247   LIR_Opr   _dst_pos;
1248   LIR_Opr   _length;
1249   LIR_Opr   _tmp;
1250   ciArrayKlass* _expected_type;
1251   int       _flags;
1252 
1253 public:
1254   enum Flags {
1255     src_null_check         = 1 << 0,
1256     dst_null_check         = 1 << 1,
1257     src_pos_positive_check = 1 << 2,
1258     dst_pos_positive_check = 1 << 3,
1259     length_positive_check  = 1 << 4,
1260     src_range_check        = 1 << 5,
1261     dst_range_check        = 1 << 6,
1262     type_check             = 1 << 7,
1263     overlapping            = 1 << 8,
1264     unaligned              = 1 << 9,
1265     src_objarray           = 1 << 10,
1266     dst_objarray           = 1 << 11,
1267     all_flags              = (1 << 12) - 1



1268   };
1269 
1270   LIR_OpArrayCopy(LIR_Opr src, LIR_Opr src_pos, LIR_Opr dst, LIR_Opr dst_pos, LIR_Opr length, LIR_Opr tmp,
1271                   ciArrayKlass* expected_type, int flags, CodeEmitInfo* info);
1272 
1273   LIR_Opr src() const                            { return _src; }
1274   LIR_Opr src_pos() const                        { return _src_pos; }
1275   LIR_Opr dst() const                            { return _dst; }
1276   LIR_Opr dst_pos() const                        { return _dst_pos; }
1277   LIR_Opr length() const                         { return _length; }
1278   LIR_Opr tmp() const                            { return _tmp; }
1279   int flags() const                              { return _flags; }
1280   ciArrayKlass* expected_type() const            { return _expected_type; }
1281   ArrayCopyStub* stub() const                    { return _stub; }
1282 
1283   virtual void emit_code(LIR_Assembler* masm);
1284   virtual LIR_OpArrayCopy* as_OpArrayCopy() { return this; }
1285   void print_instr(outputStream* out) const PRODUCT_RETURN;
1286 };
1287 


1540 };
1541 
1542 // LIR_OpTypeCheck
1543 class LIR_OpTypeCheck: public LIR_Op {
1544  friend class LIR_OpVisitState;
1545 
1546  private:
1547   LIR_Opr       _object;
1548   LIR_Opr       _array;
1549   ciKlass*      _klass;
1550   LIR_Opr       _tmp1;
1551   LIR_Opr       _tmp2;
1552   LIR_Opr       _tmp3;
1553   bool          _fast_check;
1554   CodeEmitInfo* _info_for_patch;
1555   CodeEmitInfo* _info_for_exception;
1556   CodeStub*     _stub;
1557   ciMethod*     _profiled_method;
1558   int           _profiled_bci;
1559   bool          _should_profile;

1560 
1561 public:
1562   LIR_OpTypeCheck(LIR_Code code, LIR_Opr result, LIR_Opr object, ciKlass* klass,
1563                   LIR_Opr tmp1, LIR_Opr tmp2, LIR_Opr tmp3, bool fast_check,
1564                   CodeEmitInfo* info_for_exception, CodeEmitInfo* info_for_patch, CodeStub* stub);
1565   LIR_OpTypeCheck(LIR_Code code, LIR_Opr object, LIR_Opr array,
1566                   LIR_Opr tmp1, LIR_Opr tmp2, LIR_Opr tmp3, CodeEmitInfo* info_for_exception);
1567 
1568   LIR_Opr object() const                         { return _object;         }
1569   LIR_Opr array() const                          { assert(code() == lir_store_check, "not valid"); return _array;         }
1570   LIR_Opr tmp1() const                           { return _tmp1;           }
1571   LIR_Opr tmp2() const                           { return _tmp2;           }
1572   LIR_Opr tmp3() const                           { return _tmp3;           }
1573   ciKlass* klass() const                         { assert(code() == lir_instanceof || code() == lir_checkcast, "not valid"); return _klass;          }
1574   bool fast_check() const                        { assert(code() == lir_instanceof || code() == lir_checkcast, "not valid"); return _fast_check;     }
1575   CodeEmitInfo* info_for_patch() const           { return _info_for_patch;  }
1576   CodeEmitInfo* info_for_exception() const       { return _info_for_exception; }
1577   CodeStub* stub() const                         { return _stub;           }
1578 
1579   // MethodData* profiling
1580   void set_profiled_method(ciMethod *method)     { _profiled_method = method; }
1581   void set_profiled_bci(int bci)                 { _profiled_bci = bci;       }
1582   void set_should_profile(bool b)                { _should_profile = b;       }
1583   ciMethod* profiled_method() const              { return _profiled_method;   }
1584   int       profiled_bci() const                 { return _profiled_bci;      }
1585   bool      should_profile() const               { return _should_profile;    }
1586 
1587   virtual bool is_patching() { return _info_for_patch != NULL; }
1588   virtual void emit_code(LIR_Assembler* masm);
1589   virtual LIR_OpTypeCheck* as_OpTypeCheck() { return this; }
1590   void print_instr(outputStream* out) const PRODUCT_RETURN;
1591 };
1592 




























1593 // LIR_Op2
1594 class LIR_Op2: public LIR_Op {
1595  friend class LIR_OpVisitState;
1596 
1597   int  _fpu_stack_size; // for sin/cos implementation on Intel
1598 
1599  protected:
1600   LIR_Opr   _opr1;
1601   LIR_Opr   _opr2;
1602   BasicType _type;
1603   LIR_Opr   _tmp1;
1604   LIR_Opr   _tmp2;
1605   LIR_Opr   _tmp3;
1606   LIR_Opr   _tmp4;
1607   LIR_Opr   _tmp5;
1608   LIR_Condition _condition;
1609 
1610   void verify() const;
1611 
1612  public:


1765 
1766 //--------------------------------
1767 class LabelObj: public CompilationResourceObj {
1768  private:
1769   Label _label;
1770  public:
1771   LabelObj()                                     {}
1772   Label* label()                                 { return &_label; }
1773 };
1774 
1775 
1776 class LIR_OpLock: public LIR_Op {
1777  friend class LIR_OpVisitState;
1778 
1779  private:
1780   LIR_Opr _hdr;
1781   LIR_Opr _obj;
1782   LIR_Opr _lock;
1783   LIR_Opr _scratch;
1784   CodeStub* _stub;

1785  public:
1786   LIR_OpLock(LIR_Code code, LIR_Opr hdr, LIR_Opr obj, LIR_Opr lock, LIR_Opr scratch, CodeStub* stub, CodeEmitInfo* info)
1787     : LIR_Op(code, LIR_OprFact::illegalOpr, info)
1788     , _hdr(hdr)
1789     , _obj(obj)
1790     , _lock(lock)
1791     , _scratch(scratch)
1792     , _stub(stub)                      {}

1793 
1794   LIR_Opr hdr_opr() const                        { return _hdr; }
1795   LIR_Opr obj_opr() const                        { return _obj; }
1796   LIR_Opr lock_opr() const                       { return _lock; }
1797   LIR_Opr scratch_opr() const                    { return _scratch; }
1798   CodeStub* stub() const                         { return _stub; }

1799 
1800   virtual void emit_code(LIR_Assembler* masm);
1801   virtual LIR_OpLock* as_OpLock() { return this; }
1802   void print_instr(outputStream* out) const PRODUCT_RETURN;
1803 };
1804 
1805 
1806 class LIR_OpDelay: public LIR_Op {
1807  friend class LIR_OpVisitState;
1808 
1809  private:
1810   LIR_Op* _op;
1811 
1812  public:
1813   LIR_OpDelay(LIR_Op* op, CodeEmitInfo* info):
1814     LIR_Op(lir_delay_slot, LIR_OprFact::illegalOpr, info),
1815     _op(op) {
1816     assert(op->code() == lir_nop || LIRFillDelaySlots, "should be filling with nops");
1817   }
1818   virtual void emit_code(LIR_Assembler* masm);


2213   void unsigned_shift_right(LIR_Opr value, LIR_Opr count, LIR_Opr dst, LIR_Opr tmp);
2214 
2215   void shift_left(LIR_Opr value, int count, LIR_Opr dst)       { shift_left(value, LIR_OprFact::intConst(count), dst, LIR_OprFact::illegalOpr); }
2216   void shift_right(LIR_Opr value, int count, LIR_Opr dst)      { shift_right(value, LIR_OprFact::intConst(count), dst, LIR_OprFact::illegalOpr); }
2217   void unsigned_shift_right(LIR_Opr value, int count, LIR_Opr dst) { unsigned_shift_right(value, LIR_OprFact::intConst(count), dst, LIR_OprFact::illegalOpr); }
2218 
2219   void lcmp2int(LIR_Opr left, LIR_Opr right, LIR_Opr dst)        { append(new LIR_Op2(lir_cmp_l2i,  left, right, dst)); }
2220   void fcmp2int(LIR_Opr left, LIR_Opr right, LIR_Opr dst, bool is_unordered_less);
2221 
2222   void call_runtime_leaf(address routine, LIR_Opr tmp, LIR_Opr result, LIR_OprList* arguments) {
2223     append(new LIR_OpRTCall(routine, tmp, result, arguments));
2224   }
2225 
2226   void call_runtime(address routine, LIR_Opr tmp, LIR_Opr result,
2227                     LIR_OprList* arguments, CodeEmitInfo* info) {
2228     append(new LIR_OpRTCall(routine, tmp, result, arguments, info));
2229   }
2230 
2231   void load_stack_address_monitor(int monitor_ix, LIR_Opr dst)  { append(new LIR_Op1(lir_monaddr, LIR_OprFact::intConst(monitor_ix), dst)); }
2232   void unlock_object(LIR_Opr hdr, LIR_Opr obj, LIR_Opr lock, LIR_Opr scratch, CodeStub* stub);
2233   void lock_object(LIR_Opr hdr, LIR_Opr obj, LIR_Opr lock, LIR_Opr scratch, CodeStub* stub, CodeEmitInfo* info);
2234 
2235   void set_24bit_fpu()                                               { append(new LIR_Op0(lir_24bit_FPU )); }
2236   void restore_fpu()                                                 { append(new LIR_Op0(lir_reset_FPU )); }
2237   void breakpoint()                                                  { append(new LIR_Op0(lir_breakpoint)); }
2238 
2239   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)); }
2240 
2241   void update_crc32(LIR_Opr crc, LIR_Opr val, LIR_Opr res)  { append(new LIR_OpUpdateCRC32(crc, val, res)); }
2242 
2243   void fpop_raw()                                { append(new LIR_Op0(lir_fpop_raw)); }
2244 
2245   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);
2246   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);

2247 
2248   void checkcast (LIR_Opr result, LIR_Opr object, ciKlass* klass,
2249                   LIR_Opr tmp1, LIR_Opr tmp2, LIR_Opr tmp3, bool fast_check,
2250                   CodeEmitInfo* info_for_exception, CodeEmitInfo* info_for_patch, CodeStub* stub,
2251                   ciMethod* profiled_method, int profiled_bci);
2252   // MethodData* profiling
2253   void profile_call(ciMethod* method, int bci, ciMethod* callee, LIR_Opr mdo, LIR_Opr recv, LIR_Opr t1, ciKlass* cha_klass) {
2254     append(new LIR_OpProfileCall(method, bci, callee, mdo, recv, t1, cha_klass));
2255   }
2256   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) {
2257     append(new LIR_OpProfileType(LIR_OprFact::address(mdp), obj, exact_klass, current_klass, tmp, not_null, no_conflict));
2258   }
2259 
2260   void xadd(LIR_Opr src, LIR_Opr add, LIR_Opr res, LIR_Opr tmp) { append(new LIR_Op2(lir_xadd, src, add, res, tmp)); }
2261   void xchg(LIR_Opr src, LIR_Opr set, LIR_Opr res, LIR_Opr tmp) { append(new LIR_Op2(lir_xchg, src, set, res, tmp)); }
2262 #ifdef ASSERT
2263   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)); }
2264 #endif
2265 };
2266 
2267 void print_LIR(BlockList* blocks);
2268 
2269 class LIR_InsertionBuffer : public CompilationResourceObj {
2270  private:
2271   LIR_List*   _lir;   // the lir list where ops of this buffer should be inserted later (NULL when uninitialized)




 299   friend BasicType as_BasicType(OprType t);
 300 
 301   OprType type_field_valid() const               { assert(is_register() || is_stack(), "should not be called otherwise"); return (OprType)(value() & type_mask); }
 302   OprType type_field() const                     { return is_illegal() ? unknown_type : (OprType)(value() & type_mask); }
 303 
 304   static OprSize size_for(BasicType t) {
 305     switch (t) {
 306       case T_LONG:
 307       case T_DOUBLE:
 308         return double_size;
 309         break;
 310 
 311       case T_FLOAT:
 312       case T_BOOLEAN:
 313       case T_CHAR:
 314       case T_BYTE:
 315       case T_SHORT:
 316       case T_INT:
 317       case T_ADDRESS:
 318       case T_OBJECT:
 319       case T_VALUETYPE:
 320       case T_ARRAY:
 321       case T_METADATA:
 322         return single_size;
 323         break;
 324 
 325       default:
 326         ShouldNotReachHere();
 327         return single_size;
 328       }
 329   }
 330 
 331 
 332   void validate_type() const PRODUCT_RETURN;
 333 
 334   BasicType type() const {
 335     if (is_pointer()) {
 336       return pointer()->type();
 337     }
 338     return as_BasicType(type_field());
 339   }


 450 #endif
 451 
 452   jint      as_jint()    const { return as_constant_ptr()->as_jint(); }
 453   jlong     as_jlong()   const { return as_constant_ptr()->as_jlong(); }
 454   jfloat    as_jfloat()  const { return as_constant_ptr()->as_jfloat(); }
 455   jdouble   as_jdouble() const { return as_constant_ptr()->as_jdouble(); }
 456   jobject   as_jobject() const { return as_constant_ptr()->as_jobject(); }
 457 
 458   void print() const PRODUCT_RETURN;
 459   void print(outputStream* out) const PRODUCT_RETURN;
 460 };
 461 
 462 
 463 inline LIR_OprDesc::OprType as_OprType(BasicType type) {
 464   switch (type) {
 465   case T_INT:      return LIR_OprDesc::int_type;
 466   case T_LONG:     return LIR_OprDesc::long_type;
 467   case T_FLOAT:    return LIR_OprDesc::float_type;
 468   case T_DOUBLE:   return LIR_OprDesc::double_type;
 469   case T_OBJECT:
 470   case T_VALUETYPE:
 471   case T_ARRAY:    return LIR_OprDesc::object_type;
 472   case T_ADDRESS:  return LIR_OprDesc::address_type;
 473   case T_METADATA: return LIR_OprDesc::metadata_type;
 474   case T_ILLEGAL:  // fall through
 475   default: ShouldNotReachHere(); return LIR_OprDesc::unknown_type;
 476   }
 477 }
 478 
 479 inline BasicType as_BasicType(LIR_OprDesc::OprType t) {
 480   switch (t) {
 481   case LIR_OprDesc::int_type:     return T_INT;
 482   case LIR_OprDesc::long_type:    return T_LONG;
 483   case LIR_OprDesc::float_type:   return T_FLOAT;
 484   case LIR_OprDesc::double_type:  return T_DOUBLE;
 485   case LIR_OprDesc::object_type:  return T_OBJECT;
 486   case LIR_OprDesc::address_type: return T_ADDRESS;
 487   case LIR_OprDesc::metadata_type:return T_METADATA;
 488   case LIR_OprDesc::unknown_type: // fall through
 489   default: ShouldNotReachHere();  return T_ILLEGAL;
 490   }


 636     return (LIR_Opr)(intptr_t)((reg << LIR_OprDesc::reg1_shift) |
 637                                LIR_OprDesc::float_type          |
 638                                LIR_OprDesc::fpu_register        |
 639                                LIR_OprDesc::single_size         |
 640                                LIR_OprDesc::is_xmm_mask);
 641   }
 642   static LIR_Opr double_xmm(int reg) {
 643     return (LIR_Opr)(intptr_t)((reg << LIR_OprDesc::reg1_shift) |
 644                                (reg << LIR_OprDesc::reg2_shift) |
 645                                LIR_OprDesc::double_type         |
 646                                LIR_OprDesc::fpu_register        |
 647                                LIR_OprDesc::double_size         |
 648                                LIR_OprDesc::is_xmm_mask);
 649   }
 650 #endif // X86
 651 
 652   static LIR_Opr virtual_register(int index, BasicType type) {
 653     LIR_Opr res;
 654     switch (type) {
 655       case T_OBJECT: // fall through
 656       case T_VALUETYPE: // fall through
 657       case T_ARRAY:
 658         res = (LIR_Opr)(intptr_t)((index << LIR_OprDesc::data_shift)  |
 659                                             LIR_OprDesc::object_type  |
 660                                             LIR_OprDesc::cpu_register |
 661                                             LIR_OprDesc::single_size  |
 662                                             LIR_OprDesc::virtual_mask);
 663         break;
 664 
 665       case T_METADATA:
 666         res = (LIR_Opr)(intptr_t)((index << LIR_OprDesc::data_shift)  |
 667                                             LIR_OprDesc::metadata_type|
 668                                             LIR_OprDesc::cpu_register |
 669                                             LIR_OprDesc::single_size  |
 670                                             LIR_OprDesc::virtual_mask);
 671         break;
 672 
 673       case T_INT:
 674         res = (LIR_Opr)(intptr_t)((index << LIR_OprDesc::data_shift) |
 675                                   LIR_OprDesc::int_type              |
 676                                   LIR_OprDesc::cpu_register          |


 742                                t |
 743                                LIR_OprDesc::cpu_register |
 744                                LIR_OprDesc::size_for(type) | LIR_OprDesc::virtual_mask);
 745 #else // __SOFTFP__
 746     LIR_Opr old_res = (LIR_Opr)(intptr_t)((index << LIR_OprDesc::data_shift) | t |
 747                                           ((type == T_FLOAT || type == T_DOUBLE) ?  LIR_OprDesc::fpu_register : LIR_OprDesc::cpu_register) |
 748                                LIR_OprDesc::size_for(type) | LIR_OprDesc::virtual_mask);
 749     assert(res == old_res, "old and new method not equal");
 750 #endif // __SOFTFP__
 751 #endif // ASSERT
 752 
 753     return res;
 754   }
 755 
 756   // 'index' is computed by FrameMap::local_stack_pos(index); do not use other parameters as
 757   // the index is platform independent; a double stack useing indeces 2 and 3 has always
 758   // index 2.
 759   static LIR_Opr stack(int index, BasicType type) {
 760     LIR_Opr res;
 761     switch (type) {
 762       case T_VALUETYPE: // fall through
 763       case T_OBJECT: // fall through
 764       case T_ARRAY:
 765         res = (LIR_Opr)(intptr_t)((index << LIR_OprDesc::data_shift) |
 766                                   LIR_OprDesc::object_type           |
 767                                   LIR_OprDesc::stack_value           |
 768                                   LIR_OprDesc::single_size);
 769         break;
 770 
 771       case T_METADATA:
 772         res = (LIR_Opr)(intptr_t)((index << LIR_OprDesc::data_shift) |
 773                                   LIR_OprDesc::metadata_type         |
 774                                   LIR_OprDesc::stack_value           |
 775                                   LIR_OprDesc::single_size);
 776         break;
 777       case T_INT:
 778         res = (LIR_Opr)(intptr_t)((index << LIR_OprDesc::data_shift) |
 779                                   LIR_OprDesc::int_type              |
 780                                   LIR_OprDesc::stack_value           |
 781                                   LIR_OprDesc::single_size);
 782         break;


 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)


1256   LIR_Opr   _dst_pos;
1257   LIR_Opr   _length;
1258   LIR_Opr   _tmp;
1259   ciArrayKlass* _expected_type;
1260   int       _flags;
1261 
1262 public:
1263   enum Flags {
1264     src_null_check         = 1 << 0,
1265     dst_null_check         = 1 << 1,
1266     src_pos_positive_check = 1 << 2,
1267     dst_pos_positive_check = 1 << 3,
1268     length_positive_check  = 1 << 4,
1269     src_range_check        = 1 << 5,
1270     dst_range_check        = 1 << 6,
1271     type_check             = 1 << 7,
1272     overlapping            = 1 << 8,
1273     unaligned              = 1 << 9,
1274     src_objarray           = 1 << 10,
1275     dst_objarray           = 1 << 11,
1276     always_slow_path       = 1 << 12,
1277     src_flat_check         = 1 << 13,
1278     dst_flat_check         = 1 << 14,
1279     all_flags              = (1 << 15) - 1
1280   };
1281 
1282   LIR_OpArrayCopy(LIR_Opr src, LIR_Opr src_pos, LIR_Opr dst, LIR_Opr dst_pos, LIR_Opr length, LIR_Opr tmp,
1283                   ciArrayKlass* expected_type, int flags, CodeEmitInfo* info);
1284 
1285   LIR_Opr src() const                            { return _src; }
1286   LIR_Opr src_pos() const                        { return _src_pos; }
1287   LIR_Opr dst() const                            { return _dst; }
1288   LIR_Opr dst_pos() const                        { return _dst_pos; }
1289   LIR_Opr length() const                         { return _length; }
1290   LIR_Opr tmp() const                            { return _tmp; }
1291   int flags() const                              { return _flags; }
1292   ciArrayKlass* expected_type() const            { return _expected_type; }
1293   ArrayCopyStub* stub() const                    { return _stub; }
1294 
1295   virtual void emit_code(LIR_Assembler* masm);
1296   virtual LIR_OpArrayCopy* as_OpArrayCopy() { return this; }
1297   void print_instr(outputStream* out) const PRODUCT_RETURN;
1298 };
1299 


1552 };
1553 
1554 // LIR_OpTypeCheck
1555 class LIR_OpTypeCheck: public LIR_Op {
1556  friend class LIR_OpVisitState;
1557 
1558  private:
1559   LIR_Opr       _object;
1560   LIR_Opr       _array;
1561   ciKlass*      _klass;
1562   LIR_Opr       _tmp1;
1563   LIR_Opr       _tmp2;
1564   LIR_Opr       _tmp3;
1565   bool          _fast_check;
1566   CodeEmitInfo* _info_for_patch;
1567   CodeEmitInfo* _info_for_exception;
1568   CodeStub*     _stub;
1569   ciMethod*     _profiled_method;
1570   int           _profiled_bci;
1571   bool          _should_profile;
1572   bool          _need_null_check;
1573 
1574 public:
1575   LIR_OpTypeCheck(LIR_Code code, LIR_Opr result, LIR_Opr object, ciKlass* klass,
1576                   LIR_Opr tmp1, LIR_Opr tmp2, LIR_Opr tmp3, bool fast_check,
1577                   CodeEmitInfo* info_for_exception, CodeEmitInfo* info_for_patch, CodeStub* stub, bool need_null_check = true);
1578   LIR_OpTypeCheck(LIR_Code code, LIR_Opr object, LIR_Opr array,
1579                   LIR_Opr tmp1, LIR_Opr tmp2, LIR_Opr tmp3, CodeEmitInfo* info_for_exception);
1580 
1581   LIR_Opr object() const                         { return _object;         }
1582   LIR_Opr array() const                          { assert(code() == lir_store_check, "not valid"); return _array;         }
1583   LIR_Opr tmp1() const                           { return _tmp1;           }
1584   LIR_Opr tmp2() const                           { return _tmp2;           }
1585   LIR_Opr tmp3() const                           { return _tmp3;           }
1586   ciKlass* klass() const                         { assert(code() == lir_instanceof || code() == lir_checkcast, "not valid"); return _klass;          }
1587   bool fast_check() const                        { assert(code() == lir_instanceof || code() == lir_checkcast, "not valid"); return _fast_check;     }
1588   CodeEmitInfo* info_for_patch() const           { return _info_for_patch;  }
1589   CodeEmitInfo* info_for_exception() const       { return _info_for_exception; }
1590   CodeStub* stub() const                         { return _stub;           }
1591 
1592   // MethodData* profiling
1593   void set_profiled_method(ciMethod *method)     { _profiled_method = method; }
1594   void set_profiled_bci(int bci)                 { _profiled_bci = bci;       }
1595   void set_should_profile(bool b)                { _should_profile = b;       }
1596   ciMethod* profiled_method() const              { return _profiled_method;   }
1597   int       profiled_bci() const                 { return _profiled_bci;      }
1598   bool      should_profile() const               { return _should_profile;    }
1599   bool      need_null_check() const              { return _need_null_check;   }
1600   virtual bool is_patching() { return _info_for_patch != NULL; }
1601   virtual void emit_code(LIR_Assembler* masm);
1602   virtual LIR_OpTypeCheck* as_OpTypeCheck() { return this; }
1603   void print_instr(outputStream* out) const PRODUCT_RETURN;
1604 };
1605 
1606 // LIR_OpFlattenedStoreCheck
1607 class LIR_OpFlattenedStoreCheck: public LIR_Op {
1608  friend class LIR_OpVisitState;
1609 
1610  private:
1611   LIR_Opr       _object;
1612   ciKlass*      _element_klass;
1613   LIR_Opr       _tmp1;
1614   LIR_Opr       _tmp2;
1615   CodeEmitInfo* _info_for_exception;
1616   CodeStub*     _stub;
1617 
1618 public:
1619   LIR_OpFlattenedStoreCheck(LIR_Opr object, ciKlass* element_klass, LIR_Opr tmp1, LIR_Opr tmp2,
1620                             CodeEmitInfo* info_for_exception);
1621 
1622   LIR_Opr object() const                         { return _object;         }
1623   LIR_Opr tmp1() const                           { return _tmp1;           }
1624   LIR_Opr tmp2() const                           { return _tmp2;           }
1625   ciKlass* element_klass() const                 { return _element_klass;  }
1626   CodeEmitInfo* info_for_exception() const       { return _info_for_exception; }
1627   CodeStub* stub() const                         { return _stub;           }
1628 
1629   virtual void emit_code(LIR_Assembler* masm);
1630   virtual LIR_OpFlattenedStoreCheck* as_OpFlattenedStoreCheck() { return this; }
1631   virtual void print_instr(outputStream* out) const PRODUCT_RETURN;
1632 };
1633 
1634 // LIR_Op2
1635 class LIR_Op2: public LIR_Op {
1636  friend class LIR_OpVisitState;
1637 
1638   int  _fpu_stack_size; // for sin/cos implementation on Intel
1639 
1640  protected:
1641   LIR_Opr   _opr1;
1642   LIR_Opr   _opr2;
1643   BasicType _type;
1644   LIR_Opr   _tmp1;
1645   LIR_Opr   _tmp2;
1646   LIR_Opr   _tmp3;
1647   LIR_Opr   _tmp4;
1648   LIR_Opr   _tmp5;
1649   LIR_Condition _condition;
1650 
1651   void verify() const;
1652 
1653  public:


1806 
1807 //--------------------------------
1808 class LabelObj: public CompilationResourceObj {
1809  private:
1810   Label _label;
1811  public:
1812   LabelObj()                                     {}
1813   Label* label()                                 { return &_label; }
1814 };
1815 
1816 
1817 class LIR_OpLock: public LIR_Op {
1818  friend class LIR_OpVisitState;
1819 
1820  private:
1821   LIR_Opr _hdr;
1822   LIR_Opr _obj;
1823   LIR_Opr _lock;
1824   LIR_Opr _scratch;
1825   CodeStub* _stub;
1826   CodeStub* _throw_imse_stub;
1827  public:
1828   LIR_OpLock(LIR_Code code, LIR_Opr hdr, LIR_Opr obj, LIR_Opr lock, LIR_Opr scratch, CodeStub* stub, CodeEmitInfo* info, CodeStub* throw_imse_stub=NULL)
1829     : LIR_Op(code, LIR_OprFact::illegalOpr, info)
1830     , _hdr(hdr)
1831     , _obj(obj)
1832     , _lock(lock)
1833     , _scratch(scratch)
1834     , _stub(stub)
1835     , _throw_imse_stub(throw_imse_stub)                    {}
1836 
1837   LIR_Opr hdr_opr() const                        { return _hdr; }
1838   LIR_Opr obj_opr() const                        { return _obj; }
1839   LIR_Opr lock_opr() const                       { return _lock; }
1840   LIR_Opr scratch_opr() const                    { return _scratch; }
1841   CodeStub* stub() const                         { return _stub; }
1842   CodeStub* throw_imse_stub() const              { return _throw_imse_stub; }
1843 
1844   virtual void emit_code(LIR_Assembler* masm);
1845   virtual LIR_OpLock* as_OpLock() { return this; }
1846   void print_instr(outputStream* out) const PRODUCT_RETURN;
1847 };
1848 
1849 
1850 class LIR_OpDelay: public LIR_Op {
1851  friend class LIR_OpVisitState;
1852 
1853  private:
1854   LIR_Op* _op;
1855 
1856  public:
1857   LIR_OpDelay(LIR_Op* op, CodeEmitInfo* info):
1858     LIR_Op(lir_delay_slot, LIR_OprFact::illegalOpr, info),
1859     _op(op) {
1860     assert(op->code() == lir_nop || LIRFillDelaySlots, "should be filling with nops");
1861   }
1862   virtual void emit_code(LIR_Assembler* masm);


2257   void unsigned_shift_right(LIR_Opr value, LIR_Opr count, LIR_Opr dst, LIR_Opr tmp);
2258 
2259   void shift_left(LIR_Opr value, int count, LIR_Opr dst)       { shift_left(value, LIR_OprFact::intConst(count), dst, LIR_OprFact::illegalOpr); }
2260   void shift_right(LIR_Opr value, int count, LIR_Opr dst)      { shift_right(value, LIR_OprFact::intConst(count), dst, LIR_OprFact::illegalOpr); }
2261   void unsigned_shift_right(LIR_Opr value, int count, LIR_Opr dst) { unsigned_shift_right(value, LIR_OprFact::intConst(count), dst, LIR_OprFact::illegalOpr); }
2262 
2263   void lcmp2int(LIR_Opr left, LIR_Opr right, LIR_Opr dst)        { append(new LIR_Op2(lir_cmp_l2i,  left, right, dst)); }
2264   void fcmp2int(LIR_Opr left, LIR_Opr right, LIR_Opr dst, bool is_unordered_less);
2265 
2266   void call_runtime_leaf(address routine, LIR_Opr tmp, LIR_Opr result, LIR_OprList* arguments) {
2267     append(new LIR_OpRTCall(routine, tmp, result, arguments));
2268   }
2269 
2270   void call_runtime(address routine, LIR_Opr tmp, LIR_Opr result,
2271                     LIR_OprList* arguments, CodeEmitInfo* info) {
2272     append(new LIR_OpRTCall(routine, tmp, result, arguments, info));
2273   }
2274 
2275   void load_stack_address_monitor(int monitor_ix, LIR_Opr dst)  { append(new LIR_Op1(lir_monaddr, LIR_OprFact::intConst(monitor_ix), dst)); }
2276   void unlock_object(LIR_Opr hdr, LIR_Opr obj, LIR_Opr lock, LIR_Opr scratch, CodeStub* stub);
2277   void lock_object(LIR_Opr hdr, LIR_Opr obj, LIR_Opr lock, LIR_Opr scratch, CodeStub* stub, CodeEmitInfo* info, CodeStub* throw_imse_stub=NULL);
2278 
2279   void set_24bit_fpu()                                               { append(new LIR_Op0(lir_24bit_FPU )); }
2280   void restore_fpu()                                                 { append(new LIR_Op0(lir_reset_FPU )); }
2281   void breakpoint()                                                  { append(new LIR_Op0(lir_breakpoint)); }
2282 
2283   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)); }
2284 
2285   void update_crc32(LIR_Opr crc, LIR_Opr val, LIR_Opr res)  { append(new LIR_OpUpdateCRC32(crc, val, res)); }
2286 
2287   void fpop_raw()                                { append(new LIR_Op0(lir_fpop_raw)); }
2288 
2289   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);
2290   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);
2291   void flattened_store_check(LIR_Opr object, ciKlass* element_klass, LIR_Opr tmp1, LIR_Opr tmp2, CodeEmitInfo* info_for_exception);
2292 
2293   void checkcast (LIR_Opr result, LIR_Opr object, ciKlass* klass,
2294                   LIR_Opr tmp1, LIR_Opr tmp2, LIR_Opr tmp3, bool fast_check,
2295                   CodeEmitInfo* info_for_exception, CodeEmitInfo* info_for_patch, CodeStub* stub,
2296                   ciMethod* profiled_method, int profiled_bci, bool is_never_null);
2297   // MethodData* profiling
2298   void profile_call(ciMethod* method, int bci, ciMethod* callee, LIR_Opr mdo, LIR_Opr recv, LIR_Opr t1, ciKlass* cha_klass) {
2299     append(new LIR_OpProfileCall(method, bci, callee, mdo, recv, t1, cha_klass));
2300   }
2301   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) {
2302     append(new LIR_OpProfileType(LIR_OprFact::address(mdp), obj, exact_klass, current_klass, tmp, not_null, no_conflict));
2303   }
2304 
2305   void xadd(LIR_Opr src, LIR_Opr add, LIR_Opr res, LIR_Opr tmp) { append(new LIR_Op2(lir_xadd, src, add, res, tmp)); }
2306   void xchg(LIR_Opr src, LIR_Opr set, LIR_Opr res, LIR_Opr tmp) { append(new LIR_Op2(lir_xchg, src, set, res, tmp)); }
2307 #ifdef ASSERT
2308   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)); }
2309 #endif
2310 };
2311 
2312 void print_LIR(BlockList* blocks);
2313 
2314 class LIR_InsertionBuffer : public CompilationResourceObj {
2315  private:
2316   LIR_List*   _lir;   // the lir list where ops of this buffer should be inserted later (NULL when uninitialized)


< prev index next >