ClassLoader & Interpreter

Kresten Krab Thorup krab@yl.is.s.u-tokyo.ac.jp
Thu Jul 15 03:10:00 GMT 1999


Hi again,

I've started working towards an interpreter for GCJ.  

At this point, I've implemented ClassLoader (and some helper classes)
to the point where it can load and link classes.  I can create
object-instances of these classes, but I have not written the
byte-code interepreter, .. yet.  So, you cannot call methods on such
loaded classes.

First off, I'd like to have a branch of CVS repository where I can
keep this, and share it with others while it is being developed. How
do I do that?

Secondly, do you have a particular policy on package names?  Right now
I keep the support-classes in gnu.gcj.runtime/gnu.gcj.util. 

Here's an outline of what I've written so far:

  java.lang.ClassLoader
	-- redone from scratch

  gnu.gcj.runtime.SystemClassLoader  
	-- delegated to from the "boot class loader" 

  gnu.gcj.util.SearchPath
	-- utility to search for files in a given path, 
	   including directory, ".zip" and URL path elements.
           This includes some helper classes, URLPathEntry,
           ZipPathEntry, and DirectoryPathEntry.  Ideally,
           these should be inner classes of SearchPath.

  gnu.gcj.util.ClassFileParser       
	-- similar to jcf-xxx in gcc/java, initalized with
           a byte[], and will call handleXXX methods on itself.

  gnu.gcj.runtime.ClassFileLoader    
	-- ClassFileParser subclass, load/init of a Class object.
           Implements ClassLoader.defineClass()

For now, these are all related to the ClassLoader, but there might be
some more, like gnu.gcj.runtime.InterpretedMethod.  Please advise what
package names you would find appropriate.


CHANGES.  I have moved some of the _Jv_ support functions from
natClass.cc to natClassLoader.cc, where they properly belong; and
changed a number of other small things, like adding some new class
states (STATE_XXX).  Another change is that I needed an extra argument
for _Jv_FindArrayClass, to identify the initiating class loader for
that array class.

Basically, there are very few changes to the "system" per se, the bulk
of the changes so far are all in natClassLoader.cc, and
natClassFileLoader.cc, implementing the loading process.

I have implemented almost all of the loading, preparation and resolve
functionality, including all the proper type checking, except the
bytecode verifier.  Given the code in gcc/java/verifier.c, it should
be rather easy to write one.  I'm thinking that the verifier can be
written i Java.

As for the interpreter, I intend to do it very plain right now.  I'll
be using GFFI to create stubs to be installed in the vtable, and
similarily GFFI to invoke all methods.  

-- Kresten  

 Kresten Krab Thorup
 c/o Yonezawa Laboratory
 Department of Information Science   
 The University of Tokyo             

 http://www.daimi.au.dk/~krab/resume.html



More information about the Java mailing list