From aff1b1af2d3ac5a321ddc36350bed6781e66671e Mon Sep 17 00:00:00 2001 From: Jason Wilson Date: Wed, 9 Jun 1993 20:30:00 +0000 Subject: [PATCH] Add support for booting the C back end. --- v7/src/microcode/boot.c | 61 ++++++++++++++++++++++---------- v7/src/microcode/const.h | 5 +-- v7/src/microcode/option.c | 6 ++-- v7/src/microcode/unxutl/makefile | 7 ++-- v8/src/microcode/const.h | 5 +-- 5 files changed, 58 insertions(+), 26 deletions(-) diff --git a/v7/src/microcode/boot.c b/v7/src/microcode/boot.c index 013158b9b..920ebb188 100644 --- a/v7/src/microcode/boot.c +++ b/v7/src/microcode/boot.c @@ -1,6 +1,6 @@ /* -*-C-*- -$Id: boot.c,v 9.77 1993/02/23 20:19:14 gjr Exp $ +$Id: boot.c,v 9.78 1993/06/09 20:28:14 jawilson Exp $ Copyright (c) 1988-1993 Massachusetts Institute of Technology @@ -104,6 +104,8 @@ DEFUN (usage, (error_string), CONST char * error_string) #define main_type void #endif +#define FILE_READABLE(filename) ((access ((filename), 4)) >= 0) + main_type DEFUN (main, (argc, argv), int argc AND CONST char ** argv) @@ -157,15 +159,22 @@ DEFUN (main, (argc, argv), Setup_Memory ((BLOCKS_TO_BYTES (Heap_Size)), (BLOCKS_TO_BYTES (Stack_Size)), (BLOCKS_TO_BYTES (Constant_Size))); - if (option_fasl_file) + if (! option_fasl_file) { - compiler_initialize (1); - Start_Scheme (BOOT_FASLOAD, option_fasl_file); + compiler_initialize (0); + Start_Scheme (BOOT_LOAD_BAND, option_band_file); } +#ifdef NATIVE_CODE_IS_C + else if (! (FILE_READABLE (option_fasl_file))) + { + compiler_initialize (1); + Start_Scheme (BOOT_EXECUTE, option_fasl_file); + } +#endif /* NATIVE_CODE_IS_C */ else { - compiler_initialize (0); - Start_Scheme (BOOT_LOAD_BAND, option_band_file); + compiler_initialize (1); + Start_Scheme (BOOT_FASLOAD, option_fasl_file); } } termination_init_error (); @@ -298,7 +307,7 @@ static void DEFUN (Start_Scheme, (Start_Prim, File_Name), int Start_Prim AND CONST char * File_Name) { - SCHEME_OBJECT FName, Init_Prog, *Fasload_Call, prim; + SCHEME_OBJECT FName, expr, * inner_arg, prim; fast long i; /* Parallel processor test */ Boolean I_Am_Master = (Start_Prim != BOOT_GET_WORK); @@ -320,40 +329,56 @@ DEFUN (Start_Scheme, (Start_Prim, File_Name), (SCODE-EVAL (BINARY-FASLOAD ) SYSTEM-GLOBAL-ENVIRONMENT), (LOAD-BAND ), or ((GET-WORK)) + (SCODE-EVAL (INITIALIZE-C-COMPILED-BLOCK ) GLOBAL-ENV) depending on the value of Start_Prim. */ switch (Start_Prim) { case BOOT_FASLOAD: /* (SCODE-EVAL (BINARY-FASLOAD ) GLOBAL-ENV) */ FName = (char_pointer_to_string ((unsigned char *) File_Name)); prim = (make_primitive ("BINARY-FASLOAD")); - Fasload_Call = Free; + inner_arg = Free; *Free++ = prim; *Free++ = FName; prim = (make_primitive ("SCODE-EVAL")); - Init_Prog = MAKE_POINTER_OBJECT (TC_PCOMB2, Free); + expr = (MAKE_POINTER_OBJECT (TC_PCOMB2, Free)); *Free++ = prim; - *Free++ = MAKE_POINTER_OBJECT (TC_PCOMB1, Fasload_Call); - *Free++ = MAKE_OBJECT (GLOBAL_ENV, GO_TO_GLOBAL); + *Free++ = (MAKE_POINTER_OBJECT (TC_PCOMB1, inner_arg)); + *Free++ = (MAKE_OBJECT (GLOBAL_ENV, GO_TO_GLOBAL)); break; case BOOT_LOAD_BAND: /* (LOAD-BAND ) */ FName = (char_pointer_to_string ((unsigned char *) File_Name)); prim = (make_primitive ("LOAD-BAND")); - Fasload_Call = Free; + inner_arg = Free; *Free++ = prim; *Free++ = FName; - Init_Prog = MAKE_POINTER_OBJECT (TC_PCOMB1, Fasload_Call); + expr = (MAKE_POINTER_OBJECT (TC_PCOMB1, inner_arg)); break; case BOOT_GET_WORK: /* ((GET-WORK)) */ prim = (make_primitive ("GET-WORK")); - Fasload_Call = Free; + inner_arg = Free; *Free++ = prim; *Free++ = SHARP_F; - Init_Prog = MAKE_POINTER_OBJECT (TC_COMBINATION, Free); - *Free++ = MAKE_OBJECT (TC_MANIFEST_VECTOR, 1); - *Free++ = MAKE_POINTER_OBJECT (TC_PCOMB1, Fasload_Call); + expr = (MAKE_POINTER_OBJECT (TC_COMBINATION, Free)); + *Free++ = (MAKE_OBJECT (TC_MANIFEST_VECTOR, 1)); + *Free++ = (MAKE_POINTER_OBJECT (TC_PCOMB1, inner_arg)); + break; + + case BOOT_EXECUTE: + /* (SCODE-EVAL (INITIALIZE-C-COMPILED-BLOCK ) GLOBAL-ENV) */ + FName = (char_pointer_to_string ((unsigned char *) File_Name)); + prim = (make_primitive ("INITIALIZE-C-COMPILED-BLOCK")); + inner_arg = Free; + *Free++ = prim; + *Free++ = FName; + prim = (make_primitive ("SCODE-EVAL")); + expr = (MAKE_POINTER_OBJECT (TC_PCOMB2, Free)); + *Free++ = prim; + *Free++ = (MAKE_POINTER_OBJECT (TC_PCOMB1, inner_arg)); + *Free++ = (MAKE_OBJECT (GLOBAL_ENV, GO_TO_GLOBAL)); break; + default: fprintf (stderr, "Unknown boot time option: %d\n", Start_Prim); @@ -375,7 +400,7 @@ DEFUN (Start_Scheme, (Start_Prim, File_Name), Save_Cont (); Pushed (); - Store_Expression (Init_Prog); + Store_Expression (expr); /* Go to it! */ if ((Stack_Pointer <= Stack_Guard) || (Free > MemTop)) diff --git a/v7/src/microcode/const.h b/v7/src/microcode/const.h index 263d0183b..77e697256 100644 --- a/v7/src/microcode/const.h +++ b/v7/src/microcode/const.h @@ -1,8 +1,8 @@ /* -*-C-*- -$Id: const.h,v 9.41 1992/09/11 21:58:14 cph Exp $ +$Id: const.h,v 9.42 1993/06/09 20:28:27 jawilson Exp $ -Copyright (c) 1987-92 Massachusetts Institute of Technology +Copyright (c) 1987-1993 Massachusetts Institute of Technology This material was developed by the Scheme project at the Massachusetts Institute of Technology, Department of Electrical Engineering and @@ -185,3 +185,4 @@ MIT in each case. */ #define BOOT_FASLOAD 0 #define BOOT_LOAD_BAND 1 #define BOOT_GET_WORK 2 +#define BOOT_EXECUTE 3 diff --git a/v7/src/microcode/option.c b/v7/src/microcode/option.c index c64f25bc2..f6354085f 100644 --- a/v7/src/microcode/option.c +++ b/v7/src/microcode/option.c @@ -1,8 +1,8 @@ /* -*-C-*- -$Id: option.c,v 1.31 1993/02/11 02:24:35 adams Exp $ +$Id: option.c,v 1.32 1993/06/09 20:30:00 jawilson Exp $ -Copyright (c) 1990-92 Massachusetts Institute of Technology +Copyright (c) 1990-1993 Massachusetts Institute of Technology This material was developed by the Scheme project at the Massachusetts Institute of Technology, Department of Electrical Engineering and @@ -1127,12 +1127,14 @@ DEFUN (read_command_line_options, (argc, argv), { if (option_raw_band != 0) conflicting_options ("-fasl", "-band"); +#ifndef NATIVE_CODE_IS_C if (! (FILE_READABLE (option_fasl_file))) { fprintf (stderr, "%s: can't read option file: -fasl %s\n", scheme_program_name, option_fasl_file); termination_init_error (); } +#endif /* NATIVE_CODE_IS_C */ option_large_sizes = 1; option_band_specified = 1; option_band_file = 0; diff --git a/v7/src/microcode/unxutl/makefile b/v7/src/microcode/unxutl/makefile index 15e62f293..73be94fe4 100644 --- a/v7/src/microcode/unxutl/makefile +++ b/v7/src/microcode/unxutl/makefile @@ -1,7 +1,7 @@ # # Makefile for MIT CScheme microcode. # -# $Id: makefile,v 1.23 1993/06/09 18:38:44 jawilson Exp $ +# $Id: makefile,v 1.24 1993/06/09 20:29:39 jawilson Exp $ # CPP = cc -E MAKE = make # BSD doesn't have it as a default. @@ -60,7 +60,7 @@ everything: xmakefile # If you have a problem with cc -E here, changing # the definition of CPP above may fix it. -xmakefile: ymakefile ymake.script ymake.local cf.h s.h m.h +xmakefile: ymakefile ymake.script ymake.local ymake.cclist cf.h s.h m.h rm -f xmakefile junk.c cp ymakefile junk.c $(CPP) junk.c | sed -n -f ymake.script > xmakefile @@ -69,6 +69,9 @@ xmakefile: ymakefile ymake.script ymake.local cf.h s.h m.h ymake.local: touch ymake.local +ymake.cclist: + echo "COMPILED_SOURCES =" > ymake.cclist + clean remove: # the - at the beginning of the following line is what causes make to continue # even if the clean.world target doesn't exist diff --git a/v8/src/microcode/const.h b/v8/src/microcode/const.h index 263d0183b..77e697256 100644 --- a/v8/src/microcode/const.h +++ b/v8/src/microcode/const.h @@ -1,8 +1,8 @@ /* -*-C-*- -$Id: const.h,v 9.41 1992/09/11 21:58:14 cph Exp $ +$Id: const.h,v 9.42 1993/06/09 20:28:27 jawilson Exp $ -Copyright (c) 1987-92 Massachusetts Institute of Technology +Copyright (c) 1987-1993 Massachusetts Institute of Technology This material was developed by the Scheme project at the Massachusetts Institute of Technology, Department of Electrical Engineering and @@ -185,3 +185,4 @@ MIT in each case. */ #define BOOT_FASLOAD 0 #define BOOT_LOAD_BAND 1 #define BOOT_GET_WORK 2 +#define BOOT_EXECUTE 3 -- 2.25.1