Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Set up frame pointer correctly prior to tail calling caml_c_call.
This repairs operation when the compiler is built with --enable-frame-pointers and either Effect.Unhandled or Effect.Continuation_already_resumed needs to be raised.
- Loading branch information
1 parent
ccb75bf
commit c04755a
Showing
3 changed files
with
43 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
(* TEST | ||
set OCAMLRUNPARAM = "s32"; | ||
native; | ||
*) | ||
|
||
(* This test verifies that stack frames are correct when raising unhandled | ||
effect exceptions. This used not to be the case on some platforms, | ||
causing assertions when the garbage collector would fire. | ||
By using a very small initial heap (s32), this test guarantees the GC | ||
will get triggered. | ||
Refer to https://github.com/ocaml/ocaml/issues/12486 for more | ||
information. | ||
*) | ||
|
||
open Effect | ||
|
||
type _ t += Yield : unit t | ||
|
||
let rec burn l = | ||
if List.hd l > 12 then () | ||
else | ||
burn (l @ l |> List.map (fun x -> x + 1)) | ||
|
||
let foo l = | ||
burn l; | ||
perform Yield | ||
|
||
let bar i = foo [i] | ||
|
||
let () = | ||
for _ = 1 to 10_000 do | ||
try bar 8 | ||
with Unhandled _ -> () | ||
done |