comparison src/share/vm/c1/c1_LIR.hpp @ 1330:4a9cc99938e3

Merge
author acorn
date Fri, 26 Mar 2010 11:10:26 -0400
parents c466efa608d5
children 9f5b60a14736
comparison
equal deleted inserted replaced
1329:84043c7507b9 1330:4a9cc99938e3
83 private: 83 private:
84 JavaValue _value; 84 JavaValue _value;
85 85
86 void type_check(BasicType t) const { assert(type() == t, "type check"); } 86 void type_check(BasicType t) const { assert(type() == t, "type check"); }
87 void type_check(BasicType t1, BasicType t2) const { assert(type() == t1 || type() == t2, "type check"); } 87 void type_check(BasicType t1, BasicType t2) const { assert(type() == t1 || type() == t2, "type check"); }
88 88 void type_check(BasicType t1, BasicType t2, BasicType t3) const { assert(type() == t1 || type() == t2 || type() == t3, "type check"); }
89 public: 89
90 LIR_Const(jint i) { _value.set_type(T_INT); _value.set_jint(i); } 90 public:
91 LIR_Const(jint i, bool is_address=false) { _value.set_type(is_address?T_ADDRESS:T_INT); _value.set_jint(i); }
91 LIR_Const(jlong l) { _value.set_type(T_LONG); _value.set_jlong(l); } 92 LIR_Const(jlong l) { _value.set_type(T_LONG); _value.set_jlong(l); }
92 LIR_Const(jfloat f) { _value.set_type(T_FLOAT); _value.set_jfloat(f); } 93 LIR_Const(jfloat f) { _value.set_type(T_FLOAT); _value.set_jfloat(f); }
93 LIR_Const(jdouble d) { _value.set_type(T_DOUBLE); _value.set_jdouble(d); } 94 LIR_Const(jdouble d) { _value.set_type(T_DOUBLE); _value.set_jdouble(d); }
94 LIR_Const(jobject o) { _value.set_type(T_OBJECT); _value.set_jobject(o); } 95 LIR_Const(jobject o) { _value.set_type(T_OBJECT); _value.set_jobject(o); }
95 LIR_Const(void* p) { 96 LIR_Const(void* p) {
103 } 104 }
104 105
105 virtual BasicType type() const { return _value.get_type(); } 106 virtual BasicType type() const { return _value.get_type(); }
106 virtual LIR_Const* as_constant() { return this; } 107 virtual LIR_Const* as_constant() { return this; }
107 108
108 jint as_jint() const { type_check(T_INT ); return _value.get_jint(); } 109 jint as_jint() const { type_check(T_INT, T_ADDRESS); return _value.get_jint(); }
109 jlong as_jlong() const { type_check(T_LONG ); return _value.get_jlong(); } 110 jlong as_jlong() const { type_check(T_LONG ); return _value.get_jlong(); }
110 jfloat as_jfloat() const { type_check(T_FLOAT ); return _value.get_jfloat(); } 111 jfloat as_jfloat() const { type_check(T_FLOAT ); return _value.get_jfloat(); }
111 jdouble as_jdouble() const { type_check(T_DOUBLE); return _value.get_jdouble(); } 112 jdouble as_jdouble() const { type_check(T_DOUBLE); return _value.get_jdouble(); }
112 jobject as_jobject() const { type_check(T_OBJECT); return _value.get_jobject(); } 113 jobject as_jobject() const { type_check(T_OBJECT); return _value.get_jobject(); }
113 jint as_jint_lo() const { type_check(T_LONG ); return low(_value.get_jlong()); } 114 jint as_jint_lo() const { type_check(T_LONG ); return low(_value.get_jlong()); }
118 #else 119 #else
119 address as_pointer() const { type_check(T_INT ); return (address)_value.get_jint(); } 120 address as_pointer() const { type_check(T_INT ); return (address)_value.get_jint(); }
120 #endif 121 #endif
121 122
122 123
123 jint as_jint_bits() const { type_check(T_FLOAT, T_INT); return _value.get_jint(); } 124 jint as_jint_bits() const { type_check(T_FLOAT, T_INT, T_ADDRESS); return _value.get_jint(); }
124 jint as_jint_lo_bits() const { 125 jint as_jint_lo_bits() const {
125 if (type() == T_DOUBLE) { 126 if (type() == T_DOUBLE) {
126 return low(jlong_cast(_value.get_jdouble())); 127 return low(jlong_cast(_value.get_jdouble()));
127 } else { 128 } else {
128 return as_jint_lo(); 129 return as_jint_lo();
716 static LIR_Opr oopConst(jobject o) { return (LIR_Opr)(new LIR_Const(o)); } 717 static LIR_Opr oopConst(jobject o) { return (LIR_Opr)(new LIR_Const(o)); }
717 static LIR_Opr address(LIR_Address* a) { return (LIR_Opr)a; } 718 static LIR_Opr address(LIR_Address* a) { return (LIR_Opr)a; }
718 static LIR_Opr intptrConst(void* p) { return (LIR_Opr)(new LIR_Const(p)); } 719 static LIR_Opr intptrConst(void* p) { return (LIR_Opr)(new LIR_Const(p)); }
719 static LIR_Opr intptrConst(intptr_t v) { return (LIR_Opr)(new LIR_Const((void*)v)); } 720 static LIR_Opr intptrConst(intptr_t v) { return (LIR_Opr)(new LIR_Const((void*)v)); }
720 static LIR_Opr illegal() { return (LIR_Opr)-1; } 721 static LIR_Opr illegal() { return (LIR_Opr)-1; }
722 static LIR_Opr addressConst(jint i) { return (LIR_Opr)(new LIR_Const(i, true)); }
721 723
722 static LIR_Opr value_type(ValueType* type); 724 static LIR_Opr value_type(ValueType* type);
723 static LIR_Opr dummy_value_type(ValueType* type); 725 static LIR_Opr dummy_value_type(ValueType* type);
724 }; 726 };
725 727
838 , begin_opJavaCall 840 , begin_opJavaCall
839 , lir_static_call 841 , lir_static_call
840 , lir_optvirtual_call 842 , lir_optvirtual_call
841 , lir_icvirtual_call 843 , lir_icvirtual_call
842 , lir_virtual_call 844 , lir_virtual_call
845 , lir_dynamic_call
843 , end_opJavaCall 846 , end_opJavaCall
844 , begin_opArrayCopy 847 , begin_opArrayCopy
845 , lir_arraycopy 848 , lir_arraycopy
846 , end_opArrayCopy 849 , end_opArrayCopy
847 , begin_opLock 850 , begin_opLock
1050 , _method(method) { assert(is_in_range(code, begin_opJavaCall, end_opJavaCall), "code check"); } 1053 , _method(method) { assert(is_in_range(code, begin_opJavaCall, end_opJavaCall), "code check"); }
1051 1054
1052 LIR_Opr receiver() const { return _receiver; } 1055 LIR_Opr receiver() const { return _receiver; }
1053 ciMethod* method() const { return _method; } 1056 ciMethod* method() const { return _method; }
1054 1057
1058 // JSR 292 support.
1059 bool is_invokedynamic() const { return code() == lir_dynamic_call; }
1060 bool is_method_handle_invoke() const {
1061 return
1062 is_invokedynamic() // An invokedynamic is always a MethodHandle call site.
1063 ||
1064 (method()->holder()->name() == ciSymbol::java_dyn_MethodHandle() &&
1065 method()->name() == ciSymbol::invoke_name());
1066 }
1067
1055 intptr_t vtable_offset() const { 1068 intptr_t vtable_offset() const {
1056 assert(_code == lir_virtual_call, "only have vtable for real vcall"); 1069 assert(_code == lir_virtual_call, "only have vtable for real vcall");
1057 return (intptr_t) addr(); 1070 return (intptr_t) addr();
1058 } 1071 }
1059 1072
1763 append(new LIR_OpJavaCall(lir_icvirtual_call, method, receiver, result, dest, arguments, info)); 1776 append(new LIR_OpJavaCall(lir_icvirtual_call, method, receiver, result, dest, arguments, info));
1764 } 1777 }
1765 void call_virtual(ciMethod* method, LIR_Opr receiver, LIR_Opr result, 1778 void call_virtual(ciMethod* method, LIR_Opr receiver, LIR_Opr result,
1766 intptr_t vtable_offset, LIR_OprList* arguments, CodeEmitInfo* info) { 1779 intptr_t vtable_offset, LIR_OprList* arguments, CodeEmitInfo* info) {
1767 append(new LIR_OpJavaCall(lir_virtual_call, method, receiver, result, vtable_offset, arguments, info)); 1780 append(new LIR_OpJavaCall(lir_virtual_call, method, receiver, result, vtable_offset, arguments, info));
1781 }
1782 void call_dynamic(ciMethod* method, LIR_Opr receiver, LIR_Opr result,
1783 address dest, LIR_OprList* arguments, CodeEmitInfo* info) {
1784 append(new LIR_OpJavaCall(lir_dynamic_call, method, receiver, result, dest, arguments, info));
1768 } 1785 }
1769 1786
1770 void get_thread(LIR_Opr result) { append(new LIR_Op0(lir_get_thread, result)); } 1787 void get_thread(LIR_Opr result) { append(new LIR_Op0(lir_get_thread, result)); }
1771 void word_align() { append(new LIR_Op0(lir_word_align)); } 1788 void word_align() { append(new LIR_Op0(lir_word_align)); }
1772 void membar() { append(new LIR_Op0(lir_membar)); } 1789 void membar() { append(new LIR_Op0(lir_membar)); }