src/share/vm/runtime/thread.cpp

changeset 7074
833b0f92429a
parent 6992
2c6ef90f030a
child 7107
966601b12d4f
     1.1 --- a/src/share/vm/runtime/thread.cpp	Wed Aug 27 09:36:55 2014 +0200
     1.2 +++ b/src/share/vm/runtime/thread.cpp	Wed Aug 27 08:19:12 2014 -0400
     1.3 @@ -331,8 +331,7 @@
     1.4  #if INCLUDE_NMT
     1.5    // record thread's native stack, stack grows downward
     1.6    address stack_low_addr = stack_base() - stack_size();
     1.7 -  MemTracker::record_thread_stack(stack_low_addr, stack_size(), this,
     1.8 -      CURRENT_PC);
     1.9 +  MemTracker::record_thread_stack(stack_low_addr, stack_size());
    1.10  #endif // INCLUDE_NMT
    1.11  }
    1.12  
    1.13 @@ -350,7 +349,7 @@
    1.14  #if INCLUDE_NMT
    1.15    if (_stack_base != NULL) {
    1.16      address low_stack_addr = stack_base() - stack_size();
    1.17 -    MemTracker::release_thread_stack(low_stack_addr, stack_size(), this);
    1.18 +    MemTracker::release_thread_stack(low_stack_addr, stack_size());
    1.19  #ifdef ASSERT
    1.20      set_stack_base(NULL);
    1.21  #endif
    1.22 @@ -1442,9 +1441,6 @@
    1.23    set_monitor_chunks(NULL);
    1.24    set_next(NULL);
    1.25    set_thread_state(_thread_new);
    1.26 -#if INCLUDE_NMT
    1.27 -  set_recorder(NULL);
    1.28 -#endif
    1.29    _terminated = _not_terminated;
    1.30    _privileged_stack_top = NULL;
    1.31    _array_for_gc = NULL;
    1.32 @@ -1519,7 +1515,6 @@
    1.33      _jni_attach_state = _not_attaching_via_jni;
    1.34    }
    1.35    assert(deferred_card_mark().is_empty(), "Default MemRegion ctor");
    1.36 -  _safepoint_visible = false;
    1.37  }
    1.38  
    1.39  bool JavaThread::reguard_stack(address cur_sp) {
    1.40 @@ -1582,7 +1577,6 @@
    1.41    thr_type = entry_point == &compiler_thread_entry ? os::compiler_thread :
    1.42                                                       os::java_thread;
    1.43    os::create_thread(this, thr_type, stack_sz);
    1.44 -  _safepoint_visible = false;
    1.45    // The _osthread may be NULL here because we ran out of memory (too many threads active).
    1.46    // We need to throw and OutOfMemoryError - however we cannot do this here because the caller
    1.47    // may hold a lock and all locks must be unlocked before throwing the exception (throwing
    1.48 @@ -1600,13 +1594,6 @@
    1.49        tty->print_cr("terminate thread %p", this);
    1.50    }
    1.51  
    1.52 -  // By now, this thread should already be invisible to safepoint,
    1.53 -  // and its per-thread recorder also collected.
    1.54 -  assert(!is_safepoint_visible(), "wrong state");
    1.55 -#if INCLUDE_NMT
    1.56 -  assert(get_recorder() == NULL, "Already collected");
    1.57 -#endif // INCLUDE_NMT
    1.58 -
    1.59    // JSR166 -- return the parker to the free list
    1.60    Parker::Release(_parker);
    1.61    _parker = NULL ;
    1.62 @@ -3370,11 +3357,6 @@
    1.63    // intialize TLS
    1.64    ThreadLocalStorage::init();
    1.65  
    1.66 -  // Bootstrap native memory tracking, so it can start recording memory
    1.67 -  // activities before worker thread is started. This is the first phase
    1.68 -  // of bootstrapping, VM is currently running in single-thread mode.
    1.69 -  MemTracker::bootstrap_single_thread();
    1.70 -
    1.71    // Initialize output stream logging
    1.72    ostream_init_log();
    1.73  
    1.74 @@ -3425,9 +3407,6 @@
    1.75    // Initialize Java-Level synchronization subsystem
    1.76    ObjectMonitor::Initialize() ;
    1.77  
    1.78 -  // Second phase of bootstrapping, VM is about entering multi-thread mode
    1.79 -  MemTracker::bootstrap_multi_thread();
    1.80 -
    1.81    // Initialize global modules
    1.82    jint status = init_globals();
    1.83    if (status != JNI_OK) {
    1.84 @@ -3449,9 +3428,6 @@
    1.85    // real raw monitor. VM is setup enough here for raw monitor enter.
    1.86    JvmtiExport::transition_pending_onload_raw_monitors();
    1.87  
    1.88 -  // Fully start NMT
    1.89 -  MemTracker::start();
    1.90 -
    1.91    // Create the VMThread
    1.92    { TraceTime timer("Start VMThread", TraceStartupTime);
    1.93      VMThread::create();
    1.94 @@ -4089,8 +4065,6 @@
    1.95      daemon = false;
    1.96    }
    1.97  
    1.98 -  p->set_safepoint_visible(true);
    1.99 -
   1.100    ThreadService::add_thread(p, daemon);
   1.101  
   1.102    // Possible GC point.
   1.103 @@ -4136,13 +4110,6 @@
   1.104      // to do callbacks into the safepoint code. However, the safepoint code is not aware
   1.105      // of this thread since it is removed from the queue.
   1.106      p->set_terminated_value();
   1.107 -
   1.108 -    // Now, this thread is not visible to safepoint
   1.109 -    p->set_safepoint_visible(false);
   1.110 -    // once the thread becomes safepoint invisible, we can not use its per-thread
   1.111 -    // recorder. And Threads::do_threads() no longer walks this thread, so we have
   1.112 -    // to release its per-thread recorder here.
   1.113 -    MemTracker::thread_exiting(p);
   1.114    } // unlock Threads_lock
   1.115  
   1.116    // Since Events::log uses a lock, we grab it outside the Threads_lock

mercurial