This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
Re: Patch: Remove exception catching from normal path in Arrays.equals.
>>>>> "Andrew" == Andrew Haley <aph@redhat.com> writes:
>> And this one would be even better:
>> Class* caller = t->tryTofindFirstNonNullClassStartingAtIndex (1);
>> if (caller)
>> caller_loader = caller->getClassLoaderInternal ();
>> ...where tryTofindFirstNonNullClassStartingAtIndex, a new method of
>> StackTrace, is replaced by a better name (I'm bad at names).
Andrew> This isn't a totally bad idea. But findCallerClass might be a
Andrew> better name.
Classpath's VMSecurityManager already has:
/**
* Get the current ClassLoader. This is the first non-null class loader
* on the stack, if one exists, stopping either at the end of the stack
* or the first instance of a PrivilegedAction. In other words, this call
* automatically unwinds past all classes loaded by the bootstrap loader,
* where getClassLoader() returns null, to get to the user class that
* really invoked the call that needs a classloader.
*
* @return the current ClassLoader
*/
static native ClassLoader currentClassLoader();
If we specifically need the caller's class, and not the class loader,
we can add a new method to VMSecurityManager.
In general the Classpath VM* approach seems pretty good, and it will
benefit us if we adopt it in most cases.
Tom