lightning
[Top][All Lists]
Advanced

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

[PATCH 2/2] Add new skip instruction.


From: marc . nieper+gnu
Subject: [PATCH 2/2] Add new skip instruction.
Date: Mon, 31 Oct 2022 13:17:14 +0100

From: Marc Nieper-Wißkirchen <marc@nieper-wisskirchen.de>

* .gitignore: Update from Gnulib.
* check/Makefile.am: Add tests.
* check/lightning.c: Handle skip instructions.
* check/protect.c: Rewrite with skip.
* check/skip.ok: New test.
* check/skip.tst: New test.
* doc/body.texi: Document the skip instruction.
* include/lightning.h.in: Add the skip instruction.
* lib/jit_aarch64-sz.c: Update for skip instruction.
* lib/jit_aarch64.c: Implement skip instruction.
* lib/jit_alpha-sz.c: Update for skip instruction.
* lib/jit_alpha.c: Implement skip instruction.
* lib/jit_arm-sz.c: Update for skip instruction.
* lib/jit_arm.c: Implement skip instruction.
* lib/jit_hppa-sz.c: Update for skip instruction.
* lib/jit_hppa.c: Implement skip instruction.
* lib/jit_ia64-sz.c: Update for skip instruction.
* lib/jit_ia64.c: Implement skip instruction.
* lib/jit_loongarch-sz.c: Update for skip instruction.
* lib/jit_loongarch.c: Implement skip instruction.
* lib/jit_mips-sz.c: Update for skip instruction.
* lib/jit_mips.c: Implement skip instruction.
* lib/jit_names.c: Update for skip instruction.
* lib/jit_ppc-sz.c: Update for skip instruction.
* lib/jit_ppc.c: Implement skip instruction.
* lib/jit_riscv-sz.c: Update for skip instruction.
* lib/jit_riscv.c: Implement skip instruction.
* lib/jit_s390-sz.c: Update for skip instruction.
* lib/jit_s390.c: Implement skip instruction.
* lib/jit_size.c: Treat align and skip in a special way.
* lib/jit_sparc-sz.c: Update for skip instruction.
* lib/jit_sparc.c: Implement skip instruction.
* lib/jit_x86-sz.c: Update for skip instruction.
* lib/jit_x86.c: Implement skip instruction.
* lib/lightning.c: Classify skip instruction.
---
 .gitignore             |  1 +
 ChangeLog              | 39 +++++++++++++++++++++++++++++++++++++++
 check/Makefile.am      |  3 ++-
 check/lightning.c      |  3 +++
 check/protect.c        |  8 +++-----
 check/skip.ok          |  1 +
 check/skip.tst         | 13 +++++++++++++
 doc/body.texi          | 12 ++++++++++++
 include/lightning.h.in |  2 ++
 lib/jit_aarch64-sz.c   |  1 +
 lib/jit_aarch64.c      |  3 +++
 lib/jit_alpha-sz.c     |  1 +
 lib/jit_alpha.c        |  3 +++
 lib/jit_arm-sz.c       |  1 +
 lib/jit_arm.c          |  3 +++
 lib/jit_hppa-sz.c      |  1 +
 lib/jit_hppa.c         |  3 +++
 lib/jit_ia64-sz.c      |  1 +
 lib/jit_ia64.c         |  4 ++++
 lib/jit_loongarch-sz.c |  1 +
 lib/jit_loongarch.c    |  3 +++
 lib/jit_mips-sz.c      |  1 +
 lib/jit_mips.c         |  3 +++
 lib/jit_names.c        |  1 +
 lib/jit_ppc-sz.c       |  1 +
 lib/jit_ppc.c          |  3 +++
 lib/jit_riscv-sz.c     |  1 +
 lib/jit_riscv.c        |  3 +++
 lib/jit_s390-sz.c      |  1 +
 lib/jit_s390.c         |  3 +++
 lib/jit_size.c         | 10 +++++++++-
 lib/jit_sparc-sz.c     |  1 +
 lib/jit_sparc.c        |  3 +++
 lib/jit_x86-sz.c       |  4 ++++
 lib/jit_x86.c          |  5 ++++-
 lib/lightning.c        |  3 ++-
 36 files changed, 141 insertions(+), 9 deletions(-)
 create mode 100644 check/skip.ok
 create mode 100644 check/skip.tst

diff --git a/.gitignore b/.gitignore
index 6fc5bf9..bc7e971 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
+/build-aux
 +*
 
 *.o
