mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-03 02:36:19 +02:00
Add mov_addr test
This commit is contained in:
parent
ae1394831c
commit
3acf10280b
1 changed files with 23 additions and 0 deletions
23
tests/mov_addr.c
Normal file
23
tests/mov_addr.c
Normal file
|
@ -0,0 +1,23 @@
|
|||
#include "test.h"
|
||||
|
||||
static uint64_t thing = 0x123456789abcdef0;
|
||||
|
||||
static void
|
||||
run_test(jit_state_t *j, uint8_t *arena_base, size_t arena_size)
|
||||
{
|
||||
jit_begin(j, arena_base, arena_size);
|
||||
|
||||
jit_patch_there(j, jit_mov_addr(j, JIT_R0), &thing);
|
||||
jit_retr(j, JIT_R0);
|
||||
|
||||
void* (*f)(void) = jit_end(j, NULL);
|
||||
|
||||
ASSERT(f() == &thing);
|
||||
ASSERT(*(uint64_t*)f() == thing);
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
return main_helper(argc, argv, run_test);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue