hotspot/src/share/vm/c1/c1_LIR.hpp
changeset 6453 970dc585ab63
parent 6176 4d9030fe341f
child 6461 cfc616b49f58
equal deleted inserted replaced
6452:cc624b341ab2 6453:970dc585ab63
   847       , lir_convert
   847       , lir_convert
   848       , lir_alloc_object
   848       , lir_alloc_object
   849       , lir_monaddr
   849       , lir_monaddr
   850       , lir_roundfp
   850       , lir_roundfp
   851       , lir_safepoint
   851       , lir_safepoint
       
   852       , lir_pack64
       
   853       , lir_unpack64
   852       , lir_unwind
   854       , lir_unwind
   853   , end_op1
   855   , end_op1
   854   , begin_op2
   856   , begin_op2
   855       , lir_cmp
   857       , lir_cmp
   856       , lir_cmp_l2i
   858       , lir_cmp_l2i
  1462   LIR_Opr       _tmp3;
  1464   LIR_Opr       _tmp3;
  1463   bool          _fast_check;
  1465   bool          _fast_check;
  1464   CodeEmitInfo* _info_for_patch;
  1466   CodeEmitInfo* _info_for_patch;
  1465   CodeEmitInfo* _info_for_exception;
  1467   CodeEmitInfo* _info_for_exception;
  1466   CodeStub*     _stub;
  1468   CodeStub*     _stub;
  1467   // Helpers for Tier1UpdateMethodData
       
  1468   ciMethod*     _profiled_method;
  1469   ciMethod*     _profiled_method;
  1469   int           _profiled_bci;
  1470   int           _profiled_bci;
       
  1471   bool          _should_profile;
  1470 
  1472 
  1471 public:
  1473 public:
  1472   LIR_OpTypeCheck(LIR_Code code, LIR_Opr result, LIR_Opr object, ciKlass* klass,
  1474   LIR_OpTypeCheck(LIR_Code code, LIR_Opr result, LIR_Opr object, ciKlass* klass,
  1473                   LIR_Opr tmp1, LIR_Opr tmp2, LIR_Opr tmp3, bool fast_check,
  1475                   LIR_Opr tmp1, LIR_Opr tmp2, LIR_Opr tmp3, bool fast_check,
  1474                   CodeEmitInfo* info_for_exception, CodeEmitInfo* info_for_patch, CodeStub* stub,
  1476                   CodeEmitInfo* info_for_exception, CodeEmitInfo* info_for_patch, CodeStub* stub);
  1475                   ciMethod* profiled_method, int profiled_bci);
       
  1476   LIR_OpTypeCheck(LIR_Code code, LIR_Opr object, LIR_Opr array,
  1477   LIR_OpTypeCheck(LIR_Code code, LIR_Opr object, LIR_Opr array,
  1477                   LIR_Opr tmp1, LIR_Opr tmp2, LIR_Opr tmp3, CodeEmitInfo* info_for_exception,
  1478                   LIR_Opr tmp1, LIR_Opr tmp2, LIR_Opr tmp3, CodeEmitInfo* info_for_exception);
  1478                   ciMethod* profiled_method, int profiled_bci);
       
  1479 
  1479 
  1480   LIR_Opr object() const                         { return _object;         }
  1480   LIR_Opr object() const                         { return _object;         }
  1481   LIR_Opr array() const                          { assert(code() == lir_store_check, "not valid"); return _array;         }
  1481   LIR_Opr array() const                          { assert(code() == lir_store_check, "not valid"); return _array;         }
  1482   LIR_Opr tmp1() const                           { return _tmp1;           }
  1482   LIR_Opr tmp1() const                           { return _tmp1;           }
  1483   LIR_Opr tmp2() const                           { return _tmp2;           }
  1483   LIR_Opr tmp2() const                           { return _tmp2;           }
  1487   CodeEmitInfo* info_for_patch() const           { return _info_for_patch;  }
  1487   CodeEmitInfo* info_for_patch() const           { return _info_for_patch;  }
  1488   CodeEmitInfo* info_for_exception() const       { return _info_for_exception; }
  1488   CodeEmitInfo* info_for_exception() const       { return _info_for_exception; }
  1489   CodeStub* stub() const                         { return _stub;           }
  1489   CodeStub* stub() const                         { return _stub;           }
  1490 
  1490 
  1491   // methodDataOop profiling
  1491   // methodDataOop profiling
  1492   ciMethod* profiled_method()                    { return _profiled_method; }
  1492   void set_profiled_method(ciMethod *method)     { _profiled_method = method; }
  1493   int       profiled_bci()                       { return _profiled_bci; }
  1493   void set_profiled_bci(int bci)                 { _profiled_bci = bci;       }
       
  1494   void set_should_profile(bool b)                { _should_profile = b;       }
       
  1495   ciMethod* profiled_method() const              { return _profiled_method;   }
       
  1496   int       profiled_bci() const                 { return _profiled_bci;      }
       
  1497   bool      should_profile() const               { return _should_profile;    }
  1494 
  1498 
  1495   virtual void emit_code(LIR_Assembler* masm);
  1499   virtual void emit_code(LIR_Assembler* masm);
  1496   virtual LIR_OpTypeCheck* as_OpTypeCheck() { return this; }
  1500   virtual LIR_OpTypeCheck* as_OpTypeCheck() { return this; }
  1497   void print_instr(outputStream* out) const PRODUCT_RETURN;
  1501   void print_instr(outputStream* out) const PRODUCT_RETURN;
  1498 };
  1502 };
  1769   virtual void emit_code(LIR_Assembler* masm);
  1773   virtual void emit_code(LIR_Assembler* masm);
  1770   virtual LIR_OpProfileCall* as_OpProfileCall() { return this; }
  1774   virtual LIR_OpProfileCall* as_OpProfileCall() { return this; }
  1771   virtual void print_instr(outputStream* out) const PRODUCT_RETURN;
  1775   virtual void print_instr(outputStream* out) const PRODUCT_RETURN;
  1772 };
  1776 };
  1773 
  1777 
  1774 
       
  1775 class LIR_InsertionBuffer;
  1778 class LIR_InsertionBuffer;
  1776 
  1779 
  1777 //--------------------------------LIR_List---------------------------------------------------
  1780 //--------------------------------LIR_List---------------------------------------------------
  1778 // Maintains a list of LIR instructions (one instance of LIR_List per basic block)
  1781 // Maintains a list of LIR instructions (one instance of LIR_List per basic block)
  1779 // The LIR instructions are appended by the LIR_List class itself;
  1782 // The LIR instructions are appended by the LIR_List class itself;
  1833   void append(LIR_InsertionBuffer* buffer);
  1836   void append(LIR_InsertionBuffer* buffer);
  1834 
  1837 
  1835   //---------- mutators ---------------
  1838   //---------- mutators ---------------
  1836   void insert_before(int i, LIR_List* op_list)   { _operations.insert_before(i, op_list->instructions_list()); }
  1839   void insert_before(int i, LIR_List* op_list)   { _operations.insert_before(i, op_list->instructions_list()); }
  1837   void insert_before(int i, LIR_Op* op)          { _operations.insert_before(i, op); }
  1840   void insert_before(int i, LIR_Op* op)          { _operations.insert_before(i, op); }
       
  1841   void remove_at(int i)                          { _operations.remove_at(i); }
  1838 
  1842 
  1839   //---------- printing -------------
  1843   //---------- printing -------------
  1840   void print_instructions() PRODUCT_RETURN;
  1844   void print_instructions() PRODUCT_RETURN;
  1841 
  1845 
  1842 
  1846 
  1906 
  1910 
  1907   void logical_and (LIR_Opr left, LIR_Opr right, LIR_Opr dst) { append(new LIR_Op2(lir_logic_and,  left, right, dst)); }
  1911   void logical_and (LIR_Opr left, LIR_Opr right, LIR_Opr dst) { append(new LIR_Op2(lir_logic_and,  left, right, dst)); }
  1908   void logical_or  (LIR_Opr left, LIR_Opr right, LIR_Opr dst) { append(new LIR_Op2(lir_logic_or,   left, right, dst)); }
  1912   void logical_or  (LIR_Opr left, LIR_Opr right, LIR_Opr dst) { append(new LIR_Op2(lir_logic_or,   left, right, dst)); }
  1909   void logical_xor (LIR_Opr left, LIR_Opr right, LIR_Opr dst) { append(new LIR_Op2(lir_logic_xor,  left, right, dst)); }
  1913   void logical_xor (LIR_Opr left, LIR_Opr right, LIR_Opr dst) { append(new LIR_Op2(lir_logic_xor,  left, right, dst)); }
  1910 
  1914 
       
  1915   void   pack64(LIR_Opr src, LIR_Opr dst) { append(new LIR_Op1(lir_pack64,   src, dst, T_LONG, lir_patch_none, NULL)); }
       
  1916   void unpack64(LIR_Opr src, LIR_Opr dst) { append(new LIR_Op1(lir_unpack64, src, dst, T_LONG, lir_patch_none, NULL)); }
       
  1917 
  1911   void null_check(LIR_Opr opr, CodeEmitInfo* info)         { append(new LIR_Op1(lir_null_check, opr, info)); }
  1918   void null_check(LIR_Opr opr, CodeEmitInfo* info)         { append(new LIR_Op1(lir_null_check, opr, info)); }
  1912   void throw_exception(LIR_Opr exceptionPC, LIR_Opr exceptionOop, CodeEmitInfo* info) {
  1919   void throw_exception(LIR_Opr exceptionPC, LIR_Opr exceptionOop, CodeEmitInfo* info) {
  1913     append(new LIR_Op2(lir_throw, exceptionPC, exceptionOop, LIR_OprFact::illegalOpr, info));
  1920     append(new LIR_Op2(lir_throw, exceptionPC, exceptionOop, LIR_OprFact::illegalOpr, info));
  1914   }
  1921   }
  1915   void unwind_exception(LIR_Opr exceptionOop) {
  1922   void unwind_exception(LIR_Opr exceptionOop) {
  2032 
  2039 
  2033   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)); }
  2040   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)); }
  2034 
  2041 
  2035   void fpop_raw()                                { append(new LIR_Op0(lir_fpop_raw)); }
  2042   void fpop_raw()                                { append(new LIR_Op0(lir_fpop_raw)); }
  2036 
  2043 
       
  2044   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);
       
  2045   void store_check(LIR_Opr object, LIR_Opr array, LIR_Opr tmp1, LIR_Opr tmp2, LIR_Opr tmp3, CodeEmitInfo* info_for_exception);
       
  2046 
  2037   void checkcast (LIR_Opr result, LIR_Opr object, ciKlass* klass,
  2047   void checkcast (LIR_Opr result, LIR_Opr object, ciKlass* klass,
  2038                   LIR_Opr tmp1, LIR_Opr tmp2, LIR_Opr tmp3, bool fast_check,
  2048                   LIR_Opr tmp1, LIR_Opr tmp2, LIR_Opr tmp3, bool fast_check,
  2039                   CodeEmitInfo* info_for_exception, CodeEmitInfo* info_for_patch, CodeStub* stub,
  2049                   CodeEmitInfo* info_for_exception, CodeEmitInfo* info_for_patch, CodeStub* stub,
  2040                   ciMethod* profiled_method, int profiled_bci);
  2050                   ciMethod* profiled_method, int profiled_bci);
  2041   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);
       
  2042   void store_check(LIR_Opr object, LIR_Opr array, LIR_Opr tmp1, LIR_Opr tmp2, LIR_Opr tmp3, CodeEmitInfo* info_for_exception);
       
  2043 
       
  2044   // methodDataOop profiling
  2051   // methodDataOop profiling
  2045   void profile_call(ciMethod* method, int bci, LIR_Opr mdo, LIR_Opr recv, LIR_Opr t1, ciKlass* cha_klass) { append(new LIR_OpProfileCall(lir_profile_call, method, bci, mdo, recv, t1, cha_klass)); }
  2052   void profile_call(ciMethod* method, int bci, LIR_Opr mdo, LIR_Opr recv, LIR_Opr t1, ciKlass* cha_klass) {
       
  2053     append(new LIR_OpProfileCall(lir_profile_call, method, bci, mdo, recv, t1, cha_klass));
       
  2054   }
  2046 };
  2055 };
  2047 
  2056 
  2048 void print_LIR(BlockList* blocks);
  2057 void print_LIR(BlockList* blocks);
  2049 
  2058 
  2050 class LIR_InsertionBuffer : public CompilationResourceObj {
  2059 class LIR_InsertionBuffer : public CompilationResourceObj {