shithub: MicroHs

Download patch

ref: 2f2823cdc3b1105e431ab6b99e25251862b6b9eb
parent: 818777d0d4b3ce9d8f1c46b913c44169aa91101f
author: Lennart Augustsson <lennart.augustsson@epicgames.com>
date: Sat Jan 13 07:22:35 EST 2024

More cleanup for minimal compile.

--- a/src/runtime/config-micro-64.h
+++ b/src/runtime/config-micro-64.h
@@ -31,6 +31,11 @@
 #define WANT_TICK 0
 
 /*
+ * Process argc, argv
+ */
+#define WANT_ARGS 0
+
+/*
  * Number of bits in a word.  Only 32 and 64 are supported.
  */
 #define WORD_SIZE 64
@@ -41,7 +46,7 @@
  * It return the number of the least significant bit that is set.
  * Numberings starts from 1.  If no bit is set, it should return 0.
  */
-#define FFS ffsl
+/* #define FFS ffsl */
 
 /*
  * This is the character used for comma-separation in printf.
@@ -71,8 +76,7 @@
 /* #define ERR1(s,a) */
 
 #define GCRED    0              /* do some reductions during GC */
-#define FASTTAGS 1              /* compute tag by pointer subtraction */
-#define INTTABLE 1              /* use fixed table of small INT nodes */
+#define FASTTAGS 0              /* compute tag by pointer subtraction */
+#define INTTABLE 0              /* use fixed table of small INT nodes */
 #define SANITY   0              /* do some sanity checks */
 #define STACKOVL 0              /* check for stack overflow */
-
--- /dev/null
+++ b/src/runtime/eval-micro-64.c
@@ -1,0 +1,6 @@
+/* Copyright 2023 Lennart Augustsson
+ * See LICENSE file for full license.
+ */
+#include "config-micro-64.h"
+
+#include "eval.c"
--- a/src/runtime/eval.c
+++ b/src/runtime/eval.c
@@ -2114,7 +2114,9 @@
   flt_t xd, yd, rd;
 #endif  /* WANT_FLOAT */
   char *msg;
+#if FASTTAGS
   heapoffs_t l;
+#endif
 
 /* Reset stack pointer and return. */
 #define RET do { stack_ptr = stk; return; } while(0)
@@ -2772,8 +2774,10 @@
   char *inname = 0;
   char **av;
   int inrts;
+#if WANT_TICK
   int dump_ticks = 0;
 #endif
+#endif
 #if WANT_STDIO
   char *outname = 0;
   size_t file_size = 0;
@@ -2786,9 +2790,7 @@
 #endif
 
 #ifdef INITIALIZATION
-  main_setup(); // void main_setup(void); will perform extra initialization
-                // that is unique to a specific platform, e.g. initialization
-                // a HAL
+  main_setup(); /* Do platform specific start-up. */
 #endif
 
 #if WANT_ARGS
@@ -2887,9 +2889,15 @@
   execio(&TOP(0));
   prog = TOP(0);
   POP(1);
+#if SANITY
   if (GETTAG(prog) != T_AP || GETTAG(FUN(prog)) != T_IO_RETURN)
     ERR("main execio");
+#endif
+#if WANT_STDIO
   NODEPTR res = evali(ARG(prog));
+#else
+  (void)evali(ARG(prog));
+#endif
   run_time += GETTIMEMILLI();
 #if WANT_STDIO
   if (verbose) {
@@ -2923,7 +2931,7 @@
 #endif
 
 #ifdef TEARDOWN
-  main_teardown(); // do some platform specific teardown
+  main_teardown(); /* do some platform specific teardown */
 #endif
   EXIT(0);
 }
--