attila-lendvai / maru

Maru - a tiny self-hosting lisp dialect
http://piumarta.com/software/maru/
Other
189 stars 10 forks source link

maru.9 eval0 built but fail to generate eval1 (MacOS X - llvm) #2

Open TheFausap opened 3 years ago

TheFausap commented 3 years ago

Hello,

I did some changes in my forked repo, in order to compile up to maru.8 everything under Mac OS X BigSur. Maru.9 compile eval.l in eval0 using the maru.8 binaries, but when it starts compiling again to generate eval1 I got this error:

time build/llvm-libc/x86_64-apple-darwin/eval0  -O -v --define *host-directory*"/Users/fausap/MyDocuments/maru/build/eval0/build/maru.9" --define *slave-directory*     "/Users/fausap/MyDocuments/maru/build/eval0/build/maru.9" source/bootstrapping/prepare.l boot.l /Users/fausap/MyDocuments/maru/build/eval0/build/maru.9/source/bootstrapping/host-ready.l source/bootstrapping/early.l --define feature/profiler        0 boot.l source/bootstrapping/late.l --define target/cpu            x86_64 --define target/vendor           apple --define target/os            darwin source/emit-early.l source/emit-llvm.l source/emit-late.l source/platforms/libc/eval.l source/emit-finish.l >build/llvm-libc/64bit-le/eval1.ll || { touch -t 200012312359 build/llvm-libc/64bit-le/eval1.ll; exit 42; }
loading file: source/bootstrapping/prepare.l    (as a CLA)
changing working directory to: /Users/fausap/MyDocuments/maru/build/eval0/build/maru.9
loading file: boot.l    (as a CLA)
loading file: source/list-min.l
loading file: source/control-structures.l
loading file: source/list-basic.l
loading file: source/destructuring.l
loading file: source/iteration-min.l
loading file: source/sequences-basic.l
loading file: source/types.l

ERROR: 
selector '$peek has no method for type 0
ABORTED
  0: require.0+122
    callee: Expr<require (path.2+0)>
    arg 0:  [instof:0]
  1: apply
    callee: Expr<require (path.2+0)>
    arg 0:  [instof:0]
  2: Fixed<.let>
    callee: Fixed<.let>
    arg 0:  Env< Lv2,Off2,#1
    arg 1:  ((list.2+1 *load-history*.0+120))
    arg 2:  (Fixed<.while> (Fixed<.and> list.2+1 (not.0+55 (=.0+41 path.2+0 (car.0+100 list.2+1)))) (Fixed<.set> list.2+1 (cdr.0+99 list.2+1)))
    arg 3:  (Fixed<.if> (not.0+55 list.2+1) (load.0+67 path.2+0))
  3: apply
    callee: .let
    arg 0:  Env< Lv2,Off2,#1
    arg 1:  ((list.2+1 *load-history*.0+120))
    arg 2:  (Fixed<.while> (Fixed<.and> list.2+1 (not.0+55 (=.0+41 path.2+0 (car.0+100 list.2+1)))) (Fixed<.set> list.2+1 (cdr.0+99 list.2+1)))
    arg 3:  (Fixed<.if> (not.0+55 list.2+1) (load.0+67 path.2+0))
  4: Fixed<.if>
    callee: Fixed<.if>
    arg 0:  (not.0+55 list.2+1)
    arg 1:  (load.0+67 path.2+0)
  5: apply
    callee: .if
    arg 0:  (not.0+55 list.2+1)
    arg 1:  (load.0+67 path.2+0)
  6: load.0+67
    callee: Expr<? (path.2+0)>
    arg 0:  [instof:0]
  7: apply
    callee: Expr<? (path.2+0)>
    arg 0:  [instof:0]
  8: primitive/load.0+121
    callee: .load
    arg 0:  [instof:0]
  9: apply
    callee: .load
    arg 0:  [instof:0]

real    0m0.014s
user    0m0.011s
sys 0m0.002s
make[3]: *** [build/llvm-libc/64bit-le/eval1.ll] Error 42
make[2]: *** [build/maru.9/eval] Error 2
make[1]: *** [/Users/fausap/MyDocuments/maru/build/eval0/eval0-llvm] Error 2
make: *** [build/llvm-libc/64bit-le/eval1.ll] Error 2

Any idea where can I look to fix this?

thanks, Fausto

