guile-commits
[Top][All Lists]
Advanced

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

[Guile-commits] 14/24: Remove char->integer from VM


From: Andy Wingo
Subject: [Guile-commits] 14/24: Remove char->integer from VM
Date: Tue, 10 Apr 2018 13:24:14 -0400 (EDT)

wingo pushed a commit to branch master
in repository guile.

commit 644875cf0e11b3ddd50501b189c17516a63d2ee2
Author: Andy Wingo <address@hidden>
Date:   Tue Apr 10 13:50:28 2018 +0200

    Remove char->integer from VM
    
    * libguile/vm-engine.c (VM_VALIDATE_CHAR, VM_VALIDATE_STRING)
      (VM_VALIDATE_INDEX): Remove now-unused helpers.
      (vm_engine): Fix position of intrinsics declaration.
      (char->integer): Remove unused opcode.
    * libguile/vm.c (vm_error_not_a_char, vm_error_not_a_string)
      (vm_error_out_of_range_uint64): Remove unused decls.
---
 libguile/vm-engine.c | 30 +++---------------------------
 libguile/vm.c        | 21 ---------------------
 2 files changed, 3 insertions(+), 48 deletions(-)

diff --git a/libguile/vm-engine.c b/libguile/vm-engine.c
index 0a0df20..05d88aa 100644
--- a/libguile/vm-engine.c
+++ b/libguile/vm-engine.c
@@ -318,13 +318,6 @@
 
 #define VM_VALIDATE_ATOMIC_BOX(x, proc)                                 \
   VM_VALIDATE (x, scm_is_atomic_box, proc, atomic_box)
-#define VM_VALIDATE_CHAR(x, proc)                                       \
-  VM_VALIDATE (x, SCM_CHARP, proc, char)
-#define VM_VALIDATE_STRING(obj, proc)                                   \
-  VM_VALIDATE (obj, scm_is_string, proc, string)
-
-#define VM_VALIDATE_INDEX(u64, size, proc)                              \
-  VM_ASSERT (u64 < size, vm_error_out_of_range_uint64 (proc, u64))
 
 /* Return true (non-zero) if PTR has suitable alignment for TYPE.  */
 #define ALIGNED_P(ptr, type)                   \
@@ -346,6 +339,8 @@ VM_NAME (scm_i_thread *thread, struct scm_vm *vp,
   /* Current opcode: A cache of *ip.  */
   register scm_t_uint32 op;
 
+  void **intrinsics = (void**) &scm_vm_intrinsics;
+
 #ifdef HAVE_LABELS_AS_VALUES
   static const void *jump_table_[256] = {
 #define LABEL_ADDR(opcode, tag, name, meta) &&op_##tag,
@@ -358,8 +353,6 @@ VM_NAME (scm_i_thread *thread, struct scm_vm *vp,
   jump_table = jump_table_;
 #endif
 
-  void **intrinsics = (void**) &scm_vm_intrinsics;
-
   /* Load VM registers. */
   CACHE_REGISTER ();
 
@@ -2838,29 +2831,12 @@ VM_NAME (scm_i_thread *thread, struct scm_vm *vp,
   VM_DEFINE_OP (173, unused_173, NULL, NOP)
   VM_DEFINE_OP (174, unused_174, NULL, NOP)
   VM_DEFINE_OP (175, unused_175, NULL, NOP)
+  VM_DEFINE_OP (176, unused_176, NULL, NOP)
     {
       vm_error_bad_instruction (op);
       abort (); /* never reached */
     }
 
-  /* char->integer a:12 b:12
-   *
-   * Untag the character in B to U64, and return it in A.
-   */
-  VM_DEFINE_OP (176, char_to_integer, "char->integer", OP1 (X8_S12_S12) | 
OP_DST)
-    {
-      scm_t_uint16 dst, src;
-      SCM x;
-
-      UNPACK_12_12 (op, dst, src);
-      x = SP_REF (src);
-
-      VM_VALIDATE_CHAR (x, "char->integer");
-      SP_SET_U64 (dst, SCM_CHAR (x));
-
-      NEXT (1);
-    }
-
   /* ulogxor dst:8 a:8 b:8
    *
    * Place the bitwise exclusive OR of the u64 values in A and B into
diff --git a/libguile/vm.c b/libguile/vm.c
index 2381a14..3129fcb 100644
--- a/libguile/vm.c
+++ b/libguile/vm.c
@@ -436,10 +436,7 @@ static void vm_error_kwargs_invalid_keyword (SCM proc, SCM 
obj) SCM_NORETURN SCM
 static void vm_error_kwargs_unrecognized_keyword (SCM proc, SCM kw) 
SCM_NORETURN SCM_NOINLINE;
 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_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_out_of_range_uint64 (const char *subr, scm_t_uint64 idx) 
SCM_NORETURN SCM_NOINLINE;
 static void vm_error_no_values (void) SCM_NORETURN SCM_NOINLINE;
 static void vm_error_not_enough_values (void) SCM_NORETURN SCM_NOINLINE;
 static void vm_error_wrong_number_of_values (scm_t_uint32 expected) 
SCM_NORETURN SCM_NOINLINE;
@@ -547,30 +544,12 @@ vm_error_wrong_type_apply (SCM proc)
 }
 
 static void
-vm_error_not_a_char (const char *subr, SCM x)
-{
-  scm_wrong_type_arg_msg (subr, 1, x, "char");
-}
-
-static void
-vm_error_not_a_string (const char *subr, SCM x)
-{
-  scm_wrong_type_arg_msg (subr, 1, x, "string");
-}
-
-static void
 vm_error_not_a_atomic_box (const char *subr, SCM x)
 {
   scm_wrong_type_arg_msg (subr, 1, x, "atomic box");
 }
 
 static void
-vm_error_out_of_range_uint64 (const char *subr, scm_t_uint64 idx)
-{
-  scm_out_of_range (subr, scm_from_uint64 (idx));
-}
-
-static void
 vm_error_no_values (void)
 {
   vm_error ("Zero values returned to single-valued continuation",



reply via email to

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