guile-commits
[Top][All Lists]
Advanced

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

[Guile-commits] 21/25: Remove pair-related instructions


From: Andy Wingo
Subject: [Guile-commits] 21/25: Remove pair-related instructions
Date: Mon, 8 Jan 2018 09:25:05 -0500 (EST)

wingo pushed a commit to branch master
in repository guile.

commit 798f6336246305554567f10e1561ed6545640545
Author: Andy Wingo <address@hidden>
Date:   Sun Jan 7 18:32:07 2018 +0100

    Remove pair-related instructions
    
    * libguile/vm-engine.c (VM_VALIDATE_PAIR, VM_VALIDATE_MUTABLE_PAIR):
      Remove these now-unused definitions.
      (VM_VALIDATE_VECTOR, VM_VALIDATE_MUTABLE_VECTOR): Likewise.
      (cons, car, cdr, set-car!, set-cdr!): Remove instructions.
    * libguile/vm.c (vm_error_not_a_pair, vm_error_not_a_mutable_pair):
      Remove unused error cases.
---
 libguile/vm-engine.c | 83 +++++-----------------------------------------------
 libguile/vm.c        | 14 ---------
 2 files changed, 7 insertions(+), 90 deletions(-)

diff --git a/libguile/vm-engine.c b/libguile/vm-engine.c
index 5205550..997fdcc 100644
--- a/libguile/vm-engine.c
+++ b/libguile/vm-engine.c
@@ -321,20 +321,12 @@
   VM_VALIDATE (obj, SCM_MUTABLE_BYTEVECTOR_P, proc, mutable_bytevector)
 #define VM_VALIDATE_CHAR(x, proc)                                       \
   VM_VALIDATE (x, SCM_CHARP, proc, char)
-#define VM_VALIDATE_PAIR(x, proc)                                       \
-  VM_VALIDATE (x, scm_is_pair, proc, pair)
-#define VM_VALIDATE_MUTABLE_PAIR(x, proc)                               \
-  VM_VALIDATE (x, scm_is_mutable_pair, proc, mutable_pair)
 #define VM_VALIDATE_STRING(obj, proc)                                   \
   VM_VALIDATE (obj, scm_is_string, proc, string)
 #define VM_VALIDATE_STRUCT(obj, proc)                                   \
   VM_VALIDATE (obj, SCM_STRUCTP, proc, struct)
 #define VM_VALIDATE_VARIABLE(obj, proc)                                 \
   VM_VALIDATE (obj, SCM_VARIABLEP, proc, variable)
-#define VM_VALIDATE_VECTOR(obj, proc)                                   \
-  VM_VALIDATE (obj, SCM_I_IS_VECTOR, proc, vector)
-#define VM_VALIDATE_MUTABLE_VECTOR(obj, proc)                           \
-  VM_VALIDATE (obj, SCM_I_IS_MUTABLE_VECTOR, proc, mutable_vector)
 
 #define VM_VALIDATE_INDEX(u64, size, proc)                              \
   VM_ASSERT (u64 < size, vm_error_out_of_range_uint64 (proc, u64))
