summaryrefslogtreecommitdiff
path: root/erts/lib_src
diff options
context:
space:
mode:
authorRickard Green <rickard@erlang.org>2012-02-29 20:10:37 +0100
committerRickard Green <rickard@erlang.org>2012-02-29 20:10:37 +0100
commit3750ac230e0af600417fff900b3d5ef242fb18c7 (patch)
treeb9c56b3d7a681bcf0441e4bb2adf48da3cc8656e /erts/lib_src
parenteda0a2d866060b18af6f06abbc9ea9e920de43b7 (diff)
parentb8e572a1d755e5b90dfc9aedb49e21862376ea7d (diff)
downloaderlang-3750ac230e0af600417fff900b3d5ef242fb18c7.tar.gz
Merge branch 'rickard/barriers/OTP-9922' into maint
* rickard/barriers/OTP-9922: Fix implementation with ddrb barriers
Diffstat (limited to 'erts/lib_src')
-rw-r--r--erts/lib_src/common/ethr_atomics.c24
-rwxr-xr-xerts/lib_src/utils/make_atomics_api20
2 files changed, 21 insertions, 23 deletions
diff --git a/erts/lib_src/common/ethr_atomics.c b/erts/lib_src/common/ethr_atomics.c
index e4213e1eef..d093873841 100644
--- a/erts/lib_src/common/ethr_atomics.c
+++ b/erts/lib_src/common/ethr_atomics.c
@@ -561,12 +561,12 @@ int ethr_dw_atomic_cmpxchg(ethr_dw_atomic_t *var, ethr_dw_sint_t *val, ethr_dw_s
}
#endif
-int ETHR_DW_ATOMIC_FUNC__(cmpxchg_ddrb)(ethr_dw_atomic_t *var, ethr_dw_sint_t *val, ethr_dw_sint_t *old_val)
+int ethr_dw_atomic_cmpxchg_ddrb(ethr_dw_atomic_t *var, ethr_dw_sint_t *val, ethr_dw_sint_t *old_val)
{
#ifdef ETHR_ORDERED_READ_DEPEND
- return ETHR_DW_ATOMIC_FUNC__(cmpxchg)(var, val, old_val);
+ return ethr_dw_atomic_cmpxchg(var, val, old_val);
#else
- return ETHR_DW_ATOMIC_FUNC__(cmpxchg_rb)(var, val, old_val);
+ return ethr_dw_atomic_cmpxchg_rb(var, val, old_val);
#endif
}
@@ -784,12 +784,12 @@ void ethr_dw_atomic_set(ethr_dw_atomic_t *var, ethr_dw_sint_t *val)
}
#endif
-void ETHR_DW_ATOMIC_FUNC__(set_ddrb)(ethr_dw_atomic_t *var, ethr_dw_sint_t *val)
+void ethr_dw_atomic_set_ddrb(ethr_dw_atomic_t *var, ethr_dw_sint_t *val)
{
#ifdef ETHR_ORDERED_READ_DEPEND
- ETHR_DW_ATOMIC_FUNC__(set)(var, val);
+ ethr_dw_atomic_set(var, val);
#else
- ETHR_DW_ATOMIC_FUNC__(set_rb)(var, val);
+ ethr_dw_atomic_set_rb(var, val);
#endif
}
@@ -947,12 +947,12 @@ void ethr_dw_atomic_read(ethr_dw_atomic_t *var, ethr_dw_sint_t *val)
}
#endif
-void ETHR_DW_ATOMIC_FUNC__(read_ddrb)(ethr_dw_atomic_t *var, ethr_dw_sint_t *val)
+void ethr_dw_atomic_read_ddrb(ethr_dw_atomic_t *var, ethr_dw_sint_t *val)
{
#ifdef ETHR_ORDERED_READ_DEPEND
- ETHR_DW_ATOMIC_FUNC__(read)(var, val);
+ ethr_dw_atomic_read(var, val);
#else
- ETHR_DW_ATOMIC_FUNC__(read_rb)(var, val);
+ ethr_dw_atomic_read_rb(var, val);
#endif
}
@@ -1107,12 +1107,12 @@ void ethr_dw_atomic_init(ethr_dw_atomic_t *var, ethr_dw_sint_t *val)
}
#endif
-void ETHR_DW_ATOMIC_FUNC__(init_ddrb)(ethr_dw_atomic_t *var, ethr_dw_sint_t *val)
+void ethr_dw_atomic_init_ddrb(ethr_dw_atomic_t *var, ethr_dw_sint_t *val)
{
#ifdef ETHR_ORDERED_READ_DEPEND
- ETHR_DW_ATOMIC_FUNC__(init)(var, val);
+ ethr_dw_atomic_init(var, val);
#else
- ETHR_DW_ATOMIC_FUNC__(init_rb)(var, val);
+ ethr_dw_atomic_init_rb(var, val);
#endif
}
diff --git a/erts/lib_src/utils/make_atomics_api b/erts/lib_src/utils/make_atomics_api
index d8b1a56100..75e88f8a7e 100755
--- a/erts/lib_src/utils/make_atomics_api
+++ b/erts/lib_src/utils/make_atomics_api
@@ -805,17 +805,17 @@ rtchk_fallback_call(Return, #atomic_context{dw = DW,
non_native_barrier(B) ->
lists:member(B, ?NON_NATIVE_BARRIERS).
-non_native_barrier_impl(AC, Type, Macro, Op, B) ->
+non_native_barrier_impl(AC, Type, Op, B) ->
["
-", func_header(AC, Type, Macro, Op, B), "
+", func_header(AC, Type, false, Op, B), "
{",
case B of
ddrb ->
["
#ifdef ETHR_ORDERED_READ_DEPEND
- ", func_call(AC, Type, Macro, Op, none, true), "
+ ", func_call(AC, Type, Op, none, true), "
#else
- ", func_call(AC, Type, Macro, Op, rb, true), "
+ ", func_call(AC, Type, Op, rb, true), "
#endif
"
]
@@ -824,12 +824,10 @@ non_native_barrier_impl(AC, Type, Macro, Op, B) ->
"
].
-func_call(#atomic_context{'ATMC' = ATMC} = AC, inline_implementation, _Macro, Op, B, RetStatement) ->
+func_call(#atomic_context{'ATMC' = ATMC} = AC, inline_implementation, Op, B, RetStatement) ->
func_call(AC, Op, ["ETHR_", ATMC, "_FUNC__(", opstr(Op), op_barrier_ext(B), ")"], RetStatement);
-func_call(#atomic_context{atomic = Atomic} = AC, implementation, false, Op, B, RetStatement) ->
- func_call(AC, Op, [Atomic, "_", opstr(Op), op_barrier_ext(B)], RetStatement);
-func_call(AC, implementation, Macro, Op, B, RetStatement) ->
- func_call(AC, Op, [Macro, "(", opstr(Op), op_barrier_ext(B), ")"], RetStatement).
+func_call(#atomic_context{atomic = Atomic} = AC, implementation, Op, B, RetStatement) ->
+ func_call(AC, Op, [Atomic, "_", opstr(Op), op_barrier_ext(B)], RetStatement).
func_call(#atomic_context{dw = DW, arg1 = Arg1, arg2 = Arg2, arg3 = Arg3} = AC, Op, Func, true) ->
op_call(Op, DW, case is_return_op(AC, Op) of
@@ -901,7 +899,7 @@ make_implementations(#atomic_context{dw = DW,
lists:map(fun (B) ->
case non_native_barrier(B) of
true ->
- non_native_barrier_impl(AC, inline_implementation, false, Op, B);
+ non_native_barrier_impl(AC, inline_implementation, Op, B);
false ->
TryBarriers = try_barrier_order(B),
["
@@ -1211,7 +1209,7 @@ int ethr_have_native_dw_atomic(void)
end,
case non_native_barrier(B) of
true ->
- non_native_barrier_impl(AC, implementation, Macro, Op, B);
+ non_native_barrier_impl(AC, implementation, Op, B);
false ->
["\n",
func_header(AC, implementation, Macro, Op, B),