From 45ae2ebc8b4a72c924d4395dd61219d441b3a50c Mon Sep 17 00:00:00 2001 From: Chris Hanson Date: Thu, 18 Nov 2004 18:14:06 +0000 Subject: [PATCH] Introduce new default object and use that for filling in optional arguments. --- v7/src/microcode/cmpint.c | 48 +++++++++++++++++++-------------------- v7/src/microcode/const.h | 42 ++++++++++++++-------------------- v7/src/microcode/interp.c | 8 +++---- 3 files changed, 45 insertions(+), 53 deletions(-) diff --git a/v7/src/microcode/cmpint.c b/v7/src/microcode/cmpint.c index 50525077f..16eea8716 100644 --- a/v7/src/microcode/cmpint.c +++ b/v7/src/microcode/cmpint.c @@ -1,6 +1,6 @@ /* -*-C-*- -$Id: cmpint.c,v 1.101 2003/05/17 20:55:31 cph Exp $ +$Id: cmpint.c,v 1.102 2004/11/18 18:13:58 cph Exp $ Copyright 1989,1990,1991,1992,1993,1994 Massachusetts Institute of Technology Copyright 1995,1996,2000,2001,2002,2003 Massachusetts Institute of Technology @@ -86,7 +86,7 @@ USA. #include "interp.h" /* Interpreter state and primitive destructuring */ #include "default.h" /* various definitions */ #include "extern.h" /* External decls (missing Cont_Debug, etc.) */ -#include "trap.h" /* UNASSIGNED_OBJECT, CACHE_TYPE */ +#include "trap.h" /* CACHE_TYPE */ #include "prims.h" /* LEXPR */ #include "prim.h" /* Primitive_Procedure_Table, etc. */ @@ -461,7 +461,7 @@ DEFUN (open_gap, delta = (- delta); while ((--delta) >= 0) { - STACK_LOCATIVE_POP (gap_location) = UNASSIGNED_OBJECT; + STACK_LOCATIVE_POP (gap_location) = DEFAULT_OBJECT; } return (source_location); } @@ -1461,7 +1461,7 @@ DEFUN_VOID (comp_op_lookup_trap_restart) /* ARITY Mismatch handling These receive the entry point as an argument and must fill the - Scheme stack with the missing unassigned values. + Scheme stack with the missing default values. They are invoked by TRAMPOLINE_K_n_m where n and m are the same as in the name of the procedure. The single item of information in the trampoline data area is @@ -1473,7 +1473,7 @@ DEFINE_SCHEME_UTILITY_1 (comutil_operator_1_0_trap, tramp_data_raw) { SCHEME_OBJECT * tramp_data = (SCHEME_ADDR_TO_ADDR (tramp_data_raw)); - STACK_PUSH (UNASSIGNED_OBJECT); + STACK_PUSH (DEFAULT_OBJECT); RETURN_TO_SCHEME (OBJECT_ADDRESS (tramp_data[0])); } @@ -1483,7 +1483,7 @@ DEFINE_SCHEME_UTILITY_1 (comutil_operator_2_1_trap, tramp_data_raw) SCHEME_OBJECT * tramp_data = (SCHEME_ADDR_TO_ADDR (tramp_data_raw)); Top = (STACK_POP ()); - STACK_PUSH (UNASSIGNED_OBJECT); + STACK_PUSH (DEFAULT_OBJECT); STACK_PUSH (Top); RETURN_TO_SCHEME (OBJECT_ADDRESS (tramp_data[0])); } @@ -1492,8 +1492,8 @@ DEFINE_SCHEME_UTILITY_1 (comutil_operator_2_0_trap, tramp_data_raw) { SCHEME_OBJECT * tramp_data = (SCHEME_ADDR_TO_ADDR (tramp_data_raw)); - STACK_PUSH (UNASSIGNED_OBJECT); - STACK_PUSH (UNASSIGNED_OBJECT); + STACK_PUSH (DEFAULT_OBJECT); + STACK_PUSH (DEFAULT_OBJECT); RETURN_TO_SCHEME (OBJECT_ADDRESS (tramp_data[0])); } @@ -1504,7 +1504,7 @@ DEFINE_SCHEME_UTILITY_1 (comutil_operator_3_2_trap, tramp_data_raw) Top = (STACK_POP ()); Next = (STACK_POP ()); - STACK_PUSH (UNASSIGNED_OBJECT); + STACK_PUSH (DEFAULT_OBJECT); STACK_PUSH (Next); STACK_PUSH (Top); RETURN_TO_SCHEME (OBJECT_ADDRESS (tramp_data[0])); @@ -1516,8 +1516,8 @@ DEFINE_SCHEME_UTILITY_1 (comutil_operator_3_1_trap, tramp_data_raw) SCHEME_OBJECT * tramp_data = (SCHEME_ADDR_TO_ADDR (tramp_data_raw)); Top = (STACK_POP ()); - STACK_PUSH (UNASSIGNED_OBJECT); - STACK_PUSH (UNASSIGNED_OBJECT); + STACK_PUSH (DEFAULT_OBJECT); + STACK_PUSH (DEFAULT_OBJECT); STACK_PUSH (Top); RETURN_TO_SCHEME (OBJECT_ADDRESS (tramp_data[0])); } @@ -1526,9 +1526,9 @@ DEFINE_SCHEME_UTILITY_1 (comutil_operator_3_0_trap, tramp_data_raw) { SCHEME_OBJECT * tramp_data = (SCHEME_ADDR_TO_ADDR (tramp_data_raw)); - STACK_PUSH (UNASSIGNED_OBJECT); - STACK_PUSH (UNASSIGNED_OBJECT); - STACK_PUSH (UNASSIGNED_OBJECT); + STACK_PUSH (DEFAULT_OBJECT); + STACK_PUSH (DEFAULT_OBJECT); + STACK_PUSH (DEFAULT_OBJECT); RETURN_TO_SCHEME (OBJECT_ADDRESS (tramp_data[0])); } @@ -1541,7 +1541,7 @@ DEFINE_SCHEME_UTILITY_1 (comutil_operator_4_3_trap, tramp_data_raw) Middle = (STACK_POP ()); Bottom = (STACK_POP ()); - STACK_PUSH (UNASSIGNED_OBJECT); + STACK_PUSH (DEFAULT_OBJECT); STACK_PUSH (Bottom); STACK_PUSH (Middle); STACK_PUSH (Top); @@ -1555,8 +1555,8 @@ DEFINE_SCHEME_UTILITY_1 (comutil_operator_4_2_trap, tramp_data_raw) Top = (STACK_POP ()); Next = (STACK_POP ()); - STACK_PUSH (UNASSIGNED_OBJECT); - STACK_PUSH (UNASSIGNED_OBJECT); + STACK_PUSH (DEFAULT_OBJECT); + STACK_PUSH (DEFAULT_OBJECT); STACK_PUSH (Next); STACK_PUSH (Top); RETURN_TO_SCHEME (OBJECT_ADDRESS (tramp_data[0])); @@ -1568,9 +1568,9 @@ DEFINE_SCHEME_UTILITY_1 (comutil_operator_4_1_trap, tramp_data_raw) SCHEME_OBJECT * tramp_data = (SCHEME_ADDR_TO_ADDR (tramp_data_raw)); Top = (STACK_POP ()); - STACK_PUSH (UNASSIGNED_OBJECT); - STACK_PUSH (UNASSIGNED_OBJECT); - STACK_PUSH (UNASSIGNED_OBJECT); + STACK_PUSH (DEFAULT_OBJECT); + STACK_PUSH (DEFAULT_OBJECT); + STACK_PUSH (DEFAULT_OBJECT); STACK_PUSH (Top); RETURN_TO_SCHEME (OBJECT_ADDRESS (tramp_data[0])); } @@ -1578,10 +1578,10 @@ DEFINE_SCHEME_UTILITY_1 (comutil_operator_4_1_trap, tramp_data_raw) DEFINE_SCHEME_UTILITY_1 (comutil_operator_4_0_trap, tramp_data_raw) { SCHEME_OBJECT * tramp_data = (SCHEME_ADDR_TO_ADDR (tramp_data_raw)); - STACK_PUSH (UNASSIGNED_OBJECT); - STACK_PUSH (UNASSIGNED_OBJECT); - STACK_PUSH (UNASSIGNED_OBJECT); - STACK_PUSH (UNASSIGNED_OBJECT); + STACK_PUSH (DEFAULT_OBJECT); + STACK_PUSH (DEFAULT_OBJECT); + STACK_PUSH (DEFAULT_OBJECT); + STACK_PUSH (DEFAULT_OBJECT); RETURN_TO_SCHEME (OBJECT_ADDRESS (tramp_data[0])); } diff --git a/v7/src/microcode/const.h b/v7/src/microcode/const.h index 6b5453c39..90923f4e6 100644 --- a/v7/src/microcode/const.h +++ b/v7/src/microcode/const.h @@ -1,6 +1,6 @@ /* -*-C-*- -$Id: const.h,v 9.48 2003/02/14 18:28:18 cph Exp $ +$Id: const.h,v 9.49 2004/11/18 18:14:02 cph Exp $ Copyright (c) 1987-2000 Massachusetts Institute of Technology @@ -34,31 +34,23 @@ USA. #define PI 3.1415926535 #define STACK_FRAME_HEADER 1 -/* Precomputed typed pointers */ -#if (SIZEOF_UNSIGNED_LONG == 4) /* 32 bit word */ -# if (TYPE_CODE_LENGTH == 8) -# define SHARP_F 0x00000000 -# define SHARP_T 0x08000000 -# define UNSPECIFIC 0x08000001 -# define FIXNUM_ZERO 0x1A000000 -# define BROKEN_HEART_ZERO 0x22000000 -# endif -# if (TYPE_CODE_LENGTH == 6) -# define SHARP_F 0x00000000 -# define SHARP_T 0x20000000 -# define UNSPECIFIC 0x20000001 -# define FIXNUM_ZERO 0x68000000 -# define BROKEN_HEART_ZERO 0x88000000 -# endif -#endif +/* Assigned TC_CONSTANT datum values: + 0 #t + 1 unspecific + 2 [non-object] + 3 #!optional + 4 #!rest + 5 #!key + 6 #!eof + 7 #!default + */ -#ifndef SHARP_F /* Safe version */ -# define SHARP_F MAKE_OBJECT (TC_NULL, 0) -# define SHARP_T MAKE_OBJECT (TC_CONSTANT, 0) -# define UNSPECIFIC MAKE_OBJECT (TC_CONSTANT, 1) -# define FIXNUM_ZERO MAKE_OBJECT (TC_FIXNUM, 0) -# define BROKEN_HEART_ZERO MAKE_OBJECT (TC_BROKEN_HEART, 0) -#endif /* SHARP_F */ +#define SHARP_F MAKE_OBJECT (TC_NULL, 0) +#define SHARP_T MAKE_OBJECT (TC_CONSTANT, 0) +#define UNSPECIFIC MAKE_OBJECT (TC_CONSTANT, 1) +#define DEFAULT_OBJECT MAKE_OBJECT (TC_CONSTANT, 7) +#define FIXNUM_ZERO MAKE_OBJECT (TC_FIXNUM, 0) +#define BROKEN_HEART_ZERO MAKE_OBJECT (TC_BROKEN_HEART, 0) #define EMPTY_LIST SHARP_F diff --git a/v7/src/microcode/interp.c b/v7/src/microcode/interp.c index 29e3ba67f..748dd52ea 100644 --- a/v7/src/microcode/interp.c +++ b/v7/src/microcode/interp.c @@ -1,6 +1,6 @@ /* -*-C-*- -$Id: interp.c,v 9.100 2003/03/06 05:41:19 cph Exp $ +$Id: interp.c,v 9.101 2004/11/18 18:14:06 cph Exp $ Copyright 1986,1987,1988,1989,1990,1991 Massachusetts Institute of Technology Copyright 1992,2000,2001,2002,2003 Massachusetts Institute of Technology @@ -1407,11 +1407,11 @@ DEFUN (Interpret, (pop_return_p), int pop_return_p) for (i = (nargs + 1); (--i) >= 0; ) (*scan++) = (STACK_POP ()); for (i = (params - nargs); (--i) >= 0; ) - (*scan++) = UNASSIGNED_OBJECT; + (*scan++) = DEFAULT_OBJECT; if (rest_flag) (*scan++) = EMPTY_LIST; for (i = auxes; (--i) >= 0; ) - (*scan++) = UNASSIGNED_OBJECT; + (*scan++) = DEFAULT_OBJECT; } else { @@ -1422,7 +1422,7 @@ DEFUN (Interpret, (pop_return_p), int pop_return_p) (*scan++) = (STACK_POP ()); (*scan++) = list; for (i = auxes; (--i) >= 0; ) - (*scan++) = UNASSIGNED_OBJECT; + (*scan++) = DEFAULT_OBJECT; /* Now scan == OBJECT_ADDRESS (list) */ for (i = (nargs - params); (--i) >= 0; ) { -- 2.25.1