16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 *
25 */
26
27 #include "asm/macroAssembler.inline.hpp"
28 #include "c1/c1_Compilation.hpp"
29 #include "c1/c1_FrameMap.hpp"
30 #include "c1/c1_Instruction.hpp"
31 #include "c1/c1_LIRAssembler.hpp"
32 #include "c1/c1_LIRGenerator.hpp"
33 #include "c1/c1_Runtime1.hpp"
34 #include "c1/c1_ValueStack.hpp"
35 #include "ci/ciArray.hpp"
36 #include "ci/ciObjArrayKlass.hpp"
37 #include "ci/ciTypeArrayKlass.hpp"
38 #include "runtime/sharedRuntime.hpp"
39 #include "runtime/stubRoutines.hpp"
40 #include "utilities/powerOfTwo.hpp"
41 #include "vmreg_riscv.inline.hpp"
42
43 #ifdef ASSERT
44 #define __ gen()->lir(__FILE__, __LINE__)->
45 #else
46 #define __ gen()->lir()->
47 #endif
48
49 // Item will be loaded into a byte register; Intel only
50 void LIRItem::load_byte_item() {
51 load_item();
52 }
53
54
55 void LIRItem::load_nonconstant() {
86 case floatTag: opr = FrameMap::fpu10_float_opr; break;
87 case doubleTag: opr = FrameMap::fpu10_double_opr; break;
88
89 case addressTag: // fall through
90 default:
91 ShouldNotReachHere();
92 return LIR_OprFact::illegalOpr;
93 }
94
95 assert(opr->type_field() == as_OprType(as_BasicType(type)), "type mismatch");
96 return opr;
97 }
98
99
100 LIR_Opr LIRGenerator::rlock_byte(BasicType type) {
101 LIR_Opr reg = new_register(T_INT);
102 set_vreg_flag(reg, LIRGenerator::byte_reg);
103 return reg;
104 }
105
106 //--------- loading items into registers --------------------------------
107
108
109 bool LIRGenerator::can_store_as_constant(Value v, BasicType type) const {
110 if (v->type()->as_IntConstant() != nullptr) {
111 return v->type()->as_IntConstant()->value() == 0;
112 } else if (v->type()->as_LongConstant() != nullptr) {
113 return v->type()->as_LongConstant()->value() == 0;
114 } else if (v->type()->as_ObjectConstant() != nullptr) {
115 return v->type()->as_ObjectConstant()->value()->is_null_object();
116 } else if (v->type()->as_FloatConstant() != nullptr) {
117 return jint_cast(v->type()->as_FloatConstant()->value()) == 0.0f;
118 } else if (v->type()->as_DoubleConstant() != nullptr) {
119 return jlong_cast(v->type()->as_DoubleConstant()->value()) == 0.0;
120 }
121 return false;
122 }
123
124 bool LIRGenerator::can_inline_as_constant(Value v) const {
125 if (v->type()->as_IntConstant() != nullptr) {
262
263 //----------------------------------------------------------------------
264 // visitor functions
265 //----------------------------------------------------------------------
266
267 void LIRGenerator::do_MonitorEnter(MonitorEnter* x) {
268 assert(x->is_pinned(), "");
269 LIRItem obj(x->obj(), this);
270 obj.load_item();
271
272 set_no_result(x);
273
274 // "lock" stores the address of the monitor stack slot, so this is not an oop
275 LIR_Opr lock = new_register(T_INT);
276 LIR_Opr scratch = new_register(T_INT);
277
278 CodeEmitInfo* info_for_exception = nullptr;
279 if (x->needs_null_check()) {
280 info_for_exception = state_for(x);
281 }
282 // this CodeEmitInfo must not have the xhandlers because here the
283 // object is already locked (xhandlers expect object to be unlocked)
284 CodeEmitInfo* info = state_for(x, x->state(), true);
285 monitor_enter(obj.result(), lock, syncTempOpr(), scratch,
286 x->monitor_no(), info_for_exception, info);
287 }
288
289 void LIRGenerator::do_MonitorExit(MonitorExit* x) {
290 assert(x->is_pinned(), "");
291
292 LIRItem obj(x->obj(), this);
293 obj.dont_load_item();
294
295 LIR_Opr lock = new_register(T_INT);
296 LIR_Opr obj_temp = new_register(T_INT);
297 LIR_Opr scratch = new_register(T_INT);
298 set_no_result(x);
299 monitor_exit(obj_temp, lock, syncTempOpr(), scratch, x->monitor_no());
300 }
301
302 // neg
303 void LIRGenerator::do_NegateOp(NegateOp* x) {
304 LIRItem from(x->x(), this);
305 from.load_item();
306 LIR_Opr result = rlock_result(x);
893 value.load_item();
894 LIR_Opr input = value.result();
895 LIR_Opr result = rlock(x);
896
897 // arguments of lir_convert
898 LIR_Opr conv_input = input;
899 LIR_Opr conv_result = result;
900
901 __ convert(x->op(), conv_input, conv_result);
902
903 assert(result->is_virtual(), "result must be virtual register");
904 set_result(x, result);
905 }
906
907 void LIRGenerator::do_NewInstance(NewInstance* x) {
908 #ifndef PRODUCT
909 if (PrintNotLoaded && !x->klass()->is_loaded()) {
910 tty->print_cr(" ###class not loaded at new bci %d", x->printable_bci());
911 }
912 #endif
913 CodeEmitInfo* info = state_for(x, x->state());
914 LIR_Opr reg = result_register_for(x->type());
915 new_instance(reg, x->klass(), x->is_unresolved(),
916 FrameMap::r12_oop_opr,
917 FrameMap::r15_oop_opr,
918 FrameMap::r14_oop_opr,
919 LIR_OprFact::illegalOpr,
920 FrameMap::r13_metadata_opr,
921 info);
922 LIR_Opr result = rlock_result(x);
923 __ move(reg, result);
924 }
925
926 void LIRGenerator::do_NewTypeArray(NewTypeArray* x) {
927 CodeEmitInfo* info = nullptr;
928 if (x->state_before() != nullptr && x->state_before()->force_reexecute()) {
929 info = state_for(x, x->state_before());
930 info->set_force_reexecute();
931 } else {
932 info = state_for(x, x->state());
933 }
934
935 LIRItem length(x->length(), this);
936 length.load_item_force(FrameMap::r9_opr);
937
938 LIR_Opr reg = result_register_for(x->type());
939 LIR_Opr tmp1 = FrameMap::r12_oop_opr;
940 LIR_Opr tmp2 = FrameMap::r14_oop_opr;
941 LIR_Opr tmp3 = FrameMap::r15_oop_opr;
957 LIRItem length(x->length(), this);
958 // in case of patching (i.e., object class is not yet loaded), we need to reexecute the instruction
959 // and therefore provide the state before the parameters have been consumed
960 CodeEmitInfo* patching_info = nullptr;
961 if (!x->klass()->is_loaded() || PatchALot) {
962 patching_info = state_for(x, x->state_before());
963 }
964
965 CodeEmitInfo* info = state_for(x, x->state());
966
967 LIR_Opr reg = result_register_for(x->type());
968 LIR_Opr tmp1 = FrameMap::r12_oop_opr;
969 LIR_Opr tmp2 = FrameMap::r14_oop_opr;
970 LIR_Opr tmp3 = FrameMap::r15_oop_opr;
971 LIR_Opr tmp4 = reg;
972 LIR_Opr klass_reg = FrameMap::r13_metadata_opr;
973
974 length.load_item_force(FrameMap::r9_opr);
975 LIR_Opr len = length.result();
976
977 CodeStub* slow_path = new NewObjectArrayStub(klass_reg, len, reg, info);
978 ciKlass* obj = (ciKlass*) ciObjArrayKlass::make(x->klass());
979 if (obj == ciEnv::unloaded_ciobjarrayklass()) {
980 BAILOUT("encountered unloaded_ciobjarrayklass due to out of memory error");
981 }
982 klass2reg_with_patching(klass_reg, obj, patching_info);
983 __ allocate_array(reg, len, tmp1, tmp2, tmp3, tmp4, T_OBJECT, klass_reg, slow_path);
984
985 LIR_Opr result = rlock_result(x);
986 __ move(reg, result);
987 }
988
989
990 void LIRGenerator::do_NewMultiArray(NewMultiArray* x) {
991 Values* dims = x->dims();
992 int i = dims->length();
993 LIRItemList* items = new LIRItemList(i, i, nullptr);
994 while (i-- > 0) {
995 LIRItem* size = new LIRItem(dims->at(i), this);
996 items->at_put(i, size);
997 }
998
999 // Evaluate state_for early since it may emit code.
1000 CodeEmitInfo* patching_info = nullptr;
1001 if (!x->klass()->is_loaded() || PatchALot) {
1002 patching_info = state_for(x, x->state_before());
1003
1060
1061 CodeStub* stub = nullptr;
1062 if (x->is_incompatible_class_change_check()) {
1063 assert(patching_info == nullptr, "can't patch this");
1064 stub = new SimpleExceptionStub(StubId::c1_throw_incompatible_class_change_error_id, LIR_OprFact::illegalOpr,
1065 info_for_exception);
1066 } else if (x->is_invokespecial_receiver_check()) {
1067 assert(patching_info == nullptr, "can't patch this");
1068 stub = new DeoptimizeStub(info_for_exception,
1069 Deoptimization::Reason_class_check,
1070 Deoptimization::Action_none);
1071 } else {
1072 stub = new SimpleExceptionStub(StubId::c1_throw_class_cast_exception_id, obj.result(), info_for_exception);
1073 }
1074 LIR_Opr reg = rlock_result(x);
1075 LIR_Opr tmp3 = LIR_OprFact::illegalOpr;
1076 tmp3 = new_register(objectType);
1077 __ checkcast(reg, obj.result(), x->klass(),
1078 new_register(objectType), new_register(objectType), tmp3,
1079 x->direct_compare(), info_for_exception, patching_info, stub,
1080 x->profiled_method(), x->profiled_bci());
1081 }
1082
1083 void LIRGenerator::do_InstanceOf(InstanceOf* x) {
1084 LIRItem obj(x->obj(), this);
1085
1086 // result and test object may not be in same register
1087 LIR_Opr reg = rlock_result(x);
1088 CodeEmitInfo* patching_info = nullptr;
1089 if ((!x->klass()->is_loaded() || PatchALot)) {
1090 // must do this before locking the destination register as an oop register
1091 patching_info = state_for(x, x->state_before());
1092 }
1093 obj.load_item();
1094 LIR_Opr tmp3 = LIR_OprFact::illegalOpr;
1095 tmp3 = new_register(objectType);
1096 __ instanceof(reg, obj.result(), x->klass(),
1097 new_register(objectType), new_register(objectType), tmp3,
1098 x->direct_compare(), patching_info, x->profiled_method(), x->profiled_bci());
1099 }
1100
1125 yin = &xitem;
1126 }
1127 xin->set_destroys_register();
1128 }
1129 xin->load_item();
1130 yin->load_item();
1131
1132 set_no_result(x);
1133
1134 LIR_Opr left = xin->result();
1135 LIR_Opr right = yin->result();
1136
1137 // add safepoint before generating condition code so it can be recomputed
1138 if (x->is_safepoint()) {
1139 // increment backedge counter if needed
1140 increment_backedge_counter_conditionally(lir_cond(cond), left, right, state_for(x, x->state_before()),
1141 x->tsux()->bci(), x->fsux()->bci(), x->profiled_bci());
1142 __ safepoint(LIR_OprFact::illegalOpr, state_for(x, x->state_before()));
1143 }
1144
1145 // Generate branch profiling. Profiling code doesn't kill flags.
1146 __ cmp(lir_cond(cond), left, right);
1147 profile_branch(x, cond);
1148 move_to_phi(x->state());
1149 if (x->x()->type()->is_float_kind()) {
1150 __ branch(lir_cond(cond), x->tsux(), x->usux());
1151 } else {
1152 __ branch(lir_cond(cond), x->tsux());
1153 }
1154 assert(x->default_sux() == x->fsux(), "wrong destination above");
1155 __ jump(x->default_sux());
1156 }
1157
1158 LIR_Opr LIRGenerator::getThreadPointer() {
1159 return FrameMap::as_pointer_opr(xthread);
1160 }
1161
1162 void LIRGenerator::trace_block_entry(BlockBegin* block) { Unimplemented(); }
1163
1164 void LIRGenerator::volatile_field_store(LIR_Opr value, LIR_Address* address,
1165 CodeEmitInfo* info) {
1166 __ volatile_store_mem_reg(value, address, info);
|
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 *
25 */
26
27 #include "asm/macroAssembler.inline.hpp"
28 #include "c1/c1_Compilation.hpp"
29 #include "c1/c1_FrameMap.hpp"
30 #include "c1/c1_Instruction.hpp"
31 #include "c1/c1_LIRAssembler.hpp"
32 #include "c1/c1_LIRGenerator.hpp"
33 #include "c1/c1_Runtime1.hpp"
34 #include "c1/c1_ValueStack.hpp"
35 #include "ci/ciArray.hpp"
36 #include "ci/ciInstanceKlass.hpp"
37 #include "ci/ciObjArrayKlass.hpp"
38 #include "ci/ciTypeArrayKlass.hpp"
39 #include "runtime/sharedRuntime.hpp"
40 #include "runtime/stubRoutines.hpp"
41 #include "utilities/powerOfTwo.hpp"
42 #include "vmreg_riscv.inline.hpp"
43
44 #ifdef ASSERT
45 #define __ gen()->lir(__FILE__, __LINE__)->
46 #else
47 #define __ gen()->lir()->
48 #endif
49
50 // Item will be loaded into a byte register; Intel only
51 void LIRItem::load_byte_item() {
52 load_item();
53 }
54
55
56 void LIRItem::load_nonconstant() {
87 case floatTag: opr = FrameMap::fpu10_float_opr; break;
88 case doubleTag: opr = FrameMap::fpu10_double_opr; break;
89
90 case addressTag: // fall through
91 default:
92 ShouldNotReachHere();
93 return LIR_OprFact::illegalOpr;
94 }
95
96 assert(opr->type_field() == as_OprType(as_BasicType(type)), "type mismatch");
97 return opr;
98 }
99
100
101 LIR_Opr LIRGenerator::rlock_byte(BasicType type) {
102 LIR_Opr reg = new_register(T_INT);
103 set_vreg_flag(reg, LIRGenerator::byte_reg);
104 return reg;
105 }
106
107
108 //--------- loading items into registers --------------------------------
109
110
111 bool LIRGenerator::can_store_as_constant(Value v, BasicType type) const {
112 if (v->type()->as_IntConstant() != nullptr) {
113 return v->type()->as_IntConstant()->value() == 0;
114 } else if (v->type()->as_LongConstant() != nullptr) {
115 return v->type()->as_LongConstant()->value() == 0;
116 } else if (v->type()->as_ObjectConstant() != nullptr) {
117 return v->type()->as_ObjectConstant()->value()->is_null_object();
118 } else if (v->type()->as_FloatConstant() != nullptr) {
119 return jint_cast(v->type()->as_FloatConstant()->value()) == 0.0f;
120 } else if (v->type()->as_DoubleConstant() != nullptr) {
121 return jlong_cast(v->type()->as_DoubleConstant()->value()) == 0.0;
122 }
123 return false;
124 }
125
126 bool LIRGenerator::can_inline_as_constant(Value v) const {
127 if (v->type()->as_IntConstant() != nullptr) {
264
265 //----------------------------------------------------------------------
266 // visitor functions
267 //----------------------------------------------------------------------
268
269 void LIRGenerator::do_MonitorEnter(MonitorEnter* x) {
270 assert(x->is_pinned(), "");
271 LIRItem obj(x->obj(), this);
272 obj.load_item();
273
274 set_no_result(x);
275
276 // "lock" stores the address of the monitor stack slot, so this is not an oop
277 LIR_Opr lock = new_register(T_INT);
278 LIR_Opr scratch = new_register(T_INT);
279
280 CodeEmitInfo* info_for_exception = nullptr;
281 if (x->needs_null_check()) {
282 info_for_exception = state_for(x);
283 }
284
285 CodeStub* throw_ie_stub =
286 x->maybe_inlinetype() ?
287 new SimpleExceptionStub(StubId::c1_throw_identity_exception_id, obj.result(), state_for(x)) :
288 nullptr;
289
290 // this CodeEmitInfo must not have the xhandlers because here the
291 // object is already locked (xhandlers expect object to be unlocked)
292 CodeEmitInfo* info = state_for(x, x->state(), true);
293 monitor_enter(obj.result(), lock, syncTempOpr(), scratch,
294 x->monitor_no(), info_for_exception, info, throw_ie_stub);
295 }
296
297 void LIRGenerator::do_MonitorExit(MonitorExit* x) {
298 assert(x->is_pinned(), "");
299
300 LIRItem obj(x->obj(), this);
301 obj.dont_load_item();
302
303 LIR_Opr lock = new_register(T_INT);
304 LIR_Opr obj_temp = new_register(T_INT);
305 LIR_Opr scratch = new_register(T_INT);
306 set_no_result(x);
307 monitor_exit(obj_temp, lock, syncTempOpr(), scratch, x->monitor_no());
308 }
309
310 // neg
311 void LIRGenerator::do_NegateOp(NegateOp* x) {
312 LIRItem from(x->x(), this);
313 from.load_item();
314 LIR_Opr result = rlock_result(x);
901 value.load_item();
902 LIR_Opr input = value.result();
903 LIR_Opr result = rlock(x);
904
905 // arguments of lir_convert
906 LIR_Opr conv_input = input;
907 LIR_Opr conv_result = result;
908
909 __ convert(x->op(), conv_input, conv_result);
910
911 assert(result->is_virtual(), "result must be virtual register");
912 set_result(x, result);
913 }
914
915 void LIRGenerator::do_NewInstance(NewInstance* x) {
916 #ifndef PRODUCT
917 if (PrintNotLoaded && !x->klass()->is_loaded()) {
918 tty->print_cr(" ###class not loaded at new bci %d", x->printable_bci());
919 }
920 #endif
921 CodeEmitInfo* info = state_for(x, x->needs_state_before() ? x->state_before() : x->state());
922 LIR_Opr reg = result_register_for(x->type());
923 new_instance(reg, x->klass(), x->is_unresolved(),
924 !x->is_unresolved() && x->klass()->is_inlinetype(),
925 FrameMap::r12_oop_opr,
926 FrameMap::r15_oop_opr,
927 FrameMap::r14_oop_opr,
928 LIR_OprFact::illegalOpr,
929 FrameMap::r13_metadata_opr,
930 info);
931
932 LIR_Opr result = rlock_result(x);
933 __ move(reg, result);
934 }
935
936 void LIRGenerator::do_NewTypeArray(NewTypeArray* x) {
937 CodeEmitInfo* info = nullptr;
938 if (x->state_before() != nullptr && x->state_before()->force_reexecute()) {
939 info = state_for(x, x->state_before());
940 info->set_force_reexecute();
941 } else {
942 info = state_for(x, x->state());
943 }
944
945 LIRItem length(x->length(), this);
946 length.load_item_force(FrameMap::r9_opr);
947
948 LIR_Opr reg = result_register_for(x->type());
949 LIR_Opr tmp1 = FrameMap::r12_oop_opr;
950 LIR_Opr tmp2 = FrameMap::r14_oop_opr;
951 LIR_Opr tmp3 = FrameMap::r15_oop_opr;
967 LIRItem length(x->length(), this);
968 // in case of patching (i.e., object class is not yet loaded), we need to reexecute the instruction
969 // and therefore provide the state before the parameters have been consumed
970 CodeEmitInfo* patching_info = nullptr;
971 if (!x->klass()->is_loaded() || PatchALot) {
972 patching_info = state_for(x, x->state_before());
973 }
974
975 CodeEmitInfo* info = state_for(x, x->state());
976
977 LIR_Opr reg = result_register_for(x->type());
978 LIR_Opr tmp1 = FrameMap::r12_oop_opr;
979 LIR_Opr tmp2 = FrameMap::r14_oop_opr;
980 LIR_Opr tmp3 = FrameMap::r15_oop_opr;
981 LIR_Opr tmp4 = reg;
982 LIR_Opr klass_reg = FrameMap::r13_metadata_opr;
983
984 length.load_item_force(FrameMap::r9_opr);
985 LIR_Opr len = length.result();
986
987 ciKlass* obj = ciObjArrayKlass::make(x->klass());
988
989 // TODO 8265122 Implement a fast path for this
990 bool is_flat = obj->is_loaded() && obj->is_flat_array_klass();
991 bool is_null_free = obj->is_loaded() && obj->as_array_klass()->is_elem_null_free();
992
993 CodeStub* slow_path = new NewObjectArrayStub(klass_reg, len, reg, info, is_null_free);
994
995 if (obj == ciEnv::unloaded_ciobjarrayklass()) {
996 BAILOUT("encountered unloaded_ciobjarrayklass due to out of memory error");
997 }
998 klass2reg_with_patching(klass_reg, obj, patching_info);
999 __ allocate_array(reg, len, tmp1, tmp2, tmp3, tmp4, T_OBJECT, klass_reg, slow_path, true, is_null_free || is_flat);
1000
1001 LIR_Opr result = rlock_result(x);
1002 __ move(reg, result);
1003 }
1004
1005
1006 void LIRGenerator::do_NewMultiArray(NewMultiArray* x) {
1007 Values* dims = x->dims();
1008 int i = dims->length();
1009 LIRItemList* items = new LIRItemList(i, i, nullptr);
1010 while (i-- > 0) {
1011 LIRItem* size = new LIRItem(dims->at(i), this);
1012 items->at_put(i, size);
1013 }
1014
1015 // Evaluate state_for early since it may emit code.
1016 CodeEmitInfo* patching_info = nullptr;
1017 if (!x->klass()->is_loaded() || PatchALot) {
1018 patching_info = state_for(x, x->state_before());
1019
1076
1077 CodeStub* stub = nullptr;
1078 if (x->is_incompatible_class_change_check()) {
1079 assert(patching_info == nullptr, "can't patch this");
1080 stub = new SimpleExceptionStub(StubId::c1_throw_incompatible_class_change_error_id, LIR_OprFact::illegalOpr,
1081 info_for_exception);
1082 } else if (x->is_invokespecial_receiver_check()) {
1083 assert(patching_info == nullptr, "can't patch this");
1084 stub = new DeoptimizeStub(info_for_exception,
1085 Deoptimization::Reason_class_check,
1086 Deoptimization::Action_none);
1087 } else {
1088 stub = new SimpleExceptionStub(StubId::c1_throw_class_cast_exception_id, obj.result(), info_for_exception);
1089 }
1090 LIR_Opr reg = rlock_result(x);
1091 LIR_Opr tmp3 = LIR_OprFact::illegalOpr;
1092 tmp3 = new_register(objectType);
1093 __ checkcast(reg, obj.result(), x->klass(),
1094 new_register(objectType), new_register(objectType), tmp3,
1095 x->direct_compare(), info_for_exception, patching_info, stub,
1096 x->profiled_method(), x->profiled_bci(), x->is_null_free());
1097 }
1098
1099 void LIRGenerator::do_InstanceOf(InstanceOf* x) {
1100 LIRItem obj(x->obj(), this);
1101
1102 // result and test object may not be in same register
1103 LIR_Opr reg = rlock_result(x);
1104 CodeEmitInfo* patching_info = nullptr;
1105 if ((!x->klass()->is_loaded() || PatchALot)) {
1106 // must do this before locking the destination register as an oop register
1107 patching_info = state_for(x, x->state_before());
1108 }
1109 obj.load_item();
1110 LIR_Opr tmp3 = LIR_OprFact::illegalOpr;
1111 tmp3 = new_register(objectType);
1112 __ instanceof(reg, obj.result(), x->klass(),
1113 new_register(objectType), new_register(objectType), tmp3,
1114 x->direct_compare(), patching_info, x->profiled_method(), x->profiled_bci());
1115 }
1116
1141 yin = &xitem;
1142 }
1143 xin->set_destroys_register();
1144 }
1145 xin->load_item();
1146 yin->load_item();
1147
1148 set_no_result(x);
1149
1150 LIR_Opr left = xin->result();
1151 LIR_Opr right = yin->result();
1152
1153 // add safepoint before generating condition code so it can be recomputed
1154 if (x->is_safepoint()) {
1155 // increment backedge counter if needed
1156 increment_backedge_counter_conditionally(lir_cond(cond), left, right, state_for(x, x->state_before()),
1157 x->tsux()->bci(), x->fsux()->bci(), x->profiled_bci());
1158 __ safepoint(LIR_OprFact::illegalOpr, state_for(x, x->state_before()));
1159 }
1160
1161 if (x->substitutability_check()) {
1162 substitutability_check(x, *xin, *yin);
1163 } else {
1164 __ cmp(lir_cond(cond), left, right);
1165 }
1166
1167 // Generate branch profiling. Profiling code doesn't kill flags.
1168 profile_branch(x, cond);
1169 move_to_phi(x->state());
1170 if (x->x()->type()->is_float_kind()) {
1171 __ branch(lir_cond(cond), x->tsux(), x->usux());
1172 } else {
1173 __ branch(lir_cond(cond), x->tsux());
1174 }
1175 assert(x->default_sux() == x->fsux(), "wrong destination above");
1176 __ jump(x->default_sux());
1177 }
1178
1179 LIR_Opr LIRGenerator::getThreadPointer() {
1180 return FrameMap::as_pointer_opr(xthread);
1181 }
1182
1183 void LIRGenerator::trace_block_entry(BlockBegin* block) { Unimplemented(); }
1184
1185 void LIRGenerator::volatile_field_store(LIR_Opr value, LIR_Address* address,
1186 CodeEmitInfo* info) {
1187 __ volatile_store_mem_reg(value, address, info);
|