From 0ae3d62f40f35dde06c6020ee36afb2bc4053ccf Mon Sep 17 00:00:00 2001 From: Andy Wingo Date: Fri, 13 Apr 2018 10:15:04 +0200 Subject: [PATCH] Remove implementation of atomic box ops * libguile/vm-engine.c (VM_VALIDATE, VM_VALIDATE_ATOMIC_BOX): Remove now-unused definitions. Remove implementations of atomic-box-ref et al. * libguile/vm.c (vm_error_not_a_atomic_box): Remove. --- libguile/vm-engine.c | 67 ++------------------------------------------ libguile/vm.c | 7 ----- 2 files changed, 2 insertions(+), 72 deletions(-) diff --git a/libguile/vm-engine.c b/libguile/vm-engine.c index 8f06c5769..7640b967b 100644 --- a/libguile/vm-engine.c +++ b/libguile/vm-engine.c @@ -321,12 +321,6 @@ RETURN_EXP (SFUNC (x, y)); \ } -#define VM_VALIDATE(x, pred, proc, what) \ - VM_ASSERT (pred (x), vm_error_not_a_ ## what (proc, x)) - -#define VM_VALIDATE_ATOMIC_BOX(x, proc) \ - VM_VALIDATE (x, scm_is_atomic_box, proc, atomic_box) - /* Return true (non-zero) if PTR has suitable alignment for TYPE. */ #define ALIGNED_P(ptr, type) \ ((scm_t_uintptr) (ptr) % alignof_type (type) == 0) @@ -2769,69 +2763,13 @@ VM_NAME (scm_i_thread *thread, struct scm_vm *vp, } VM_DEFINE_OP (178, unused_178, NULL, NOP) - { - SCM box; - scm_t_uint16 dst, src; - UNPACK_12_12 (op, dst, src); - SYNC_IP (); - box = scm_inline_cell (thread, scm_tc7_atomic_box, - SCM_UNPACK (SCM_UNSPECIFIED)); - scm_atomic_set_scm (scm_atomic_box_loc (box), SP_REF (src)); - SP_SET (dst, box); - NEXT (1); - } - VM_DEFINE_OP (179, unused_179, NULL, NOP) - { - scm_t_uint16 dst, src; - SCM box; - UNPACK_12_12 (op, dst, src); - box = SP_REF (src); - VM_VALIDATE_ATOMIC_BOX (box, "atomic-box-ref"); - SP_SET (dst, scm_atomic_ref_scm (scm_atomic_box_loc (box))); - NEXT (1); - } - VM_DEFINE_OP (180, unused_180, NULL, NOP) - { - scm_t_uint16 dst, src; - SCM box; - UNPACK_12_12 (op, dst, src); - box = SP_REF (dst); - VM_VALIDATE_ATOMIC_BOX (box, "atomic-box-set!"); - scm_atomic_set_scm (scm_atomic_box_loc (box), SP_REF (src)); - NEXT (1); - } - VM_DEFINE_OP (181, unused_181, NULL, NOP) - { - scm_t_uint16 dst, box; - scm_t_uint32 val; - SCM scm_box; - UNPACK_12_12 (op, dst, box); - UNPACK_24 (ip[1], val); - scm_box = SP_REF (box); - VM_VALIDATE_ATOMIC_BOX (scm_box, "atomic-box-swap!"); - SP_SET (dst, - scm_atomic_swap_scm (scm_atomic_box_loc (scm_box), SP_REF (val))); - NEXT (2); - } - VM_DEFINE_OP (182, unused_182, NULL, NOP) { - scm_t_uint16 dst, box; - scm_t_uint32 expected, desired; - SCM scm_box, scm_expected; - UNPACK_12_12 (op, dst, box); - UNPACK_24 (ip[1], expected); - UNPACK_24 (ip[2], desired); - scm_box = SP_REF (box); - VM_VALIDATE_ATOMIC_BOX (scm_box, "atomic-box-compare-and-swap!"); - scm_expected = SP_REF (expected); - scm_atomic_compare_and_swap_scm (scm_atomic_box_loc (scm_box), - &scm_expected, SP_REF (desired)); - SP_SET (dst, scm_expected); - NEXT (3); + vm_error_bad_instruction (op); + abort (); /* never reached */ } /* handle-interrupts _:24 @@ -3707,7 +3645,6 @@ VM_NAME (scm_i_thread *thread, struct scm_vm *vp, #undef VM_DEFINE_OP #undef VM_INSTRUCTION_TO_LABEL #undef VM_USE_HOOKS -#undef VM_VALIDATE_ATOMIC_BOX /* (defun renumber-ops () diff --git a/libguile/vm.c b/libguile/vm.c index 3129fcb1e..7ebebd1c6 100644 --- a/libguile/vm.c +++ b/libguile/vm.c @@ -436,7 +436,6 @@ 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_atomic_box (const char *subr, SCM x) 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; @@ -543,12 +542,6 @@ vm_error_wrong_type_apply (SCM proc) scm_list_1 (proc), scm_list_1 (proc)); } -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_no_values (void) {