Skip to content

Commit 9992bc2

Browse files
committed
Fix release semantics in jvm_objectmonitor
The existing release_store_thread does not provide release semantics. Replace the implemtation with a store that does provide release semantics and which allows better optimization on architectures with dedicated store-with-release-semantics instructions. Fixes #58 Change-Id: I3fd68689a79565b50c122ea3b964127e40c00b60 Signed-Off-By: Chase Conklin <chase.conklin@arm.com>
1 parent 3d95040 commit 9992bc2

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

ext/jvm/jvm_objectmonitor.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
* or visit www.oracle.com if you need additional information or have any
2121
* questions.
2222
*
23+
* Portions copyright (c) 2019, ARM Limited and Contributors. All rights
24+
* reserved.
2325
*/
2426

2527
#ifndef JVM_OBJECT_MONITOR_H
@@ -120,9 +122,7 @@
120122

121123
inline static void release_store_thread(volatile pthread_t* dest,
122124
pthread_t val) {
123-
READ_MEM_BARRIER;
124-
*dest = val;
125-
WRITE_MEM_BARRIER;
125+
__atomic_store_n(dest, val, __ATOMIC_RELEASE);
126126
}
127127

128128
inline static void storeload(void) {

0 commit comments

Comments
 (0)