poke-devel
[Top][All Lists]
Advanced

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

[PATCH 1/2] pkl: remove `isn' instruction


From: Mohammad-Reza Nabipoor
Subject: [PATCH 1/2] pkl: remove `isn' instruction
Date: Thu, 27 Oct 2022 22:10:45 +0200

2022-10-27  Mohammad-Reza Nabipoor  <mnabipoor@gnu.org>

        * libpoke/pkl-insn.def (isn): Remove instruction because we
        already have the `nnn' instruction.
        * libpoke/pvm.jitter: Likewise.
        * libpoke/pkl-rt.pk (_pkl_print_format_any): Adapt.
---
 ChangeLog            |  7 +++++++
 libpoke/pkl-insn.def |  4 ----
 libpoke/pkl-rt.pk    | 10 +++++-----
 libpoke/pvm.jitter   | 16 ----------------
 4 files changed, 12 insertions(+), 25 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 3782cdc8..f433a704 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2022-10-27  Mohammad-Reza Nabipoor  <mnabipoor@gnu.org>
+
+       * libpoke/pkl-insn.def (isn): Remove instruction because we
+       already have the `nnn' instruction.
+       * libpoke/pvm.jitter: Likewise.
+       * libpoke/pkl-rt.pk (_pkl_print_format_any): Adapt.
+
 2022-10-27  Jose E. Marchesi  <jemarch@gnu.org>
 
        * etc/hacking.org (How `any' is handed in the PVM): New section.
diff --git a/libpoke/pkl-insn.def b/libpoke/pkl-insn.def
index 250a6372..88feccba 100644
--- a/libpoke/pkl-insn.def
+++ b/libpoke/pkl-insn.def
@@ -289,10 +289,6 @@ PKL_DEF_INSN(PKL_INSN_SSET,"","sset")
 PKL_DEF_INSN(PKL_INSN_SSETI,"","sseti")
 PKL_DEF_INSN(PKL_INSN_SMODI,"","smodi")
 
-/* Instructions to handle values.  */
-
-PKL_DEF_INSN(PKL_INSN_ISN,"","isn")
-
 /* Instructions to handle mapped values.  */
 
 PKL_DEF_INSN(PKL_INSN_MM,"","mm")
diff --git a/libpoke/pkl-rt.pk b/libpoke/pkl-rt.pk
index 15fc07f9..454661d5 100644
--- a/libpoke/pkl-rt.pk
+++ b/libpoke/pkl-rt.pk
@@ -838,7 +838,7 @@ immutable fun _pkl_print_format_any = (any val,
 
         _pkl_print_format_any (asm any: ("tyagett; nip" : val), ctx, depth);
         ctx.emit ("[");
-        if (!asm int<32>: ("isn; nip" : bound))
+        if (!asm int<32>: ("nnn; nip" : bound))
           _pkl_print_format_any (bound, ctx, depth);
         ctx.emit ("]");
       }
@@ -846,7 +846,7 @@ immutable fun _pkl_print_format_any = (any val,
       {
         var maybe_name = asm any: ("tysctgetn; nip" : val);
         var name
-          = asm int<32>: ("isn; nip" : maybe_name) ? "struct"
+          = asm int<32>: ("nnn; nip" : maybe_name) ? "struct"
                                                    : (maybe_name as string);
         var nfields = asm uint<64>: ("tysctgetnf; nip" : val);
 
@@ -860,7 +860,7 @@ immutable fun _pkl_print_format_any = (any val,
             if (i != 0UL)
               ctx.emit (" ");
             _pkl_print_format_any (ftype, ctx, depth);
-            if (!asm int<32>: ("isn; nip" : maybe_fname))
+            if (!asm int<32>: ("nnn; nip" : maybe_fname))
               ctx.emit (" " + (maybe_fname as string));
             ctx.emit (";");
           }
@@ -1127,11 +1127,11 @@ immutable fun _pkl_print_format_any = (any val,
     ctx.end_class ("struct");
   }
 
-  if (asm int<32>: ("isn; nip" : val))
+  if (asm int<32>: ("nnn; nip" : val))
     ctx.emit ("null");
   else if (asm int<32>: ("isty; nip" : val))
     handle_type;
-  else if (asm int<32>: ("typof; nip; isn; nip" : val))
+  else if (asm int<32>: ("typof; nip; nnn; nip" : val))
     {
       ctx.begin_class ("special");
       ctx.emit ("#<closure>");
diff --git a/libpoke/pvm.jitter b/libpoke/pvm.jitter
index 3d8a65ac..95fcc563 100644
--- a/libpoke/pvm.jitter
+++ b/libpoke/pvm.jitter
@@ -5350,22 +5350,6 @@ instruction ogetbt ()
   end
 end
 
-
-## Instructions to handle values
-
-# Instruction: isn
-#
-# Given a value, push 1 on the stack if the value is null.
-# Push 0 otherwise.
-#
-# Stack: ( VAL -- VAL INT )
-
-instruction isn ()
-  code
-    JITTER_PUSH_STACK (PVM_MAKE_INT (JITTER_TOP_STACK () == PVM_NULL, 32));
-  end
-end
-
 
 ## Instructions to handle mapped values
 
-- 
2.38.1




reply via email to

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