Implement a simple compare and swap atomic operation. - lightning.git - Portable just-in-time compiler library

index : lightning.git
Portable just-in-time compiler library
summary refs log tree commit diff
path: root/lib/jit_x86.c
diff options
context:
space:
mode:
authorpcpa <paulo.cesar.pereira.de.andrade@gmail.com>2022年09月08日 16:48:43 -0300
committerpcpa <paulo.cesar.pereira.de.andrade@gmail.com>2022年09月08日 16:48:43 -0300
commitd5a7c8e4ad719e84dbb4904c532f906a1ef5a77b (patch)
tree58f01a849950cef4f32cbfbf4fd036d17ece66d7 /lib/jit_x86.c
parente7a4ea8828be7c71140b5a0ca4f891d0053c64a5 (diff)
downloadlightning-d5a7c8e4ad719e84dbb4904c532f906a1ef5a77b.tar.gz
Implement a simple compare and swap atomic operation.
* lib/jit_fallback.c: Implement fallback compare and swap with pthreads. * check/Makefile.am: Update for new cas{r,i} simple test. * check/catomic.c, check/catomic.ok: New test case for simple compare and swap atomic operation. * check/lightning.c: Add entries to be able to use the new compare and swap atomic operation. Still missing a general test, only the basic C version. * include/lightning.h.in: Include pthread.h, even if not needing a fallback compare and swap. * include/lightning/jit_private.h: Add support for a register pair in second argument. Required by the new casr and casi operations. * lib/jit_aarch64-cpu.c, lib/jit_aarch64-sz.c, lib/jit_aarch64.c, lib/jit_ppc-cpu.c, lib/jit_ppc-sz.c, lib/jit_ppc.c, lib/jit_x86-cpu.c, lib/jit_x86-sz.c, lib/jit_x86.c: Implement inline code for compare and swap. * lib/jit_arm-cpu.c, lib/jit_arm-sz.c, lib/jit_arm.c: Implement inline code for compare and swap if cpu is armv7, otherwise, use a fallback with pthreads. * lib/jit_alpha-cpu.c, lib/jit_alpha-sz.c, lib/jit_alpha.c, lib/jit_hppa-cpu.c, lib/jit_hppa-sz.c, lib/jit_hppa.c, lib/jit_ia64-cpu.c, lib/jit_ia64-sz.c, lib/jit_ia64.c, lib/jit_mips-cpu.c, lib/jit_mips-sz.c, lib/jit_mips.c, lib/jit_riscv-cpu.c, lib/jit_riscv-sz.c, lib/jit_riscv.c, lib/jit_s390-cpu.c, lib/jit_s390-sz.c, lib/jit_s390.c, lib/jit_sparc-cpu.c, lib/jit_sparc-sz.c, lib/jit_sparc.c: Implement fallback compare and swap with pthreads. At least some of these should be updated for inline code generation. * lib/jit_names.c, lib/jit_print.c: lib/lightning.c: Update for the new compare and swap operation. * doc/body.texi: Add simple documentation of the compare and swap new operation.
Diffstat (limited to 'lib/jit_x86.c')
-rw-r--r--lib/jit_x86.c 8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/jit_x86.c b/lib/jit_x86.c
index e3e1383..fb0b06b 100644
--- a/lib/jit_x86.c
+++ b/lib/jit_x86.c
@@ -1674,6 +1674,14 @@ _emit_code(jit_state_t *_jit)
case_rrw(gt, _u);
case_rrr(ne,);
case_rrw(ne,);
+ case jit_code_casr:
+ casr(rn(node->u.w), rn(node->v.w),
+ rn(node->w.q.l), rn(node->w.q.h));
+ break;
+ case jit_code_casi:
+ casi(rn(node->u.w), node->v.w,
+ rn(node->w.q.l), rn(node->w.q.h));
+ break;
case_rrr(movn,);
case_rrr(movz,);
case_rr(mov,);
generated by cgit v1.2.3 (git 2.39.1) at 2025年09月16日 21:39:02 +0000

AltStyle によって変換されたページ (->オリジナル) /