[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#600408: ocaml: Building OCaml with LOCAL_CALLBACK_BYTECODE enabled



Le 17/10/2010 00:53, Guillaume Yziquel a écrit :
> I register an OCaml array with caml_register_generational_global_root.
> The array contains functions. The C++ code takes an offset in this array
> and calls the function, typically with caml_callback3.
> [...]
> But it works fine in native code, so I'm not doing things completely
> crazily. I'm currently trying to see why I have an invalid opcode there.

This handwaving in English is quite difficult to understand... Couldn't
you back it up with a concrete example? Give some commented source code
and a way to reproduce the segfault?

> Having it global makes me worry a lot about threads, callbacks, why am I
> getting an invalid opcode, etc...

The runtime is made is such a way that OCaml code should be running in a
single thread at any time. Even when dealing with callbacks, you should
make sure only one thread of OCaml code is running.

> I'm not sure (and I do not believe) that it would solve my issue, but it
> would just feel much more 'right' to me.

This just sounds like a workaround to me. But I am waiting for an
example to make a more confident judgement.

> I do not think that the comments in callbacks.c are very enlightening as
> to the proper usage of LOCAL_CALLBACK_BYTECODE. I'm not saying that it
> should be changed, but I do not see why it should be kept this way.

It has to have been written this way and not documented for a reason...


Cheers,

-- 
Stéphane




Reply to: