1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-22 03:30:22 +02:00

Remove jit_nop

Instead, jit_align will call nop() internally.  You can't nop 3 bytes on
most architectures.
This commit is contained in:
Andy Wingo 2019-05-16 11:40:24 +02:00
parent f2d7321504
commit 9d4185af2b
3 changed files with 10 additions and 38 deletions

View file

@ -574,8 +574,6 @@ jit_load_args_3(jit_state_t *_jit, jit_operand_t a, jit_operand_t b,
M(RGG__, bxsubr_u) \
M(RGu__, bxsubi_u) \
\
M(_i___, nop) \
\
M(_G___, jmpr) \
M(_p___, jmpi) \
M(R____, jmp) \

View file

@ -248,16 +248,6 @@ is_power_of_two (unsigned x)
return x && !(x & (x-1));
}
void
jit_align(jit_state_t *_jit, unsigned align)
{
ASSERT (is_power_of_two (align));
uintptr_t here = _jit->pc.w;
uintptr_t there = (here + align - 1) & ~(align - 1);
if (there - here)
jit_nop(_jit, there - here);
}
static jit_gpr_t
get_temp_gpr(jit_state_t *_jit)
{
@ -547,6 +537,16 @@ jit_patch_there(jit_state_t* _jit, jit_reloc_t reloc, jit_pointer_t addr)
FOR_EACH_INSTRUCTION(IMPL_INSTRUCTION)
#undef IMPL_INSTRUCTION
void
jit_align(jit_state_t *_jit, unsigned align)
{
ASSERT (is_power_of_two (align));
uintptr_t here = _jit->pc.w;
uintptr_t there = (here + align - 1) & ~(align - 1);
if (there - here)
nop(_jit, there - here);
}
static jit_bool_t
is_fpr_arg(enum jit_operand_abi arg)
{

View file

@ -1,26 +0,0 @@
#include "test.h"
static void
run_test(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);
size_t total = 0;
char *start = jit_address(j);
for (size_t i = 1; i < 10; total += i, i++)
jit_nop(j, i);
char *end = jit_address(j);
ASSERT(end - start == total);
jit_leave_jit_abi(j, 0, 0, align);
jit_reti(j, 42);
jit_word_t (*f)(void) = jit_end(j, NULL);
ASSERT(f() == 42);
}
int
main (int argc, char *argv[])
{
return main_helper(argc, argv, run_test);
}