< prev index next >

src/hotspot/share/opto/library_call.cpp

Print this page
*** 476,10 ***
--- 476,11 ---
    case vmIntrinsics::_onSpinWait:               return inline_onspinwait();
  
    case vmIntrinsics::_currentCarrierThread:     return inline_native_currentCarrierThread();
    case vmIntrinsics::_currentThread:            return inline_native_currentThread();
    case vmIntrinsics::_setCurrentThread:         return inline_native_setCurrentThread();
+   case vmIntrinsics::_setLockId:                return inline_native_setLockId();
  
    case vmIntrinsics::_scopedValueCache:          return inline_native_scopedValueCache();
    case vmIntrinsics::_setScopedValueCache:       return inline_native_setScopedValueCache();
  
  #if INCLUDE_JVMTI

*** 3635,14 ***
--- 3636,27 ---
    Node* thread_obj_handle
      = make_load(nullptr, p, p->bottom_type()->is_ptr(), T_OBJECT, MemNode::unordered);
    thread_obj_handle = _gvn.transform(thread_obj_handle);
    const TypePtr *adr_type = _gvn.type(thread_obj_handle)->isa_ptr();
    access_store_at(nullptr, thread_obj_handle, adr_type, arr, _gvn.type(arr), T_OBJECT, IN_NATIVE | MO_UNORDERED);
+ 
+   // Change the lock_id of the JavaThread
+   Node* tid = load_field_from_object(arr, "tid", "J");
+   Node* thread_id_offset = basic_plus_adr(thread, in_bytes(JavaThread::lock_id_offset()));
+   Node* tid_memory = store_to_memory(control(), thread_id_offset, tid, T_LONG, Compile::AliasIdxRaw, MemNode::unordered, true);
+ 
    JFR_ONLY(extend_setCurrentThread(thread, arr);)
    return true;
  }
  
+ bool LibraryCallKit::inline_native_setLockId() {
+   Node* thread = _gvn.transform(new ThreadLocalNode());
+   Node* thread_id_offset = basic_plus_adr(thread, in_bytes(JavaThread::lock_id_offset()));
+   Node* tid_memory = store_to_memory(control(), thread_id_offset, ConvL2X(argument(0)), T_LONG, Compile::AliasIdxRaw, MemNode::unordered, true);
+   return true;
+ }
+ 
  const Type* LibraryCallKit::scopedValueCache_type() {
    ciKlass* objects_klass = ciObjArrayKlass::make(env()->Object_klass());
    const TypeOopPtr* etype = TypeOopPtr::make_from_klass(env()->Object_klass());
    const TypeAry* arr0 = TypeAry::make(etype, TypeInt::POS);
  
< prev index next >