public class CallSiteGenerator
extends Object
Generates specialized call-site classes for the classic (non-indy) call-site cache.
Prefer invokedynamic call sites for new code. Planned for deprecation/removal in a future Groovy version.
| Type Params | Return Type | Name and description |
|---|---|---|
|
public static Constructor |
compilePogoMethod(CachedMethod cachedMethod)Loads a pogo call-site class for cachedMethod through the loader
cached for its declaring class, and returns the constructor that accepts
the parent site, meta class, meta method, parameter types, and reflective
constructor. |
|
public static Constructor |
compilePojoMethod(CachedMethod cachedMethod)Loads a pojo call-site class for cachedMethod through the loader
cached for its declaring class, and returns the constructor that accepts
the parent site, meta class, meta method, parameter types, and reflective
constructor. |
|
public static Constructor |
compileStaticMethod(CachedMethod cachedMethod)Loads a static call-site class for cachedMethod through the loader
cached for its declaring class, and returns the constructor that accepts
the parent site, meta class, meta method, parameter types, and reflective
constructor. |
|
public static void |
genCallWithFixedParams(org.objectweb.asm.ClassWriter cw, String name, String superClass, CachedMethod cachedMethod, String receiverType)Writes a fixed-arity call method for cachedMethod when it has
four parameters or fewer. |
|
public static void |
genCallXxxWithArray(org.objectweb.asm.ClassWriter cw, String name, String superClass, CachedMethod cachedMethod, String receiverType)Writes the array form of a call method for cachedMethod.
|
|
public static byte[] |
genPogoMetaMethodSite(CachedMethod cachedMethod, org.objectweb.asm.ClassWriter cw, String name)Writes a PogoMetaMethodSite subclass into cw. |
|
public static byte[] |
genPojoMetaMethodSite(CachedMethod cachedMethod, org.objectweb.asm.ClassWriter cw, String name)Writes a PojoMetaMethodSite subclass into cw. |
|
public static byte[] |
genStaticMetaMethodSite(CachedMethod cachedMethod, org.objectweb.asm.ClassWriter cw, String name)Writes a StaticMetaMethodSite subclass into cw. |
|
public static boolean |
isCompilable(CachedMethod method)Returns whether method can be compiled to a direct call site.
|
Loads a pogo call-site class for cachedMethod through the loader
cached for its declaring class, and returns the constructor that accepts
the parent site, meta class, meta method, parameter types, and reflective
constructor.
Loads a pojo call-site class for cachedMethod through the loader
cached for its declaring class, and returns the constructor that accepts
the parent site, meta class, meta method, parameter types, and reflective
constructor.
Loads a static call-site class for cachedMethod through the loader
cached for its declaring class, and returns the constructor that accepts
the parent site, meta class, meta method, parameter types, and reflective
constructor.
Writes a fixed-arity call method for cachedMethod when it has
four parameters or fewer. Wider methods are skipped. The generated method
checks that the call is still valid, invokes the target, turns a void
result into null, boxes a primitive result, and falls back to the default
call path when the guard fails.
Writes the array form of a call method for cachedMethod.
Arguments are unpacked from the Object[] parameter, then invoked,
boxed, and guarded the same way as the fixed-arity form.
Writes a PogoMetaMethodSite subclass into cw. Dots in name
become slashes in the internal class name.
The class declares a public static __constructor__ field and does not
initialize it. It also defines array and fixed-arity call and callCurrent
methods for Groovy object and plain object receivers.
Writes a PojoMetaMethodSite subclass into cw. Dots in name
become slashes in the internal class name.
The class declares a public static __constructor__ field and does not
initialize it. It also defines array and fixed-arity call methods for a plain
object receiver.
Writes a StaticMetaMethodSite subclass into cw. Dots in name
become slashes in the internal class name.
The class declares a public static __constructor__ field and does not
initialize it. It also defines array and fixed-arity call and callStatic
methods.
Returns whether method can be compiled to a direct call site.
The declaring class, the method, and every parameter type must be public,
AndroidSupport must not report an Android runtime, and encoding
the method name as a class name must leave it unchanged.