shithub: MicroHs

Download patch

ref: 8805075d742bd3eb434699c4591a5c8dfc340bc3
parent: a29aeb7b470b51a212e225b7fe2d5233533b0269
author: Lennart Augustsson <lennart.augustsson@epicgames.com>
date: Mon Nov 13 15:14:55 EST 2023

Update for windows.ZZ

--- /dev/null
+++ b/Makefile.windows
@@ -1,0 +1,11 @@
+all:    bin/mhs.exe bin/mhseval.exe
+
+# Compile mhs from distribution, with C compiler
+bin/mhs.exe:	src/runtime/eval.c src/runtime/config*.h #generated/mhs.c
+	@-mkdir bin
+	cl /O2 src/runtime/eval.c generated/mhs.c /Febin/mhs.exe
+
+# Compile combinator evaluator
+bin/mhseval.exe:	src/runtime/eval.c src/runtime/config*.h src/runtime/comb.c
+	@-mkdir bin
+	cl /O2 src/runtime/eval.c src/runtime/comb.c /Febin/mhs.exe
--- a/src/runtime/config-windows-64.h
+++ b/src/runtime/config-windows-64.h
@@ -31,8 +31,9 @@
  * 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.
  */
-#pragma warning(disable : 4996)
-#pragma intrinsic(_BitScanForward)
+#include <intrin.h>
+//#pragma warning(disable : 4996)
+#pragma intrinsic(_BitScanForward64)
 static inline int
 FFS(int64_t arg)
 {
@@ -71,7 +72,7 @@
 
     SYSTEMTIME  system_time;
     FILETIME    file_time;
-    uint64_t    time;
+    uint64_t    time, msec;
 
     GetSystemTime( &system_time );
     SystemTimeToFileTime( &system_time, &file_time );
@@ -78,9 +79,9 @@
     time =  ((uint64_t)file_time.dwLowDateTime )      ;
     time += ((uint64_t)file_time.dwHighDateTime) << 32;
 
-    time /= 10000L;
-    time += system_time.wMilliseconds * 1000;
-    return time;
+    msec = (time - EPOCH) / 10000L;
+    msec = time + system_time.wMilliseconds;
+    return msec;
 }
 
 
@@ -87,4 +88,12 @@
 /*
  * The ERR macro should report an error and exit.
  * If not defined, a generic one will be used.
-/* #define ERR(s,a) */
+ */
+/* #define ERR(s) */
+/* #define ERR1(s,a) */
+
+#define GCRED    1              /* do some reductions during GC */
+#define FASTTAGS 1              /* compute tag by pointer subtraction */
+#define INTTABLE 1              /* use fixed table of small INT nodes */
+#define SANITY   1              /* do some sanity checks */
+#define STACKOVL 1              /* check for stack overflow */
--