Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] "yielding" in bytecode
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Chris Hecker <checker@d...>
Subject: [Caml-list] "yielding" in bytecode

I'd like to use ocaml bytecode embedded in another application, so I'll be calling caml_startup() from C code.

I'd like to be able to have bytecode functions yield back to the calling C code but maintain their state when resumed.  I'm not talking about full continuations or anything fancy like that, I'm just talking about breaking out of the interpreter loop and storing the state, so that when it's reentered (via a new API, like caml_resume() or something) it continues executing.

I don't think there's any way to do this right now, but it looks like it'd be possible.  Is there any reason this couldn't be made to work?

In addition, a couple more related features would be nice for embedding ocaml as a scripting language:

- non-preemptive threads (aka fibers), this would be especially good if it was integrated with the above yield thing, so you could yield and then C code could resume individual fibers as it wanted

- having the ocaml byterun state be packaged up in a structure instead of using globals, so you could run multiple copies of it...not sure what kind of performance impact this would have, though...maybe it could be a compile time option, I guess you'd have multiple GCs too...

Chris

-------------------
To unsubscribe, mail caml-list-request@inria.fr.  Archives: http://caml.inria.fr