diff options
author | Kimplul <kimi.h.kuparinen@gmail.com> | 2024-06-25 23:25:29 +0300 |
---|---|---|
committer | Kimplul <kimi.h.kuparinen@gmail.com> | 2024-06-25 23:25:29 +0300 |
commit | 01052811be08444458576dda994d15f8823560ea (patch) | |
tree | c52f2d72ef0ef703e755fcf05ee5d3a02f050acc /deps/lightening/tests/jmpi.c | |
parent | 449ca1e570aa421992bbe98c6928def1ba8896fd (diff) | |
download | posthaste-01052811be08444458576dda994d15f8823560ea.tar.gz posthaste-01052811be08444458576dda994d15f8823560ea.zip |
initial rewrite to use ejit
+ Doesn't actually link yet due to missing stuff from ejit, will have to
add them (tomorrow?)
Diffstat (limited to 'deps/lightening/tests/jmpi.c')
-rw-r--r-- | deps/lightening/tests/jmpi.c | 41 |
1 files changed, 0 insertions, 41 deletions
diff --git a/deps/lightening/tests/jmpi.c b/deps/lightening/tests/jmpi.c deleted file mode 100644 index e73ace0..0000000 --- a/deps/lightening/tests/jmpi.c +++ /dev/null @@ -1,41 +0,0 @@ -#include "test.h" - -void *tail; - -static void *target; - -static void -run_test(jit_state_t *j, uint8_t *arena_base, size_t arena_size) -{ - jit_begin(j, arena_base, arena_size); - jit_enter_jit_abi(j, 0, 0, 0); - jit_movi(j, JIT_R0, 42); - jit_jmpi(j, target); - // Unreachable. - jit_breakpoint(j); - int (*f)(void) = jit_end(j, NULL); - ASSERT(f() == 42); -} - -// Make the tail-call target via a separate main_helper because probably the new -// arena will be allocated farther away, forcing nonlocal jumps. -static void -make_target(jit_state_t *j, uint8_t *arena_base, size_t arena_size) -{ - jit_begin(j, arena_base, arena_size); - size_t align = jit_enter_jit_abi(j, 0, 0, 0); - // Tail call target assumes tail caller called enter_jit_abi with compatible - // parameters. - target = jit_address(j); - jit_leave_jit_abi(j, 0, 0, align); - jit_retr(j, JIT_R0); - jit_end(j, NULL); - - main_helper(0, NULL, run_test); -} - -int -main (int argc, char *argv[]) -{ - return main_helper(argc, argv, make_target); -} |