harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Xiao-Feng Li <xiaofeng...@gmail.com>
Subject Re: Question about the boot and classloading
Date Tue, 19 May 2009 11:39:12 GMT
On Tue, May 19, 2009 at 6:41 PM, Mark Hindess
<mark.hindess@googlemail.com> wrote:
>
> In message <dff214c70905190147x57135ef3hf26cbf6a93ae2255@mail.gmail.com>, tian
> galaxy writes:
>>
>> Hindess .Thanks for the help ! I realized that this far more complex than I
>> thought before .
>> So I think I need a deeper look into both osgi and harmony .
>> Here are several things I don't qiute understand and I noted them below.May
>> be it's because I am not quite familiar with the low level , classloading
>> details .
>> thanks!
>>
>> 2009/5/19 Mark Hindess <mark.hindess@googlemail.com>
>> >
>> > In message <dff214c70905180610w407e3bd4h5baa319729c1fc55@mail.gmail.com>,
>> > tian galaxy writes:
>> > >
>> > > OK ,thanks .Seems the minimal class set has been defined by the osgi.
>> >
>> > Not sure how this helps though.  The OSGi Minimum Execution Environment
>> > says what is theoretically the minimum required to run OSGi.  What we
>> > need to concern ourselves with is the *practical* minimum and that
>> > really depends on our implementation details.
>> >
>> > I don't think that we should implement OSGi in the VM.  Instead the
>> > existing bootstrap classloader should load the OSGi framework (with
>> > a unique classloader)
>>
>> If we load the osgi with the bootstrap class loader , why comes a unique
>> class loader?
>
> It isn't necessary but I think it is useful to use a separate
> classloader for the OSGi framework so that we can isolate the classes
> use by the VM's OSGi framework and avoid polluting the namespace.
>
>> Do you mean the bootstrap class loader should delegate the loading to
>> the 'unique class loader '?
>
> Yes.
>
>> > and the system classes (with a "temporary" classloader).
>>
>> Again ,the relation between temporary and bootstrap classloder?  And
>> why temporary ?
>
> Temporary because until the OSGi framework is up you wont know which
> bundle the classes belong to and thus wont know which bundle classloader
> the classes should belong to.  Alternatively, I suppose you could
> implement minimal support for reading OSGi headers from manifests
> in the VM so that you could assign classes to what would become a bundle
> classloader when the framework is up.
>
> -Mark.


This makes sense to me. The VM simply grabs in all the stuff "as
usual" including the OSGi framework, then sort them out according to
the bundles' definitions.

It could be VM-neutral, because it is the VM's own business to take
care of its loaded classes. A callback interface OSGI_ready() can
inform the VM to tidy up the classes loaded for OSGi (or before it is
ready).

Thanks,
xiaofeng


>> >  Once the OSGi framework is configured the system classes need to be
>> > moved to the correct classloader for the OSGi bundle to which they
>> > belong.
>> >
>> > This means that during the initial starting-OSGi-framework phase
>> > the OSGi bundle import/exports will not be enforced but, other than
>> > implementing OSGi in the VM, I don't see how to avoid this.
>> >
>> > The multiplicity of bootstrap classloaders still needs to be hidden
>> > since the API demands that getClassLoader should return null for the
>> > bootstrap classloader(s).
>> >
>> > The biggest problem is probably how to implement this as VM-independent
>> > API such that a VM wanting to implement OSGi had to provide only a
>> > minimal C/Java interface in order to gain OSGi support.
>> >
>> > Regards,
>> >  Mark.
>> >
>> > > I will look more closely on this problems and let you know if there some
>> > > progresses made.
>> > > Thanks  a  lot !
>> >
>> > > 2009/5/18 Pavel Pervov <pmcfirst@gmail.com>
>> > >
>> > > > I do not know osgi model in detail, but what minimal set of classes
is
>> > > > needed to start osgi model itself? Then we could delegate to "system"
>> > > > bundle loader from bootstrap classloader.
>> > > >
>> > > > 2009/5/18, tian galaxy <harmonymail.ty@gmail.com>:
>> > > > > Yes , implement osgi loading model in there is too complex.
>> > > > >
>> > > > > We know some modules are more important than others , performing
some
>> > > > > fundamental , basic functions .
>> > > > > Is it possible to only load these more" basic " modules with
>> > bootstrap
>> > > > class
>> > > > > loader and make the other modules work the osgi bundle?
>> > > > > Actually I don't quite understand why system classes could only
be
>> > loaded
>> > > > by
>> > > > > bootstrap class loader?I noticed that there are some safety concerns
>> > > > > ,is there any reasons other than that?
>> > > > > Thanks !
>> > > > >
>> > > > >
>> > > > > 2009/5/18 Pavel Pervov <pmcfirst@gmail.com>
>> > > > >
>> > > > >> Short answer is "no". You'll have to implement osgi loading
model
>> > > > >> inside bootstrap classloader. Is it too complex?
>> > > > >>
>> > > > >> 2009/5/18, tian galaxy <harmonymail.ty@gmail.com>:
>> > > > >> > Hi Pavel.
>> > > > >> >
>> > > > >> > Thanks.
>> > > > >> > Yes ,that's right .My question is whether there is a
way to load
>> > the
>> > > > >> system
>> > > > >> > class by class loader other than the  bootstrap class
loader ?
>> > > > >> > If we could load the system class by different loaders
other than
>> > the
>> > > > >> > bootstrap class loader then there is a chance to make
the harmony
>> > > > >> > runtime
>> > > > >> to
>> > > > >> > be osgi-ed.
>> > > > >> > I trying to work on this problem . Do you have any suggestions
?
>> > > > >> >
>> > > > >> >
>> > > > >> > 2009/5/18 Pavel Pervov <pmcfirst@gmail.com>
>> > > > >> >
>> > > > >> >> Tian,
>> > > > >> >> System classes are all loaded with bootstrap classloader.
It is
>> > > > >> >> written in C++ and is located in
>> > > > >> >> working_vm/vm/vmcore/src/class_support/classloader.cpp
>> > > > >> >>
>> > > > >> >> 2009/5/17, tian galaxy <harmonymail.ty@gmail.com>:
>> > > > >> >> > Hi all
>> > > > >> >> > I have a question about the classloading in
the drlvm.
>> > > > >> >> >
>> > > > >> >> > I know that there are kernel library inside
the drlvm such as
>> > > > >> >> > java.lang.classloader, which enclose the the
systemclassloader.
>> > And
>> > > > >> this
>> > > > >> >> > class is loaded and used in the process of
creating VM .
>> > > > >> >> > While the systemclassloader is a subtype of
urlclassloader
>> > which is
>> > > > >> >> > in
>> > > > >> >> the
>> > > > >> >> > "luni" module.So does the JNI_CreateJavaVM
>> > > > >> >> > also load the urlclassloader in the boot procedure
of vm ?(I
>> > failed
>> > > > >> >> > to
>> > > > >> >> > search related code in the source code of drlvm).
>> > > > >> >> > If so , when ?Before or after the jni available
?
>> > > > >> >> > Since I am trying to implement the osgi on
harmony and the osgi
>> > > > works
>> > > > >> >> with
>> > > > >> >> > bundles (modules) , I think I need to know
the procedure of
>> > booting
>> > > > >> and
>> > > > >> >> > loading of class from different modules at
the start up time.
>> > > > >> >> > Any clue about this ?Thanks
>> > > > >> >> >
>> > > > >> >> > plus,do we have the source code of java.exe
?Where?
>
>
>



-- 
http://people.apache.org/~xli

Mime
View raw message