< prev index next >

src/hotspot/share/runtime/javaThread.cpp

Print this page
@@ -155,11 +155,11 @@
  void JavaThread::set_threadOopHandles(oop p) {
    assert(_thread_oop_storage != NULL, "not yet initialized");
    _threadObj   = OopHandle(_thread_oop_storage, p);
    _vthread     = OopHandle(_thread_oop_storage, p);
    _jvmti_vthread = OopHandle(_thread_oop_storage, NULL);
-   _extentLocalCache = OopHandle(_thread_oop_storage, NULL);
+   _scopedValueCache = OopHandle(_thread_oop_storage, NULL);
  }
  
  oop JavaThread::threadObj() const {
    // Ideally we would verify the current thread is oop_safe when this is called, but as we can
    // be called from a signal handler we would have to use Thread::current_or_null_safe(). That

@@ -184,17 +184,25 @@
  void JavaThread::set_jvmti_vthread(oop p) {
    assert(_thread_oop_storage != NULL, "not yet initialized");
    _jvmti_vthread.replace(p);
  }
  
- oop JavaThread::extentLocalCache() const {
-   return _extentLocalCache.resolve();
+ oop JavaThread::scopedValueCache() const {
+   return _scopedValueCache.resolve();
  }
  
- void JavaThread::set_extentLocalCache(oop p) {
-   assert(_thread_oop_storage != NULL, "not yet initialized");
-   _extentLocalCache.replace(p);
+ void JavaThread::set_scopedValueCache(oop p) {
+   if (_scopedValueCache.ptr_raw() != NULL) { // i.e. if the OopHandle has been allocated
+     _scopedValueCache.replace(p);
+   } else {
+     assert(p == NULL, "not yet initialized");
+   }
+ }
+ 
+ void JavaThread::clear_scopedValueBindings() {
+   set_scopedValueCache(NULL);
+   java_lang_Thread::clear_scopedValueBindings(vthread());
  }
  
  void JavaThread::allocate_threadObj(Handle thread_group, const char* thread_name,
                                      bool daemon, TRAPS) {
    assert(thread_group.not_null(), "thread group should be specified");

@@ -1063,15 +1071,11 @@
    }
  
    // We cannot call Exceptions::_throw(...) here because we cannot block
    set_pending_exception(java_throwable, __FILE__, __LINE__);
  
-   // Clear any extent-local bindings
-   set_extentLocalCache(NULL);
-   oop threadOop = threadObj();
-   assert(threadOop != NULL, "must be");
-   java_lang_Thread::clear_extentLocalBindings(threadOop);
+   clear_scopedValueBindings();
  
    LogTarget(Info, exceptions) lt;
    if (lt.is_enabled()) {
      ResourceMark rm;
      LogStream ls(lt);

@@ -2129,9 +2133,9 @@
    MutexLocker ml(Service_lock, Mutex::_no_safepoint_check_flag);
    OopHandleList* new_head = new OopHandleList(_oop_handle_list);
    new_head->add(_threadObj);
    new_head->add(_vthread);
    new_head->add(_jvmti_vthread);
-   new_head->add(_extentLocalCache);
+   new_head->add(_scopedValueCache);
    _oop_handle_list = new_head;
    Service_lock->notify_all();
  }
< prev index next >