Fix definition of `stack-top-address' to make it consistent with
authorChris Hanson <org/chris-hanson/cph>
Fri, 23 Dec 1988 04:32:55 +0000 (04:32 +0000)
committerChris Hanson <org/chris-hanson/cph>
Fri, 23 Dec 1988 04:32:55 +0000 (04:32 +0000)
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.

v7/src/microcode/comutl.c
v7/src/microcode/version.h
v8/src/microcode/version.h

index 38f44a9d16967645712f3b080ab554f1da5f58d6..f412f32b009ed25fb6b2e708d7b26af80d2b9ca2 100644 (file)
@@ -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;
index 8fda51b26045b8807a0fbc7df758046ed08ffc02..ad93941f5e5e3bed825e9296e75e85b145b6e130 100644 (file)
@@ -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
index e6a37e2ea7dcd0da7cf4b7681d038fa23e7a32f2..97559ed980e813cfe9930187b9812858a6b6714f 100644 (file)
@@ -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