From: Chris Hanson Date: Fri, 23 Dec 1988 04:32:55 +0000 (+0000) Subject: Fix definition of `stack-top-address' to make it consistent with X-Git-Tag: 20090517-FFI~12321 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=b179fdbac8fc6e8a9a00bd519f8d8f7df940b18a;p=mit-scheme.git Fix definition of `stack-top-address' to make it consistent with definition of `object-datum' (which will be used to extract the address value of a stack address). Implement new primitive `stack-address-offset' which computes the offset (in objects) between the stack-address argument and the top of stack. --- diff --git a/v7/src/microcode/comutl.c b/v7/src/microcode/comutl.c index 38f44a9d1..f412f32b0 100644 --- a/v7/src/microcode/comutl.c +++ b/v7/src/microcode/comutl.c @@ -1,6 +1,6 @@ /* -*-C-*- -$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/comutl.c,v 1.14 1988/11/08 07:31:15 cph Exp $ +$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/comutl.c,v 1.15 1988/12/23 04:32:24 cph Exp $ Copyright (c) 1987, 1988 Massachusetts Institute of Technology @@ -71,23 +71,32 @@ DEFINE_PRIMITIVE ("COMPILED-CODE-ADDRESS->OFFSET", Prim_comp_code_address_offset (MAKE_SIGNED_FIXNUM (compiled_entry_to_block_offset (ARG_REF (1)))); } -/* - This number is eventually used to subtract from stack environment - addresses, so it must correspond to how those are made. +#ifndef USE_STACKLETS - NOTE: this will have to be updated when the compiler is ported to the - stacklet microcode. - */ +DEFINE_PRIMITIVE ("STACK-TOP-ADDRESS", Prim_stack_top_address, 0, 0, 0) +{ + PRIMITIVE_HEADER (0); -#define STACK_TOP_TO_DATUM() (((long) Stack_Top) & ADDRESS_MASK) + PRIMITIVE_RETURN (C_Integer_To_Scheme_Integer (OBJECT_DATUM (Stack_Top))); +} -DEFINE_PRIMITIVE ("STACK-TOP-ADDRESS", Prim_stack_top_address, 0, 0, 0) +#define STACK_ADDRESS_P(object) \ + ((OBJECT_TYPE (object)) == TC_STACK_ENVIRONMENT) + +DEFINE_PRIMITIVE ("STACK-ADDRESS-OFFSET", Prim_stack_address_offset, 1, 1, 0) { - Primitive_0_Args(); + PRIMITIVE_HEADER (1); - PRIMITIVE_RETURN (MAKE_SIGNED_FIXNUM(STACK_TOP_TO_DATUM())); + CHECK_ARG (1, STACK_ADDRESS_P); + PRIMITIVE_RETURN + (C_Integer_To_Scheme_Integer + ((STACK_LOCATIVE_DIFFERENCE + ((OBJECT_DATUM (ARG_REF (1))), (OBJECT_DATUM (Stack_Top)))) + / (sizeof (Pointer)))); } +#endif /* USE_STACKLETS */ + DEFINE_PRIMITIVE ("COMPILED-ENTRY-KIND", Prim_compiled_entry_type, 1, 1, 0) { fast Pointer *temp; diff --git a/v7/src/microcode/version.h b/v7/src/microcode/version.h index 8fda51b26..ad93941f5 100644 --- a/v7/src/microcode/version.h +++ b/v7/src/microcode/version.h @@ -1,6 +1,6 @@ /* -*-C-*- -$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/Attic/version.h,v 10.64 1988/12/12 21:51:29 jinx Exp $ +$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/Attic/version.h,v 10.65 1988/12/23 04:32:55 cph Exp $ Copyright (c) 1988 Massachusetts Institute of Technology @@ -46,7 +46,7 @@ MIT in each case. */ #define VERSION 10 #endif #ifndef SUBVERSION -#define SUBVERSION 64 +#define SUBVERSION 65 #endif #ifndef UCODE_TABLES_FILENAME diff --git a/v8/src/microcode/version.h b/v8/src/microcode/version.h index e6a37e2ea..97559ed98 100644 --- a/v8/src/microcode/version.h +++ b/v8/src/microcode/version.h @@ -1,6 +1,6 @@ /* -*-C-*- -$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v8/src/microcode/version.h,v 10.64 1988/12/12 21:51:29 jinx Exp $ +$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v8/src/microcode/version.h,v 10.65 1988/12/23 04:32:55 cph Exp $ Copyright (c) 1988 Massachusetts Institute of Technology @@ -46,7 +46,7 @@ MIT in each case. */ #define VERSION 10 #endif #ifndef SUBVERSION -#define SUBVERSION 64 +#define SUBVERSION 65 #endif #ifndef UCODE_TABLES_FILENAME