1222 CodeEmitInfo* patching_info = NULL;
1223 if (!x->klass()->is_loaded() || (PatchALot && !x->is_incompatible_class_change_check())) {
1224 // must do this before locking the destination register as an oop register,
1225 // and before the obj is loaded (the latter is for deoptimization)
1226 patching_info = state_for(x, x->state_before());
1227 }
1228 obj.load_item();
1229
1230 // info for exceptions
1231 CodeEmitInfo* info_for_exception = state_for(x);
1232
1233 CodeStub* stub;
1234 if (x->is_incompatible_class_change_check()) {
1235 assert(patching_info == NULL, "can't patch this");
1236 stub = new SimpleExceptionStub(Runtime1::throw_incompatible_class_change_error_id, LIR_OprFact::illegalOpr, info_for_exception);
1237 } else {
1238 stub = new SimpleExceptionStub(Runtime1::throw_class_cast_exception_id, obj.result(), info_for_exception);
1239 }
1240 LIR_Opr reg = rlock_result(x);
1241 LIR_Opr tmp3 = LIR_OprFact::illegalOpr;
1242 if (!x->klass()->is_loaded() || UseCompressedKlassPointers) {
1243 tmp3 = new_register(objectType);
1244 }
1245 __ checkcast(reg, obj.result(), x->klass(),
1246 new_register(objectType), new_register(objectType), tmp3,
1247 x->direct_compare(), info_for_exception, patching_info, stub,
1248 x->profiled_method(), x->profiled_bci());
1249 }
1250
1251
1252 void LIRGenerator::do_InstanceOf(InstanceOf* x) {
1253 LIRItem obj(x->obj(), this);
1254
1255 // result and test object may not be in same register
1256 LIR_Opr reg = rlock_result(x);
1257 CodeEmitInfo* patching_info = NULL;
1258 if ((!x->klass()->is_loaded() || PatchALot)) {
1259 // must do this before locking the destination register as an oop register
1260 patching_info = state_for(x, x->state_before());
1261 }
1262 obj.load_item();
1263 LIR_Opr tmp3 = LIR_OprFact::illegalOpr;
1264 if (!x->klass()->is_loaded() || UseCompressedKlassPointers) {
1265 tmp3 = new_register(objectType);
1266 }
1267 __ instanceof(reg, obj.result(), x->klass(),
1268 new_register(objectType), new_register(objectType), tmp3,
1269 x->direct_compare(), patching_info, x->profiled_method(), x->profiled_bci());
1270 }
1271
1272
1273 void LIRGenerator::do_If(If* x) {
1274 assert(x->number_of_sux() == 2, "inconsistency");
1275 ValueTag tag = x->x()->type()->tag();
1276 bool is_safepoint = x->is_safepoint();
1277
1278 If::Condition cond = x->cond();
1279
1280 LIRItem xitem(x->x(), this);
1281 LIRItem yitem(x->y(), this);
1282 LIRItem* xin = &xitem;
1283 LIRItem* yin = &yitem;
1284
|
1222 CodeEmitInfo* patching_info = NULL;
1223 if (!x->klass()->is_loaded() || (PatchALot && !x->is_incompatible_class_change_check())) {
1224 // must do this before locking the destination register as an oop register,
1225 // and before the obj is loaded (the latter is for deoptimization)
1226 patching_info = state_for(x, x->state_before());
1227 }
1228 obj.load_item();
1229
1230 // info for exceptions
1231 CodeEmitInfo* info_for_exception = state_for(x);
1232
1233 CodeStub* stub;
1234 if (x->is_incompatible_class_change_check()) {
1235 assert(patching_info == NULL, "can't patch this");
1236 stub = new SimpleExceptionStub(Runtime1::throw_incompatible_class_change_error_id, LIR_OprFact::illegalOpr, info_for_exception);
1237 } else {
1238 stub = new SimpleExceptionStub(Runtime1::throw_class_cast_exception_id, obj.result(), info_for_exception);
1239 }
1240 LIR_Opr reg = rlock_result(x);
1241 LIR_Opr tmp3 = LIR_OprFact::illegalOpr;
1242 if (!x->klass()->is_loaded() || UseCompressedClassPointers) {
1243 tmp3 = new_register(objectType);
1244 }
1245 __ checkcast(reg, obj.result(), x->klass(),
1246 new_register(objectType), new_register(objectType), tmp3,
1247 x->direct_compare(), info_for_exception, patching_info, stub,
1248 x->profiled_method(), x->profiled_bci());
1249 }
1250
1251
1252 void LIRGenerator::do_InstanceOf(InstanceOf* x) {
1253 LIRItem obj(x->obj(), this);
1254
1255 // result and test object may not be in same register
1256 LIR_Opr reg = rlock_result(x);
1257 CodeEmitInfo* patching_info = NULL;
1258 if ((!x->klass()->is_loaded() || PatchALot)) {
1259 // must do this before locking the destination register as an oop register
1260 patching_info = state_for(x, x->state_before());
1261 }
1262 obj.load_item();
1263 LIR_Opr tmp3 = LIR_OprFact::illegalOpr;
1264 if (!x->klass()->is_loaded() || UseCompressedClassPointers) {
1265 tmp3 = new_register(objectType);
1266 }
1267 __ instanceof(reg, obj.result(), x->klass(),
1268 new_register(objectType), new_register(objectType), tmp3,
1269 x->direct_compare(), patching_info, x->profiled_method(), x->profiled_bci());
1270 }
1271
1272
1273 void LIRGenerator::do_If(If* x) {
1274 assert(x->number_of_sux() == 2, "inconsistency");
1275 ValueTag tag = x->x()->type()->tag();
1276 bool is_safepoint = x->is_safepoint();
1277
1278 If::Condition cond = x->cond();
1279
1280 LIRItem xitem(x->x(), this);
1281 LIRItem yitem(x->y(), this);
1282 LIRItem* xin = &xitem;
1283 LIRItem* yin = &yitem;
1284
|