Hi,

What would it take to build Factor for the MacOS M1 (arm64) systems?

I do see in the code that there is some stuff for Linux ARM, which I think
is actually complete (I'll try to build it on a Raspberry Pi tomorrow).
There is also some stuff in build.sh for Apple iPhone/IPad hardware with
arm64 processor, but as far as I can see this is not complete.

What is the state of Factor on arm?  Was arm64 ever attempted?

I guess to get it built requires some blend of the Darwin work and the arm
stuff.

I did some basic tinkering in the build side and got a little bit along.
Well I got as far as errors...

In file included from vm/master.hpp:116:

vm/code_blocks.hpp:74:33: error: no member named 'flush_icache' in
namespace 'factor'

  void flush_icache() { factor::flush_icache((cell)this, size()); }

                        ~~~~~~~~^
And etc.  Well that's no surprise.  Is there any insight or porting guide
as to what Factor needs to run in a new environment like this?

Thanks,
Steve

---------------------

diff --git a/GNUmakefile b/GNUmakefile
index babefb19e9..2012f20bf8 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -188,6 +188,10 @@ macosx-x86-64:
 macosx-x86-fat:
        $(MAKE) $(ALL) macosx.app CONFIG=vm/Config.macosx.x86.fat

+macosx-arm64-64:
+       $(MAKE) $(ALL) macosx.app CONFIG=vm/Config.macosx.arm64.64
+
 linux-x86-32:
        $(MAKE) $(ALL) CONFIG=vm/Config.linux.x86.32

diff --git a/build.sh b/build.sh
index 490c9ac02a..9b32d4d87d 100755
--- a/build.sh
+++ b/build.sh
@@ -299,6 +299,7 @@ find_architecture() {
        i86pc) ARCH=x86;;
        amd64) ARCH=x86;;
        ppc64) ARCH=ppc;;
+       arm64) ARCH=arm64;;
        *86) ARCH=x86;;
        *86_64) ARCH=x86;;
        aarch64) ARCH=arm64;;
diff --git a/vm/master.hpp b/vm/master.hpp
index bac9e5f7ed..86edfaa628 100644
--- a/vm/master.hpp
+++ b/vm/master.hpp
@@ -64,6 +64,9 @@
 // Detect target CPU type
 #if defined(__arm__)
 #define FACTOR_ARM
+#elif defined(__arm64__)
+#define FACTOR_ARM
+#define FACTOR_64
 #elif defined(__amd64__) || defined(__x86_64__) || defined(_M_AMD64)
 #define FACTOR_AMD64
 #define FACTOR_64
diff --git a/vm/platform.hpp b/vm/platform.hpp
index c72b7b6334..8c4b39012a 100644
--- a/vm/platform.hpp
+++ b/vm/platform.hpp
@@ -22,6 +22,8 @@
       #include "os-macosx-x86.32.hpp"
     #elif defined(FACTOR_AMD64)
       #include "os-macosx-x86.64.hpp"
+    #elif defined(FACTOR_ARM)
+      #include "os-macosx-arm64-64.hpp"
     #else
       #error "Unsupported Mac OS X flavor"
     #endif

I also made a vm/os-macosx-arm64-64.hpp but of course I'm now already out
of my depth since I have no understanding of the Factor implementation.
_______________________________________________
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk

Reply via email to