You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// OCaml code fixed by Demi Marie Obenour in https://github.com/ocaml/ocaml/pull/13370, before and after the fix.
3
+
// Buggy code from https://github.com/ocaml/ocaml/pull/13370 where some local variables are not registered.
4
4
5
5
#include<caml/mlvalues.h>
6
6
#include<caml/alloc.h>
@@ -11,10 +11,12 @@
11
11
12
12
#defineCAMLparam0() __goblint_caml_param0()
13
13
#defineCAMLparam1(x) __goblint_caml_param1(&x)
14
-
#defineCAMLlocal1(x) __goblint_caml_param1(&x) // The local and param functions behave the same for our purposes, registering variables.
15
-
#defineCAMLlocal3(x, y, z) __goblint_caml_param3(&x, &y, &z)
14
+
#defineCAMLlocal1(x) value x = Val_unit; __goblint_caml_param1(&x) // The local and param functions behave the same for our purposes, registering variables.
15
+
#defineCAMLlocal3(x, y, z) value x = Val_unit; value y = Val_unit; value z = Val_unit; __goblint_caml_param3(&x, &y, &z)
16
16
#defineCAMLreturn(x) return (x) // From AI - CAMLreturn needs some variable named caml__frame, which is not available in our mock CAMLparam1, so we mock the return as well.
17
17
18
+
// A reference to caml_gc_minor_words_unboxed can be found in _opam/lib/ocaml/ml/gc.ml.
19
+
#definecaml_gc_minor_words_unboxed() (0.0) // TODO: Put a value here that's in the OCaml heap.
18
20
19
21
CAMLprimvaluecaml_gc_counters(valuev)
20
22
{
@@ -23,10 +25,13 @@ CAMLprim value caml_gc_counters(value v)
23
25
24
26
/* get a copy of these before allocating anything... */
doubleprowords=v; // It does not find the Caml_state so dummy values are used for the test. The argument v, which is otherwise unused, is used as the dummy value because it allows for simulating the variables' registration.
32
+
doublemajwords=v;
29
33
34
+
// Evaluating one argument could erase the next variables.
30
35
res=caml_alloc_3(0,
31
36
caml_copy_double(minwords),
32
37
caml_copy_double(prowords),
@@ -41,9 +46,11 @@ CAMLprim value caml_gc_counters_correct(value v)
41
46
42
47
/* get a copy of these before allocating anything... */
0 commit comments