attila-lendvai commented 3 years ago

it would be nice if i could reproduce this, but last time i was running macos in a VM under linux it was a lot of pain (mouse is sometimes offset, i can't move it where i want to, stuff like that). i welcome any recommendations about this if you have experience.

last time i tried i was using debian stable. now i'm on guix, which probably has much newer qemu stuff.

ideas:

TheFausap commented 3 years ago

it would be nice if i could reproduce this, but last time i was running macos in a VM under linux it was a lot of pain (mouse is sometimes offset, i can't move it where i want to, stuff like that). i welcome any recommendations about this if you have experience.

Before getting a MacBook, I installed BigSur with this guide https://osxdaily.com/2021/07/15/how-install-macos-virtualbox-windows/ and it was quite ok. I don't know if you already tried that, maybe it's worth a shot.

last time i tried i was using debian stable. now i'm on guix, which probably has much newer qemu stuff.

ideas:

  • arg 0 is [instof:0], which suggests heap corruption. i think there shouldn't be any objects under type id 1: (define %first-type-id 1).

  • try to compile stuff with (define *safety* 3), see boot.l. it will be much slower, but there will be much more asserts that hopefully catches something earlier.

  • with-input-from-file may return with the wrong object, and $peek is called on it

  • primitive/load is what's defined in vm-with-file-support.l in (define-primitive-function (load ()) ((path <string>)) ...)

  • the libc, stdin, etc related stuff may be involved

  • maybe loading types.l screws up something, but that is a can of worms. i'd go there last. I'll try all of them and I'll let you know.

  • try it on linux? maybe it's reproducible there with some of your changes included? I tried on ubuntu 64bit, cloning from your repo, without any change applied. CLANG v.10 installed.

I tried LLVM with target CPU x86_64, but I get a different error always in eval0 built from maru.9

root@ubuntu-6b467d8587-7dc8t:/data/maru# make TARGET-CPU=x86_64 test-bootstrap-llvm
test -e /data/maru/build/eval0/eval0-llvm || make /data/maru/build/eval0/eval0-llvm
make[1]: Entering directory '/data/maru'
make --directory=/data/maru/build/eval0         \
        TARGET_CPU=i686                         \
        TARGET_VENDOR=linux             \
        TARGET_OS=gnu                   \
        PLATFORM=linux                          \
        eval0-llvm
make[2]: Entering directory '/data/maru/build/eval0'
time --format='\nuser time: %U\n' build/maru.9/eval -v
\
        --define *host-directory*       "build/maru.9"                  \
        --define *slave-directory*      "/data/maru/build/eval0"                                                                                             \
        --define *compiler-backend*     "llvm"                          \
        --define target/cpu             i686            \
        --define target/vendor          linux           \
        source/bootstrapping/prepare.l                                  \
        boot.l                                                          \
        /data/maru/build/eval0/source/bootstrapping/host-ready.l                                                                                             \
        source/bootstrapping/host-extras.l                              \
        source/bootstrapping/early.l                                    \
        --define feature/profiler       0                       \
        boot.l                                                          \
        source/bootstrapping/slave-extras.l                             \
        source/bootstrapping/late.l                                     \
        source/platforms/linux/eval.l                           \
        source/emit-finish.l                                            \
                >build/llvm-linux/32bit-le/eval0.ll || { touch -t 200012312359 build/llvm-linux/32bit-le/eval0.ll; exit 42; }
loading file: source/bootstrapping/prepare.l    (as a CLA)
changing working directory to: build/maru.9
loading file: boot.l    (as a CLA)
loading file: source/list-min.l
loading file: source/control-structures.l
loading file: source/list-basic.l
loading file: source/destructuring.l
loading file: source/iteration-min.l
loading file: source/sequences-basic.l
loading file: source/types.l
loading file: source/selector.l
loading file: source/printing.l
loading file: source/generic.l
loading file: /data/maru/build/eval0/source/bootstrapping/host-ready.l  (as a CLA)
changing working directory to: /data/maru/build/eval0
loading file: source/bootstrapping/host-extras.l        (as a CLA)
loading file: source/bootstrapping/early.l      (as a CLA)
loading file: boot.l    (as a CLA)
boot.l speaking with *verbosity* 1; we're bootstrapping; we're evolving
loading file: source/list-min.l
loading file: source/control-structures.l
loading file: source/list-basic.l
loading file: source/destructuring.l
loading file: source/iteration-min.l
loading file: source/sequences-basic.l
loading file: source/types.l
loading file: source/selector.l
loading file: source/printing.l
loading file: source/generic.l
loading file: source/bootstrapping/slave-extras.l       (as a CLA)
loading file: source/bootstrapping/late.l       (as a CLA)
loading file: source/platforms/linux/eval.l     (as a CLA)
loading file: source/emit-llvm.l
loading file: source/emit-early.l
loading file: source/conversion.l

ERROR:
encode/symbol: failed for target/os, current module Module<maru-user,Env<maru-user Lv0,Off424,#424>, env Env< Lv1,Off3,#2
ABORTED
  0: load.0+67
        callee: Expr<? (path.2+0)>
        arg 0:  source/emit-llvm.l
  1: apply
        callee: Expr<? (path.2+0)>
        arg 0:  source/emit-llvm.l
  2: primitive/load.0+124
        callee: .load
        arg 0:  source/emit-llvm.l
  3: apply
        callee: .load
        arg 0:  source/emit-llvm.l
  4: require.0+125
        callee: Expr<require (path.2+0)>
        arg 0:  source/emit-early.l
  5: apply
        callee: Expr<require (path.2+0)>
        arg 0:  source/emit-early.l
  6: Fixed<.let>
        callee: Fixed<.let>
        arg 0:  Env< Lv2,Off2,#1
        arg 1:  ((list.2+1 *load-history*.0+123))
        arg 2:  (Fixed<.while> (Fixed<.and> list.2+1 (not.0+55 (=.0+41 path.2+0 (car.0+100 list.2+1)))) (Fixed<.set> list.2+1 (cdr.0+99 list.2+1)))
        arg 3:  (Fixed<.if> (not.0+55 list.2+1) (load.0+67 path.2+0))
  7: apply
        callee: .let
        arg 0:  Env< Lv2,Off2,#1
        arg 1:  ((list.2+1 *load-history*.0+123))
        arg 2:  (Fixed<.while> (Fixed<.and> list.2+1 (not.0+55 (=.0+41 path.2+0 (car.0+100 list.2+1)))) (Fixed<.set> list.2+1 (cdr.0+99 list.2+1)))
        arg 3:  (Fixed<.if> (not.0+55 list.2+1) (load.0+67 path.2+0))
  8: Fixed<.if>
        callee: Fixed<.if>
        arg 0:  (not.0+55 list.2+1)
        arg 1:  (load.0+67 path.2+0)
  9: apply
        callee: .if
        arg 0:  (not.0+55 list.2+1)
        arg 1:  (load.0+67 path.2+0)
 10: load.0+67
        callee: Expr<? (path.2+0)>
        arg 0:  source/emit-early.l
 11: apply
        callee: Expr<? (path.2+0)>
        arg 0:  source/emit-early.l
 12: primitive/load.0+124
        callee: .load
        arg 0:  source/emit-early.l
 13: apply
        callee: .load
        arg 0:  source/emit-early.l
 14: encode
        expr: (let ((arch ()) (word-size ())) (let ((__value__ target/cpu)) (if (or (= __value__ x86_64)) (let () (set arch (quote x86-64)) (set word-size 64)
) (if (or (= __value__ i686) (= __value__ i386)) (let () (set arch (quote IA-32)) (set word-size 32)) (error Couldn't identify architecture and word size from
 target/cpu:  target/cpu)))) (eval-in-slave (cons (quote let) (cons (quote ()) (cons (cons (quote define-constant) (cons (quote +architecture+) (cons (cons (q
uote quote) (cons (cons (quote quote) (cons arch (quote ()))) (quote ()))) (quote ())))) (cons (cons (quote define-constant) (cons (quote +operating-system+) 
(cons (cons (quote quote) (cons (cons (quote quote) (cons (string->symbol target/os) (quote ()))) (quote ()))) (quote ())))) (cons (cons (quote define-constan
t) (cons (quote +little-endian?+) (cons (quote true) (quote ())))) (cons (cons (quote define-constant) (cons (quote +word-size-in-bits+) (cons word-size (quot
e ())))) (cons (cons (quote define-constant) (cons (quote +word-size-in-bytes+) (cons (/ word-size 8) (quote ())))) (quote ()))))))))))
 15: encode
        expr: (eval-in-slave (cons (quote let) (cons (quote ()) (cons (cons (quote define-constant) (cons (quote +architecture+) (cons (cons (quote quote) (co
ns (cons (quote quote) (cons arch (quote ()))) (quote ()))) (quote ())))) (cons (cons (quote define-constant) (cons (quote +operating-system+) (cons (cons (qu
ote quote) (cons (cons (quote quote) (cons (string->symbol target/os) (quote ()))) (quote ()))) (quote ())))) (cons (cons (quote define-constant) (cons (quote
 +little-endian?+) (cons (quote true) (quote ())))) (cons (cons (quote define-constant) (cons (quote +word-size-in-bits+) (cons word-size (quote ())))) (cons 
(cons (quote define-constant) (cons (quote +word-size-in-bytes+) (cons (/ word-size 8) (quote ())))) (quote ())))))))))
 16: encode
        expr: (cons (quote let) (cons (quote ()) (cons (cons (quote define-constant) (cons (quote +architecture+) (cons (cons (quote quote) (cons (cons (quote
 quote) (cons arch (quote ()))) (quote ()))) (quote ())))) (cons (cons (quote define-constant) (cons (quote +operating-system+) (cons (cons (quote quote) (con
s (cons (quote quote) (cons (string->symbol target/os) (quote ()))) (quote ()))) (quote ())))) (cons (cons (quote define-constant) (cons (quote +little-endian
?+) (cons (quote true) (quote ())))) (cons (cons (quote define-constant) (cons (quote +word-size-in-bits+) (cons word-size (quote ())))) (cons (cons (quote de
fine-constant) (cons (quote +word-size-in-bytes+) (cons (/ word-size 8) (quote ())))) (quote ()))))))))
 17: encode
        expr: (cons (quote ()) (cons (cons (quote define-constant) (cons (quote +architecture+) (cons (cons (quote quote) (cons (cons (quote quote) (cons arch
 (quote ()))) (quote ()))) (quote ())))) (cons (cons (quote define-constant) (cons (quote +operating-system+) (cons (cons (quote quote) (cons (cons (quote quo
te) (cons (string->symbol target/os) (quote ()))) (quote ()))) (quote ())))) (cons (cons (quote define-constant) (cons (quote +little-endian?+) (cons (quote t
rue) (quote ())))) (cons (cons (quote define-constant) (cons (quote +word-size-in-bits+) (cons word-size (quote ())))) (cons (cons (quote define-constant) (co
ns (quote +word-size-in-bytes+) (cons (/ word-size 8) (quote ())))) (quote ())))))))
 18: encode
        expr: (cons (cons (quote define-constant) (cons (quote +architecture+) (cons (cons (quote quote) (cons (cons (quote quote) (cons arch (quote ()))) (qu
ote ()))) (quote ())))) (cons (cons (quote define-constant) (cons (quote +operating-system+) (cons (cons (quote quote) (cons (cons (quote quote) (cons (string
->symbol target/os) (quote ()))) (quote ()))) (quote ())))) (cons (cons (quote define-constant) (cons (quote +little-endian?+) (cons (quote true) (quote ())))
) (cons (cons (quote define-constant) (cons (quote +word-size-in-bits+) (cons word-size (quote ())))) (cons (cons (quote define-constant) (cons (quote +word-s
ize-in-bytes+) (cons (/ word-size 8) (quote ())))) (quote ()))))))
 19: encode
        expr: (cons (cons (quote define-constant) (cons (quote +operating-system+) (cons (cons (quote quote) (cons (cons (quote quote) (cons (string->symbol t
arget/os) (quote ()))) (quote ()))) (quote ())))) (cons (cons (quote define-constant) (cons (quote +little-endian?+) (cons (quote true) (quote ())))) (cons (c
ons (quote define-constant) (cons (quote +word-size-in-bits+) (cons word-size (quote ())))) (cons (cons (quote define-constant) (cons (quote +word-size-in-byt
es+) (cons (/ word-size 8) (quote ())))) (quote ())))))
 20: encode
        expr: (cons (quote define-constant) (cons (quote +operating-system+) (cons (cons (quote quote) (cons (cons (quote quote) (cons (string->symbol target/
os) (quote ()))) (quote ()))) (quote ()))))
 21: encode
        expr: (cons (quote +operating-system+) (cons (cons (quote quote) (cons (cons (quote quote) (cons (string->symbol target/os) (quote ()))) (quote ()))) 
(quote ())))
 22: encode
        expr: (cons (cons (quote quote) (cons (cons (quote quote) (cons (string->symbol target/os) (quote ()))) (quote ()))) (quote ()))
 23: encode
        expr: (cons (quote quote) (cons (cons (quote quote) (cons (string->symbol target/os) (quote ()))) (quote ())))
 24: encode
        expr: (cons (cons (quote quote) (cons (string->symbol target/os) (quote ()))) (quote ()))
 25: encode
        expr: (cons (quote quote) (cons (string->symbol target/os) (quote ())))
 26: encode
        expr: (cons (string->symbol target/os) (quote ()))
 27: encode
        expr: (string->symbol target/os)
 28: encode
        expr: target/os
Command exited with non-zero status 255

user time: 0.07

make[2]: *** [Makefile:299: build/llvm-linux/32bit-le/eval0.ll] Error 42
make[2]: Leaving directory '/data/maru/build/eval0'
make[1]: *** [Makefile:258: /data/maru/build/eval0/eval0-llvm] Error 2
make[1]: Leaving directory '/data/maru'
make: *** [Makefile:333: build/llvm-libc/64bit-le/eval1.ll] Error 2
attila-lendvai commented 3 years ago

@TheFausap it's not the same problem: target/os is not defined. i don't know why i didn't encounter this, but a --define target/os seems to be missing from the eval0.ll path in the makefile, and i can't see any reason for that. it's probably a bug.

TheFausap commented 3 years ago

@TheFausap it's not the same problem: target/os is not defined. i don't know why i didn't encounter this, but a --define target/os seems to be missing from the eval0.ll path in the makefile (EDIT: in maru.10, i.e. not relevant here?), and i can't see any reason for that. it's probably a bug.

Yes, I noticed that sorry. Up to maru.8 everything is ok, however.

attila-lendvai commented 3 years ago

Up to maru.8 everything is ok, however.

do you mean maru.8 is working fine on macos with the llvm backend?

that would be somewhat surprising, because it seems to be doing pretty much the same as maru.10:

(define-form define-libc-ffi ()
  '(let ()
    (define-C-variable libc/stdin  stdin  (* "%struct._IO_FILE"))
TheFausap commented 3 years ago

Up to maru.8 everything is ok, however.

do you mean maru.8 is working fine on macos with the llvm backend?

yes maru.8 is working. It uses the code from maru.7 that do not need any change in the struct, because maru.7 do not uses the opaque struct for stin, stdout and stderr. Maru.8 code itself need both changes, in the descriptor names and in the struct, but at the end it compiles itself without any problem.

In maru.9, if I understood correcly, there's the platform idea not present in maru.8, so maybe this breaks some compatibility.

that would be somewhat surprising, because it seems to be doing pretty much the same as maru.10:

(define-form define-libc-ffi ()
  '(let ()
    (define-C-variable libc/stdin  stdin  (* "%struct._IO_FILE"))
TheFausap commented 3 years ago

I have also to add that the idea to build the eval0 32bit version under darwin is deprecated now. I suppose in the very near future all the 32bit support will be totally removed by xcode. So it should be better for MacOS using directly the 64bit version.

In maru.9 Makefile the eval0 i686 is commented out, but it's back in maru.10 Makefile, why? I suppose in this case an ifeq HOST_OS darwin could fix this problem, what do you think?

---- MARU.10

# "forward" this target to the makefile in build/eval0
# NOTE: we fix TARGET_CPU to i686 (and platform to linux) because 32 bit LLVM is the fastest version of us.
$(EVAL0_DIR)/$(EVAL0_BINARY): $(EVAL0_DIR)
        $(MAKE) --directory=$(EVAL0_DIR)                \
                TARGET_CPU=i686                         \
                TARGET_VENDOR=$(TARGET_VENDOR)          \
                TARGET_OS=$(TARGET_OS)                  \
                PLATFORM=linux                          \
                $(EVAL0_BINARY)

---- MARU.9


# "forward" this target to the makefile in build/eval0
# NOTE using TARGET_CPU=i686 would be faster, but i have trouble linking
# -m32 executables on my nixos to test this properly.
$(EVAL0_DIR)/$(EVAL0_BINARY): $(EVAL0_DIR)
        $(MAKE) --directory=$(EVAL0_DIR)                \
                TARGET_CPU=$(TARGET_CPU)                \
                TARGET_VENDOR=$(TARGET_VENDOR)          \
                TARGET_OS=$(TARGET_OS)                  \
                PLATFORM=$(PLATFORM)                    \
                $(EVAL0_BINARY)

# "forward" this target to the makefile, because this is typically used as EVAL0
# $(EVAL0_DIR)/$(BUILD)/llvm-$(PLATFORM)/i686-$(TARGET_VENDOR)-$(TARGET_OS)/eval0: $(EVAL0_DIR)
# # NOTE linux platform on llvm is broken currently, so we fix the platform to libc
#       $(MAKE) --directory=$(EVAL0_DIR)                \
#               TARGET_CPU=i686                         \
#               TARGET_VENDOR=$(TARGET_VENDOR)          \
#               TARGET_OS=$(TARGET_OS)                  \
#               PLATFORM=libc                           \
#               $(BUILD)/llvm-libc/i686-$(TARGET_VENDOR)-$(TARGET_OS)/eval0
TheFausap commented 3 years ago

I cleaned up a little bit all the old build directories, and relaunched the make test-bootstrap-llvm and now the error is different. The biggest difference at the moment, using MacOS is the eval0 in my case (for maru.10) is built in 64bit form, instead under linux eval0, as I said before, is built in 32bit form.

time build/llvm-libc/x86_64-apple-darwin/eval0  -O -v --define *host-directory*"/Users/fausap/MyDocuments/maru/build/eval0/build/maru.9" --define *slave-directory*     "/Users/fausap/MyDocuments/maru/build/eval0/build/maru.9" source/bootstrapping/prepare.l boot.l /Users/fausap/MyDocuments/maru/build/eval0/build/maru.9/source/bootstrapping/host-ready.l source/bootstrapping/early.l --define feature/profiler        0 boot.l source/bootstrapping/late.l --define target/cpu            x86_64 --define target/vendor           apple --define target/os            darwin source/emit-early.l source/emit-llvm.l source/emit-late.l source/platforms/libc/eval.l source/emit-finish.l >build/llvm-libc/64bit-le/eval1.ll || { touch -t 200012312359 build/llvm-libc/64bit-le/eval1.ll; exit 42; }
loading file: source/bootstrapping/prepare.l    (as a CLA)
changing working directory to: /Users/fausap/MyDocuments/maru/build/eval0/build/maru.9
loading file: boot.l    (as a CLA)
loading file: source/list-min.l
loading file: source/control-structures.l
loading file: source/list-basic.l
loading file: source/destructuring.l
loading file: source/iteration-min.l
loading file: source/sequences-basic.l
loading file: source/types.l
loading file: source/selector.l
loading file: source/printing.l

ERROR: 
environment: arg 'parent' is not of type <env>
ABORTED
  0: require.0+122
    callee: Expr<require (path.2+0)>
    arg 0:  source/printing.l
  1: apply
    callee: Expr<require (path.2+0)>
    arg 0:  source/printing.l
  2: Fixed<.let>
    callee: Fixed<.let>
    arg 0:  Env< Lv2,Off2,#1
    arg 1:  ((list.2+1 *load-history*.0+120))
    arg 2:  (Fixed<.while> (Fixed<.and> list.2+1 (not.0+55 (=.0+41 path.2+0 (car.0+100 list.2+1)))) (Fixed<.set> list.2+1 (cdr.0+99 list.2+1)))
    arg 3:  (Fixed<.if> (not.0+55 list.2+1) (load.0+67 path.2+0))
  3: apply
    callee: .let
    arg 0:  Env< Lv2,Off2,#1
    arg 1:  ((list.2+1 *load-history*.0+120))
    arg 2:  (Fixed<.while> (Fixed<.and> list.2+1 (not.0+55 (=.0+41 path.2+0 (car.0+100 list.2+1)))) (Fixed<.set> list.2+1 (cdr.0+99 list.2+1)))
    arg 3:  (Fixed<.if> (not.0+55 list.2+1) (load.0+67 path.2+0))
  4: Fixed<.if>
    callee: Fixed<.if>
    arg 0:  (not.0+55 list.2+1)
    arg 1:  (load.0+67 path.2+0)
  5: apply
    callee: .if
    arg 0:  (not.0+55 list.2+1)
    arg 1:  (load.0+67 path.2+0)
  6: load.0+67
    callee: Expr<? (path.2+0)>
    arg 0:  source/printing.l
  7: apply
    callee: Expr<? (path.2+0)>
    arg 0:  source/printing.l
  8: primitive/load.0+121
    callee: .load
    arg 0:  source/printing.l
  9: apply
    callee: .load
    arg 0:  source/printing.l
 10: Fixed<.let>
    callee: Fixed<.let>
    arg 0:  [instof:0]
    arg 1:  ()
    arg 2:  [instof:0]
 11: apply
    callee: .let
    arg 0:  [instof:0]
    arg 1:  ()
    arg 2:  [instof:0]
 12: Fixed<.let>
    callee: Fixed<.let>
    arg 0:  [instof:0]
    arg 1:  ()
    arg 2:  [instof:0]
    arg 3:  [instof:0]
    arg 4:  [instof:0]
    arg 5:  [instof:0]
    arg 6:  [instof:0]
    arg 7:  [instof:0]
    arg 8:  [instof:0]
 13: apply
    callee: .let
    arg 0:  [instof:0]
    arg 1:  ()
    arg 2:  [instof:0]
    arg 3:  [instof:0]
    arg 4:  [instof:0]
    arg 5:  [instof:0]
    arg 6:  [instof:0]
    arg 7:  [instof:0]
    arg 8:  [instof:0]
 14: add-method.0+346
    callee: [instof:21]
    arg 0:  [instof:21]
    arg 1:  [instof:3]
    arg 2:  [instof:0]
    arg 3:  [instof:0]
 15: apply
    callee: [instof:21]
    arg 0:  [instof:21]
    arg 1:  [instof:3]
    arg 2:  [instof:0]
    arg 3:  [instof:0]
 16: apply
    callee: Expr<? (self.2+0 . arguments.2+1)>
    arg 0:  [instof:21]
    arg 1:  [instof:21]
    arg 2:  [instof:3]
    arg 3:  [instof:0]
    arg 4:  [instof:0]
 17: apply.0+77
    callee: .apply
    arg 0:  Expr<<selector>.add-method (self.2+0 type.2+1 args.2+2 body.2+3)>
    arg 1:  [instof:0]
 18: apply
    callee: .apply
    arg 0:  Expr<<selector>.add-method (self.2+0 type.2+1 args.2+2 body.2+3)>
    arg 1:  [instof:0]
 19: apply
    callee: Expr<<selector>.add-method (self.2+0 type.2+1 args.2+2 body.2+3)>
    arg 0:  [instof:21]
    arg 1:  [instof:3]
    arg 2:  [instof:0]
    arg 3:  [instof:0]
 20: <selector>-add-method.0+344
    callee: Expr<<selector>-add-method (self.2+0 type.2+1 method.2+2)>
    arg 0:  self.2+0
    arg 1:  type.2+1
    arg 2:  (eval.0+65 (cons.0+96 (Fixed<.quote> lambda) (cons.0+96 args.2+2 (cons.0+96 (cons.0+96 (Fixed<.quote> with-instance-accessors) (cons.0+96 (Fixed<.quote> self) (cons.0+96 type.2+1 body.2+3))) (Fixed<.quote> ())))))
 21: eval.0+65
    callee: .eval
    arg 0:  [instof:0]
 22: apply
    callee: .eval
    arg 0:  [instof:0]
 23: expand
    expr: [instof:0]
 24: expand
    expr: [instof:0]
 25: expand
    expr: (with-forms () . [instof:0])
 26: apply
    callee: Expr<with-forms (*env*.2+0 bindings.2+1 . body.2+2)>
    arg 0:  [instof:0]
    arg 1:  ()
    arg 2:  [instof:0]
 27: Fixed<.let>
    callee: Fixed<.let>
    arg 0:  Env< Lv2,Off5,#1
    arg 1:  ((env.2+3 (environment.0+90 *env*.2+0)))
    arg 2:  (Fixed<.let> Env< Lv2,Off6,#1 ((_list_.2+4 bindings.2+1)) (Fixed<.while> _list_.2+4 (Fixed<.let> Env< Lv2,Off7,#1 ((binding.2+5 (car.0+100 _list_.2+4))) (Fixed<.let> Env< Lv2,Off8,#1 ((name.2+6 (first.0+136 binding.2+5))) (Fixed<.let> Env< Lv2,Off9,#1 ((fun.2+7 (second.0+137 binding.2+5))) (Fixed<.let> Env< Lv2,Off10,#1 ((var.2+8 (third.0+138 binding.2+5))) (Fixed<.let> Env< Lv2,Off10,#1 ((exp.2+9 (list.0+119 form.0+93 (make-with-form.0+329 fun.2+7) (make-with-form.0+329 var.2+8)))) (environment-define.0+85 env.2+3 name.2+6 (eval.0+65 exp.2+9 *env*.2+0))))))) (Fixed<.set> _list_.2+4 (cdr.0+99 _list_.2+4))))
    arg 3:  (cons.0+96 (Fixed<.quote> let) (cons.0+96 (Fixed<.quote> ()) (map-with.0+215 expand.0+76 body.2+2 env.2+3)))
 28: apply
    callee: .let
    arg 0:  Env< Lv2,Off5,#1
    arg 1:  ((env.2+3 (environment.0+90 *env*.2+0)))
    arg 2:  (Fixed<.let> Env< Lv2,Off6,#1 ((_list_.2+4 bindings.2+1)) (Fixed<.while> _list_.2+4 (Fixed<.let> Env< Lv2,Off7,#1 ((binding.2+5 (car.0+100 _list_.2+4))) (Fixed<.let> Env< Lv2,Off8,#1 ((name.2+6 (first.0+136 binding.2+5))) (Fixed<.let> Env< Lv2,Off9,#1 ((fun.2+7 (second.0+137 binding.2+5))) (Fixed<.let> Env< Lv2,Off10,#1 ((var.2+8 (third.0+138 binding.2+5))) (Fixed<.let> Env< Lv2,Off10,#1 ((exp.2+9 (list.0+119 form.0+93 (make-with-form.0+329 fun.2+7) (make-with-form.0+329 var.2+8)))) (environment-define.0+85 env.2+3 name.2+6 (eval.0+65 exp.2+9 *env*.2+0))))))) (Fixed<.set> _list_.2+4 (cdr.0+99 _list_.2+4))))
    arg 3:  (cons.0+96 (Fixed<.quote> let) (cons.0+96 (Fixed<.quote> ()) (map-with.0+215 expand.0+76 body.2+2 env.2+3)))
 29: environment.0+90
    callee: .environment
    arg 0:  [instof:0]
 30: apply
    callee: .environment
    arg 0:  [instof:0]

real    0m0.035s
user    0m0.032s
sys 0m0.003s
make[3]: *** [build/llvm-libc/64bit-le/eval1.ll] Error 42
make[2]: *** [build/maru.9/eval] Error 2
make[1]: *** [/Users/fausap/MyDocuments/maru/build/eval0/eval0-llvm] Error 2
make: *** [build/llvm-libc/64bit-le/eval1.ll] Error 2
attila-lendvai commented 3 years ago

I have also to add that the idea to build the eval0 32bit version under darwin is deprecated now. I suppose in the very near future all the 32bit support will be totally removed by xcode. So it should be better for MacOS using directly the 64bit version.

In maru.9 Makefile the eval0 i686 is commented out, but it's back in maru.10 Makefile, why? I suppose in this case an ifeq HOST_OS darwin could fix this problem, what do you think?

the fastest version of Maru is 32 bit LLVM, that's the reason i have hardwired eval0 to it.

IIRC, there were some issues at one point, maybe that's why i commented it out.

feel free to conditionalize it on darwin if needed (but add a comment, please).

the entire eval0 thing is really just for convenience: to be able to start benefiting from new features (e.g. a better backtrace) before a new bootstrap stage is opened.

attila-lendvai commented 3 years ago

the other issue i don't understand. somehow this gets called with the wrong type of argument:

(define-primitive-function environment ((parent <env>) ...

although, here's something i have noticed: there seems to be a space missing here: --define *host-directory*"/Users/fausap/My....

please note that in the makefile TABs and spaces have different meaning. and specifically, *host-directory* should have at least one space after it, even if there's a TAB to line it up with the others. even your editor may be too smart and "clean it up".

unfortunately, the errors resulting from such mistakes can often be cryptic. i've been there a few times due to empty Makefile variables...