libgcj merging and VMStackWalker

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This week I spent some time looking at the libgcj/Classpath merge
situation.  After removing all the simple merges that hadn't yet been
handled for some reason, I looked at VMStackWalker a little.

I think this merge could be done fairly simply.  In fact I think it
just requires adding a 'Class' argument to
VMStackWalker.getCallingClass and VMStackWalker.getCallingClassLoader.
This argument would name the immediate caller, and these methods
would be changed to return the class just above the argument class in
the stack trace.

With this change I think I could immediately merge Logger,
ResourceBundle, Package, and parts of SecurityManager and the little
CORBA differences.

I don't think this would overly affect performance (a big worry on the
gcj end) or maintainability on the Classpath side.

It would require a small VM change.  However, other VMs could simply
add this method argument and then ignore it, and things would continue
to work as they do today.

I've appended the VMStackWalker change so folks can see what it looks
like.  I didn't include all the other changes, which are basically
mechanical.

On the libgcj side, VMStackWalker would be just a simple wrapper
around the existing stack-walking code.  The class argument would make
it simpler for our stack walker to know when to start looking for the
'caller' class -- it would skip both VMStackWalker and the immediate
(internal) caller.

Comments?

Tom

Index: VMStackWalker.java
===================================================================
RCS file: /cvsroot/classpath/classpath/vm/reference/gnu/classpath/VMStackWalker.java,v
retrieving revision 1.6
diff -u -r1.6 VMStackWalker.java
--- VMStackWalker.java	13 Nov 2005 22:29:45 -0000	1.6
+++ VMStackWalker.java	13 May 2006 23:28:36 -0000
@@ -78,7 +78,7 @@
    * VM implementers are encouraged to provide a more efficient
    * version of this method.
    */
-  public static Class getCallingClass()
+  public static Class getCallingClass(Class context)
   {
     Class[] ctx = getClassContext();
     if (ctx.length < 3)
@@ -97,7 +97,7 @@
    * VM implementers are encouraged to provide a more efficient
    * version of this method.
    */
-  public static ClassLoader getCallingClassLoader()
+  public static ClassLoader getCallingClassLoader(Class context)
   {
     Class[] ctx = getClassContext();
     if (ctx.length < 3)


[Index of Archives]     [Linux Kernel]     [Linux Cryptography]     [Fedora]     [Fedora Directory]     [Red Hat Development]

  Powered by Linux