Class StaticTypesCallSiteWriter
java.lang.Object
org.codehaus.groovy.classgen.asm.CallSiteWriter
org.codehaus.groovy.classgen.asm.sc.StaticTypesCallSiteWriter
A call site writer which replaces call site caching with static calls. This means that the generated code
looks more like Java code than dynamic Groovy code. Best effort is made to use JVM instructions instead of
calls to helper methods.
-
Field Summary
Fields inherited from class org.codehaus.groovy.classgen.asm.CallSiteWriter
CONSTRUCTOR -
Constructor Summary
ConstructorsConstructorDescriptionStaticTypesCallSiteWriter(StaticTypesWriterController controller) Creates a call-site writer for statically compiled property and operator access. -
Method Summary
Modifier and TypeMethodDescriptionvoidfallbackAttributeOrPropertySite(PropertyExpression expression, Expression objectExpression, String name, MethodCallerMultiAdapter adapter) Generates a fallback call for attribute or property access.voidGenerates the call site array field and accessor methods.voidmakeCallSite(Expression receiver, String message, Expression arguments, boolean safe, boolean implicitThis, boolean callCurrent, boolean callStatic) Generates a general method call through the call site infrastructure.voidGenerates bytecode to initialize the call site array field to null.voidmakeGetPropertySite(Expression receiver, String propertyName, boolean safe, boolean implicitThis) Generates a general getProperty call.voidmakeGroovyObjectGetPropertySite(Expression receiver, String propertyName, boolean safe, boolean implicitThis) Generates a GroovyObject getProperty call.voidmakeSingleArgumentCall(Expression receiver, String message, Expression argument, boolean safe) Generates a single-argument method call with optional safe navigation.voidGenerates bytecode to load the call site array into a local variable.voidprepareCallSite(String message) Prepares a call-site entry for the named method on the bytecode operand stack, loading the call-site array and selecting the slot formessage.Methods inherited from class org.codehaus.groovy.classgen.asm.CallSiteWriter
getCallSites, hasCallSiteUse, makeSingleArgumentCall, prepareSiteAndReceiver, visitBoxedArgument
-
Constructor Details
-
StaticTypesCallSiteWriter
Creates a call-site writer for statically compiled property and operator access.
-
-
Method Details
-
generateCallSiteArray
public void generateCallSiteArray()Generates the call site array field and accessor methods.- Overrides:
generateCallSiteArrayin classCallSiteWriter
-
makeCallSite
public void makeCallSite(Expression receiver, String message, Expression arguments, boolean safe, boolean implicitThis, boolean callCurrent, boolean callStatic) Generates a general method call through the call site infrastructure.- Overrides:
makeCallSitein classCallSiteWriter- Parameters:
receiver- the receiver expressionmessage- the method namearguments- the arguments expressionsafe- whether to use safe navigationimplicitThis- whether the receiver is implicit 'this'callCurrent- whether to call on the current objectcallStatic- whether this is a static method call
-
makeGetPropertySite
public void makeGetPropertySite(Expression receiver, String propertyName, boolean safe, boolean implicitThis) Generates a general getProperty call.- Overrides:
makeGetPropertySitein classCallSiteWriter- Parameters:
receiver- the receiver expressionpropertyName- the property namesafe- whether to use safe navigationimplicitThis- whether the receiver is implicit 'this'
-
makeGroovyObjectGetPropertySite
public void makeGroovyObjectGetPropertySite(Expression receiver, String propertyName, boolean safe, boolean implicitThis) Generates a GroovyObject getProperty call.- Overrides:
makeGroovyObjectGetPropertySitein classCallSiteWriter- Parameters:
receiver- the receiver expressionpropertyName- the property namesafe- whether to use safe navigationimplicitThis- whether the receiver is implicit 'this'
-
makeCallSiteArrayInitializer
public void makeCallSiteArrayInitializer()Generates bytecode to initialize the call site array field to null.- Overrides:
makeCallSiteArrayInitializerin classCallSiteWriter
-
makeSiteEntry
public void makeSiteEntry()Generates bytecode to load the call site array into a local variable.- Overrides:
makeSiteEntryin classCallSiteWriter
-
prepareCallSite
Prepares a call-site entry for the named method on the bytecode operand stack, loading the call-site array and selecting the slot formessage.- Overrides:
prepareCallSitein classCallSiteWriter- Parameters:
message- the method name for which to prepare the call site
-
makeSingleArgumentCall
public void makeSingleArgumentCall(Expression receiver, String message, Expression argument, boolean safe) Generates a single-argument method call with optional safe navigation.- Overrides:
makeSingleArgumentCallin classCallSiteWriter- Parameters:
receiver- the receiver expressionmessage- the method nameargument- the argument expressionsafe- whether to use safe navigation
-
fallbackAttributeOrPropertySite
public void fallbackAttributeOrPropertySite(PropertyExpression expression, Expression objectExpression, String name, MethodCallerMultiAdapter adapter) Generates a fallback call for attribute or property access.- Overrides:
fallbackAttributeOrPropertySitein classCallSiteWriter- Parameters:
expression- the property expressionobjectExpression- the object expressionname- the property nameadapter- the method caller adapter
-