ocaml-multicore icon indicating copy to clipboard operation
ocaml-multicore copied to clipboard

Stack overflow with `4.12.0+multicore+flambda`

Open lingmar opened this issue 4 years ago • 0 comments

Hi!

We are bootstrapping our compiler toolchain using OCaml. When we use the OCaml multicore compiler with flambda enabled, we sometimes get a Stack overflow during execution of ocamlopt. We don't get the error when disabling flambda or when using the default (non-multicore) OCaml compiler (with or without flambda).

It might just be that flambda requires a lot of stack memory for its optimizations and that's why we get the error. But I thought it was worth asking here whether there could be an issue in the flambda implementation since we don't get the error in the default OCaml compiler.

Btw, what is the status of flambda in OCaml multicore? Is it still under development? Do you recommend us to use it?

Steps to reproduce the error

Sorry for not having a minimal example. I attach the OCaml code that generates the stack overflow, but it doesn't compile without our tool installed, so it's probably necessary to follow the instructions below. prog.txt

  • Install the 4.12.0+multicore+flambda opam switch:
opam switch create 4.12.0+domains+flambda --packages=ocaml-variants.4.12.0+domains,ocaml-option-flambda --repositories=multicore=git+https://github.com/ocaml-multicore/multicore-opam.git,default
  • Clone our repo:
git clone https://github.com/miking-lang/miking.git
  • Navigate to the develop branch
cd miking && git checkout develop
  • Install prerequisites (on the 4.12.0+multicore+flambda switch)
opam install dune batteries linenoise
  • Bootstrap the compiler
make install
  • To reproduce the error, run
mi compile --test stdlib/ocaml/generate.mc
<long output>
Fatal error: exception Stack overflow

Relevant platform settings

ulimit -s
65532

Operating system: macOS Catalina version 10.15.7

lingmar avatar May 20 '21 16:05 lingmar