Skip to content

Commit

Permalink
flambda-backend: Add a test for frametable setup in natdynlinked libr…
Browse files Browse the repository at this point in the history
…aries (#983)
  • Loading branch information
lukemaurer authored Nov 24, 2022
1 parent b73ab12 commit 396d5b8
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
3 changes: 3 additions & 0 deletions testsuite/tests/lib-dynlink-native/main.reference
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ Registering module Plugin2
2
6
1
Raised by primitive operation at Plugin2.foo in file "plugin2.ml", line 4, characters 38-64
Called from Plugin2.test_frametable in file "plugin2.ml", line 10, characters 2-72
Called from Plugin2 in file "plugin2.ml", line 19, characters 2-20
XXX
Loading plugin_thread.so
Registering module Plugin_thread
Expand Down
12 changes: 12 additions & 0 deletions testsuite/tests/lib-dynlink-native/plugin2.ml
Original file line number Diff line number Diff line change
@@ -1,8 +1,20 @@
(*external ex: int -> int = "caml_ex"*)

let foo a1 a2 a3 a4 a5 a6 a7 a8 a9 =
Printexc.print_raw_backtrace stdout (Printexc.get_callstack 4);
fun a10 a11 a12 a13 a14 a15 a16 a17 a18 -> ()

(* Ensure that the frametable is set up correctly so that a [caml_curry_18]
frame can be traversed *)
let[@inline never] test_frametable () =
(Sys.opaque_identity foo) 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18;
(* force non-tail call *)
Sys.opaque_identity ()

let () =
Api.reg_mod "Plugin2";
Api.add_cb (fun () -> print_endline "Callback from plugin2");
(* let i = ex 3 in*)
List.iter (fun i -> Printf.printf "%i\n" i) Plugin.facts;
test_frametable ();
Printf.printf "XXX\n"

0 comments on commit 396d5b8

Please sign in to comment.