MethodSubstitution non-static methods

Curt Albert falbert9 at
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
Substitution methods must be static:" I was looking at 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 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) {

//The method I am trying to substitute
public void vecExecution(int vec)
      for(int i = 0; i < vec; i++)
         //increment group id
         kernelState.setGroupId(0,(kernelState.getGroupIds()[0] + 1));
         //increment global id
         kernelState.setGlobalId(0,(kernelState.getGlobalIds()[0] + 1));

Curt Albert

More information about the graal-dev mailing list