hotspot/src/share/vm/jvmci/jvmciCodeInstaller.cpp
changeset 42861 1d4dfdf4390b
parent 42650 1f304d0c888b
child 46271 979ebd346ecf
child 43416 f8c241512446
equal deleted inserted replaced
42845:17469f16fbb4 42861:1d4dfdf4390b
   965   }
   965   }
   966   _debug_recorder->dump_object_pool(objects);
   966   _debug_recorder->dump_object_pool(objects);
   967   return objects;
   967   return objects;
   968 }
   968 }
   969 
   969 
   970 void CodeInstaller::record_scope(jint pc_offset, Handle debug_info, ScopeMode scope_mode, TRAPS) {
   970 void CodeInstaller::record_scope(jint pc_offset, Handle debug_info, ScopeMode scope_mode, bool return_oop, TRAPS) {
   971   Handle position = DebugInfo::bytecodePosition(debug_info);
   971   Handle position = DebugInfo::bytecodePosition(debug_info);
   972   if (position.is_null()) {
   972   if (position.is_null()) {
   973     // Stubs do not record scope info, just oop maps
   973     // Stubs do not record scope info, just oop maps
   974     return;
   974     return;
   975   }
   975   }
   978   if (scope_mode == CodeInstaller::FullFrame) {
   978   if (scope_mode == CodeInstaller::FullFrame) {
   979     objectMapping = record_virtual_objects(debug_info, CHECK);
   979     objectMapping = record_virtual_objects(debug_info, CHECK);
   980   } else {
   980   } else {
   981     objectMapping = NULL;
   981     objectMapping = NULL;
   982   }
   982   }
   983   record_scope(pc_offset, position, scope_mode, objectMapping, CHECK);
   983   record_scope(pc_offset, position, scope_mode, objectMapping, return_oop, CHECK);
   984 }
   984 }
   985 
   985 
   986 void CodeInstaller::record_scope(jint pc_offset, Handle position, ScopeMode scope_mode, GrowableArray<ScopeValue*>* objects, TRAPS) {
   986 void CodeInstaller::record_scope(jint pc_offset, Handle position, ScopeMode scope_mode, GrowableArray<ScopeValue*>* objects, bool return_oop, TRAPS) {
   987   Handle frame;
   987   Handle frame;
   988   if (scope_mode == CodeInstaller::FullFrame) {
   988   if (scope_mode == CodeInstaller::FullFrame) {
   989     if (!position->is_a(BytecodeFrame::klass())) {
   989     if (!position->is_a(BytecodeFrame::klass())) {
   990       JVMCI_ERROR("Full frame expected for debug info at %i", pc_offset);
   990       JVMCI_ERROR("Full frame expected for debug info at %i", pc_offset);
   991     }
   991     }
   992     frame = position;
   992     frame = position;
   993   }
   993   }
   994   Handle caller_frame = BytecodePosition::caller(position);
   994   Handle caller_frame = BytecodePosition::caller(position);
   995   if (caller_frame.not_null()) {
   995   if (caller_frame.not_null()) {
   996     record_scope(pc_offset, caller_frame, scope_mode, objects, CHECK);
   996     record_scope(pc_offset, caller_frame, scope_mode, objects, return_oop, CHECK);
   997   }
   997   }
   998 
   998 
   999   Handle hotspot_method = BytecodePosition::method(position);
   999   Handle hotspot_method = BytecodePosition::method(position);
  1000   Method* method = getMethodFromHotSpotMethod(hotspot_method());
  1000   Method* method = getMethodFromHotSpotMethod(hotspot_method());
  1001   jint bci = BytecodePosition::bci(position);
  1001   jint bci = BytecodePosition::bci(position);
  1081     monitors_token = _debug_recorder->create_monitor_values(monitors);
  1081     monitors_token = _debug_recorder->create_monitor_values(monitors);
  1082 
  1082 
  1083     throw_exception = BytecodeFrame::rethrowException(frame) == JNI_TRUE;
  1083     throw_exception = BytecodeFrame::rethrowException(frame) == JNI_TRUE;
  1084   }
  1084   }
  1085 
  1085 
  1086   _debug_recorder->describe_scope(pc_offset, method, NULL, bci, reexecute, throw_exception, false, false,
  1086   _debug_recorder->describe_scope(pc_offset, method, NULL, bci, reexecute, throw_exception, false, return_oop,
  1087                                   locals_token, expressions_token, monitors_token);
  1087                                   locals_token, expressions_token, monitors_token);
  1088 }
  1088 }
  1089 
  1089 
  1090 void CodeInstaller::site_Safepoint(CodeBuffer& buffer, jint pc_offset, Handle site, TRAPS) {
  1090 void CodeInstaller::site_Safepoint(CodeBuffer& buffer, jint pc_offset, Handle site, TRAPS) {
  1091   Handle debug_info = site_Infopoint::debugInfo(site);
  1091   Handle debug_info = site_Infopoint::debugInfo(site);
  1137   jint next_pc_offset = CodeInstaller::pd_next_offset(inst, pc_offset, hotspot_method, CHECK);
  1137   jint next_pc_offset = CodeInstaller::pd_next_offset(inst, pc_offset, hotspot_method, CHECK);
  1138 
  1138 
  1139   if (debug_info.not_null()) {
  1139   if (debug_info.not_null()) {
  1140     OopMap *map = create_oop_map(debug_info, CHECK);
  1140     OopMap *map = create_oop_map(debug_info, CHECK);
  1141     _debug_recorder->add_safepoint(next_pc_offset, map);
  1141     _debug_recorder->add_safepoint(next_pc_offset, map);
  1142     record_scope(next_pc_offset, debug_info, CodeInstaller::FullFrame, CHECK);
  1142 
       
  1143     bool return_oop = hotspot_method.not_null() && getMethodFromHotSpotMethod(hotspot_method())->is_returning_oop();
       
  1144 
       
  1145     record_scope(next_pc_offset, debug_info, CodeInstaller::FullFrame, return_oop, CHECK);
  1143   }
  1146   }
  1144 
  1147 
  1145   if (foreign_call.not_null()) {
  1148   if (foreign_call.not_null()) {
  1146     jlong foreign_call_destination = HotSpotForeignCallTarget::address(foreign_call);
  1149     jlong foreign_call_destination = HotSpotForeignCallTarget::address(foreign_call);
  1147     if (_immutable_pic_compilation) {
  1150     if (_immutable_pic_compilation) {