From 1f42f5b69b145b8625d004a5b76e61aa9c63de2d Mon Sep 17 00:00:00 2001 From: Matt Birkholz Date: Wed, 7 Mar 2012 20:40:02 -0700 Subject: [PATCH] svm: Fix COMPILER_TEMP_SIZE to 2. On x86-64 sizeof(double)/sizeof(SCHEME_OBJECT) is 1, but svm/machine.scm expects it to be 2 (as on i386). --- src/microcode/cmpintmd/svm1.h | 6 ++++-- src/microcode/svm1-interp.c | 4 +--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/microcode/cmpintmd/svm1.h b/src/microcode/cmpintmd/svm1.h index 332e754a2..656980580 100644 --- a/src/microcode/cmpintmd/svm1.h +++ b/src/microcode/cmpintmd/svm1.h @@ -32,8 +32,10 @@ USA. #define ASM_RESET_HOOK initialize_svm1 #define COMPILER_REGBLOCK_N_TEMPS 256 -#define COMPILER_TEMP_SIZE ((sizeof (double)) / (sizeof (SCHEME_OBJECT))) -#define COMPILER_REGBLOCK_N_FIXED REGBLOCK_MINIMUM_LENGTH +#define COMPILER_REGBLOCK_N_FIXED 14 +#define COMPILER_TEMP_SIZE 2 +/* COMPILER_TEMP_SIZE is NOT ((sizeof (double)) / (sizeof (SCHEME_OBJECT))). + It must not vary e.g. from 1 on x86-64 to 2 on i386. */ typedef byte_t insn_t; diff --git a/src/microcode/svm1-interp.c b/src/microcode/svm1-interp.c index 4df83ea41..72a236c8c 100644 --- a/src/microcode/svm1-interp.c +++ b/src/microcode/svm1-interp.c @@ -182,9 +182,7 @@ initialize_svm1 (void) FREG_SET (i, 0.0); WREG_SET (SVM1_REG_INTERPRETER_REGISTER_BLOCK, ((word_t)Registers)); - /* These are hard-coded into compiler/machines/svm/machine.scm. */ - assert (COMPILER_TEMP_SIZE == 2); - assert (COMPILER_REGBLOCK_N_FIXED == 14); + assert (((sizeof (double)) / (sizeof (SCHEME_OBJECT))) <= COMPILER_TEMP_SIZE); } #define IMPORT_REGS() do \ -- 2.25.1