Skip to content

Commit b9729cb

Browse files
committed
8253284: Zero OrderAccess barrier mappings are incorrect
Reviewed-by: dholmes, aph, andrew
1 parent 284bbf0 commit b9729cb

File tree

2 files changed

+26
-26
lines changed

2 files changed

+26
-26
lines changed

src/hotspot/os_cpu/bsd_zero/orderAccess_bsd_zero.hpp

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929
// Included in orderAccess.hpp header file.
3030

31-
#ifdef ARM
31+
#if defined(ARM) // ----------------------------------------------------
3232

3333
/*
3434
* ARM Kernel helper for memory barrier.
@@ -39,28 +39,32 @@
3939
typedef void (__kernel_dmb_t) (void);
4040
#define __kernel_dmb (*(__kernel_dmb_t *) 0xffff0fa0)
4141

42-
#define FULL_MEM_BARRIER __kernel_dmb()
4342
#define LIGHT_MEM_BARRIER __kernel_dmb()
43+
#define FULL_MEM_BARRIER __kernel_dmb()
4444

45-
#else // ARM
46-
47-
#define FULL_MEM_BARRIER __sync_synchronize()
48-
49-
#ifdef PPC
45+
#elif defined(PPC) // ----------------------------------------------------
5046

5147
#ifdef __NO_LWSYNC__
5248
#define LIGHT_MEM_BARRIER __asm __volatile ("sync":::"memory")
5349
#else
5450
#define LIGHT_MEM_BARRIER __asm __volatile ("lwsync":::"memory")
5551
#endif
5652

57-
#else // PPC
53+
#define FULL_MEM_BARRIER __sync_synchronize()
54+
55+
#elif defined(X86) // ----------------------------------------------------
5856

5957
#define LIGHT_MEM_BARRIER __asm __volatile ("":::"memory")
58+
#define FULL_MEM_BARRIER __sync_synchronize()
59+
60+
#else // ----------------------------------------------------
61+
62+
// Default to strongest barriers for correctness.
6063

61-
#endif // PPC
64+
#define LIGHT_MEM_BARRIER __sync_synchronize()
65+
#define FULL_MEM_BARRIER __sync_synchronize()
6266

63-
#endif // ARM
67+
#endif // ----------------------------------------------------
6468

6569
// Note: What is meant by LIGHT_MEM_BARRIER is a barrier which is sufficient
6670
// to provide TSO semantics, i.e. StoreStore | LoadLoad | LoadStore.

src/hotspot/os_cpu/linux_zero/orderAccess_linux_zero.hpp

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929
// Included in orderAccess.hpp header file.
3030

31-
#ifdef ARM
31+
#if defined(ARM) // ----------------------------------------------------
3232

3333
/*
3434
* ARM Kernel helper for memory barrier.
@@ -39,36 +39,32 @@
3939
typedef void (__kernel_dmb_t) (void);
4040
#define __kernel_dmb (*(__kernel_dmb_t *) 0xffff0fa0)
4141

42-
#define FULL_MEM_BARRIER __kernel_dmb()
4342
#define LIGHT_MEM_BARRIER __kernel_dmb()
43+
#define FULL_MEM_BARRIER __kernel_dmb()
4444

45-
#else // ARM
46-
47-
#define FULL_MEM_BARRIER __sync_synchronize()
48-
49-
#ifdef PPC
45+
#elif defined(PPC) // ----------------------------------------------------
5046

5147
#ifdef __NO_LWSYNC__
5248
#define LIGHT_MEM_BARRIER __asm __volatile ("sync":::"memory")
5349
#else
5450
#define LIGHT_MEM_BARRIER __asm __volatile ("lwsync":::"memory")
5551
#endif
5652

57-
#else // PPC
53+
#define FULL_MEM_BARRIER __sync_synchronize()
5854

59-
#ifdef ALPHA
60-
61-
#define LIGHT_MEM_BARRIER __sync_synchronize()
62-
63-
#else // ALPHA
55+
#elif defined(X86) // ----------------------------------------------------
6456

6557
#define LIGHT_MEM_BARRIER __asm __volatile ("":::"memory")
58+
#define FULL_MEM_BARRIER __sync_synchronize()
59+
60+
#else // ----------------------------------------------------
6661

67-
#endif // ALPHA
62+
// Default to strongest barriers for correctness.
6863

69-
#endif // PPC
64+
#define LIGHT_MEM_BARRIER __sync_synchronize()
65+
#define FULL_MEM_BARRIER __sync_synchronize()
7066

71-
#endif // ARM
67+
#endif // ----------------------------------------------------
7268

7369
// Note: What is meant by LIGHT_MEM_BARRIER is a barrier which is sufficient
7470
// to provide TSO semantics, i.e. StoreStore | LoadLoad | LoadStore.

0 commit comments

Comments
 (0)