Package org.codehaus.groovy.classgen.asm.sc

# Class StaticTypesCallSiteWriter

java.lang.Object
org.codehaus.groovy.classgen.asm.CallSiteWriter
org.codehaus.groovy.classgen.asm.sc.StaticTypesCallSiteWriter

public class StaticTypesCallSiteWriter extends CallSiteWriter
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

  Constructors
  Constructor
  Description
  `StaticTypesCallSiteWriter(StaticTypesWriterController controller)`
  Creates a call-site writer for statically compiled property and operator access.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `fallbackAttributeOrPropertySite(PropertyExpression expression, Expression objectExpression, String name, MethodCallerMultiAdapter adapter)`
  Generates a fallback call for attribute or property access.
  `void`
  `generateCallSiteArray()`
  Generates the call site array field and accessor methods.
  `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.
  `void`
  `makeCallSiteArrayInitializer()`
  Generates bytecode to initialize the call site array field to null.
  `void`
  `makeGetPropertySite(Expression receiver, String propertyName, boolean safe, boolean implicitThis)`
  Generates a general getProperty call.
  `void`
  `makeGroovyObjectGetPropertySite(Expression receiver, String propertyName, boolean safe, boolean implicitThis)`
  Generates a GroovyObject getProperty call.
  `void`
  `makeSingleArgumentCall(Expression receiver, String message, Expression argument, boolean safe)`
  Generates a single-argument method call with optional safe navigation.
  `void`
  `makeSiteEntry()`
  Generates bytecode to load the call site array into a local variable.
  `void`
  `prepareCallSite(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 for `message`.

  ### Methods inherited from class org.codehaus.groovy.classgen.asm.CallSiteWriter

  `getCallSites, hasCallSiteUse, makeSetPropertySite, makeSingleArgumentCall, prepareSiteAndReceiver, visitBoxedArgument`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### StaticTypesCallSiteWriter

    public StaticTypesCallSiteWriter(StaticTypesWriterController controller)
    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:
      `generateCallSiteArray` in class `CallSiteWriter`

  - ### 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:
      `makeCallSite` in class `CallSiteWriter`
    Parameters:
      `receiver` - the receiver expression
      `message` - the method name
      `arguments` - the arguments expression
      `safe` - whether to use safe navigation
      `implicitThis` - whether the receiver is implicit 'this'
      `callCurrent` - whether to call on the current object
      `callStatic` - 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:
      `makeGetPropertySite` in class `CallSiteWriter`
    Parameters:
      `receiver` - the receiver expression
      `propertyName` - the property name
      `safe` - whether to use safe navigation
      `implicitThis` - whether the receiver is implicit 'this'

  - ### makeGroovyObjectGetPropertySite

    public void makeGroovyObjectGetPropertySite(Expression receiver, String propertyName, boolean safe, boolean implicitThis)
    Generates a GroovyObject getProperty call.
    Overrides:
      `makeGroovyObjectGetPropertySite` in class `CallSiteWriter`
    Parameters:
      `receiver` - the receiver expression
      `propertyName` - the property name
      `safe` - whether to use safe navigation
      `implicitThis` - whether the receiver is implicit 'this'

  - ### makeCallSiteArrayInitializer

    public void makeCallSiteArrayInitializer()
    Generates bytecode to initialize the call site array field to null.
    Overrides:
      `makeCallSiteArrayInitializer` in class `CallSiteWriter`

  - ### makeSiteEntry

    public void makeSiteEntry()
    Generates bytecode to load the call site array into a local variable.
    Overrides:
      `makeSiteEntry` in class `CallSiteWriter`

  - ### prepareCallSite

    public void prepareCallSite(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 for `message`.
    Overrides:
      `prepareCallSite` in class `CallSiteWriter`
    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:
      `makeSingleArgumentCall` in class `CallSiteWriter`
    Parameters:
      `receiver` - the receiver expression
      `message` - the method name
      `argument` - the argument expression
      `safe` - 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:
      `fallbackAttributeOrPropertySite` in class `CallSiteWriter`
    Parameters:
      `expression` - the property expression
      `objectExpression` - the object expression
      `name` - the property name
      `adapter` - the method caller adapter