src/share/vm/runtime/thread.cpp

changeset 6457
94c202aa2646
parent 6455
438e13354adf
parent 5427
02d7aa1456c9
child 6462
e2722a66aba7
     1.1 --- a/src/share/vm/runtime/thread.cpp	Fri Jul 26 10:12:15 2013 +0200
     1.2 +++ b/src/share/vm/runtime/thread.cpp	Thu Aug 01 17:25:10 2013 -0700
     1.3 @@ -218,6 +218,7 @@
     1.4    // allocated data structures
     1.5    set_osthread(NULL);
     1.6    set_resource_area(new (mtThread)ResourceArea());
     1.7 +  DEBUG_ONLY(_current_resource_mark = NULL;)
     1.8    set_handle_area(new (mtThread) HandleArea(NULL));
     1.9    set_metadata_handles(new (ResourceObj::C_HEAP, mtClass) GrowableArray<Metadata*>(30, true));
    1.10    set_active_handles(NULL);
    1.11 @@ -956,6 +957,14 @@
    1.12  }
    1.13  
    1.14  
    1.15 +bool Thread::is_in_usable_stack(address adr) const {
    1.16 +  size_t stack_guard_size = os::uses_stack_guard_pages() ? (StackYellowPages + StackRedPages) * os::vm_page_size() : 0;
    1.17 +  size_t usable_stack_size = _stack_size - stack_guard_size;
    1.18 +
    1.19 +  return ((adr < stack_base()) && (adr >= stack_base() - usable_stack_size));
    1.20 +}
    1.21 +
    1.22 +
    1.23  // We had to move these methods here, because vm threads get into ObjectSynchronizer::enter
    1.24  // However, there is a note in JavaThread::is_lock_owned() about the VM threads not being
    1.25  // used for compilation in the future. If that change is made, the need for these methods
    1.26 @@ -1220,7 +1229,7 @@
    1.27  bool WatcherThread::_startable = false;
    1.28  volatile bool  WatcherThread::_should_terminate = false;
    1.29  
    1.30 -WatcherThread::WatcherThread() : Thread() {
    1.31 +WatcherThread::WatcherThread() : Thread(), _crash_protection(NULL) {
    1.32    assert(watcher_thread() == NULL, "we can only allocate one WatcherThread");
    1.33    if (os::create_thread(this, os::watcher_thread)) {
    1.34      _watcher_thread = this;
    1.35 @@ -3484,44 +3493,6 @@
    1.36  
    1.37      initialize_class(vmSymbols::java_lang_String(), CHECK_0);
    1.38  
    1.39 -    if (AggressiveOpts) {
    1.40 -      {
    1.41 -        // Forcibly initialize java/util/HashMap and mutate the private
    1.42 -        // static final "frontCacheEnabled" field before we start creating instances
    1.43 -#ifdef ASSERT
    1.44 -        Klass* tmp_k = SystemDictionary::find(vmSymbols::java_util_HashMap(), Handle(), Handle(), CHECK_0);
    1.45 -        assert(tmp_k == NULL, "java/util/HashMap should not be loaded yet");
    1.46 -#endif
    1.47 -        Klass* k_o = SystemDictionary::resolve_or_null(vmSymbols::java_util_HashMap(), Handle(), Handle(), CHECK_0);
    1.48 -        KlassHandle k = KlassHandle(THREAD, k_o);
    1.49 -        guarantee(k.not_null(), "Must find java/util/HashMap");
    1.50 -        instanceKlassHandle ik = instanceKlassHandle(THREAD, k());
    1.51 -        ik->initialize(CHECK_0);
    1.52 -        fieldDescriptor fd;
    1.53 -        // Possible we might not find this field; if so, don't break
    1.54 -        if (ik->find_local_field(vmSymbols::frontCacheEnabled_name(), vmSymbols::bool_signature(), &fd)) {
    1.55 -          k()->java_mirror()->bool_field_put(fd.offset(), true);
    1.56 -        }
    1.57 -      }
    1.58 -
    1.59 -      if (UseStringCache) {
    1.60 -        // Forcibly initialize java/lang/StringValue and mutate the private
    1.61 -        // static final "stringCacheEnabled" field before we start creating instances
    1.62 -        Klass* k_o = SystemDictionary::resolve_or_null(vmSymbols::java_lang_StringValue(), Handle(), Handle(), CHECK_0);
    1.63 -        // Possible that StringValue isn't present: if so, silently don't break
    1.64 -        if (k_o != NULL) {
    1.65 -          KlassHandle k = KlassHandle(THREAD, k_o);
    1.66 -          instanceKlassHandle ik = instanceKlassHandle(THREAD, k());
    1.67 -          ik->initialize(CHECK_0);
    1.68 -          fieldDescriptor fd;
    1.69 -          // Possible we might not find this field: if so, silently don't break
    1.70 -          if (ik->find_local_field(vmSymbols::stringCacheEnabled_name(), vmSymbols::bool_signature(), &fd)) {
    1.71 -            k()->java_mirror()->bool_field_put(fd.offset(), true);
    1.72 -          }
    1.73 -        }
    1.74 -      }
    1.75 -    }
    1.76 -
    1.77      // Initialize java_lang.System (needed before creating the thread)
    1.78      initialize_class(vmSymbols::java_lang_System(), CHECK_0);
    1.79      initialize_class(vmSymbols::java_lang_ThreadGroup(), CHECK_0);
    1.80 @@ -3639,6 +3610,7 @@
    1.81  
    1.82    // Start Attach Listener if +StartAttachListener or it can't be started lazily
    1.83    if (!DisableAttachMechanism) {
    1.84 +    AttachListener::vm_start();
    1.85      if (StartAttachListener || AttachListener::init_at_startup()) {
    1.86        AttachListener::init();
    1.87      }

mercurial