ocamllabs / ocaml-effects

*DEPRECATED: See ocaml-multicore/ocaml-multicore* OCaml effects handlers
Other
27 stars 4 forks source link

`fundecl.funbody.live` does not capture all of the live registers #8

Open kayceesrk opened 8 years ago

kayceesrk commented 8 years ago

In the native-code backend, at entry to functions a stack overflow check is inserted [0]. If the stack needs to be reallocated, a frame table entry with the live registers at this point is created so that the GC may find them. Surprisingly, fundecl.funbody.live does not seem to capture all of the live registers. Currently, all the function arguments are considered to be live, some of which may be immediate values. If fundecl.funbody.live is used for the frame table entry, camlp4 fails to build with 4.02.2+effects. This behavior needs to be examined closely and a unit test needs to be created. Until then, all the function arguments are considered live. Relevant commits are https://github.com/ocamllabs/ocaml-effects/commit/046de6d80b6f0906351b243b86ada763c2173655, https://github.com/ocamllabs/ocaml-effects/commit/607bc1808fe669de756f563395509596d8199704, https://github.com/ocamllabs/ocaml-effects/commit/7be5024bdf8e22e9525889a673a485f0f31c9223.

[0] https://github.com/ocamllabs/ocaml-effects/blob/4.02.2+effects/asmcomp/amd64/emit.mlp#L931-L938