Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
RE: [Caml-list] choosing modules at runtime
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2002-10-02 (20:59)
From: Chris Hecker <checker@d...>
Subject: Re: [Caml-list] choosing modules at runtime

> > And finally, a mixed byte-native runtime is not supported.
>This is definitely something I'd like to see.  As I understand it,
>there are 2 problems: bytecode vs. native function dispatch, and GC.
>Trying to resolve this is on my list of things to do, but it's a long
>list, so I'd love to hear that someone else has done it first!

I looked into this a fair amount and there were some threads on this topic 
on the list.  It's totally possible to do, but it looks like a 
mess.  Xavier explained the problems in the old thread.  I looked into how 
to do the function dispatch without requiring an if statement or two 
pointers in the closures, and it seems doable by being wacky with nop 
instructions on the various supported architectures (for better or for worse).

Here's the thread:

A unification of the GC between bytecode and native would be good for the 
other wacky feature I'd like to see implemented: 
coroutines/fibers/cooperative-threads/whatever-your-pet-name-is.  These 
require allocating a block of memory, treating it as a stack and switching 
to it to run a coroutine.  All of the allocated stacks have to be visible 
to the GC so it doesn't treat as garbage something living on a non-running 
stack.  I haven't looked into this at all, but I assume there's something 
in there for the preemptive threads, but I wonder how different it is for 
bytecode versus native.  Coroutines are useful in games for writing AI code 
so you don't have to write it as an FSM to spread it across frames.


To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: