use of org.jikesrvm.runtime.StackBrowser in project JikesRVM by JikesRVM.
the class RVMClass method getClassLoaderFromStackFrame.
// --------------------------------------------------------------------//
// Miscellaneous queries. //
// ---------------------------------------------------------------------//
/**
* Support for user-written class loaders:
* It's required to find the classloader of the class
* whose method requires another class to be loaded;
* the initiating loader of the required class is the
* defining loader of the requiring class.
*
* @param skip specifies the number of frames back from the
* caller to the method whose class's loader is required
*
* @return the class loader
*/
@Entrypoint
public static ClassLoader getClassLoaderFromStackFrame(int skip) {
// account for stack frame of this function
skip++;
StackBrowser browser = new StackBrowser();
VM.disableGC();
browser.init();
while (skip-- > 0) browser.up();
VM.enableGC();
return browser.getClassLoader();
}
Aggregations