Skip to content

Commit 1d6a06c

Browse files
committed
OxCaml: recursive value involving mixed blocks
The primitive caml_alloc_dummy_mixed is used in this case.
1 parent 39dbf43 commit 1d6a06c

File tree

6 files changed

+26
-3
lines changed

6 files changed

+26
-3
lines changed

compiler/lib/generate.ml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1348,8 +1348,10 @@ let _ =
13481348
]
13491349
`Mutator
13501350
(fun cx cy cz _ -> J.EBin (J.Eq, Mlvalue.Array.field cx cy, cz));
1351-
register_un_prims [ "caml_alloc_dummy"; "caml_alloc_dummy_float" ] `Pure (fun _ _ ->
1352-
J.array []);
1351+
register_un_prims
1352+
[ "caml_alloc_dummy"; "caml_alloc_dummy_float"; "caml_alloc_dummy_mixed" ]
1353+
`Pure
1354+
(fun _ _ -> J.array []);
13531355
register_un_prims
13541356
[ "caml_int_of_float"
13551357
; "caml_int32_of_float"
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
disable

compiler/tests-oxcaml/misc/dune

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
(env
2+
(_
3+
(flags
4+
(:standard
5+
(-w -32-69)))))
6+
7+
(tests
8+
(names test)
9+
(build_if %{oxcaml_supported})
10+
(modes byte js wasm))

compiler/tests-oxcaml/misc/test.ml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
2+
type t = { x : t; y : float32# }
3+
4+
let rec x = { x; y = #0.s }

runtime/wasm/obj.wat

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,12 @@
135135
(array.new $float_array (f64.const 0)
136136
(i31.get_u (ref.cast (ref i31) (local.get $size)))))
137137

138+
(func (export "caml_alloc_dummy_mixed")
139+
(param $size (ref eq)) (param (ref eq)) (result (ref eq))
140+
(array.new $block (ref.i31 (i32.const 0))
141+
(i32.add (i31.get_u (ref.cast (ref i31) (local.get $size)))
142+
(i32.const 1))))
143+
138144
(func (export "caml_update_dummy")
139145
(param $dummy (ref eq)) (param $newval (ref eq)) (result (ref eq))
140146
(local $i i32)

toplevel/examples/lwt_toplevel/dune

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@
158158
"%+(jsoo_runtime)"
159159
-r
160160
js_of_ocaml-ppx.as-lib)
161-
(run tr -d "\r")
161+
(run tr -d \r)
162162
(with-accepted-exit-codes
163163
(or 0 1)
164164
(run grep -v ^$))))))

0 commit comments

Comments
 (0)