[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] 12/25: Remove now-unused make-vector et al instructions
From: |
Andy Wingo |
Subject: |
[Guile-commits] 12/25: Remove now-unused make-vector et al instructions |
Date: |
Mon, 8 Jan 2018 09:25:03 -0500 (EST) |
wingo pushed a commit to branch master
in repository guile.
commit 94f8f70b22f2aad76d35bfd7f7e506d769fe4096
Author: Andy Wingo <address@hidden>
Date: Sun Jan 7 16:34:13 2018 +0100
Remove now-unused make-vector et al instructions
* libguile/vm-engine.c (make-vector, make-vector/immediate)
(vector-ref, vector-ref/immediate, vector-set!)
(vector-set!/immediate): Remove these now-unused instructions.
* libguile/vm.c (vm_error_not_a_vector, vm_error_not_a_mutable_vector):
Remove.
---
libguile/vm-engine.c | 142 ++++-----------------------------------------------
libguile/vm.c | 16 +-----
2 files changed, 10 insertions(+), 148 deletions(-)
diff --git a/libguile/vm-engine.c b/libguile/vm-engine.c
index aa59795..5205550 100644
--- a/libguile/vm-engine.c
+++ b/libguile/vm-engine.c
@@ -2467,140 +2467,16 @@ VM_NAME (scm_i_thread *thread, struct scm_vm *vp,
RETURN_EXP (scm_logxor (x, y));
}
- /* make-vector dst:8 length:8 init:8
- *
- * Make a vector and write it to DST. The vector will have space for
- * LENGTH slots. They will be filled with the value in slot INIT.
- */
- VM_DEFINE_OP (99, make_vector, "make-vector", OP1 (X8_S8_S8_S8) | OP_DST)
- {
- scm_t_uint8 dst, length, init;
- scm_t_uint64 length_val;
-
- UNPACK_8_8_8 (op, dst, length, init);
- length_val = SP_REF_U64 (length);
- VM_VALIDATE_INDEX (length_val, (size_t) -1, "make-vector");
-
- /* TODO: Inline this allocation. */
- SYNC_IP ();
- SP_SET (dst, scm_c_make_vector (length_val, SP_REF (init)));
-
- NEXT (1);
- }
-
- /* make-vector/immediate dst:8 length:8 init:8
- *
- * Make a short vector of known size and write it to DST. The vector
- * will have space for LENGTH slots, an immediate value. They will be
- * filled with the value in slot INIT.
- */
- VM_DEFINE_OP (100, make_vector_immediate, "make-vector/immediate", OP1
(X8_S8_C8_S8) | OP_DST)
+ VM_DEFINE_OP (99, unused_99, NULL, NOP)
+ VM_DEFINE_OP (100, unused_100, NULL, NOP)
+ VM_DEFINE_OP (101, unused_101, NULL, NOP)
+ VM_DEFINE_OP (102, unused_102, NULL, NOP)
+ VM_DEFINE_OP (103, unused_103, NULL, NOP)
+ VM_DEFINE_OP (104, unused_104, NULL, NOP)
+ VM_DEFINE_OP (105, unused_105, NULL, NOP)
{
- scm_t_uint8 dst, init;
- scm_t_int32 length, n;
- SCM val, vector;
-
- UNPACK_8_8_8 (op, dst, length, init);
-
- val = SP_REF (init);
- SYNC_IP ();
- vector = scm_inline_words (thread, scm_tc7_vector | (length << 8),
- length + 1);
- for (n = 0; n < length; n++)
- SCM_SIMPLE_VECTOR_SET (vector, n, val);
- SP_SET (dst, vector);
- NEXT (1);
- }
-
- /* vector-length dst:12 src:12
- *
- * Store the length of the vector in SRC in DST.
- */
- VM_DEFINE_OP (101, vector_length, "vector-length", OP1 (X8_S12_S12) | OP_DST)
- {
- ARGS1 (vect);
- VM_VALIDATE_VECTOR (vect, "vector-length");
- SP_SET_U64 (dst, SCM_I_VECTOR_LENGTH (vect));
- NEXT (1);
- }
-
- /* vector-ref dst:8 src:8 idx:8
- *
- * Fetch the item at position IDX in the vector in SRC, and store it
- * in DST.
- */
- VM_DEFINE_OP (102, vector_ref, "vector-ref", OP1 (X8_S8_S8_S8) | OP_DST)
- {
- scm_t_uint8 dst, src, idx;
- SCM vect;
- scm_t_uint64 c_idx;
-
- UNPACK_8_8_8 (op, dst, src, idx);
- vect = SP_REF (src);
- c_idx = SP_REF_U64 (idx);
-
- VM_VALIDATE_VECTOR (vect, "vector-ref");
- VM_VALIDATE_INDEX (c_idx, SCM_I_VECTOR_LENGTH (vect), "vector-ref");
- RETURN (SCM_I_VECTOR_ELTS (vect)[c_idx]);
- }
-
- /* vector-ref/immediate dst:8 src:8 idx:8
- *
- * Fill DST with the item IDX elements into the vector at SRC. Useful
- * for building data types using vectors.
- */
- VM_DEFINE_OP (103, vector_ref_immediate, "vector-ref/immediate", OP1
(X8_S8_S8_C8) | OP_DST)
- {
- scm_t_uint8 dst, src, idx;
- SCM vect;
-
- UNPACK_8_8_8 (op, dst, src, idx);
- vect = SP_REF (src);
- VM_VALIDATE_VECTOR (vect, "vector-ref");
- VM_VALIDATE_INDEX (idx, SCM_I_VECTOR_LENGTH (vect), "vector-ref");
- SP_SET (dst, SCM_I_VECTOR_ELTS (vect)[idx]);
- NEXT (1);
- }
-
- /* vector-set! dst:8 idx:8 src:8
- *
- * Store SRC into the vector DST at index IDX.
- */
- VM_DEFINE_OP (104, vector_set, "vector-set!", OP1 (X8_S8_S8_S8))
- {
- scm_t_uint8 dst, idx, src;
- SCM vect, val;
- scm_t_uint64 c_idx;
-
- UNPACK_8_8_8 (op, dst, idx, src);
- vect = SP_REF (dst);
- c_idx = SP_REF_U64 (idx);
- val = SP_REF (src);
-
- VM_VALIDATE_MUTABLE_VECTOR (vect, "vector-set!");
- VM_VALIDATE_INDEX (c_idx, SCM_I_VECTOR_LENGTH (vect), "vector-set!");
- SCM_I_VECTOR_WELTS (vect)[c_idx] = val;
- NEXT (1);
- }
-
- /* vector-set!/immediate dst:8 idx:8 src:8
- *
- * Store SRC into the vector DST at index IDX. Here IDX is an
- * immediate value.
- */
- VM_DEFINE_OP (105, vector_set_immediate, "vector-set!/immediate", OP1
(X8_S8_C8_S8))
- {
- scm_t_uint8 dst, idx, src;
- SCM vect, val;
-
- UNPACK_8_8_8 (op, dst, idx, src);
- vect = SP_REF (dst);
- val = SP_REF (src);
-
- VM_VALIDATE_MUTABLE_VECTOR (vect, "vector-set!");
- VM_VALIDATE_INDEX (idx, SCM_I_VECTOR_LENGTH (vect), "vector-set!");
- SCM_I_VECTOR_WELTS (vect)[idx] = val;
- NEXT (1);
+ vm_error_bad_instruction (op);
+ abort (); /* never reached */
}
diff --git a/libguile/vm.c b/libguile/vm.c
index 719110a..6b904cf 100644
--- a/libguile/vm.c
+++ b/libguile/vm.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2017 Free
Software Foundation, Inc.
+/* Copyright (C) 2001, 2009-2015, 2017-2018 Free Software Foundation, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
@@ -440,8 +440,6 @@ static void vm_error_not_a_atomic_box (const char *subr,
SCM x) SCM_NORETURN SCM
static void vm_error_not_a_bytevector (const char *subr, SCM x) SCM_NORETURN
SCM_NOINLINE;
static void vm_error_not_a_mutable_bytevector (const char *subr, SCM v)
SCM_NORETURN SCM_NOINLINE;
static void vm_error_not_a_struct (const char *subr, SCM x) SCM_NORETURN
SCM_NOINLINE;
-static void vm_error_not_a_vector (const char *subr, SCM v) SCM_NORETURN
SCM_NOINLINE;
-static void vm_error_not_a_mutable_vector (const char *subr, SCM v)
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_out_of_range_int64 (const char *subr, scm_t_int64 idx)
SCM_NORETURN SCM_NOINLINE;
static void vm_error_boxed_struct_field (const char *subr, scm_t_uint64 idx)
SCM_NORETURN SCM_NOINLINE;
@@ -608,18 +606,6 @@ vm_error_not_a_struct (const char *subr, SCM x)
}
static void
-vm_error_not_a_vector (const char *subr, SCM x)
-{
- scm_wrong_type_arg_msg (subr, 1, x, "vector");
-}
-
-static void
-vm_error_not_a_mutable_vector (const char *subr, SCM x)
-{
- scm_wrong_type_arg_msg (subr, 1, x, "mutable vector");
-}
-
-static void
vm_error_out_of_range_uint64 (const char *subr, scm_t_uint64 idx)
{
scm_out_of_range (subr, scm_from_uint64 (idx));
- [Guile-commits] branch master updated (fa4cb21 -> e2a0624), Andy Wingo, 2018/01/08
- [Guile-commits] 05/25: Minor optimization in loop peeling, Andy Wingo, 2018/01/08
- [Guile-commits] 03/25: Bug-fix to devirtualize-integers pass, Andy Wingo, 2018/01/08
- [Guile-commits] 07/25: Instruction explosion for make-vector, Andy Wingo, 2018/01/08
- [Guile-commits] 11/25: Remove "ash" instruction., Andy Wingo, 2018/01/08
- [Guile-commits] 09/25: Mark word-ref and word-ref/immediate as producing U64 values, Andy Wingo, 2018/01/08
- [Guile-commits] 12/25: Remove now-unused make-vector et al instructions,
Andy Wingo <=
- [Guile-commits] 18/25: Minor compile-cps refactor for cons, Andy Wingo, 2018/01/08
- [Guile-commits] 15/25: CPS type analysis support for mutable vs immutable vectors, Andy Wingo, 2018/01/08
- [Guile-commits] 21/25: Remove pair-related instructions, Andy Wingo, 2018/01/08
- [Guile-commits] 10/25: CPS pass now expects exploded vector primitives, Andy Wingo, 2018/01/08
- [Guile-commits] 13/25: Add CPS compilation support for mutable-vector?, Andy Wingo, 2018/01/08
- [Guile-commits] 24/25: Sync IP before allocating closures, Andy Wingo, 2018/01/08
- [Guile-commits] 19/25: Expand pair-related primcalls, Andy Wingo, 2018/01/08
- [Guile-commits] 16/25: Re-add compiler backend support for immutable vectors, Andy Wingo, 2018/01/08
- [Guile-commits] 25/25: Save VM compare result before calling out to hooks, Andy Wingo, 2018/01/08
- [Guile-commits] 01/25: Fix verify.scm for call-thunk/no-inline, Andy Wingo, 2018/01/08