You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This low level stuff isn't really my area (I usually just write Haskell), and I had a bit of trouble with this. In particular:
Trying to properly control the grin cli via its options only caused it to crash with pattern match failures.
No main / entry point is produced.
_prim_int_print is an unknown symbol. I found a note saying it was ad-hoc and would be removed, but it seems that references to it can be produced even when it's not used directly.
For now I've muddled my way to a (perhaps naive) solution:
grinMain =
j <-pure (CInt23)
print j
print i =
(CInt i') <-pure i
_prim_int_print i'
test-add.grin
grinMain =
n1 <-pure (CInt42)
n2 <-pure (CInt10000)
n3 <- add n1 n2
(CInt r) <-pure n3
_prim_int_print r
add m n =
(CInt m') <-pure m
(CInt n') <-pure n
s1 <- _prim_int_add m' n'
s2 <-pure (CInt s1)
pure s2
test-indirect-add.grin
grinMain =
t1 <- store (CInt1)
t2 <- store (CInt10000)
t3 <- store (Fadd t1 t2)
(CInt r') <- eval t3
_prim_int_print r'
add m n =
(CInt m') <- eval m
(CInt n') <- eval n
b' <- _prim_int_add m' n'
pure (CInt b')
eval q =
v <- fetch q
case v of
(CInt x'1) ->pure v
(Fadd a b) -> w <- add a b
update q w
pure w
However it doesn't work for the examples in test-data/dead-data-elimination, and I'm not sure whether the issue originates in the examples themselves (are they currently expected to fail?), in the grin compiler, or in my process. Compiling the pnode source fails with
PipelineStep: JITLLVM
grin: user error (Pattern match failure in do expression at src/Reducer/LLVM/JIT.hs:71:13-38)
which presumably is actually one of the first two options, but more troubling is that the length source does compile, then execution fails with a segmentation fault.
The text was updated successfully, but these errors were encountered:
This code allocates the heap area also.
Currently GRIN does not have a linker compiler phase. For testing we use the GRIN interpreter.
We will add a simple linker phase to GRIN in 1-3 months.
Ok, just got to testing this. It works, and makes sense! Thanks, I didn't think about allocation, or that the smaller examples might be working because they don't need it. I've also taken note of the --eval option (which I guess is what you mean by interpreter); that works too.
This low level stuff isn't really my area (I usually just write Haskell), and I had a bit of trouble with this. In particular:
grin
cli via its options only caused it to crash with pattern match failures.main
/ entry point is produced._prim_int_print
is an unknown symbol. I found a note saying it was ad-hoc and would be removed, but it seems that references to it can be produced even when it's not used directly.For now I've muddled my way to a (perhaps naive) solution:
prim.c
compile
This works for some small grin snippets such as:
test-return.grin
test-print.grin
test-add.grin
test-indirect-add.grin
However it doesn't work for the examples in test-data/dead-data-elimination, and I'm not sure whether the issue originates in the examples themselves (are they currently expected to fail?), in the grin compiler, or in my process. Compiling the pnode source fails with
which presumably is actually one of the first two options, but more troubling is that the length source does compile, then execution fails with a segmentation fault.
The text was updated successfully, but these errors were encountered: