Skip to content

Commit

Permalink
caml_gc_get mirrors the behaviour of stock OCaml for max_stack_size.
Browse files Browse the repository at this point in the history
Maximum size of the stack is used as a means to identify whether the
code is running in bytecode (`caml_max_stack_size`) or native mode(0).
This feature is used by `ocamlfind`. This fix enables code that `#use
"topfind"` to work i.e) `topkg`.
  • Loading branch information
kayceesrk committed Dec 6, 2016
1 parent fc67f1b commit 0b2e9d7
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion byterun/gc_ctrl.c
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,18 @@ CAMLprim value caml_gc_counters(value v)

CAMLprim value caml_gc_get(value v)
{
return Val_unit;
CAMLparam0 (); /* v is ignored */
CAMLlocal1 (res);

res = caml_alloc_tuple (7);
#ifndef NATIVE_CODE
Store_field (res, 5, Val_long (caml_max_stack_size)); /* l */
#else
Store_field (res, 5, Val_long (0));
#endif

CAMLreturn (res);

#if 0
CAMLparam0 (); /* v is ignored */
CAMLlocal1 (res);
Expand Down

0 comments on commit 0b2e9d7

Please sign in to comment.