bug#70474: [PATCH 2/2] Replace aarch64 CAS and atomic-swap generated JIT code with CASAL and SWPAL instructions

2024-04-19 Thread Tony Garnock-Jones
This appears to make the problem go away. I'm new at working with `lightening` so I'm not confident I've covered everything that needs covering, particularly wrt the implementation of cas_atomic. But perhaps this can be a foundation for someone who knows more than I do to work from. ---

bug#70474: [PATCH 1/2] Including the cast makes Apple clang 15.0.0 happy; without it, clang is sad

2024-04-19 Thread Tony Garnock-Jones
I'm not sure why, exactly, but I needed this to get builds to work on OSX Sonoma at all. --- libguile/scmsigs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libguile/scmsigs.c b/libguile/scmsigs.c index 7fd3fd8f1..be96dbd5c 100644 --- a/libguile/scmsigs.c +++

bug#70474: [PATCH] Move the spin loop target to the LDAXR instruction.

2024-04-22 Thread Tony Garnock-Jones
Oh man. This little patch all by itself makes the problem behaviour go away. No switching to SWPAL/CASAL, just tightening the spinloop. (And no changes at all to the CAS code, so nothing to do with the fibers bug I guess.) With the patch, the spinloop goes LDAXR-STLXR-CBNZ (which is what GCC

bug#70474: Just adding DMB doesn't help

2024-04-22 Thread Tony Garnock-Jones
As an alternative to changing the JIT to produce SWPAL/CASAL, because I wasn't sure if *all* aarch64 targets support these, I tried adding DMB ISH or DMB SY to the end of the generated code sequences. Surprisingly, this did not fix the issue! So there's perhaps something fishy about the

bug#70474: [PATCH] Move the spin loop target to the LDAXR instruction.

2024-04-22 Thread Tony Garnock-Jones
Andy Wingo in IRC pointed out that the reason the patch appears to work is that the `movr` isn't idempotent! By the time it comes round again, `val` has already been overwritten by LDAXR in the case that `dst == val`. On 22/04/2024 10:18, Tony Garnock-Jones wrote: Oh man. This little patch all

bug#43364: with-output-to-port works with file ports

2024-04-24 Thread Tony Garnock-Jones
This is a nice idea. The way Racket does it is to make with-output-to-string cooperate with system: (with-output-to-string (lambda () (system "date"))) but a quick check shows that Guile does not yet have such cooperation in place. Would that be a good place to start looking? Tony On

bug#70474: Possible bug with `atomic-box-swap!` on OSX/M3 (?!?!)

2024-04-19 Thread Tony Garnock-Jones
Hello all, I'm seeing some very strange behaviour from `atomic-box-swap!` (but not `atomic-box-compare-and-swap!`) on Guile 3.0.9 from Homebrew on OSX Sonoma using an M3 Pro cpu. The issue does not seem to manifest on x86_64. Could it be some interaction between Guile and M3 CPUs? Or am I

bug#70474: Also manifests on an M1 running 14.1.1 and with newer Guile versions

2024-04-19 Thread Tony Garnock-Jones
A small bit of extra information: it's not just one machine; the problem also manifests on an M1 running OSX 14.1.1. In addition, it happens with newer Guile versions including `guile-next` from `aconchillo`'s Homebrew tap and including a version I built from Guile git main just now. Regards,