@@ -2231,76 +2223,16 @@ VM_NAME (scm_i_thread *thread, struct scm_vm *vp,
 
   
 
-  /*
-   * Pairs
-   */
-
-  /* cons dst:8 car:8 cdr:8
-   *
-   * Cons CAR and CDR, and store the result in DST.
-   */
-  VM_DEFINE_OP (81, cons, "cons", OP1 (X8_S8_S8_S8) | OP_DST)
-    {
-      ARGS2 (x, y);
-      SYNC_IP ();
-      RETURN (scm_inline_cons (thread, x, y));
-    }
-
-  /* car dst:12 src:12
-   *
-   * Place the car of SRC in DST.
-   */
-  VM_DEFINE_OP (82, car, "car", OP1 (X8_S12_S12) | OP_DST)
-    {
-      ARGS1 (x);
-      VM_VALIDATE_PAIR (x, "car");
-      RETURN (SCM_CAR (x));
-    }
-
-  /* cdr dst:12 src:12
-   *
-   * Place the cdr of SRC in DST.
-   */
-  VM_DEFINE_OP (83, cdr, "cdr", OP1 (X8_S12_S12) | OP_DST)
-    {
-      ARGS1 (x);
-      VM_VALIDATE_PAIR (x, "cdr");
-      RETURN (SCM_CDR (x));
-    }
-
-  /* set-car! pair:12 car:12
-   *
-   * Set the car of DST to SRC.
-   */
-  VM_DEFINE_OP (84, set_car, "set-car!", OP1 (X8_S12_S12))
+  VM_DEFINE_OP (81, unused_81, NULL, NOP)
+  VM_DEFINE_OP (82, unused_82, NULL, NOP)
+  VM_DEFINE_OP (83, unused_83, NULL, NOP)
+  VM_DEFINE_OP (84, unused_84, NULL, NOP)
+  VM_DEFINE_OP (85, unused_85, NULL, NOP)
     {
-      scm_t_uint16 a, b;
-      SCM x, y;
-      UNPACK_12_12 (op, a, b);
-      x = SP_REF (a);
-      y = SP_REF (b);
-      VM_VALIDATE_MUTABLE_PAIR (x, "set-car!");
-      SCM_SETCAR (x, y);
-      NEXT (1);
-    }
-
-  /* set-cdr! pair:12 cdr:12
-   *
-   * Set the cdr of DST to SRC.
-   */
-  VM_DEFINE_OP (85, set_cdr, "set-cdr!", OP1 (X8_S12_S12))
-    {
-      scm_t_uint16 a, b;
-      SCM x, y;
-      UNPACK_12_12 (op, a, b);
-      x = SP_REF (a);
-      y = SP_REF (b);
-      VM_VALIDATE_MUTABLE_PAIR (x, "set-cdr!");
-      SCM_SETCDR (x, y);
-      NEXT (1);
+      vm_error_bad_instruction (op);
+      abort (); /* never reached */
     }
 
-
   
 
   /*
@@ -4367,7 +4299,6 @@ VM_NAME (scm_i_thread *thread, struct scm_vm *vp,
 #undef VM_USE_HOOKS
 #undef VM_VALIDATE_ATOMIC_BOX
 #undef VM_VALIDATE_BYTEVECTOR
-#undef VM_VALIDATE_PAIR
 #undef VM_VALIDATE_STRUCT
 
 /*
diff --git a/libguile/vm.c b/libguile/vm.c
index 6b904cf..feed5c8 100644
--- a/libguile/vm.c
+++ b/libguile/vm.c
@@ -433,8 +433,6 @@ static void vm_error_kwargs_unrecognized_keyword (SCM proc, 
SCM kw) SCM_NORETURN
 static void vm_error_wrong_num_args (SCM proc) SCM_NORETURN SCM_NOINLINE;
 static void vm_error_wrong_type_apply (SCM proc) SCM_NORETURN SCM_NOINLINE;
 static void vm_error_not_a_char (const char *subr, SCM x) SCM_NORETURN 
SCM_NOINLINE;
-static void vm_error_not_a_pair (const char *subr, SCM x) SCM_NORETURN 
SCM_NOINLINE;
-static void vm_error_not_a_mutable_pair (const char *subr, SCM x) SCM_NORETURN 
SCM_NOINLINE;
 static void vm_error_not_a_string (const char *subr, SCM x) SCM_NORETURN 
SCM_NOINLINE;
 static void vm_error_not_a_atomic_box (const char *subr, SCM x) SCM_NORETURN 
SCM_NOINLINE;
 static void vm_error_not_a_bytevector (const char *subr, SCM x) SCM_NORETURN 
SCM_NOINLINE;
@@ -564,18 +562,6 @@ vm_error_not_a_char (const char *subr, SCM x)
 }
 
 static void
-vm_error_not_a_pair (const char *subr, SCM x)
-{
-  scm_wrong_type_arg_msg (subr, 1, x, "pair");
-}
-
-static void
-vm_error_not_a_mutable_pair (const char *subr, SCM x)
-{
-  scm_wrong_type_arg_msg (subr, 1, x, "mutable pair");
-}
-
-static void
 vm_error_not_a_string (const char *subr, SCM x)
 {
   scm_wrong_type_arg_msg (subr, 1, x, "string");



reply via email to

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