Add support for booting the C back end.
authorJason Wilson <edu/mit/csail/zurich/jawilson>
Wed, 9 Jun 1993 20:30:00 +0000 (20:30 +0000)
committerJason Wilson <edu/mit/csail/zurich/jawilson>
Wed, 9 Jun 1993 20:30:00 +0000 (20:30 +0000)
v7/src/microcode/boot.c
v7/src/microcode/const.h
v7/src/microcode/option.c
v7/src/microcode/unxutl/makefile
v8/src/microcode/const.h

index 013158b9b21159158cd3789b095ef4f0ae8dd082..920ebb1884711ed789b0f0ed9a8e6063ea10b83e 100644 (file)
@@ -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 <file-name>) SYSTEM-GLOBAL-ENVIRONMENT),
        (LOAD-BAND <file-name>), or
        ((GET-WORK))
+       (SCODE-EVAL (INITIALIZE-C-COMPILED-BLOCK <file>) GLOBAL-ENV)
      depending on the value of Start_Prim. */
   switch (Start_Prim)
   {
     case BOOT_FASLOAD: /* (SCODE-EVAL (BINARY-FASLOAD <file>) 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 <file>) */
       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 <file>) 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))
index 263d0183b6e2809d90b50b8f785aa94685791290..77e697256b2bab53dce6f291c94a079760c5e81e 100644 (file)
@@ -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
index c64f25bc235c2b4039aeb3ef32a179be446d5409..f6354085f9d281681c35c355e3bb636df13081b6 100644 (file)
@@ -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;
index 15e62f2937740188d3521e97428dac3f7e885c64..73be94fe404bcd289ec98ff38f01992ae764ce49 100644 (file)
@@ -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
index 263d0183b6e2809d90b50b8f785aa94685791290..77e697256b2bab53dce6f291c94a079760c5e81e 100644 (file)
@@ -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