|
From: | Archie Cobbs |
Subject: | Re: proposal: VMStackBrowser |
Date: | Sun, 16 Jan 2005 11:36:08 -0600 |
User-agent: | Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.7.3) Gecko/20041129 |
Steven Augart wrote:
I propose adding a new class that may be optionally implemented by the VM, gnu.classpath.VMStackBrowser. I say that it is "optional" because I have here a reference implementation for it that uses the existing gnu.classpath.VMStackWalker to do all the work: /* VMStackBrowser.java -- Reference implementation of OPTIONAL VM hooks for stack access.[The Classpath copyright notice can go here]*/ package gnu.classpath; /** * This optional class provides access to the classes on the Java stack. * Use this class to explore the stack. It is sometimes necessary to * find out the current context class loader, and other things like that. * <P> * This reference implementation works on top of the mandatory VMStackWalker * class. So you can leave it completely alone if you want to. * You may be able to improve your VM's efficiency by implementing * VMStackBrowser yourself. It's your choice. */
Looks good. Presumably the idea here is to optimize this in such a way that you don't have to crawl the entire stack in the constructor (as is done by the default implementation). In that case, to make such implementations easier, we should specify that the VMStackBrowser object is only valid until the instantiating method returns, and that the instantiating method is required to call release() before returning (e.g., using try { ... } finally { x.release(); } or whatever). Then simple implementations that store the current position as a frame pointer (or whatever) are possible and don't need to worry about the stack changing out from under them. -Archie __________________________________________________________________________ Archie Cobbs * CTO, Awarix * http://www.awarix.com
[Prev in Thread] | Current Thread | [Next in Thread] |