diff --git a/ChangeLog b/ChangeLog
index 0848e6c..e138220 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,42 @@
+2022-10-31  Marc Nieper-Wißkirchen  <marc@nieper-wisskirchen.de>
+
+       Add new skip instruction.
+       * .gitignore: Update from Gnulib.
+       * check/Makefile.am: Add tests.
+       * check/lightning.c: Handle skip instructions.
+       * check/protect.c: Rewrite with skip.
+       * check/skip.ok: New test.
+       * check/skip.tst: New test.
+       * doc/body.texi: Document the skip instruction.
+       * include/lightning.h.in: Add the skip instruction.
+       * lib/jit_aarch64-sz.c: Update for skip instruction.
+       * lib/jit_aarch64.c: Implement skip instruction.
+       * lib/jit_alpha-sz.c: Update for skip instruction.
+       * lib/jit_alpha.c: Implement skip instruction.
+       * lib/jit_arm-sz.c: Update for skip instruction.
+       * lib/jit_arm.c: Implement skip instruction.
+       * lib/jit_hppa-sz.c: Update for skip instruction.
+       * lib/jit_hppa.c: Implement skip instruction.
+       * lib/jit_ia64-sz.c: Update for skip instruction.
+       * lib/jit_ia64.c: Implement skip instruction.
+       * lib/jit_loongarch-sz.c: Update for skip instruction.
+       * lib/jit_loongarch.c: Implement skip instruction.
+       * lib/jit_mips-sz.c: Update for skip instruction.
+       * lib/jit_mips.c: Implement skip instruction.
+       * lib/jit_names.c: Update for skip instruction.
+       * lib/jit_ppc-sz.c: Update for skip instruction.
+       * lib/jit_ppc.c: Implement skip instruction.
+       * lib/jit_riscv-sz.c: Update for skip instruction.
+       * lib/jit_riscv.c: Implement skip instruction.
+       * lib/jit_s390-sz.c: Update for skip instruction.
+       * lib/jit_s390.c: Implement skip instruction.
+       * lib/jit_size.c: Treat align and skip in a special way.
+       * lib/jit_sparc-sz.c: Update for skip instruction.
+       * lib/jit_sparc.c: Implement skip instruction.
+       * lib/jit_x86-sz.c: Update for skip instruction.
+       * lib/jit_x86.c: Implement skip instruction.
+       * lib/lightning.c: Classify skip instruction.
+
 2022-10-30  Marc Nieper-Wißkirchen  <marc@nieper-wisskirchen.de>
 
        Add user-visible functions jit_protect and jit_unprotect.
diff --git a/check/Makefile.am b/check/Makefile.am
index f1839ef..189f3da 100644
--- a/check/Makefile.am
+++ b/check/Makefile.am
@@ -108,6 +108,7 @@ EXTRA_DIST =                                \
        range.tst       range.ok        \
        ranger.tst      ranger.ok       \
        ret.tst         ret.ok          \
+       skip.tst        skip.ok         \
        tramp.tst       tramp.ok        \
        va_list.tst     va_list.ok      \
        check.sh                        \
@@ -139,7 +140,7 @@ base_TESTS =                                \
        clobber carry call              \
        float jmpr live put             \
        qalu_mul qalu_div               \
-       range ranger ret tramp          \
+       range ranger ret skip tramp     \
        va_list
 
 $(base_TESTS): check.sh
diff --git a/check/lightning.c b/check/lightning.c
index 4f3b052..bdb70c4 100644
--- a/check/lightning.c
+++ b/check/lightning.c
@@ -270,6 +270,7 @@ static jit_pointer_t get_arg(void);
 static jit_word_t get_imm(void);
 static void live(void);
 static void align(void);       static void name(void);
+static void skip(void);
 static void prolog(void);
 static void frame(void);       static void tramp(void);
 static void ellipsis(void);
