< prev index next >

src/hotspot/share/jvmci/jvmciCodeInstaller.cpp

Print this page




1156         expressions->append(first);
1157       } else {
1158         MonitorValue *monitor = get_monitor_value(value, objects, CHECK);
1159         monitors->append(monitor);
1160       }
1161       if (second != NULL) {
1162         i++;
1163         if (i >= values->length() || values->obj_at(i) != Value::ILLEGAL()) {
1164           JVMCI_ERROR("double-slot value not followed by Value.ILLEGAL");
1165         }
1166       }
1167     }
1168 
1169     locals_token = _debug_recorder->create_scope_values(locals);
1170     expressions_token = _debug_recorder->create_scope_values(expressions);
1171     monitors_token = _debug_recorder->create_monitor_values(monitors);
1172 
1173     throw_exception = BytecodeFrame::rethrowException(frame) == JNI_TRUE;
1174   }
1175 
1176   _debug_recorder->describe_scope(pc_offset, method, NULL, bci, reexecute, throw_exception, false, return_oop,
1177                                   locals_token, expressions_token, monitors_token);
1178 }
1179 
1180 void CodeInstaller::site_Safepoint(CodeBuffer& buffer, jint pc_offset, Handle site, TRAPS) {
1181   Handle debug_info (THREAD, site_Infopoint::debugInfo(site));
1182   if (debug_info.is_null()) {
1183     JVMCI_ERROR("debug info expected at safepoint at %i", pc_offset);
1184   }
1185 
1186   // address instruction = _instructions->start() + pc_offset;
1187   // jint next_pc_offset = Assembler::locate_next_instruction(instruction) - _instructions->start();
1188   OopMap *map = create_oop_map(debug_info, CHECK);
1189   _debug_recorder->add_safepoint(pc_offset, map);
1190   record_scope(pc_offset, debug_info, CodeInstaller::FullFrame, CHECK);
1191   _debug_recorder->end_safepoint(pc_offset);
1192 }
1193 
1194 void CodeInstaller::site_Infopoint(CodeBuffer& buffer, jint pc_offset, Handle site, TRAPS) {
1195   Handle debug_info (THREAD, site_Infopoint::debugInfo(site));
1196   if (debug_info.is_null()) {


1213   Handle hotspot_method; // JavaMethod
1214   Handle foreign_call;
1215 
1216   if (target_klass->is_subclass_of(SystemDictionary::HotSpotForeignCallTarget_klass())) {
1217     foreign_call = target;
1218   } else {
1219     hotspot_method = target;
1220   }
1221 
1222   Handle debug_info (THREAD, site_Call::debugInfo(site));
1223 
1224   assert(hotspot_method.not_null() ^ foreign_call.not_null(), "Call site needs exactly one type");
1225 
1226   NativeInstruction* inst = nativeInstruction_at(_instructions->start() + pc_offset);
1227   jint next_pc_offset = CodeInstaller::pd_next_offset(inst, pc_offset, hotspot_method, CHECK);
1228 
1229   if (debug_info.not_null()) {
1230     OopMap *map = create_oop_map(debug_info, CHECK);
1231     _debug_recorder->add_safepoint(next_pc_offset, map);
1232 
1233     bool return_oop = hotspot_method.not_null() && getMethodFromHotSpotMethod(hotspot_method())->is_returning_oop();
1234 
1235     record_scope(next_pc_offset, debug_info, CodeInstaller::FullFrame, return_oop, CHECK);
1236   }
1237 
1238   if (foreign_call.not_null()) {
1239     jlong foreign_call_destination = HotSpotForeignCallTarget::address(foreign_call);
1240     if (_immutable_pic_compilation) {
1241       // Use fake short distance during PIC compilation.
1242       foreign_call_destination = (jlong)(_instructions->start() + pc_offset);
1243     }
1244     CodeInstaller::pd_relocate_ForeignCall(inst, foreign_call_destination, CHECK);
1245   } else { // method != NULL
1246     if (debug_info.is_null()) {
1247       JVMCI_ERROR("debug info expected at call at %i", pc_offset);
1248     }
1249 
1250     TRACE_jvmci_3("method call");
1251     CodeInstaller::pd_relocate_JavaMethod(buffer, hotspot_method, pc_offset, CHECK);
1252     if (_next_call_type == INVOKESTATIC || _next_call_type == INVOKESPECIAL) {
1253       // Need a static call stub for transitions from compiled to interpreted.


1304   }
1305 }
1306 
1307 void CodeInstaller::site_Mark(CodeBuffer& buffer, jint pc_offset, Handle site, TRAPS) {
1308   Handle id_obj (THREAD, site_Mark::id(site));
1309 
1310   if (id_obj.not_null()) {
1311     if (!java_lang_boxing_object::is_instance(id_obj(), T_INT)) {
1312       JVMCI_ERROR("expected Integer id, got %s", id_obj->klass()->signature_name());
1313     }
1314     jint id = id_obj->int_field(java_lang_boxing_object::value_offset_in_bytes(T_INT));
1315 
1316     address pc = _instructions->start() + pc_offset;
1317 
1318     switch (id) {
1319       case UNVERIFIED_ENTRY:
1320         _offsets.set_value(CodeOffsets::Entry, pc_offset);
1321         break;
1322       case VERIFIED_ENTRY:
1323         _offsets.set_value(CodeOffsets::Verified_Entry, pc_offset);


1324         break;
1325       case OSR_ENTRY:
1326         _offsets.set_value(CodeOffsets::OSR_Entry, pc_offset);
1327         break;
1328       case EXCEPTION_HANDLER_ENTRY:
1329         _offsets.set_value(CodeOffsets::Exceptions, pc_offset);
1330         break;
1331       case DEOPT_HANDLER_ENTRY:
1332         _offsets.set_value(CodeOffsets::Deopt, pc_offset);
1333         break;
1334       case INVOKEVIRTUAL:
1335       case INVOKEINTERFACE:
1336       case INLINE_INVOKE:
1337       case INVOKESTATIC:
1338       case INVOKESPECIAL:
1339         _next_call_type = (MarkId) id;
1340         _invoke_mark_pc = pc;
1341         break;
1342       case POLL_NEAR:
1343       case POLL_FAR:


1156         expressions->append(first);
1157       } else {
1158         MonitorValue *monitor = get_monitor_value(value, objects, CHECK);
1159         monitors->append(monitor);
1160       }
1161       if (second != NULL) {
1162         i++;
1163         if (i >= values->length() || values->obj_at(i) != Value::ILLEGAL()) {
1164           JVMCI_ERROR("double-slot value not followed by Value.ILLEGAL");
1165         }
1166       }
1167     }
1168 
1169     locals_token = _debug_recorder->create_scope_values(locals);
1170     expressions_token = _debug_recorder->create_scope_values(expressions);
1171     monitors_token = _debug_recorder->create_monitor_values(monitors);
1172 
1173     throw_exception = BytecodeFrame::rethrowException(frame) == JNI_TRUE;
1174   }
1175 
1176   _debug_recorder->describe_scope(pc_offset, method, NULL, bci, reexecute, throw_exception, false, return_oop, false,
1177                                   locals_token, expressions_token, monitors_token);
1178 }
1179 
1180 void CodeInstaller::site_Safepoint(CodeBuffer& buffer, jint pc_offset, Handle site, TRAPS) {
1181   Handle debug_info (THREAD, site_Infopoint::debugInfo(site));
1182   if (debug_info.is_null()) {
1183     JVMCI_ERROR("debug info expected at safepoint at %i", pc_offset);
1184   }
1185 
1186   // address instruction = _instructions->start() + pc_offset;
1187   // jint next_pc_offset = Assembler::locate_next_instruction(instruction) - _instructions->start();
1188   OopMap *map = create_oop_map(debug_info, CHECK);
1189   _debug_recorder->add_safepoint(pc_offset, map);
1190   record_scope(pc_offset, debug_info, CodeInstaller::FullFrame, CHECK);
1191   _debug_recorder->end_safepoint(pc_offset);
1192 }
1193 
1194 void CodeInstaller::site_Infopoint(CodeBuffer& buffer, jint pc_offset, Handle site, TRAPS) {
1195   Handle debug_info (THREAD, site_Infopoint::debugInfo(site));
1196   if (debug_info.is_null()) {


1213   Handle hotspot_method; // JavaMethod
1214   Handle foreign_call;
1215 
1216   if (target_klass->is_subclass_of(SystemDictionary::HotSpotForeignCallTarget_klass())) {
1217     foreign_call = target;
1218   } else {
1219     hotspot_method = target;
1220   }
1221 
1222   Handle debug_info (THREAD, site_Call::debugInfo(site));
1223 
1224   assert(hotspot_method.not_null() ^ foreign_call.not_null(), "Call site needs exactly one type");
1225 
1226   NativeInstruction* inst = nativeInstruction_at(_instructions->start() + pc_offset);
1227   jint next_pc_offset = CodeInstaller::pd_next_offset(inst, pc_offset, hotspot_method, CHECK);
1228 
1229   if (debug_info.not_null()) {
1230     OopMap *map = create_oop_map(debug_info, CHECK);
1231     _debug_recorder->add_safepoint(next_pc_offset, map);
1232 
1233     bool return_oop = hotspot_method.not_null() && getMethodFromHotSpotMethod(hotspot_method())->may_return_oop();
1234 
1235     record_scope(next_pc_offset, debug_info, CodeInstaller::FullFrame, return_oop, CHECK);
1236   }
1237 
1238   if (foreign_call.not_null()) {
1239     jlong foreign_call_destination = HotSpotForeignCallTarget::address(foreign_call);
1240     if (_immutable_pic_compilation) {
1241       // Use fake short distance during PIC compilation.
1242       foreign_call_destination = (jlong)(_instructions->start() + pc_offset);
1243     }
1244     CodeInstaller::pd_relocate_ForeignCall(inst, foreign_call_destination, CHECK);
1245   } else { // method != NULL
1246     if (debug_info.is_null()) {
1247       JVMCI_ERROR("debug info expected at call at %i", pc_offset);
1248     }
1249 
1250     TRACE_jvmci_3("method call");
1251     CodeInstaller::pd_relocate_JavaMethod(buffer, hotspot_method, pc_offset, CHECK);
1252     if (_next_call_type == INVOKESTATIC || _next_call_type == INVOKESPECIAL) {
1253       // Need a static call stub for transitions from compiled to interpreted.


1304   }
1305 }
1306 
1307 void CodeInstaller::site_Mark(CodeBuffer& buffer, jint pc_offset, Handle site, TRAPS) {
1308   Handle id_obj (THREAD, site_Mark::id(site));
1309 
1310   if (id_obj.not_null()) {
1311     if (!java_lang_boxing_object::is_instance(id_obj(), T_INT)) {
1312       JVMCI_ERROR("expected Integer id, got %s", id_obj->klass()->signature_name());
1313     }
1314     jint id = id_obj->int_field(java_lang_boxing_object::value_offset_in_bytes(T_INT));
1315 
1316     address pc = _instructions->start() + pc_offset;
1317 
1318     switch (id) {
1319       case UNVERIFIED_ENTRY:
1320         _offsets.set_value(CodeOffsets::Entry, pc_offset);
1321         break;
1322       case VERIFIED_ENTRY:
1323         _offsets.set_value(CodeOffsets::Verified_Entry, pc_offset);
1324         _offsets.set_value(CodeOffsets::Verified_Value_Entry, pc_offset);
1325         _offsets.set_value(CodeOffsets::Verified_Value_Entry_RO, pc_offset);
1326         break;
1327       case OSR_ENTRY:
1328         _offsets.set_value(CodeOffsets::OSR_Entry, pc_offset);
1329         break;
1330       case EXCEPTION_HANDLER_ENTRY:
1331         _offsets.set_value(CodeOffsets::Exceptions, pc_offset);
1332         break;
1333       case DEOPT_HANDLER_ENTRY:
1334         _offsets.set_value(CodeOffsets::Deopt, pc_offset);
1335         break;
1336       case INVOKEVIRTUAL:
1337       case INVOKEINTERFACE:
1338       case INLINE_INVOKE:
1339       case INVOKESTATIC:
1340       case INVOKESPECIAL:
1341         _next_call_type = (MarkId) id;
1342         _invoke_mark_pc = pc;
1343         break;
1344       case POLL_NEAR:
1345       case POLL_FAR:
< prev index next >