harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Archie Cobbs <arc...@dellroad.org>
Subject Re: [jchevm+classlibadapter] Running classlib tests
Date Mon, 19 Jun 2006 23:09:36 GMT
Ivan Volosyuk wrote:
> IMHO, Archie's suggestion is simplier and less intrusive, as the
> function Thread.attachInternal() can be native function implemented in
> classlibadapter itself.

But Graeme is correct in that there could be initialization delay.
I.e., if we're following the normal rules of Java, all the initialization
associated with java.lang.Object, java.lang.String, etc. will have to
occur before the very first thread can invoke any methods in
java.lang.Thread (even if native).

The idea is salvagable if we have a special classlib-specific launcher
(i.e., C program using the JNI invocation interface to launch the JVM)
which did the very first thread_attach() for the main thread. Then all
the other threads could use Thread.attachThread() or whatever without
all the initialization delay.

Yet another idea (probably not feasible) would be for classlib to:

(a) check whether thread_attach() has been called yet for the current
     thread in any native method that requires this to be so, and if not,
     go ahead and do it itself
(b) store its state in a ThreadLocal (so cleanup would be automatic)

This would eliminate the requirement for the VM to be classlib-aware.

-Archie

__________________________________________________________________________
Archie Cobbs      *        CTO, Awarix        *      http://www.awarix.com

---------------------------------------------------------------------
Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
For additional commands, e-mail: harmony-dev-help@incubator.apache.org


Mime
View raw message