guile-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Guile-commits] 05/09: aarch64: Fix swap_atomic retry


From: Andy Wingo
Subject: [Guile-commits] 05/09: aarch64: Fix swap_atomic retry
Date: Mon, 22 Apr 2024 09:21:40 -0400 (EDT)

wingo pushed a commit to branch main
in repository guile.

commit 2c0126e3ef23ed7962d8fe36b0249fb4256e8d0b
Author: Tony Garnock-Jones <tonyg@leastfixedpoint.com>
AuthorDate: Mon Apr 22 13:24:17 2024 +0200

    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.
---
 lightening/aarch64-cpu.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lightening/aarch64-cpu.c b/lightening/aarch64-cpu.c
index 13aa351e9..2eaf74406 100644
--- a/lightening/aarch64-cpu.c
+++ b/lightening/aarch64-cpu.c
@@ -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.
  *
@@ -2532,10 +2532,10 @@ str_atomic(jit_state_t *_jit, int32_t loc, int32_t val)
 static void
 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 val_or_tmp = dst == val ? jit_gpr_regno(get_temp_gpr(_jit)) : val;
   movr(_jit, val_or_tmp, val);
+  void *retry = jit_address(_jit);
   LDAXR(_jit, dst, loc);
   STLXR(_jit, val_or_tmp, loc, result);
   jit_patch_there(_jit, bnei(_jit, result, 0), retry);



reply via email to

[Prev in Thread] Current Thread [Next in Thread]