Soot is now invokedynamic-ready

Eric | August 24, 2010

As many of you may know, JDK 7 will bring support for a new bytecode called invokedynamic. Thanks to Matthias Perner, a bright student of ours, Soot is already ready for this new bytecode today. I have just committed appropriate changes to the SVN trunk. The new instructions are handled as follows:

  • On the Jimple, Grimp and Baf level, invokedynamic instructions appear as DynamicInvokeExpr with a static SootMethodRef that has class java.dyn.InvokeDynamic as target class. This is in accordance with the internal handling in JDK 7.
  • SootMethodRefs which have java.dyn.InvokeDynamic as target class may not be resolved: calling resolve() will throw an exception
  • On the Jasmin level, invokedynamic instruction appear in the form “invokedynamic <methodName>(<methodParams>)<methodRetType>“. In particular, there is no target class given.
  • Jasmin translates this into an invokedynamic instruction with two arguments:
    • a NameAndType attribute referring to <methodName>(<methodParams>)<methodRetType> and
    • the constant “0” (two zero bytes, i.e., a short); according to the VM spec this is reserved for future use.

The above is an experimental design. Comments are welcome! In the near future we plan to extend TamiFlex to handle invokedynamic as well.