@@ -591,6 +592,7 @@ static instr_t                instr_vector[] = {
 #define entry2(name, function) { NULL, name, function }
     entry(live),
     entry(align),      entry(name),
+    entry(skip),
     entry(prolog),
     entry(frame),      entry(tramp),
     entry(ellipsis),
@@ -1400,6 +1402,7 @@ live(void) {
     jit_live(parser.regval);
 }
 entry_im(align)
+entry_im(skip)
 entry(prolog)
 entry_im(frame)                        entry_im(tramp)
 entry(ellipsis)
diff --git a/check/protect.c b/check/protect.c
index 256242b..2abedd1 100644
--- a/check/protect.c
+++ b/check/protect.c
@@ -29,6 +29,9 @@ main(int argc, char *argv[])
     jit_prepare();
     jit_pushargi(1);
     jit_finishi(exit);
+    label = jit_indirect();
+    jit_skip(1);             /* Reserves enough space for a byte.  */
+    jit_patch_at(load, label);
     jit_link(ok);
     jit_prepare();
     jit_pushargi((jit_word_t)"%s\n");
@@ -36,11 +39,6 @@ main(int argc, char *argv[])
     jit_pushargi((jit_word_t)"ok");
     jit_finishi(printf);
 
-    jit_epilog();
-    label = jit_indirect();
-    jit_prolog();               /* Reserves enough space for a byte.  */
-    jit_patch_at(load, label);
-
     function = jit_emit();
     if (function == NULL)
        abort();
diff --git a/check/skip.ok b/check/skip.ok
new file mode 100644
index 0000000..f599e28
--- /dev/null
+++ b/check/skip.ok
@@ -0,0 +1 @@
+10
diff --git a/check/skip.tst b/check/skip.tst
new file mode 100644
index 0000000..94eec76
--- /dev/null
+++ b/check/skip.tst
@@ -0,0 +1,13 @@
+.data  32
+fmt:
+.c     "%d\n"
+.code
+       prolog
+        skip    4
+        prepare
+                pushargi fmt
+                ellipsis
+                pushargi 10
+        finishi @printf
+        ret
+        epilog
diff --git a/doc/body.texi b/doc/body.texi
index 58f84ee..d5918a6 100644
--- a/doc/body.texi
+++ b/doc/body.texi
@@ -603,6 +603,14 @@ the next instruction, usually with a label:
 align     (not specified)                @r{align code}
 @end example
 
+Similar to @code{align} is the next instruction, also usually used with
+a label:
+@example
+skip      (not specified)                @r{skip code}
+@end example
+It is used to specify a minimal number of bytes of nops to be inserted
+before the next instruction.
+
 @code{label} is normally used as @code{patch_at} argument for backward
 jumps.
 
@@ -687,6 +695,10 @@ label2  = jit_indirect();                @rem{/* second 
entry point */}
           assert(addr2 - addr1 == 16);   @rem{/* only one of the addresses 
needs to be remembered */}
 @end example
 
+@code{skip} is useful for reserving space in the code buffer that can
+later be filled (possibly with the help of the pair of functions
+@code{jit_unprotect} and @code{jit_protect}).
+
 @item Function prolog
 
 These macros are used to set up a function prolog.  The @code{allocai}
diff --git a/include/lightning.h.in b/include/lightning.h.in
index 2ed593b..c84289e 100644
--- a/include/lightning.h.in
+++ b/include/lightning.h.in
@@ -190,6 +190,8 @@ typedef enum {
 #define jit_align(u)           jit_new_node_w(jit_code_align, u)
     jit_code_live,             jit_code_align,
     jit_code_save,             jit_code_load,
+#define jit_skip(u)             jit_new_node_w(jit_code_skip, u)
+    jit_code_skip,
 #define jit_name(u)            _jit_name(_jit,u)
     jit_code_name,
 #define jit_note(u, v)         _jit_note(_jit, u, v)
diff --git a/lib/jit_aarch64-sz.c b/lib/jit_aarch64-sz.c
index b1f451f..3099d4d 100644
--- a/lib/jit_aarch64-sz.c
+++ b/lib/jit_aarch64-sz.c
@@ -6,6 +6,7 @@
     4, /* align */
     0, /* save */
     0, /* load */
+    0,  /* skip */
     0, /* #name */
     0, /* #note */
     0, /* label */
diff --git a/lib/jit_aarch64.c b/lib/jit_aarch64.c
index fe42004..e072788 100644
--- a/lib/jit_aarch64.c
+++ b/lib/jit_aarch64.c
@@ -1024,6 +1024,9 @@ _emit_code(jit_state_t *_jit)
                if ((word = _jit->pc.w & (node->u.w - 1)))
                    nop(node->u.w - word);
                break;
+           case jit_code_skip:
+               nop(code->u.w);
+               break;
            case jit_code_note:         case jit_code_name:
                node->u.w = _jit->pc.w;
                break;
diff --git a/lib/jit_alpha-sz.c b/lib/jit_alpha-sz.c
index ac314f2..f8e2e89 100644
--- a/lib/jit_alpha-sz.c
+++ b/lib/jit_alpha-sz.c
@@ -5,6 +5,7 @@
     4, /* align */
     0, /* save */
     0, /* load */
+    0,  /* skip */
     0, /* #name */
     0, /* #note */
     0, /* label */
diff --git a/lib/jit_alpha.c b/lib/jit_alpha.c
index b545365..2cf58d7 100644
--- a/lib/jit_alpha.c
+++ b/lib/jit_alpha.c
@@ -984,6 +984,9 @@ _emit_code(jit_state_t *_jit)
                if ((word = _jit->pc.w & (node->u.w - 1)))
                    nop(node->u.w - word);
                break;
+           case jit_code_skip:
+               nop(code->u.w);
+               break;
            case jit_code_note:         case jit_code_name:
                node->u.w = _jit->pc.w;
                break;
diff --git a/lib/jit_arm-sz.c b/lib/jit_arm-sz.c
index 14f085a..f0590ee 100644
--- a/lib/jit_arm-sz.c
+++ b/lib/jit_arm-sz.c
@@ -7,6 +7,7 @@
     2, /* align */
     0, /* save */
     0, /* load */
+    0,  /* skip */
     2, /* #name */
     0, /* #note */
     0, /* label */
diff --git a/lib/jit_arm.c b/lib/jit_arm.c
index 9d0c56f..54ab21a 100644
--- a/lib/jit_arm.c
+++ b/lib/jit_arm.c
@@ -1406,6 +1406,9 @@ _emit_code(jit_state_t *_jit)
                if ((word = _jit->pc.w & (node->u.w - 1)))
                    nop(node->u.w - word);
                break;
+           case jit_code_skip:
+               nop(node->u.w);
+               break;
            case jit_code_note:         case jit_code_name:
                if (must_align_p(node->next))
                    nop(2);
diff --git a/lib/jit_hppa-sz.c b/lib/jit_hppa-sz.c
index 33ac908..2b2824d 100644
--- a/lib/jit_hppa-sz.c
+++ b/lib/jit_hppa-sz.c
@@ -6,6 +6,7 @@
     0, /* align */
     0, /* save */
     0, /* load */
+    0,  /* skip */
     0, /* #name */
     0, /* #note */
     0, /* label */
diff --git a/lib/jit_hppa.c b/lib/jit_hppa.c
index 788637a..06ba19d 100644
--- a/lib/jit_hppa.c
+++ b/lib/jit_hppa.c
@@ -980,6 +980,9 @@ _emit_code(jit_state_t *_jit)
                if ((word = _jit->pc.w & (node->u.w - 1)))
                    nop(node->u.w - word);
                break;
+           case jit_code_skip:
+               nop(node->u.w);
+               break;
            case jit_code_note:         case jit_code_name:
                node->u.w = _jit->pc.w;
                break;
diff --git a/lib/jit_ia64-sz.c b/lib/jit_ia64-sz.c
index e65da54..958093f 100644
--- a/lib/jit_ia64-sz.c
+++ b/lib/jit_ia64-sz.c
@@ -5,6 +5,7 @@
     0, /* align */
     0, /* save */
     0, /* load */
+    0,  /* skip */
     0, /* #name */
     0, /* #note */
     0, /* label */
diff --git a/lib/jit_ia64.c b/lib/jit_ia64.c
index 67251e3..5ccd136 100644
--- a/lib/jit_ia64.c
+++ b/lib/jit_ia64.c
@@ -1123,6 +1123,10 @@ _emit_code(jit_state_t *_jit)
                if (node->u.w > 8)
                    nop(node->u.w - 8);
                break;
+           case jit_code_skip:
+               sync();
+               nop(node->u.w);
+               break;
            case jit_code_note:         case jit_code_name:
                sync();
                node->u.w = _jit->pc.w;
diff --git a/lib/jit_loongarch-sz.c b/lib/jit_loongarch-sz.c
index 2490cfa..c72b259 100644
--- a/lib/jit_loongarch-sz.c
+++ b/lib/jit_loongarch-sz.c
@@ -5,6 +5,7 @@
     28,        /* align */
     0, /* save */
     0, /* load */
+    0, /* skip */
     0, /* #name */
     0, /* #note */
     0, /* label */
diff --git a/lib/jit_loongarch.c b/lib/jit_loongarch.c
index 436f775..bfc890a 100644
--- a/lib/jit_loongarch.c
+++ b/lib/jit_loongarch.c
@@ -1016,6 +1016,9 @@ _emit_code(jit_state_t *_jit)
                if ((word = _jit->pc.w & (node->u.w - 1)))
                    nop(node->u.w - word);
                break;
+           case jit_code_skip:
+               nop(node->u.w);
+               break;
            case jit_code_note:         case jit_code_name:
                node->u.w = _jit->pc.w;
                break;
diff --git a/lib/jit_mips-sz.c b/lib/jit_mips-sz.c
index 91deb4b..3afa3d5 100644
--- a/lib/jit_mips-sz.c
+++ b/lib/jit_mips-sz.c
@@ -7,6 +7,7 @@
     0, /* align */
     0, /* save */
     0, /* load */
+    0, /* skip */
     0, /* #name */
     0, /* #note */
     0, /* label */
diff --git a/lib/jit_mips.c b/lib/jit_mips.c
index ae3974e..18296ea 100644
--- a/lib/jit_mips.c
+++ b/lib/jit_mips.c
@@ -1305,6 +1305,9 @@ _emit_code(jit_state_t *_jit)
                if ((word = _jit->pc.w & (node->u.w - 1)))
                    nop(node->u.w - word);
                break;
+           case jit_code_skip:
+               nop(node->u.w);
+               break;
            case jit_code_note:         case jit_code_name:
                node->u.w = _jit->pc.w;
                break;
diff --git a/lib/jit_names.c b/lib/jit_names.c
index b663b67..7b89a7c 100644
--- a/lib/jit_names.c
+++ b/lib/jit_names.c
@@ -21,6 +21,7 @@ static char *code_name[] = {
     "data",
     "live",            "align",
     "save",            "load",
+    "skip",
     "#name",           "#note",
     "label",
     "prolog",
diff --git a/lib/jit_ppc-sz.c b/lib/jit_ppc-sz.c
index 212e637..9fbf162 100644
--- a/lib/jit_ppc-sz.c
+++ b/lib/jit_ppc-sz.c
@@ -8,6 +8,7 @@
     0, /* align */
     0, /* save */
     0, /* load */
+    0,  /* skip */
     0, /* #name */
     0, /* #note */
     0, /* label */
diff --git a/lib/jit_ppc.c b/lib/jit_ppc.c
index 9deaf47..379fda4 100644
--- a/lib/jit_ppc.c
+++ b/lib/jit_ppc.c
@@ -1294,6 +1294,9 @@ _emit_code(jit_state_t *_jit)
                if ((word = _jit->pc.w & (node->u.w - 1)))
                    nop(node->u.w - word);
                break;
+           case jit_code_skip:
+               nop(node->u.w);
+               break;
            case jit_code_note:         case jit_code_name:
                node->u.w = _jit->pc.w;
                break;
diff --git a/lib/jit_riscv-sz.c b/lib/jit_riscv-sz.c
index 8c4cf04..e25501d 100644
--- a/lib/jit_riscv-sz.c
+++ b/lib/jit_riscv-sz.c
@@ -5,6 +5,7 @@
     4, /* align */
     0, /* save */
     0, /* load */
+    0,  /* skip */
     0, /* #name */
     0, /* #note */
     0, /* label */
diff --git a/lib/jit_riscv.c b/lib/jit_riscv.c
index 8ccb09f..317f0f3 100644
--- a/lib/jit_riscv.c
+++ b/lib/jit_riscv.c
@@ -1067,6 +1067,9 @@ _emit_code(jit_state_t *_jit)
                if ((word = _jit->pc.w & (node->u.w - 1)))
                    nop(node->u.w - word);
                break;
+           case jit_code_skip:
+               nop(node->u.w);
+               break;
            case jit_code_note:         case jit_code_name:
                node->u.w = _jit->pc.w;
                break;
diff --git a/lib/jit_s390-sz.c b/lib/jit_s390-sz.c
index e70c65f..6f97eea 100644
--- a/lib/jit_s390-sz.c
+++ b/lib/jit_s390-sz.c
@@ -6,6 +6,7 @@
     2, /* align */
     0, /* save */
     0, /* load */
+    0,  /* skip */
     0, /* #name */
     0, /* #note */
     2, /* label */
diff --git a/lib/jit_s390.c b/lib/jit_s390.c
index 547913b..53475ca 100644
--- a/lib/jit_s390.c
+++ b/lib/jit_s390.c
@@ -1033,6 +1033,9 @@ _emit_code(jit_state_t *_jit)
                if ((word = _jit->pc.w & (node->u.w - 1)))
                    nop(node->u.w - word);
                break;
+           case jit_code_skip:
+                nop(node->u.w);
+               break;
            case jit_code_note:         case jit_code_name:
                node->u.w = _jit->pc.w;
                break;
diff --git a/lib/jit_size.c b/lib/jit_size.c
index b3e1cae..f7d50e1 100644
--- a/lib/jit_size.c
+++ b/lib/jit_size.c
@@ -121,7 +121,15 @@ _jit_get_size(jit_state_t *_jit)
                break;
        }
 #  endif
-       size += _szs[node->code];
+       switch (node->code) {
+           /* The instructions are special because they can be arbitrarily 
long.  */
+           case jit_code_align:
+           case jit_code_skip:
+               size += node->u.w;
+               break;
+           default:
+               size += _szs[node->code];
+       }
     }
 #  if __riscv && __WORDSIZE == 64
     /* Heuristically only 20% of constants are unique. */
diff --git a/lib/jit_sparc-sz.c b/lib/jit_sparc-sz.c
index 265769d..4d95dfa 100644
--- a/lib/jit_sparc-sz.c
+++ b/lib/jit_sparc-sz.c
@@ -5,6 +5,7 @@
     0, /* align */
     0, /* save */
     0, /* load */
+    0,  /* skip */
     0, /* #name */
     0, /* #note */
     0, /* label */
diff --git a/lib/jit_sparc.c b/lib/jit_sparc.c
index 33cc9bd..10de59c 100644
--- a/lib/jit_sparc.c
+++ b/lib/jit_sparc.c
@@ -1327,6 +1327,9 @@ _emit_code(jit_state_t *_jit)
                if ((word = _jit->pc.w & (node->u.w - 1)))
                    nop(node->u.w - word);
                break;
+           case jit_code_skip:
+               nop(code->u.w);
+               break;
            case jit_code_note:         case jit_code_name:
                node->u.w = _jit->pc.w;
                break;
diff --git a/lib/jit_x86-sz.c b/lib/jit_x86-sz.c
index eb668b3..bd8deaf 100644
--- a/lib/jit_x86-sz.c
+++ b/lib/jit_x86-sz.c
@@ -6,6 +6,7 @@
     3, /* align */
     0, /* save */
     0, /* load */
+    0,  /* skip */
     0, /* #name */
     0, /* #note */
     3, /* label */
@@ -416,6 +417,7 @@
     6, /* align */
     0, /* save */
     0, /* load */
+    0,  /* skip */
     0, /* #name */
     0, /* #note */
     7, /* label */
@@ -825,6 +827,7 @@
     3, /* align */
     0, /* save */
     0, /* load */
+    0,  /* skip */
     0, /* #name */
     0, /* #note */
     3, /* label */
@@ -1233,6 +1236,7 @@
     6, /* align */
     0, /* save */
     0, /* load */
+    0,  /* skip */
     0, /* #name */
     0, /* #note */
     7, /* label */
diff --git a/lib/jit_x86.c b/lib/jit_x86.c
index e1b22be..489f8a4 100644
--- a/lib/jit_x86.c
+++ b/lib/jit_x86.c
@@ -1599,7 +1599,10 @@ _emit_code(jit_state_t *_jit)
                if ((word = _jit->pc.w & (node->u.w - 1)))
                    nop(node->u.w - word);
                break;
-           case jit_code_note:         case jit_code_name:
+            case jit_code_skip:
+                nop(node->u.w);
+                break;
+            case jit_code_note:                case jit_code_name:
                node->u.w = _jit->pc.w;
                break;
            case jit_code_label:
diff --git a/lib/lightning.c b/lib/lightning.c
index b308844..e98f29e 100644
--- a/lib/lightning.c
+++ b/lib/lightning.c
@@ -1360,7 +1360,8 @@ _jit_classify(jit_state_t *_jit, jit_code_t code)
            mask = jit_cc_a0_reg;
            break;
        case jit_code_align:    case jit_code_reti:     case jit_code_pushargi:
-       case jit_code_finishi:  /* synthesized will set jit_cc_a0_jmp */
+        case jit_code_skip:
+        case jit_code_finishi: /* synthesized will set jit_cc_a0_jmp */
            mask = jit_cc_a0_int;
            break;
        case jit_code_reti_f:   case jit_code_pushargi_f:
-- 
2.34.1




reply via email to

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