hotspot/src/share/vm/runtime/thread.cpp
changeset 36199 855b44ce93c0
parent 36074 11263906664c
parent 36186 06763de0d7ad
child 36355 dd339cbafd31
child 36207 09a0c20ff517
equal deleted inserted replaced
36105:b382ba2f07de 36199:855b44ce93c0
    65 #include "runtime/init.hpp"
    65 #include "runtime/init.hpp"
    66 #include "runtime/interfaceSupport.hpp"
    66 #include "runtime/interfaceSupport.hpp"
    67 #include "runtime/java.hpp"
    67 #include "runtime/java.hpp"
    68 #include "runtime/javaCalls.hpp"
    68 #include "runtime/javaCalls.hpp"
    69 #include "runtime/jniPeriodicChecker.hpp"
    69 #include "runtime/jniPeriodicChecker.hpp"
       
    70 #include "runtime/logTimer.hpp"
    70 #include "runtime/memprofiler.hpp"
    71 #include "runtime/memprofiler.hpp"
    71 #include "runtime/mutexLocker.hpp"
    72 #include "runtime/mutexLocker.hpp"
    72 #include "runtime/objectMonitor.hpp"
    73 #include "runtime/objectMonitor.hpp"
    73 #include "runtime/orderAccess.inline.hpp"
    74 #include "runtime/orderAccess.inline.hpp"
    74 #include "runtime/osThread.hpp"
    75 #include "runtime/osThread.hpp"
   167                                                          AllocFailStrategy::RETURN_NULL);
   168                                                          AllocFailStrategy::RETURN_NULL);
   168     void* aligned_addr     = (void*) align_size_up((intptr_t) real_malloc_addr, alignment);
   169     void* aligned_addr     = (void*) align_size_up((intptr_t) real_malloc_addr, alignment);
   169     assert(((uintptr_t) aligned_addr + (uintptr_t) size) <=
   170     assert(((uintptr_t) aligned_addr + (uintptr_t) size) <=
   170            ((uintptr_t) real_malloc_addr + (uintptr_t) aligned_size),
   171            ((uintptr_t) real_malloc_addr + (uintptr_t) aligned_size),
   171            "JavaThread alignment code overflowed allocated storage");
   172            "JavaThread alignment code overflowed allocated storage");
   172     if (TraceBiasedLocking) {
   173     if (aligned_addr != real_malloc_addr) {
   173       if (aligned_addr != real_malloc_addr) {
   174       log_info(biasedlocking)("Aligned thread " INTPTR_FORMAT " to " INTPTR_FORMAT,
   174         tty->print_cr("Aligned thread " INTPTR_FORMAT " to " INTPTR_FORMAT,
   175                               p2i(real_malloc_addr),
   175                       p2i(real_malloc_addr), p2i(aligned_addr));
   176                               p2i(aligned_addr));
   176       }
       
   177     }
   177     }
   178     ((Thread*) aligned_addr)->_real_malloc_address = real_malloc_addr;
   178     ((Thread*) aligned_addr)->_real_malloc_address = real_malloc_addr;
   179     return aligned_addr;
   179     return aligned_addr;
   180   } else {
   180   } else {
   181     return throw_excpt? AllocateHeap(size, flags, CURRENT_PC)
   181     return throw_excpt? AllocateHeap(size, flags, CURRENT_PC)
  3339 
  3339 
  3340   // If CompilerThreads ever become non-JavaThreads, add them here
  3340   // If CompilerThreads ever become non-JavaThreads, add them here
  3341 }
  3341 }
  3342 
  3342 
  3343 void Threads::initialize_java_lang_classes(JavaThread* main_thread, TRAPS) {
  3343 void Threads::initialize_java_lang_classes(JavaThread* main_thread, TRAPS) {
  3344   TraceTime timer("Initialize java.lang classes", TraceStartupTime);
  3344   TraceStartupTime timer("Initialize java.lang classes");
  3345 
  3345 
  3346   if (EagerXrunInit && Arguments::init_libraries_at_startup()) {
  3346   if (EagerXrunInit && Arguments::init_libraries_at_startup()) {
  3347     create_vm_init_libraries();
  3347     create_vm_init_libraries();
  3348   }
  3348   }
  3349 
  3349 
  3386   initialize_class(vmSymbols::java_lang_IllegalMonitorStateException(), CHECK);
  3386   initialize_class(vmSymbols::java_lang_IllegalMonitorStateException(), CHECK);
  3387   initialize_class(vmSymbols::java_lang_IllegalArgumentException(), CHECK);
  3387   initialize_class(vmSymbols::java_lang_IllegalArgumentException(), CHECK);
  3388 }
  3388 }
  3389 
  3389 
  3390 void Threads::initialize_jsr292_core_classes(TRAPS) {
  3390 void Threads::initialize_jsr292_core_classes(TRAPS) {
       
  3391   TraceStartupTime timer("Initialize java.lang.invoke classes");
       
  3392 
  3391   initialize_class(vmSymbols::java_lang_invoke_MethodHandle(), CHECK);
  3393   initialize_class(vmSymbols::java_lang_invoke_MethodHandle(), CHECK);
  3392   initialize_class(vmSymbols::java_lang_invoke_MemberName(), CHECK);
  3394   initialize_class(vmSymbols::java_lang_invoke_MemberName(), CHECK);
  3393   initialize_class(vmSymbols::java_lang_invoke_MethodHandleNatives(), CHECK);
  3395   initialize_class(vmSymbols::java_lang_invoke_MethodHandleNatives(), CHECK);
  3394 }
  3396 }
  3395 
  3397 
  3455   }
  3457   }
  3456 
  3458 
  3457   HOTSPOT_VM_INIT_BEGIN();
  3459   HOTSPOT_VM_INIT_BEGIN();
  3458 
  3460 
  3459   // Timing (must come after argument parsing)
  3461   // Timing (must come after argument parsing)
  3460   TraceTime timer("Create VM", TraceStartupTime);
  3462   TraceStartupTime timer("Create VM");
  3461 
  3463 
  3462   // Initialize the os module after parsing the args
  3464   // Initialize the os module after parsing the args
  3463   jint os_init_2_result = os::init_2();
  3465   jint os_init_2_result = os::init_2();
  3464   if (os_init_2_result != JNI_OK) return os_init_2_result;
  3466   if (os_init_2_result != JNI_OK) return os_init_2_result;
  3465 
  3467 
  3540   // Any JVMTI raw monitors entered in onload will transition into
  3542   // Any JVMTI raw monitors entered in onload will transition into
  3541   // real raw monitor. VM is setup enough here for raw monitor enter.
  3543   // real raw monitor. VM is setup enough here for raw monitor enter.
  3542   JvmtiExport::transition_pending_onload_raw_monitors();
  3544   JvmtiExport::transition_pending_onload_raw_monitors();
  3543 
  3545 
  3544   // Create the VMThread
  3546   // Create the VMThread
  3545   { TraceTime timer("Start VMThread", TraceStartupTime);
  3547   { TraceStartupTime timer("Start VMThread");
  3546     VMThread::create();
  3548 
       
  3549   VMThread::create();
  3547     Thread* vmthread = VMThread::vm_thread();
  3550     Thread* vmthread = VMThread::vm_thread();
  3548 
  3551 
  3549     if (!os::create_thread(vmthread, os::vm_thread)) {
  3552     if (!os::create_thread(vmthread, os::vm_thread)) {
  3550       vm_exit_during_initialization("Cannot create VM thread. "
  3553       vm_exit_during_initialization("Cannot create VM thread. "
  3551                                     "Out of system resources.");
  3554                                     "Out of system resources.");