Open Trolldemorted opened 1 month ago
Perhaps the environment has a stack limit that's too low? On my Ubuntu 22.04 machine the default is 8MB (from ulimit -a
) and having just set it running it's already much further on. That said, from memory you'll need to increase the stack limit for lem
anyway, because there's some inefficiency that's not been important enough for us to track down. Note that the C output is generally much more efficient.
My ulimit -a
says the stack size is 8 MB as well:
root@b056f82bd82a:/input/arm-v9.4-a# ulimit -a
real-time non-blocking time (microseconds, -R) unlimited
core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 102326
max locked memory (kbytes, -l) 82000
max memory size (kbytes, -m) unlimited
open files (-n) 1048576
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) 8192
cpu time (seconds, -t) unlimited
max user processes (-u) unlimited
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited
The nightly docker container is using an older version of OCaml that doesn't have the TRMC (tail recursion modolo cons) optimisation. Maybe that's the issue? You could try switching it to OCaml 5.2.0
I finally got a setup where I could use docker, and increasing the stack to 64kB (a number I just tried at random) works. Looking at the stack trace when it fails with the default stack size, it's in the menhir generated parser during expression parsing. It appears to be a plain tail-call optimisation failure, which is a little bizarre.
I'm sure I've run into this before, and I think it's that recent menhir versions are relying on recent OCaml versions for optimizations.
https://github.com/rems-project/sail/pull/751 I increased the version because there's no reason for it to be on 4.10.0
That gets past parsing without any problems (I'll leave it running to check it actually produces a C model). It's a little unfortunate that we don't know suitable version combinations in general, although from the changelog any OCaml version from 4.14.0 onwards should be OK.
I tried to use the armv8 spec, but unfortunately sail complains:
Steps to reproduce:
docker run --rm -it -v "/path/to/sail-arm\:/input" --entrypoint bash sail
eval `opam env`
cd /input/arm-v9.4-a/
make
Am I doing something wrong?