Skip to content

Commit 7c8c73f

Browse files
lthlsmshinwell
authored andcommitted
Tweak test to make allocation toplevel in classic mode
(cherry picked from commit ad845a1)
1 parent 617d2e0 commit 7c8c73f

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

ocaml/testsuite/tests/mixed-blocks/structural_constants.ml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,14 @@ let () = print_endline "Success!"
5858
let () = print_endline "Testing optimization (this is a no-op in bytecode)..."
5959

6060
let () =
61+
(* Both classic mode and optimized mode should be able to statically
62+
allocate the inconstant list. *)
63+
let s = Sys.opaque_identity "foo" in
64+
let bytes_start0 = Gc.allocated_bytes () in
65+
let bytes_start1 = Gc.allocated_bytes () in
66+
let _ =
67+
Sys.opaque_identity [A #4.0; B ("B", #5.0); C ("C", #6.0, 6); D s]
68+
in
6169
match Sys.backend_type with
6270
| Bytecode -> ()
6371
| Native | Other _ ->
@@ -74,14 +82,6 @@ let () =
7482
== (Sys.opaque_identity create_a) ());
7583
assert ((Sys.opaque_identity create_vs) ()
7684
== (Sys.opaque_identity create_vs) ());
77-
(* Both classic mode and optimized mode should be able to statically
78-
allocate the inconstant list. *)
79-
let s = Sys.opaque_identity "foo" in
80-
let bytes_start0 = Gc.allocated_bytes () in
81-
let bytes_start1 = Gc.allocated_bytes () in
82-
let _ =
83-
Sys.opaque_identity [A #4.0; B ("B", #5.0); C ("C", #6.0, 6); D s]
84-
in
8585
let bytes_end = Gc.allocated_bytes () in
8686
assert (bytes_start0 +. bytes_end = 2. *. bytes_start1)
8787
;;

0 commit comments

Comments
 (0)