hotspot/src/share/vm/jvmci/jvmciCompilerToVM.cpp
changeset 35593 c733fd198e6e
parent 35592 5814f874d736
child 35606 d873b64009cc
equal deleted inserted replaced
35592:5814f874d736 35593:c733fd198e6e
   147 HeapWord** CompilerToVM::Data::_heap_top_addr;
   147 HeapWord** CompilerToVM::Data::_heap_top_addr;
   148 
   148 
   149 jbyte* CompilerToVM::Data::cardtable_start_address;
   149 jbyte* CompilerToVM::Data::cardtable_start_address;
   150 int CompilerToVM::Data::cardtable_shift;
   150 int CompilerToVM::Data::cardtable_shift;
   151 
   151 
       
   152 int CompilerToVM::Data::vm_page_size;
       
   153 
   152 void CompilerToVM::Data::initialize() {
   154 void CompilerToVM::Data::initialize() {
   153   InstanceKlass_vtable_start_offset = InstanceKlass::vtable_start_offset();
   155   InstanceKlass_vtable_start_offset = InstanceKlass::vtable_start_offset();
   154   InstanceKlass_vtable_length_offset = InstanceKlass::vtable_length_offset() * HeapWordSize;
   156   InstanceKlass_vtable_length_offset = InstanceKlass::vtable_length_offset() * HeapWordSize;
   155 
   157 
   156   Method_extra_stack_entries = Method::extra_stack_entries();
   158   Method_extra_stack_entries = Method::extra_stack_entries();
   196     break;
   198     break;
   197   default:
   199   default:
   198     ShouldNotReachHere();
   200     ShouldNotReachHere();
   199     break;
   201     break;
   200   }
   202   }
       
   203 
       
   204   vm_page_size = os::vm_page_size();
   201 }
   205 }
   202 
   206 
   203 /**
   207 /**
   204  * We put all jvmciHotSpotVM values in an array so we can read them easily from Java.
   208  * We put all jvmciHotSpotVM values in an array so we can read them easily from Java.
   205  */
   209  */
  1362     }
  1366     }
  1363   }
  1367   }
  1364   THROW_MSG_0(vmSymbols::java_lang_IllegalArgumentException(), err_msg("Invalid profile data position %d", position));
  1368   THROW_MSG_0(vmSymbols::java_lang_IllegalArgumentException(), err_msg("Invalid profile data position %d", position));
  1365 C2V_END
  1369 C2V_END
  1366 
  1370 
       
  1371 C2V_VMENTRY(int, interpreterFrameSize, (JNIEnv*, jobject, jobject bytecode_frame_handle))
       
  1372   if (bytecode_frame_handle == NULL) {
       
  1373     THROW_0(vmSymbols::java_lang_NullPointerException());
       
  1374   }
       
  1375 
       
  1376   oop top_bytecode_frame = JNIHandles::resolve_non_null(bytecode_frame_handle);
       
  1377   oop bytecode_frame = top_bytecode_frame;
       
  1378   int size = 0;
       
  1379   int callee_parameters = 0;
       
  1380   int callee_locals = 0;
       
  1381   Method* method = getMethodFromHotSpotMethod(BytecodePosition::method(bytecode_frame));
       
  1382   int extra_args = method->max_stack() - BytecodeFrame::numStack(bytecode_frame);
       
  1383 
       
  1384   while (bytecode_frame != NULL) {
       
  1385     int locks = BytecodeFrame::numLocks(bytecode_frame);
       
  1386     int temps = BytecodeFrame::numStack(bytecode_frame);
       
  1387     bool is_top_frame = (bytecode_frame == top_bytecode_frame);
       
  1388     Method* method = getMethodFromHotSpotMethod(BytecodePosition::method(bytecode_frame));
       
  1389 
       
  1390     int frame_size = BytesPerWord * Interpreter::size_activation(method->max_stack(),
       
  1391                                                                  temps + callee_parameters,
       
  1392                                                                  extra_args,
       
  1393                                                                  locks,
       
  1394                                                                  callee_parameters,
       
  1395                                                                  callee_locals,
       
  1396                                                                  is_top_frame);
       
  1397     size += frame_size;
       
  1398 
       
  1399     callee_parameters = method->size_of_parameters();
       
  1400     callee_locals = method->max_locals();
       
  1401     extra_args = 0;
       
  1402     bytecode_frame = BytecodePosition::caller(bytecode_frame);
       
  1403   }
       
  1404   return size + Deoptimization::last_frame_adjust(0, callee_locals) * BytesPerWord;
       
  1405 C2V_END
       
  1406 
  1367 
  1407 
  1368 #define CC (char*)  /*cast a literal from (const char*)*/
  1408 #define CC (char*)  /*cast a literal from (const char*)*/
  1369 #define FN_PTR(f) CAST_FROM_FN_PTR(void*, &(c2v_ ## f))
  1409 #define FN_PTR(f) CAST_FROM_FN_PTR(void*, &(c2v_ ## f))
  1370 
  1410 
  1371 #define STRING                "Ljava/lang/String;"
  1411 #define STRING                "Ljava/lang/String;"
  1372 #define OBJECT                "Ljava/lang/Object;"
  1412 #define OBJECT                "Ljava/lang/Object;"
  1373 #define CLASS                 "Ljava/lang/Class;"
  1413 #define CLASS                 "Ljava/lang/Class;"
  1374 #define STACK_TRACE_ELEMENT   "Ljava/lang/StackTraceElement;"
  1414 #define STACK_TRACE_ELEMENT   "Ljava/lang/StackTraceElement;"
  1375 #define INSTALLED_CODE        "Ljdk/vm/ci/code/InstalledCode;"
  1415 #define INSTALLED_CODE        "Ljdk/vm/ci/code/InstalledCode;"
  1376 #define TARGET_DESCRIPTION    "Ljdk/vm/ci/code/TargetDescription;"
  1416 #define TARGET_DESCRIPTION    "Ljdk/vm/ci/code/TargetDescription;"
       
  1417 #define BYTECODE_FRAME        "Ljdk/vm/ci/code/BytecodeFrame;"
  1377 #define RESOLVED_METHOD       "Ljdk/vm/ci/meta/ResolvedJavaMethod;"
  1418 #define RESOLVED_METHOD       "Ljdk/vm/ci/meta/ResolvedJavaMethod;"
  1378 #define HS_RESOLVED_METHOD    "Ljdk/vm/ci/hotspot/HotSpotResolvedJavaMethodImpl;"
  1419 #define HS_RESOLVED_METHOD    "Ljdk/vm/ci/hotspot/HotSpotResolvedJavaMethodImpl;"
  1379 #define HS_RESOLVED_KLASS     "Ljdk/vm/ci/hotspot/HotSpotResolvedObjectTypeImpl;"
  1420 #define HS_RESOLVED_KLASS     "Ljdk/vm/ci/hotspot/HotSpotResolvedObjectTypeImpl;"
  1380 #define HS_CONSTANT_POOL      "Ljdk/vm/ci/hotspot/HotSpotConstantPool;"
  1421 #define HS_CONSTANT_POOL      "Ljdk/vm/ci/hotspot/HotSpotConstantPool;"
  1381 #define HS_COMPILED_CODE      "Ljdk/vm/ci/hotspot/HotSpotCompiledCode;"
  1422 #define HS_COMPILED_CODE      "Ljdk/vm/ci/hotspot/HotSpotCompiledCode;"
  1441   {CC"materializeVirtualObjects",                    CC"("HS_STACK_FRAME_REF"Z)V",                                                     FN_PTR(materializeVirtualObjects)},
  1482   {CC"materializeVirtualObjects",                    CC"("HS_STACK_FRAME_REF"Z)V",                                                     FN_PTR(materializeVirtualObjects)},
  1442   {CC"shouldDebugNonSafepoints",                     CC"()Z",                                                                          FN_PTR(shouldDebugNonSafepoints)},
  1483   {CC"shouldDebugNonSafepoints",                     CC"()Z",                                                                          FN_PTR(shouldDebugNonSafepoints)},
  1443   {CC"writeDebugOutput",                             CC"([BII)V",                                                                      FN_PTR(writeDebugOutput)},
  1484   {CC"writeDebugOutput",                             CC"([BII)V",                                                                      FN_PTR(writeDebugOutput)},
  1444   {CC"flushDebugOutput",                             CC"()V",                                                                          FN_PTR(flushDebugOutput)},
  1485   {CC"flushDebugOutput",                             CC"()V",                                                                          FN_PTR(flushDebugOutput)},
  1445   {CC"methodDataProfileDataSize",                    CC"(JI)I",                                                                        FN_PTR(methodDataProfileDataSize)},
  1486   {CC"methodDataProfileDataSize",                    CC"(JI)I",                                                                        FN_PTR(methodDataProfileDataSize)},
       
  1487   {CC"interpreterFrameSize",                         CC"("BYTECODE_FRAME")I",                                                          FN_PTR(interpreterFrameSize)},
  1446 };
  1488 };
  1447 
  1489 
  1448 int CompilerToVM::methods_count() {
  1490 int CompilerToVM::methods_count() {
  1449   return sizeof(methods) / sizeof(JNINativeMethod);
  1491   return sizeof(methods) / sizeof(JNINativeMethod);
  1450 }
  1492 }