]> gitweb.factorcode.org Git - factor.git/commitdiff
vm: Make macos almost compile.
authorDoug Coleman <doug.coleman@gmail.com>
Tue, 24 Nov 2020 01:51:40 +0000 (19:51 -0600)
committerDoug Coleman <doug.coleman@gmail.com>
Tue, 24 Nov 2020 01:51:40 +0000 (19:51 -0600)
To fully compile mach_signal.cpp needs a fix.

GNUmakefile
vm/Config.macosx.arm64
vm/bitwise_hacks.hpp
vm/master.hpp
vm/platform.hpp

index a12916cf41db808af90a48d205d860f261bdcfa2..c549b786599d4193c700a3b80906f5b4cc78ce11 100644 (file)
@@ -188,7 +188,7 @@ macosx-x86-64:
 macosx-x86-fat:
        $(MAKE) $(ALL) macosx.app CONFIG=vm/Config.macosx.x86.fat
 
-macosx-arm64-64:
+macosx-arm64:
        $(MAKE) $(ALL) macosx.app CONFIG=vm/Config.macosx.arm64
 
 linux-arm-64:
index 95affb370dbae5a92ddc8b52fe851770e221df48..d5f31f153b55c698245f625a7997e24683895f84 100644 (file)
@@ -2,4 +2,4 @@ include vm/Config.macosx
 include vm/Config.arm64.64
 
 PLAF_DLL_OBJS += vm/cpu-arm.64.cpp
-PLAF_MASTER_HEADERS += vm/os-macosx-arm64.64.hpp
+PLAF_MASTER_HEADERS += vm/os-macosx-arm64.hpp
index 8a7078b3ddccc6415e16de8cab966f20206629b5..5332b8c7b291f48e78da6b79b8b2e66a6e7a7a83 100644 (file)
@@ -8,6 +8,7 @@ inline cell log2(cell x) {
 #else
   asm("bsr %1, %0;" : "=r"(n) : "r"(x));
 #endif
+
 #elif defined(FACTOR_AMD64)
 #if defined(_MSC_VER)
   n = 0;
@@ -15,18 +16,29 @@ inline cell log2(cell x) {
 #else
   asm("bsr %1, %0;" : "=r"(n) : "r"(x));
 #endif
+
+#elif defined(FACTOR_ARM64)
+#if defined(_MSC_VER)
+  n = 0;
+  _BitScanReverse64((unsigned long*)&n, x);
+#else
+  asm("bsr %1, %0;" : "=r"(n) : "r"(x));
+#endif
+
 #elif defined(FACTOR_PPC64)
 #if defined(__GNUC__)
   n = (63 - __builtin_clzll(x));
 #else
 #error Unsupported compiler
 #endif
+
 #elif defined(FACTOR_PPC32)
 #if defined(__GNUC__)
   n = (31 - __builtin_clz(x));
 #else
 #error Unsupported compiler
 #endif
+
 #else
 #error Unsupported CPU
 #endif
index bac9e5f7ed0f05cf5b768dca32633b95f9fec966..dec7c8d677efee5fce0ace7925664794c13b61b7 100644 (file)
@@ -64,6 +64,8 @@
 // Detect target CPU type
 #if defined(__arm__)
 #define FACTOR_ARM
+#elif defined(__aarch64__)
+#define FACTOR_ARM64
 #elif defined(__amd64__) || defined(__x86_64__) || defined(_M_AMD64)
 #define FACTOR_AMD64
 #define FACTOR_64
index c72b7b6334474d1778f3d267d2c1659c209c1758..3f85a07172a259c98aef378d9f80e03268881337 100644 (file)
@@ -22,6 +22,8 @@
       #include "os-macosx-x86.32.hpp"
     #elif defined(FACTOR_AMD64)
       #include "os-macosx-x86.64.hpp"
+    #elif defined(FACTOR_ARM64)
+      #include "os-macosx-arm64.hpp"
     #else
       #error "Unsupported Mac OS X flavor"
     #endif
@@ -67,6 +69,9 @@
   #include "cpu-ppc.hpp"
 #elif defined(FACTOR_ARM)
   #include "cpu-arm.hpp"
+#elif defined(FACTOR_ARM64)
+  #include "cpu-arm.64.hpp"
+  #include "cpu-arm.hpp"
 #else
   #error "Unsupported CPU"
 #endif