< prev index next >

src/hotspot/share/jvmci/jvmciRuntime.cpp

Print this page
rev 47794 : Port 09.17.Thread_SMR_logging_update from JDK9 to JDK10
rev 47796 : eosterlund, stefank CR - refactor code into threadSMR.cpp and threadSMR.hpp


  25 #include "jvm.h"
  26 #include "asm/codeBuffer.hpp"
  27 #include "classfile/javaClasses.inline.hpp"
  28 #include "code/codeCache.hpp"
  29 #include "compiler/compileBroker.hpp"
  30 #include "compiler/disassembler.hpp"
  31 #include "jvmci/jvmciRuntime.hpp"
  32 #include "jvmci/jvmciCompilerToVM.hpp"
  33 #include "jvmci/jvmciCompiler.hpp"
  34 #include "jvmci/jvmciJavaClasses.hpp"
  35 #include "jvmci/jvmciEnv.hpp"
  36 #include "logging/log.hpp"
  37 #include "memory/oopFactory.hpp"
  38 #include "memory/resourceArea.hpp"
  39 #include "oops/oop.inline.hpp"
  40 #include "oops/objArrayOop.inline.hpp"
  41 #include "runtime/biasedLocking.hpp"
  42 #include "runtime/interfaceSupport.hpp"
  43 #include "runtime/reflection.hpp"
  44 #include "runtime/sharedRuntime.hpp"

  45 #include "utilities/debug.hpp"
  46 #include "utilities/defaultStream.hpp"
  47 #include "utilities/macros.hpp"
  48 
  49 #if defined(_MSC_VER)
  50 #define strtoll _strtoi64
  51 #endif
  52 
  53 jobject JVMCIRuntime::_HotSpotJVMCIRuntime_instance = NULL;
  54 bool JVMCIRuntime::_HotSpotJVMCIRuntime_initialized = false;
  55 bool JVMCIRuntime::_well_known_classes_initialized = false;
  56 int JVMCIRuntime::_trivial_prefixes_count = 0;
  57 char** JVMCIRuntime::_trivial_prefixes = NULL;
  58 JVMCIRuntime::CompLevelAdjustment JVMCIRuntime::_comp_level_adjustment = JVMCIRuntime::none;
  59 bool JVMCIRuntime::_shutdown_called = false;
  60 
  61 BasicType JVMCIRuntime::kindToBasicType(Handle kind, TRAPS) {
  62   if (kind.is_null()) {
  63     THROW_(vmSymbols::java_lang_NullPointerException(), T_ILLEGAL);
  64   }


 581     case 'Z': tty->print(value == 0 ? "false" : "true"); break;
 582     case 'B': tty->print("%d", (jbyte) value); break;
 583     case 'C': tty->print("%c", (jchar) value); break;
 584     case 'S': tty->print("%d", (jshort) value); break;
 585     case 'I': tty->print("%d", (jint) value); break;
 586     case 'F': tty->print("%f", uu.f); break;
 587     case 'J': tty->print(JLONG_FORMAT, value); break;
 588     case 'D': tty->print("%lf", uu.d); break;
 589     default: assert(false, "unknown typeChar"); break;
 590   }
 591   if (newline) {
 592     tty->cr();
 593   }
 594 JRT_END
 595 
 596 JRT_ENTRY(jint, JVMCIRuntime::identity_hash_code(JavaThread* thread, oopDesc* obj))
 597   return (jint) obj->identity_hash();
 598 JRT_END
 599 
 600 JRT_ENTRY(jboolean, JVMCIRuntime::thread_is_interrupted(JavaThread* thread, oopDesc* receiver, jboolean clear_interrupted))
 601   // Ensure that the C++ Thread and OSThread structures aren't freed before we operate.
 602   // This locking requires thread_in_vm which is why this method cannot be JRT_LEAF.
 603   Handle receiverHandle(thread, receiver);
 604   MutexLockerEx ml(thread->threadObj() == (void*)receiver ? NULL : Threads_lock);



 605   JavaThread* receiverThread = java_lang_Thread::thread(receiverHandle());
 606   if (receiverThread == NULL) {
 607     // The other thread may exit during this process, which is ok so return false.
 608     return JNI_FALSE;
 609   } else {
 610     return (jint) Thread::is_interrupted(receiverThread, clear_interrupted != 0);
 611   }
 612 JRT_END
 613 
 614 JRT_ENTRY(int, JVMCIRuntime::test_deoptimize_call_int(JavaThread* thread, int value))
 615   deopt_caller();
 616   return value;
 617 JRT_END
 618 
 619 void JVMCIRuntime::force_initialization(TRAPS) {
 620   JVMCIRuntime::initialize_well_known_classes(CHECK);
 621 
 622   ResourceMark rm;
 623   TempNewSymbol getCompiler = SymbolTable::new_symbol("getCompiler", CHECK);
 624   TempNewSymbol sig = SymbolTable::new_symbol("()Ljdk/vm/ci/runtime/JVMCICompiler;", CHECK);
 625   Handle jvmciRuntime = JVMCIRuntime::get_HotSpotJVMCIRuntime(CHECK);
 626   JavaValue result(T_OBJECT);




  25 #include "jvm.h"
  26 #include "asm/codeBuffer.hpp"
  27 #include "classfile/javaClasses.inline.hpp"
  28 #include "code/codeCache.hpp"
  29 #include "compiler/compileBroker.hpp"
  30 #include "compiler/disassembler.hpp"
  31 #include "jvmci/jvmciRuntime.hpp"
  32 #include "jvmci/jvmciCompilerToVM.hpp"
  33 #include "jvmci/jvmciCompiler.hpp"
  34 #include "jvmci/jvmciJavaClasses.hpp"
  35 #include "jvmci/jvmciEnv.hpp"
  36 #include "logging/log.hpp"
  37 #include "memory/oopFactory.hpp"
  38 #include "memory/resourceArea.hpp"
  39 #include "oops/oop.inline.hpp"
  40 #include "oops/objArrayOop.inline.hpp"
  41 #include "runtime/biasedLocking.hpp"
  42 #include "runtime/interfaceSupport.hpp"
  43 #include "runtime/reflection.hpp"
  44 #include "runtime/sharedRuntime.hpp"
  45 #include "runtime/threadSMR.hpp"
  46 #include "utilities/debug.hpp"
  47 #include "utilities/defaultStream.hpp"
  48 #include "utilities/macros.hpp"
  49 
  50 #if defined(_MSC_VER)
  51 #define strtoll _strtoi64
  52 #endif
  53 
  54 jobject JVMCIRuntime::_HotSpotJVMCIRuntime_instance = NULL;
  55 bool JVMCIRuntime::_HotSpotJVMCIRuntime_initialized = false;
  56 bool JVMCIRuntime::_well_known_classes_initialized = false;
  57 int JVMCIRuntime::_trivial_prefixes_count = 0;
  58 char** JVMCIRuntime::_trivial_prefixes = NULL;
  59 JVMCIRuntime::CompLevelAdjustment JVMCIRuntime::_comp_level_adjustment = JVMCIRuntime::none;
  60 bool JVMCIRuntime::_shutdown_called = false;
  61 
  62 BasicType JVMCIRuntime::kindToBasicType(Handle kind, TRAPS) {
  63   if (kind.is_null()) {
  64     THROW_(vmSymbols::java_lang_NullPointerException(), T_ILLEGAL);
  65   }


 582     case 'Z': tty->print(value == 0 ? "false" : "true"); break;
 583     case 'B': tty->print("%d", (jbyte) value); break;
 584     case 'C': tty->print("%c", (jchar) value); break;
 585     case 'S': tty->print("%d", (jshort) value); break;
 586     case 'I': tty->print("%d", (jint) value); break;
 587     case 'F': tty->print("%f", uu.f); break;
 588     case 'J': tty->print(JLONG_FORMAT, value); break;
 589     case 'D': tty->print("%lf", uu.d); break;
 590     default: assert(false, "unknown typeChar"); break;
 591   }
 592   if (newline) {
 593     tty->cr();
 594   }
 595 JRT_END
 596 
 597 JRT_ENTRY(jint, JVMCIRuntime::identity_hash_code(JavaThread* thread, oopDesc* obj))
 598   return (jint) obj->identity_hash();
 599 JRT_END
 600 
 601 JRT_ENTRY(jboolean, JVMCIRuntime::thread_is_interrupted(JavaThread* thread, oopDesc* receiver, jboolean clear_interrupted))


 602   Handle receiverHandle(thread, receiver);
 603   // A nested ThreadsListHandle may require the Threads_lock which
 604   // requires thread_in_vm which is why this method cannot be JRT_LEAF.
 605   ThreadsListHandle tlh;
 606 
 607   JavaThread* receiverThread = java_lang_Thread::thread(receiverHandle());
 608   if (receiverThread == NULL || (EnableThreadSMRExtraValidityChecks && !tlh.includes(receiverThread))) {
 609     // The other thread may exit during this process, which is ok so return false.
 610     return JNI_FALSE;
 611   } else {
 612     return (jint) Thread::is_interrupted(receiverThread, clear_interrupted != 0);
 613   }
 614 JRT_END
 615 
 616 JRT_ENTRY(int, JVMCIRuntime::test_deoptimize_call_int(JavaThread* thread, int value))
 617   deopt_caller();
 618   return value;
 619 JRT_END
 620 
 621 void JVMCIRuntime::force_initialization(TRAPS) {
 622   JVMCIRuntime::initialize_well_known_classes(CHECK);
 623 
 624   ResourceMark rm;
 625   TempNewSymbol getCompiler = SymbolTable::new_symbol("getCompiler", CHECK);
 626   TempNewSymbol sig = SymbolTable::new_symbol("()Ljdk/vm/ci/runtime/JVMCICompiler;", CHECK);
 627   Handle jvmciRuntime = JVMCIRuntime::get_HotSpotJVMCIRuntime(CHECK);
 628   JavaValue result(T_OBJECT);


< prev index next >