guile-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Guile-commits] 12/34: Remove jit_nop


From: Andy Wingo
Subject: [Guile-commits] 12/34: Remove jit_nop
Date: Mon, 20 May 2019 09:55:52 -0400 (EDT)

wingo pushed a commit to branch master
in repository guile.

commit 9d4185af2be47f1ef8069f0ad2683e98957fb11e
Author: Andy Wingo <address@hidden>
Date:   Thu May 16 11:40:24 2019 +0200

    Remove jit_nop
    
    Instead, jit_align will call nop() internally.  You can't nop 3 bytes on
    most architectures.
---
 lightening.h            |  2 --
 lightening/lightening.c | 20 ++++++++++----------
 tests/nop.c             | 26 --------------------------
 3 files changed, 10 insertions(+), 38 deletions(-)

diff --git a/lightening.h b/lightening.h
index 6fe49ce..23635a0 100644
--- a/lightening.h
+++ b/lightening.h
@@ -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)                        \
diff --git a/lightening/lightening.c b/lightening/lightening.c
index e073103..2838891 100644
--- a/lightening/lightening.c
+++ b/lightening/lightening.c
@@ -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)
 {
diff --git a/tests/nop.c b/tests/nop.c
deleted file mode 100644
index c029954..0000000
--- a/tests/nop.c
+++ /dev/null
@@ -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);
-}



reply via email to

[Prev in Thread] Current Thread [Next in Thread]