Skip to content

Commit 62ef706

Browse files
committed
8355648: Thread.SpinAcquire()'s lock name parameter is not used
Reviewed-by: shade, coleenp
1 parent 1fd136c commit 62ef706

File tree

5 files changed

+11
-15
lines changed

5 files changed

+11
-15
lines changed

src/hotspot/share/jfr/utilities/jfrSpinlockHelper.hpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2013, 2023, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2013, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -33,11 +33,7 @@ class JfrSpinlockHelper {
3333

3434
public:
3535
JfrSpinlockHelper(volatile int* lock) : _lock(lock) {
36-
Thread::SpinAcquire(_lock, nullptr);
37-
}
38-
39-
JfrSpinlockHelper(volatile int* const lock, const char* name) : _lock(lock) {
40-
Thread::SpinAcquire(_lock, name);
36+
Thread::SpinAcquire(_lock);
4137
}
4238

4339
~JfrSpinlockHelper() {

src/hotspot/share/runtime/objectMonitor.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1805,7 +1805,7 @@ void ObjectMonitor::wait(jlong millis, bool interruptible, TRAPS) {
18051805
// returns because of a timeout of interrupt. Contention is exceptionally rare
18061806
// so we use a simple spin-lock instead of a heavier-weight blocking lock.
18071807

1808-
Thread::SpinAcquire(&_wait_set_lock, "wait_set - add");
1808+
Thread::SpinAcquire(&_wait_set_lock);
18091809
add_waiter(&node);
18101810
Thread::SpinRelease(&_wait_set_lock);
18111811

@@ -1864,7 +1864,7 @@ void ObjectMonitor::wait(jlong millis, bool interruptible, TRAPS) {
18641864
// That is, we fail toward safety.
18651865

18661866
if (node.TState == ObjectWaiter::TS_WAIT) {
1867-
Thread::SpinAcquire(&_wait_set_lock, "wait_set - unlink");
1867+
Thread::SpinAcquire(&_wait_set_lock);
18681868
if (node.TState == ObjectWaiter::TS_WAIT) {
18691869
dequeue_specific_waiter(&node); // unlink from wait_set
18701870
assert(!node._notified, "invariant");
@@ -1980,7 +1980,7 @@ void ObjectMonitor::wait(jlong millis, bool interruptible, TRAPS) {
19801980

19811981
bool ObjectMonitor::notify_internal(JavaThread* current) {
19821982
bool did_notify = false;
1983-
Thread::SpinAcquire(&_wait_set_lock, "wait_set - notify");
1983+
Thread::SpinAcquire(&_wait_set_lock);
19841984
ObjectWaiter* iterator = dequeue_waiter();
19851985
if (iterator != nullptr) {
19861986
guarantee(iterator->TState == ObjectWaiter::TS_WAIT, "invariant");
@@ -2120,7 +2120,7 @@ void ObjectMonitor::vthread_wait(JavaThread* current, jlong millis) {
21202120
// returns because of a timeout or interrupt. Contention is exceptionally rare
21212121
// so we use a simple spin-lock instead of a heavier-weight blocking lock.
21222122

2123-
Thread::SpinAcquire(&_wait_set_lock, "wait_set - add");
2123+
Thread::SpinAcquire(&_wait_set_lock);
21242124
add_waiter(node);
21252125
Thread::SpinRelease(&_wait_set_lock);
21262126

@@ -2143,7 +2143,7 @@ bool ObjectMonitor::vthread_wait_reenter(JavaThread* current, ObjectWaiter* node
21432143
// need to check if we were interrupted or the wait timed-out, and
21442144
// in that case remove ourselves from the _wait_set queue.
21452145
if (node->TState == ObjectWaiter::TS_WAIT) {
2146-
Thread::SpinAcquire(&_wait_set_lock, "wait_set - unlink");
2146+
Thread::SpinAcquire(&_wait_set_lock);
21472147
if (node->TState == ObjectWaiter::TS_WAIT) {
21482148
dequeue_specific_waiter(node); // unlink from wait_set
21492149
assert(!node->_notified, "invariant");

src/hotspot/share/runtime/park.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ ParkEvent * ParkEvent::Allocate (Thread * t) {
6060
// Using a spin lock since we are part of the mutex impl.
6161
// 8028280: using concurrent free list without memory management can leak
6262
// pretty badly it turns out.
63-
Thread::SpinAcquire(&ListLock, "ParkEventFreeListAllocate");
63+
Thread::SpinAcquire(&ListLock);
6464
{
6565
ev = FreeList;
6666
if (ev != nullptr) {
@@ -88,7 +88,7 @@ void ParkEvent::Release (ParkEvent * ev) {
8888
ev->AssociatedWith = nullptr ;
8989
// Note that if we didn't have the TSM/immortal constraint, then
9090
// when reattaching we could trim the list.
91-
Thread::SpinAcquire(&ListLock, "ParkEventFreeListRelease");
91+
Thread::SpinAcquire(&ListLock);
9292
{
9393
ev->FreeNext = FreeList;
9494
FreeList = ev;

src/hotspot/share/runtime/thread.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -562,7 +562,7 @@ bool Thread::set_as_starting_thread(JavaThread* jt) {
562562
// short-duration critical sections where we're concerned
563563
// about native mutex_t or HotSpot Mutex:: latency.
564564

565-
void Thread::SpinAcquire(volatile int * adr, const char * LockName) {
565+
void Thread::SpinAcquire(volatile int * adr) {
566566
if (Atomic::cmpxchg(adr, 0, 1) == 0) {
567567
return; // normal fast-path return
568568
}

src/hotspot/share/runtime/thread.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -605,7 +605,7 @@ class Thread: public ThreadShadow {
605605

606606
// Low-level leaf-lock primitives used to implement synchronization.
607607
// Not for general synchronization use.
608-
static void SpinAcquire(volatile int * Lock, const char * Name);
608+
static void SpinAcquire(volatile int * Lock);
609609
static void SpinRelease(volatile int * Lock);
610610

611611
#if defined(__APPLE__) && defined(AARCH64)

0 commit comments

Comments
 (0)