From a7ba6f1f05699302aa6a1e980b3961243dac1674 Mon Sep 17 00:00:00 2001
From: Stephen Adams <edu/mit/csail/zurich/adams>
Date: Wed, 5 Oct 1994 16:49:00 +0000
Subject: [PATCH] Changed macro IMPORT_REGS_AFTER_PRIMITIVE to import the
 History because the primitive may have (indirectly) called C_call_scheme to
 recursively enter the interpreter which will may rotate the History.

---
 v7/src/microcode/interp.h | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)

diff --git a/v7/src/microcode/interp.h b/v7/src/microcode/interp.h
index 0613a42af..2bc808887 100644
--- a/v7/src/microcode/interp.h
+++ b/v7/src/microcode/interp.h
@@ -1,8 +1,8 @@
 /* -*-C-*-
 
-$Id: interp.h,v 9.39 1993/11/08 20:40:10 cph Exp $
+$Id: interp.h,v 9.40 1994/10/05 16:49:00 adams Exp $
 
-Copyright (c) 1987-1993 Massachusetts Institute of Technology
+Copyright (c) 1987-1994 Massachusetts Institute of Technology
 
 This material was developed by the Scheme project at the Massachusetts
 Institute of Technology, Department of Electrical Engineering and
@@ -69,6 +69,16 @@ extern int EXFUN (abort_to_interpreter_argument, (void));
   Ext_Stack_Pointer = Reg_Stack_Pointer;				\
 }
 
+/* Importing History is required for C_call_scheme for work correctly because
+   the recursive call to Interpret() can rotate the history:
+*/
+#define IMPORT_REGS_AFTER_PRIMITIVE()                                   \
+{                                                                       \
+    Reg_History = Ext_History;                                          \
+}
+
+#define EXPORT_REGS_BEFORE_PRIMITIVE Export_Registers
+
 #else
 
 #define Regs		Registers
@@ -78,14 +88,14 @@ extern int EXFUN (abort_to_interpreter_argument, (void));
 #define Import_Registers()
 #define Export_Registers()
 
+#define IMPORT_REGS_AFTER_PRIMITIVE()
+#define EXPORT_REGS_BEFORE_PRIMITIVE()
+
 #endif
 
 #define Import_Val()
 #define Import_Registers_Except_Val()		Import_Registers()
 
-#define IMPORT_REGS_AFTER_PRIMITIVE()
-#define EXPORT_REGS_BEFORE_PRIMITIVE Export_Registers
-
 #define Env		Regs[REGBLOCK_ENV]
 #define Val		Regs[REGBLOCK_VAL]
 #define Expression	Regs[REGBLOCK_EXPR]
-- 
2.25.1