Guilhem Lavaux wrote:
I thought to have been already clear about that in the past (and with
no answers !). Let's try to summarise my goal:
* if we want something which is quite portable (but maybe not as
portable as aicas portability layer) we must ensure some level of
abstraction to hide how syscalls are really used. That way if we have
to call different things in the OS (e.g. for more exotic platforms
like windows) or to use the syscalls differently we will not be
completely stuck by tons of autoconf code in the common VM layer.
* some VMs (like us in kaffe) do like to be able to intercept most
syscalls to ensure that syscall operations are atomic from the point
of view of the threading system. Sometimes you even need to know when
a syscall may block to acknowledge the VM to take wise decisions for
the GC (I don't remember if it was about wait4 at that time).
* autoconf code is a lot clearer if we can isolate the portions of
code to be replaced.
The native layer I am writing would like to give an answer these
problems. The default code will just be a rough encapsulation of the
native syscalls (though maybe not for recv/send/... which needs some
polling operations). I think that in future we'll need another
configure option for the VM to be able to specify a new adaptative
native layer.
At the moment, I have separated this code in another directory of the
classpath tree (native/jni/native-lib).
It would be nice, I believe, to re-use libraries that have handled most
of the "porting" and "wrapping" for you such as APR
(http://apr.apache.org/), or NPR (http://www.mozilla.org/projects/nspr/)
to platforms GNU Classpath might care to support. You might also find
glib useful, http://developer.gnome.org/arch/gtk/glib.html.
If Apache's license and GPLv3 will be compatible then this is probably
the way to go.
People that care about platform specific optimizations, or code size,
etc. could then go beat up the external library provider or write a
replacement themselves.
Brian