Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
8253970: Build error: address argument to atomic builtin must be a po…
…inter to integer or pointer ('volatile narrowOop *' invalid)

Reviewed-by: kbarrett, dholmes
  • Loading branch information
DamonFool committed Oct 19, 2020
1 parent 4ffed32 commit cb7701b
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 6 deletions.
17 changes: 14 additions & 3 deletions src/hotspot/os_cpu/bsd_zero/atomic_bsd_zero.hpp
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright 2007, 2008, 2011, 2015, Red Hat, Inc.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
Expand Down Expand Up @@ -255,7 +255,12 @@ inline T Atomic::PlatformCmpxchg<4>::operator()(T volatile* dest,
#ifdef M68K
return cmpxchg_using_helper<int>(m68k_compare_and_swap, dest, compare_value, exchange_value);
#else
return __sync_val_compare_and_swap(dest, compare_value, exchange_value);
T value = compare_value;
FULL_MEM_BARRIER;
__atomic_compare_exchange(dest, &value, &exchange_value, /*weak*/false,
__ATOMIC_RELAXED, __ATOMIC_RELAXED);
FULL_MEM_BARRIER;
return value;
#endif // M68K
#endif // ARM
}
Expand All @@ -267,7 +272,13 @@ inline T Atomic::PlatformCmpxchg<8>::operator()(T volatile* dest,
T exchange_value,
atomic_memory_order order) const {
STATIC_ASSERT(8 == sizeof(T));
return __sync_val_compare_and_swap(dest, compare_value, exchange_value);

T value = compare_value;
FULL_MEM_BARRIER;
__atomic_compare_exchange(dest, &value, &exchange_value, /*weak*/false,
__ATOMIC_RELAXED, __ATOMIC_RELAXED);
FULL_MEM_BARRIER;
return value;
}

template<>
Expand Down
18 changes: 15 additions & 3 deletions src/hotspot/os_cpu/linux_zero/atomic_linux_zero.hpp
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright 2007, 2008, 2011, 2015, Red Hat, Inc.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
Expand Down Expand Up @@ -103,7 +103,13 @@ inline T Atomic::PlatformCmpxchg<4>::operator()(T volatile* dest,
T exchange_value,
atomic_memory_order order) const {
STATIC_ASSERT(4 == sizeof(T));
return __sync_val_compare_and_swap(dest, compare_value, exchange_value);

T value = compare_value;
FULL_MEM_BARRIER;
__atomic_compare_exchange(dest, &value, &exchange_value, /*weak*/false,
__ATOMIC_RELAXED, __ATOMIC_RELAXED);
FULL_MEM_BARRIER;
return value;
}

template<>
Expand All @@ -113,7 +119,13 @@ inline T Atomic::PlatformCmpxchg<8>::operator()(T volatile* dest,
T exchange_value,
atomic_memory_order order) const {
STATIC_ASSERT(8 == sizeof(T));
return __sync_val_compare_and_swap(dest, compare_value, exchange_value);

FULL_MEM_BARRIER;
T value = compare_value;
__atomic_compare_exchange(dest, &value, &exchange_value, /*weak*/false,
__ATOMIC_RELAXED, __ATOMIC_RELAXED);
FULL_MEM_BARRIER;
return value;
}

template<>
Expand Down

1 comment on commit cb7701b

@bridgekeeper
Copy link

@bridgekeeper bridgekeeper bot commented on cb7701b Oct 19, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.