harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tim Ellison <t.p.elli...@gmail.com>
Subject [vmi] Extending the VMI to allow setting a default portlib
Date Thu, 14 Sep 2006 12:31:09 GMT
At present, the Harmony launcher creates and passes an instance of the
portlib to the VM as it is being created (via an
_org.apache.harmony.vmi.portlib init arg).  This is good because allows
the launcher to define functions used for memory alloc, file IO, etc. early.

However, we also need to work with regular applications that are
embedding the JVM, and don't know/want to set up this argument for us.
In such a case the classlib should use a default portlib (and possibly
JVM subsequently if it wants).

I propose that we retain support for the init arg, but make it optional,
and that we extend the VMI [1] to allow setting the portlib struct where
it has not been previously defined.  The portlib struct can only be
defined once, subsequent attempts to set the portlib would return an
error.  Of course, you can still modify the struct to redefine the
functions it contains.

The new VMI function would be:
  vmiError(JNICALL * SetPortLibrary)
    (VMInterface * vmi, HyPortLibrary * portlib);

then the early logic in JNI_OnLoad for luniglob.c [2] would become:
 (a) if vmInterface->GetPortLibrary(vmi) is not NULL then continue
 (b) otherwise create new portlib, and vmi->SetPortlib(vmi, portlib).

and the corresponding JNI_OnUnload would destroy the portlib iff it had
been created in step (b).


[1]
http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/include/shared/vmi.h?revision=442941&view=markup
[2]
http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/luniglob.c?revision=442941&view=markup

Comments?

Regards,
Tim

-- 

Tim Ellison (t.p.ellison@gmail.com)
IBM Java technology centre, UK.

---------------------------------------------------------------------
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