MethodSubstitution non-static methods
Curt Albert
falbert9 at vt.edu
Tue Dec 17 08:24:57 PST 2013
Is it possible to preform a method substitution on a non static method?
When I try and use @MethodSubstitution followed by a non static method I
get the error " Context obj com.oracle.graal.graph.GraalInternalError:
Substitution methods must be static:" I was looking at
AESCryptSubstitutions.java and for encryptBlock and decryptBlock those
methods are not static in com.sun.crypto.provider.AESCrypt and they have
(isStatic = false) after the @MethodSubstitution then static and the method
with an additional Object in the parameters. A similar thing is true for
the ObjectSubstitutions.java for several methods the @MethodSubstitution is
followed by (isStatic = false) and have an extra object in the parameters
and some have forced = true, but when I try adding (isStatic = false) and
static in front of my MethodSubstitution and an object in the parameters
graal never substitutes the method.
How do you substitute a non-static method in graal and what does forced =
true mean?
//In VectorSubstitutions,java and tested that substitutions are registered
and does substitute for static test methods
@MethodSubstitution(isStatic = false, forced = true)
static void vecExecution(Object thisObj, int vec) {
System.out.println("vect");
}
//The method I am trying to substitute
public void vecExecution(int vec)
{
for(int i = 0; i < vec; i++)
{
run();
//increment group id
kernelState.setGroupId(0,(kernelState.getGroupIds()[0] + 1));
//increment global id
kernelState.setGlobalId(0,(kernelState.getGlobalIds()[0] + 1));
}
}
Thanks,
Curt Albert
More information about the graal-dev
mailing list