Re: loaded classes question

Etienne Gagnon <[email protected]> Wed, 16 Mar 2005 15:55:39 -0500
Newsgroups gmane.comp.java.vm.sablevm.devel
Message-ID <[email protected]>
Hi Jennifer,

Yes this is possible.  The _svmt_JavaVM struct has a class loader field
that contains a linked list of class loaders.  Each class loader
maintains its own tree of classes ("initiated").  Note that for each
class in a tree, you should check that its class loader ("defining") is
the current one, if you want accurate results.  [This complexity comes
from Chapter 5 of the JVM spec.]

In other words, you are looking for all the classes that were defined by
(application) class loaders.  The bootstrap class loader has no
"class_loader_instance" (e.g. == NULL).

Each loaded class appears in the "initiated" tree of one or more class
loaders, but only one of these class loaders is the defining one.  The
_svmt_class_info struct has a field pointing to it.

Hoping this helps.

Etienne
PS: Please read chapter 5 of the JVM spec. :-)

Jennifer LHOTAK wrote:
> Is it possible, in sablevm, to access all the loaded application classes
> (to get the class_info struct) starting from a reference to the JavaVM
> struct?

--
Etienne M. Gagnon, Ph.D.            http://www.info2.uqam.ca/~egagnon/
SableVM:                                       http://www.sablevm.org/
SableCC:                                       http://www.sablecc.org/

_______________________________________________
SableVM-devel mailing list
[email protected]
http://sablevm.org/lists/control/listinfo/sablevm-devel
signature.asc (application/pgp-signature, 256 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFCOJ1LjyrJi4rH84gRAp04AJ49gnlwoBfQLtJ1zyi++si/sAbJvgCaAoKe
KFSvcwBHSBDbT6BtkkK3ENw=
=2xtA
-----END PGP SIGNATURE-----