18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19 *
20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
21 * or visit www.oracle.com if you need additional information or have any
22 * questions.
23 *
24 */
25
26 #include "precompiled.hpp"
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 "vmreg_aarch64.inline.hpp"
41
42 #ifdef ASSERT
43 #define __ gen()->lir(__FILE__, __LINE__)->
44 #else
45 #define __ gen()->lir()->
46 #endif
47
48 // Item will be loaded into a byte register; Intel only
49 void LIRItem::load_byte_item() {
50 load_item();
51 }
52
53
54 void LIRItem::load_nonconstant() {
55 LIR_Opr r = value()->operand();
56 if (r->is_constant()) {
57 _result = r;
84 case longTag: opr = FrameMap::long0_opr; break;
85 case floatTag: opr = FrameMap::fpu0_float_opr; break;
86 case doubleTag: opr = FrameMap::fpu0_double_opr; break;
87
88 case addressTag:
89 default: ShouldNotReachHere(); return LIR_OprFact::illegalOpr;
90 }
91
92 assert(opr->type_field() == as_OprType(as_BasicType(type)), "type mismatch");
93 return opr;
94 }
95
96
97 LIR_Opr LIRGenerator::rlock_byte(BasicType type) {
98 LIR_Opr reg = new_register(T_INT);
99 set_vreg_flag(reg, LIRGenerator::byte_reg);
100 return reg;
101 }
102
103
104 //--------- loading items into registers --------------------------------
105
106
107 bool LIRGenerator::can_store_as_constant(Value v, BasicType type) const {
108 if (v->type()->as_IntConstant() != NULL) {
109 return v->type()->as_IntConstant()->value() == 0L;
110 } else if (v->type()->as_LongConstant() != NULL) {
111 return v->type()->as_LongConstant()->value() == 0L;
112 } else if (v->type()->as_ObjectConstant() != NULL) {
113 return v->type()->as_ObjectConstant()->value()->is_null_object();
114 } else {
115 return false;
116 }
117 }
118
119 bool LIRGenerator::can_inline_as_constant(Value v) const {
120 // FIXME: Just a guess
121 if (v->type()->as_IntConstant() != NULL) {
122 return Assembler::operand_valid_for_add_sub_immediate(v->type()->as_IntConstant()->value());
123 } else if (v->type()->as_LongConstant() != NULL) {
315 LIR_Opr tmp2 = new_register(objectType);
316 LIR_Opr tmp3 = new_register(objectType);
317 __ store_check(value, array, tmp1, tmp2, tmp3, store_check_info, profiled_method, profiled_bci);
318 }
319
320 //----------------------------------------------------------------------
321 // visitor functions
322 //----------------------------------------------------------------------
323
324 void LIRGenerator::do_MonitorEnter(MonitorEnter* x) {
325 assert(x->is_pinned(),"");
326 LIRItem obj(x->obj(), this);
327 obj.load_item();
328
329 set_no_result(x);
330
331 // "lock" stores the address of the monitor stack slot, so this is not an oop
332 LIR_Opr lock = new_register(T_INT);
333 // Need a scratch register for biased locking
334 LIR_Opr scratch = LIR_OprFact::illegalOpr;
335 if (UseBiasedLocking) {
336 scratch = new_register(T_INT);
337 }
338
339 CodeEmitInfo* info_for_exception = NULL;
340 if (x->needs_null_check()) {
341 info_for_exception = state_for(x);
342 }
343 // this CodeEmitInfo must not have the xhandlers because here the
344 // object is already locked (xhandlers expect object to be unlocked)
345 CodeEmitInfo* info = state_for(x, x->state(), true);
346 monitor_enter(obj.result(), lock, syncTempOpr(), scratch,
347 x->monitor_no(), info_for_exception, info);
348 }
349
350
351 void LIRGenerator::do_MonitorExit(MonitorExit* x) {
352 assert(x->is_pinned(),"");
353
354 LIRItem obj(x->obj(), this);
355 obj.dont_load_item();
356
357 LIR_Opr lock = new_register(T_INT);
358 LIR_Opr obj_temp = new_register(T_INT);
359 set_no_result(x);
360 monitor_exit(obj_temp, lock, syncTempOpr(), LIR_OprFact::illegalOpr, x->monitor_no());
361 }
362
363
364 void LIRGenerator::do_NegateOp(NegateOp* x) {
365
366 LIRItem from(x->x(), this);
367 from.load_item();
1136 }
1137
1138 void LIRGenerator::do_NewInstance(NewInstance* x) {
1139 #ifndef PRODUCT
1140 if (PrintNotLoaded && !x->klass()->is_loaded()) {
1141 tty->print_cr(" ###class not loaded at new bci %d", x->printable_bci());
1142 }
1143 #endif
1144 CodeEmitInfo* info = state_for(x, x->state());
1145 LIR_Opr reg = result_register_for(x->type());
1146 new_instance(reg, x->klass(), x->is_unresolved(),
1147 FrameMap::r2_oop_opr,
1148 FrameMap::r5_oop_opr,
1149 FrameMap::r4_oop_opr,
1150 LIR_OprFact::illegalOpr,
1151 FrameMap::r3_metadata_opr, info);
1152 LIR_Opr result = rlock_result(x);
1153 __ move(reg, result);
1154 }
1155
1156 void LIRGenerator::do_NewTypeArray(NewTypeArray* x) {
1157 CodeEmitInfo* info = state_for(x, x->state());
1158
1159 LIRItem length(x->length(), this);
1160 length.load_item_force(FrameMap::r19_opr);
1161
1162 LIR_Opr reg = result_register_for(x->type());
1163 LIR_Opr tmp1 = FrameMap::r2_oop_opr;
1164 LIR_Opr tmp2 = FrameMap::r4_oop_opr;
1165 LIR_Opr tmp3 = FrameMap::r5_oop_opr;
1166 LIR_Opr tmp4 = reg;
1167 LIR_Opr klass_reg = FrameMap::r3_metadata_opr;
1168 LIR_Opr len = length.result();
1169 BasicType elem_type = x->elt_type();
1170
1171 __ metadata2reg(ciTypeArrayKlass::make(elem_type)->constant_encoding(), klass_reg);
1172
1173 CodeStub* slow_path = new NewTypeArrayStub(klass_reg, len, reg, info);
1174 __ allocate_array(reg, len, tmp1, tmp2, tmp3, tmp4, elem_type, klass_reg, slow_path);
1175
1181 LIRItem length(x->length(), this);
1182 // in case of patching (i.e., object class is not yet loaded), we need to reexecute the instruction
1183 // and therefore provide the state before the parameters have been consumed
1184 CodeEmitInfo* patching_info = NULL;
1185 if (!x->klass()->is_loaded() || PatchALot) {
1186 patching_info = state_for(x, x->state_before());
1187 }
1188
1189 CodeEmitInfo* info = state_for(x, x->state());
1190
1191 LIR_Opr reg = result_register_for(x->type());
1192 LIR_Opr tmp1 = FrameMap::r2_oop_opr;
1193 LIR_Opr tmp2 = FrameMap::r4_oop_opr;
1194 LIR_Opr tmp3 = FrameMap::r5_oop_opr;
1195 LIR_Opr tmp4 = reg;
1196 LIR_Opr klass_reg = FrameMap::r3_metadata_opr;
1197
1198 length.load_item_force(FrameMap::r19_opr);
1199 LIR_Opr len = length.result();
1200
1201 CodeStub* slow_path = new NewObjectArrayStub(klass_reg, len, reg, info);
1202 ciKlass* obj = (ciKlass*) ciObjArrayKlass::make(x->klass());
1203 if (obj == ciEnv::unloaded_ciobjarrayklass()) {
1204 BAILOUT("encountered unloaded_ciobjarrayklass due to out of memory error");
1205 }
1206 klass2reg_with_patching(klass_reg, obj, patching_info);
1207 __ allocate_array(reg, len, tmp1, tmp2, tmp3, tmp4, T_OBJECT, klass_reg, slow_path);
1208
1209 LIR_Opr result = rlock_result(x);
1210 __ move(reg, result);
1211 }
1212
1213
1214 void LIRGenerator::do_NewMultiArray(NewMultiArray* x) {
1215 Values* dims = x->dims();
1216 int i = dims->length();
1217 LIRItemList* items = new LIRItemList(i, i, NULL);
1218 while (i-- > 0) {
1219 LIRItem* size = new LIRItem(dims->at(i), this);
1220 items->at_put(i, size);
1221 }
1222
1223 // Evaluate state_for early since it may emit code.
1224 CodeEmitInfo* patching_info = NULL;
1225 if (!x->klass()->is_loaded() || PatchALot) {
1226 patching_info = state_for(x, x->state_before());
1227
1263
1264 void LIRGenerator::do_BlockBegin(BlockBegin* x) {
1265 // nothing to do for now
1266 }
1267
1268 void LIRGenerator::do_CheckCast(CheckCast* x) {
1269 LIRItem obj(x->obj(), this);
1270
1271 CodeEmitInfo* patching_info = NULL;
1272 if (!x->klass()->is_loaded() || (PatchALot && !x->is_incompatible_class_change_check() && !x->is_invokespecial_receiver_check())) {
1273 // must do this before locking the destination register as an oop register,
1274 // and before the obj is loaded (the latter is for deoptimization)
1275 patching_info = state_for(x, x->state_before());
1276 }
1277 obj.load_item();
1278
1279 // info for exceptions
1280 CodeEmitInfo* info_for_exception =
1281 (x->needs_exception_state() ? state_for(x) :
1282 state_for(x, x->state_before(), true /*ignore_xhandler*/));
1283
1284 CodeStub* stub;
1285 if (x->is_incompatible_class_change_check()) {
1286 assert(patching_info == NULL, "can't patch this");
1287 stub = new SimpleExceptionStub(Runtime1::throw_incompatible_class_change_error_id, LIR_OprFact::illegalOpr, info_for_exception);
1288 } else if (x->is_invokespecial_receiver_check()) {
1289 assert(patching_info == NULL, "can't patch this");
1290 stub = new DeoptimizeStub(info_for_exception,
1291 Deoptimization::Reason_class_check,
1292 Deoptimization::Action_none);
1293 } else {
1294 stub = new SimpleExceptionStub(Runtime1::throw_class_cast_exception_id, obj.result(), info_for_exception);
1295 }
1296 LIR_Opr reg = rlock_result(x);
1297 LIR_Opr tmp3 = LIR_OprFact::illegalOpr;
1298 if (!x->klass()->is_loaded() || UseCompressedClassPointers) {
1299 tmp3 = new_register(objectType);
1300 }
1301 __ checkcast(reg, obj.result(), x->klass(),
1302 new_register(objectType), new_register(objectType), tmp3,
1303 x->direct_compare(), info_for_exception, patching_info, stub,
1304 x->profiled_method(), x->profiled_bci());
1305 }
1306
1307 void LIRGenerator::do_InstanceOf(InstanceOf* x) {
1308 LIRItem obj(x->obj(), this);
1309
1310 // result and test object may not be in same register
1311 LIR_Opr reg = rlock_result(x);
1312 CodeEmitInfo* patching_info = NULL;
1313 if ((!x->klass()->is_loaded() || PatchALot)) {
1314 // must do this before locking the destination register as an oop register
1315 patching_info = state_for(x, x->state_before());
1316 }
1317 obj.load_item();
1318 LIR_Opr tmp3 = LIR_OprFact::illegalOpr;
1319 if (!x->klass()->is_loaded() || UseCompressedClassPointers) {
1320 tmp3 = new_register(objectType);
1321 }
1322 __ instanceof(reg, obj.result(), x->klass(),
1323 new_register(objectType), new_register(objectType), tmp3,
1324 x->direct_compare(), patching_info, x->profiled_method(), x->profiled_bci());
|
18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19 *
20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
21 * or visit www.oracle.com if you need additional information or have any
22 * questions.
23 *
24 */
25
26 #include "precompiled.hpp"
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 "ci/ciValueKlass.hpp"
39 #include "runtime/sharedRuntime.hpp"
40 #include "runtime/stubRoutines.hpp"
41 #include "vmreg_aarch64.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() {
56 LIR_Opr r = value()->operand();
57 if (r->is_constant()) {
58 _result = r;
85 case longTag: opr = FrameMap::long0_opr; break;
86 case floatTag: opr = FrameMap::fpu0_float_opr; break;
87 case doubleTag: opr = FrameMap::fpu0_double_opr; break;
88
89 case addressTag:
90 default: ShouldNotReachHere(); return LIR_OprFact::illegalOpr;
91 }
92
93 assert(opr->type_field() == as_OprType(as_BasicType(type)), "type mismatch");
94 return opr;
95 }
96
97
98 LIR_Opr LIRGenerator::rlock_byte(BasicType type) {
99 LIR_Opr reg = new_register(T_INT);
100 set_vreg_flag(reg, LIRGenerator::byte_reg);
101 return reg;
102 }
103
104
105 void LIRGenerator::init_temps_for_substitutability_check(LIR_Opr& tmp1, LIR_Opr& tmp2) {
106 tmp1 = new_register(T_INT);
107 tmp2 = LIR_OprFact::illegalOpr;
108 }
109
110
111 //--------- loading items into registers --------------------------------
112
113
114 bool LIRGenerator::can_store_as_constant(Value v, BasicType type) const {
115 if (v->type()->as_IntConstant() != NULL) {
116 return v->type()->as_IntConstant()->value() == 0L;
117 } else if (v->type()->as_LongConstant() != NULL) {
118 return v->type()->as_LongConstant()->value() == 0L;
119 } else if (v->type()->as_ObjectConstant() != NULL) {
120 return v->type()->as_ObjectConstant()->value()->is_null_object();
121 } else {
122 return false;
123 }
124 }
125
126 bool LIRGenerator::can_inline_as_constant(Value v) const {
127 // FIXME: Just a guess
128 if (v->type()->as_IntConstant() != NULL) {
129 return Assembler::operand_valid_for_add_sub_immediate(v->type()->as_IntConstant()->value());
130 } else if (v->type()->as_LongConstant() != NULL) {
322 LIR_Opr tmp2 = new_register(objectType);
323 LIR_Opr tmp3 = new_register(objectType);
324 __ store_check(value, array, tmp1, tmp2, tmp3, store_check_info, profiled_method, profiled_bci);
325 }
326
327 //----------------------------------------------------------------------
328 // visitor functions
329 //----------------------------------------------------------------------
330
331 void LIRGenerator::do_MonitorEnter(MonitorEnter* x) {
332 assert(x->is_pinned(),"");
333 LIRItem obj(x->obj(), this);
334 obj.load_item();
335
336 set_no_result(x);
337
338 // "lock" stores the address of the monitor stack slot, so this is not an oop
339 LIR_Opr lock = new_register(T_INT);
340 // Need a scratch register for biased locking
341 LIR_Opr scratch = LIR_OprFact::illegalOpr;
342 if (UseBiasedLocking || x->maybe_valuetype()) {
343 scratch = new_register(T_INT);
344 }
345
346 CodeEmitInfo* info_for_exception = NULL;
347 if (x->needs_null_check()) {
348 info_for_exception = state_for(x);
349 }
350
351 CodeStub* throw_imse_stub =
352 x->maybe_valuetype() ?
353 new SimpleExceptionStub(Runtime1::throw_illegal_monitor_state_exception_id, LIR_OprFact::illegalOpr, state_for(x)) :
354 NULL;
355
356 // this CodeEmitInfo must not have the xhandlers because here the
357 // object is already locked (xhandlers expect object to be unlocked)
358 CodeEmitInfo* info = state_for(x, x->state(), true);
359 monitor_enter(obj.result(), lock, syncTempOpr(), scratch,
360 x->monitor_no(), info_for_exception, info, throw_imse_stub);
361 }
362
363
364 void LIRGenerator::do_MonitorExit(MonitorExit* x) {
365 assert(x->is_pinned(),"");
366
367 LIRItem obj(x->obj(), this);
368 obj.dont_load_item();
369
370 LIR_Opr lock = new_register(T_INT);
371 LIR_Opr obj_temp = new_register(T_INT);
372 set_no_result(x);
373 monitor_exit(obj_temp, lock, syncTempOpr(), LIR_OprFact::illegalOpr, x->monitor_no());
374 }
375
376
377 void LIRGenerator::do_NegateOp(NegateOp* x) {
378
379 LIRItem from(x->x(), this);
380 from.load_item();
1149 }
1150
1151 void LIRGenerator::do_NewInstance(NewInstance* x) {
1152 #ifndef PRODUCT
1153 if (PrintNotLoaded && !x->klass()->is_loaded()) {
1154 tty->print_cr(" ###class not loaded at new bci %d", x->printable_bci());
1155 }
1156 #endif
1157 CodeEmitInfo* info = state_for(x, x->state());
1158 LIR_Opr reg = result_register_for(x->type());
1159 new_instance(reg, x->klass(), x->is_unresolved(),
1160 FrameMap::r2_oop_opr,
1161 FrameMap::r5_oop_opr,
1162 FrameMap::r4_oop_opr,
1163 LIR_OprFact::illegalOpr,
1164 FrameMap::r3_metadata_opr, info);
1165 LIR_Opr result = rlock_result(x);
1166 __ move(reg, result);
1167 }
1168
1169 void LIRGenerator::do_NewValueTypeInstance (NewValueTypeInstance* x) {
1170 // Mapping to do_NewInstance (same code)
1171 CodeEmitInfo* info = state_for(x, x->state());
1172 x->set_to_object_type();
1173 LIR_Opr reg = result_register_for(x->type());
1174 new_instance(reg, x->klass(), x->is_unresolved(),
1175 FrameMap::r2_oop_opr,
1176 FrameMap::r5_oop_opr,
1177 FrameMap::r4_oop_opr,
1178 LIR_OprFact::illegalOpr,
1179 FrameMap::r3_metadata_opr, info);
1180 LIR_Opr result = rlock_result(x);
1181 __ move(reg, result);
1182
1183 }
1184
1185 void LIRGenerator::do_NewTypeArray(NewTypeArray* x) {
1186 CodeEmitInfo* info = state_for(x, x->state());
1187
1188 LIRItem length(x->length(), this);
1189 length.load_item_force(FrameMap::r19_opr);
1190
1191 LIR_Opr reg = result_register_for(x->type());
1192 LIR_Opr tmp1 = FrameMap::r2_oop_opr;
1193 LIR_Opr tmp2 = FrameMap::r4_oop_opr;
1194 LIR_Opr tmp3 = FrameMap::r5_oop_opr;
1195 LIR_Opr tmp4 = reg;
1196 LIR_Opr klass_reg = FrameMap::r3_metadata_opr;
1197 LIR_Opr len = length.result();
1198 BasicType elem_type = x->elt_type();
1199
1200 __ metadata2reg(ciTypeArrayKlass::make(elem_type)->constant_encoding(), klass_reg);
1201
1202 CodeStub* slow_path = new NewTypeArrayStub(klass_reg, len, reg, info);
1203 __ allocate_array(reg, len, tmp1, tmp2, tmp3, tmp4, elem_type, klass_reg, slow_path);
1204
1210 LIRItem length(x->length(), this);
1211 // in case of patching (i.e., object class is not yet loaded), we need to reexecute the instruction
1212 // and therefore provide the state before the parameters have been consumed
1213 CodeEmitInfo* patching_info = NULL;
1214 if (!x->klass()->is_loaded() || PatchALot) {
1215 patching_info = state_for(x, x->state_before());
1216 }
1217
1218 CodeEmitInfo* info = state_for(x, x->state());
1219
1220 LIR_Opr reg = result_register_for(x->type());
1221 LIR_Opr tmp1 = FrameMap::r2_oop_opr;
1222 LIR_Opr tmp2 = FrameMap::r4_oop_opr;
1223 LIR_Opr tmp3 = FrameMap::r5_oop_opr;
1224 LIR_Opr tmp4 = reg;
1225 LIR_Opr klass_reg = FrameMap::r3_metadata_opr;
1226
1227 length.load_item_force(FrameMap::r19_opr);
1228 LIR_Opr len = length.result();
1229
1230 ciKlass* obj = (ciKlass*) x->exact_type();
1231 CodeStub* slow_path = new NewObjectArrayStub(klass_reg, len, reg, info, x->is_never_null());
1232 if (obj == ciEnv::unloaded_ciobjarrayklass()) {
1233 BAILOUT("encountered unloaded_ciobjarrayklass due to out of memory error");
1234 }
1235
1236 klass2reg_with_patching(klass_reg, obj, patching_info);
1237 if (x->is_never_null()) {
1238 __ allocate_array(reg, len, tmp1, tmp2, tmp3, tmp4, T_VALUETYPE, klass_reg, slow_path);
1239 } else {
1240 __ allocate_array(reg, len, tmp1, tmp2, tmp3, tmp4, T_OBJECT, klass_reg, slow_path);
1241 }
1242
1243 LIR_Opr result = rlock_result(x);
1244 __ move(reg, result);
1245 }
1246
1247
1248 void LIRGenerator::do_NewMultiArray(NewMultiArray* x) {
1249 Values* dims = x->dims();
1250 int i = dims->length();
1251 LIRItemList* items = new LIRItemList(i, i, NULL);
1252 while (i-- > 0) {
1253 LIRItem* size = new LIRItem(dims->at(i), this);
1254 items->at_put(i, size);
1255 }
1256
1257 // Evaluate state_for early since it may emit code.
1258 CodeEmitInfo* patching_info = NULL;
1259 if (!x->klass()->is_loaded() || PatchALot) {
1260 patching_info = state_for(x, x->state_before());
1261
1297
1298 void LIRGenerator::do_BlockBegin(BlockBegin* x) {
1299 // nothing to do for now
1300 }
1301
1302 void LIRGenerator::do_CheckCast(CheckCast* x) {
1303 LIRItem obj(x->obj(), this);
1304
1305 CodeEmitInfo* patching_info = NULL;
1306 if (!x->klass()->is_loaded() || (PatchALot && !x->is_incompatible_class_change_check() && !x->is_invokespecial_receiver_check())) {
1307 // must do this before locking the destination register as an oop register,
1308 // and before the obj is loaded (the latter is for deoptimization)
1309 patching_info = state_for(x, x->state_before());
1310 }
1311 obj.load_item();
1312
1313 // info for exceptions
1314 CodeEmitInfo* info_for_exception =
1315 (x->needs_exception_state() ? state_for(x) :
1316 state_for(x, x->state_before(), true /*ignore_xhandler*/));
1317 if (x->is_never_null()) {
1318 __ null_check(obj.result(), new CodeEmitInfo(info_for_exception));
1319 }
1320
1321 CodeStub* stub;
1322 if (x->is_incompatible_class_change_check()) {
1323 assert(patching_info == NULL, "can't patch this");
1324 stub = new SimpleExceptionStub(Runtime1::throw_incompatible_class_change_error_id, LIR_OprFact::illegalOpr, info_for_exception);
1325 } else if (x->is_invokespecial_receiver_check()) {
1326 assert(patching_info == NULL, "can't patch this");
1327 stub = new DeoptimizeStub(info_for_exception,
1328 Deoptimization::Reason_class_check,
1329 Deoptimization::Action_none);
1330 } else {
1331 stub = new SimpleExceptionStub(Runtime1::throw_class_cast_exception_id, obj.result(), info_for_exception);
1332 }
1333 LIR_Opr reg = rlock_result(x);
1334 LIR_Opr tmp3 = LIR_OprFact::illegalOpr;
1335 if (!x->klass()->is_loaded() || UseCompressedClassPointers) {
1336 tmp3 = new_register(objectType);
1337 }
1338
1339
1340 __ checkcast(reg, obj.result(), x->klass(),
1341 new_register(objectType), new_register(objectType), tmp3,
1342 x->direct_compare(), info_for_exception, patching_info, stub,
1343 x->profiled_method(), x->profiled_bci(), x->is_never_null());
1344
1345 }
1346
1347 void LIRGenerator::do_InstanceOf(InstanceOf* x) {
1348 LIRItem obj(x->obj(), this);
1349
1350 // result and test object may not be in same register
1351 LIR_Opr reg = rlock_result(x);
1352 CodeEmitInfo* patching_info = NULL;
1353 if ((!x->klass()->is_loaded() || PatchALot)) {
1354 // must do this before locking the destination register as an oop register
1355 patching_info = state_for(x, x->state_before());
1356 }
1357 obj.load_item();
1358 LIR_Opr tmp3 = LIR_OprFact::illegalOpr;
1359 if (!x->klass()->is_loaded() || UseCompressedClassPointers) {
1360 tmp3 = new_register(objectType);
1361 }
1362 __ instanceof(reg, obj.result(), x->klass(),
1363 new_register(objectType), new_register(objectType), tmp3,
1364 x->direct_compare(), patching_info, x->profiled_method(), x->profiled_bci());
|