mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-04-30 03:40:34 +02:00
aarch64: Fix swap_atomic retry
* lightening/aarch64-cpu.c (swap_atomic): If the swap fails, and the dst register was the same as the val, we would stomple val during the retry. Fixes https://github.com/wingo/fibers/issues/83#issuecomment-2068847127.
This commit is contained in:
parent
d759faa27a
commit
2c0126e3ef
1 changed files with 2 additions and 2 deletions
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2013-2017, 2019 Free Software Foundation, Inc.
|
* Copyright (C) 2013-2017, 2019, 2024 Free Software Foundation, Inc.
|
||||||
*
|
*
|
||||||
* This file is part of GNU lightning.
|
* This file is part of GNU lightning.
|
||||||
*
|
*
|
||||||
|
@ -2532,10 +2532,10 @@ str_atomic(jit_state_t *_jit, int32_t loc, int32_t val)
|
||||||
static void
|
static void
|
||||||
swap_atomic(jit_state_t *_jit, int32_t dst, int32_t loc, int32_t val)
|
swap_atomic(jit_state_t *_jit, int32_t dst, int32_t loc, int32_t val)
|
||||||
{
|
{
|
||||||
void *retry = jit_address(_jit);
|
|
||||||
int32_t result = jit_gpr_regno(get_temp_gpr(_jit));
|
int32_t result = jit_gpr_regno(get_temp_gpr(_jit));
|
||||||
int32_t val_or_tmp = dst == val ? jit_gpr_regno(get_temp_gpr(_jit)) : val;
|
int32_t val_or_tmp = dst == val ? jit_gpr_regno(get_temp_gpr(_jit)) : val;
|
||||||
movr(_jit, val_or_tmp, val);
|
movr(_jit, val_or_tmp, val);
|
||||||
|
void *retry = jit_address(_jit);
|
||||||
LDAXR(_jit, dst, loc);
|
LDAXR(_jit, dst, loc);
|
||||||
STLXR(_jit, val_or_tmp, loc, result);
|
STLXR(_jit, val_or_tmp, loc, result);
|
||||||
jit_patch_there(_jit, bnei(_jit, result, 0), retry);
|
jit_patch_there(_jit, bnei(_jit, result, 0), retry);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue