1134 1135 CodeEmitInfo* patching_info = NULL; 1136 if (!x->klass()->is_loaded() || (PatchALot && !x->is_incompatible_class_change_check())) { 1137 // must do this before locking the destination register as an oop register, 1138 // and before the obj is loaded (the latter is for deoptimization) 1139 patching_info = state_for(x, x->state_before()); 1140 } 1141 obj.load_item(); 1142 1143 // info for exceptions 1144 CodeEmitInfo* info_for_exception = state_for(x); 1145 1146 CodeStub* stub; 1147 if (x->is_incompatible_class_change_check()) { 1148 assert(patching_info == NULL, "can't patch this"); 1149 stub = new SimpleExceptionStub(Runtime1::throw_incompatible_class_change_error_id, LIR_OprFact::illegalOpr, info_for_exception); 1150 } else { 1151 stub = new SimpleExceptionStub(Runtime1::throw_class_cast_exception_id, obj.result(), info_for_exception); 1152 } 1153 LIR_Opr reg = rlock_result(x); 1154 __ checkcast(reg, obj.result(), x->klass(), 1155 new_register(objectType), new_register(objectType), 1156 !x->klass()->is_loaded() ? new_register(objectType) : LIR_OprFact::illegalOpr, 1157 x->direct_compare(), info_for_exception, patching_info, stub, 1158 x->profiled_method(), x->profiled_bci()); 1159 } 1160 1161 1162 void LIRGenerator::do_InstanceOf(InstanceOf* x) { 1163 LIRItem obj(x->obj(), this); 1164 1165 // result and test object may not be in same register 1166 LIR_Opr reg = rlock_result(x); 1167 CodeEmitInfo* patching_info = NULL; 1168 if ((!x->klass()->is_loaded() || PatchALot)) { 1169 // must do this before locking the destination register as an oop register 1170 patching_info = state_for(x, x->state_before()); 1171 } 1172 obj.load_item(); 1173 __ instanceof(reg, obj.result(), x->klass(), 1174 new_register(objectType), new_register(objectType), 1175 !x->klass()->is_loaded() ? new_register(objectType) : LIR_OprFact::illegalOpr, 1176 x->direct_compare(), patching_info, x->profiled_method(), x->profiled_bci()); 1177 } 1178 1179 1180 void LIRGenerator::do_If(If* x) { 1181 assert(x->number_of_sux() == 2, "inconsistency"); 1182 ValueTag tag = x->x()->type()->tag(); 1183 bool is_safepoint = x->is_safepoint(); 1184 1185 If::Condition cond = x->cond(); 1186 1187 LIRItem xitem(x->x(), this); 1188 LIRItem yitem(x->y(), this); 1189 LIRItem* xin = &xitem; 1190 LIRItem* yin = &yitem; 1191 1192 if (tag == longTag) { 1193 // for longs, only conditions "eql", "neq", "lss", "geq" are valid; 1194 // mirror for other conditions 1195 if (cond == If::gtr || cond == If::leq) { | 1134 1135 CodeEmitInfo* patching_info = NULL; 1136 if (!x->klass()->is_loaded() || (PatchALot && !x->is_incompatible_class_change_check())) { 1137 // must do this before locking the destination register as an oop register, 1138 // and before the obj is loaded (the latter is for deoptimization) 1139 patching_info = state_for(x, x->state_before()); 1140 } 1141 obj.load_item(); 1142 1143 // info for exceptions 1144 CodeEmitInfo* info_for_exception = state_for(x); 1145 1146 CodeStub* stub; 1147 if (x->is_incompatible_class_change_check()) { 1148 assert(patching_info == NULL, "can't patch this"); 1149 stub = new SimpleExceptionStub(Runtime1::throw_incompatible_class_change_error_id, LIR_OprFact::illegalOpr, info_for_exception); 1150 } else { 1151 stub = new SimpleExceptionStub(Runtime1::throw_class_cast_exception_id, obj.result(), info_for_exception); 1152 } 1153 LIR_Opr reg = rlock_result(x); 1154 LIR_Opr tmp3 = LIR_OprFact::illegalOpr; 1155 if (!x->klass()->is_loaded() || UseCompressedOops) { 1156 tmp3 = new_register(objectType); 1157 } 1158 __ checkcast(reg, obj.result(), x->klass(), 1159 new_register(objectType), new_register(objectType), tmp3, 1160 x->direct_compare(), info_for_exception, patching_info, stub, 1161 x->profiled_method(), x->profiled_bci()); 1162 } 1163 1164 1165 void LIRGenerator::do_InstanceOf(InstanceOf* x) { 1166 LIRItem obj(x->obj(), this); 1167 1168 // result and test object may not be in same register 1169 LIR_Opr reg = rlock_result(x); 1170 CodeEmitInfo* patching_info = NULL; 1171 if ((!x->klass()->is_loaded() || PatchALot)) { 1172 // must do this before locking the destination register as an oop register 1173 patching_info = state_for(x, x->state_before()); 1174 } 1175 obj.load_item(); 1176 LIR_Opr tmp3 = LIR_OprFact::illegalOpr; 1177 if (!x->klass()->is_loaded() || UseCompressedOops) { 1178 tmp3 = new_register(objectType); 1179 } 1180 __ instanceof(reg, obj.result(), x->klass(), 1181 new_register(objectType), new_register(objectType), tmp3, 1182 x->direct_compare(), patching_info, x->profiled_method(), x->profiled_bci()); 1183 } 1184 1185 1186 void LIRGenerator::do_If(If* x) { 1187 assert(x->number_of_sux() == 2, "inconsistency"); 1188 ValueTag tag = x->x()->type()->tag(); 1189 bool is_safepoint = x->is_safepoint(); 1190 1191 If::Condition cond = x->cond(); 1192 1193 LIRItem xitem(x->x(), this); 1194 LIRItem yitem(x->y(), this); 1195 LIRItem* xin = &xitem; 1196 LIRItem* yin = &yitem; 1197 1198 if (tag == longTag) { 1199 // for longs, only conditions "eql", "neq", "lss", "geq" are valid; 1200 // mirror for other conditions 1201 if (cond == If::gtr || cond == If::leq) { |