Package org.codehaus.groovy.vmplugin.v8

# Class IndyInterface

java.lang.Object
org.codehaus.groovy.vmplugin.v8.IndyInterface

public class IndyInterface extends Object
Bytecode level interface for bootstrap methods used by invokedynamic. This class provides a logging ability by using the boolean system property groovy.indy.logging. Other than that this class contains the interfacing methods with bytecode for invokedynamic as well as some helper methods and classes.

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static enum`
  `IndyInterface.CallType`
  Enum for easy differentiation between call types.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final int`
  `GROOVY_OBJECT`
  Flags for method and property calls.
  `static final int`
  `IMPLICIT_THIS`
  Flags for method and property calls.
  `protected static final Logger`
  `LOG`
  Logger.
  `protected static final boolean`
  `LOG_ENABLED`
  Indicates if indy logging is enabled.
  `static final MethodHandles.Lookup`
  `LOOKUP`
  LOOKUP constant used for example in unreflect calls
  `static final int`
  `SAFE_NAVIGATION`
  Flags for method and property calls.
  `static final int`
  `SPREAD_CALL`
  Flags for method and property calls.
  `static final int`
  `THIS_CALL`
  Flags for method and property calls.
  `static final int`
  `UNCACHED_CALL`
  Flags for method and property calls.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `IndyInterface()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static CallSite`
  `bootstrap(MethodHandles.Lookup caller, String callType, MethodType type, String name, int flags)`
  Bootstrap method for method calls from Groovy-compiled code with indy.
  `static Object`
  `fromCache(CacheableCallSite callSite, Class<?> sender, String methodName, int callID, Boolean safeNavigation, Boolean thisCall, Boolean spreadCall, Object dummyReceiver, Object[] arguments)`
  Deprecated.
  Use the new bootHandle-based approach instead.
  `protected static void`
  `invalidateSwitchPoints()`
  Category enter/leave and `VMPlugin.invalidateCallSites()`.
  `protected static MethodHandle`
  `makeFallBack(MutableCallSite mc, Class<?> sender, String name, int callID, MethodType type, boolean safeNavigation, boolean thisCall, boolean spreadCall)`
  Makes a fallback method for an invalidated method selection.
  `static CallSite`
  `packedDispatchers(MethodHandles.Lookup caller, String name, MethodType type)`
  Invokedynamic bootstrap for a class's packed-closure dispatcher accessor (GROOVY-12151): links the class's generated dispatch tables into one constant bundle, lazily on first adapter creation.
  `static Class<?>[]`
  `packedParamTypes(MethodHandles.Lookup caller, String name, Class<?> type, String descriptor)`
  Constant-dynamic bootstrap for a packed closure literal's declared parameter types (GROOVY-12151): decodes a method descriptor into a `Class[]` resolved once per literal site.
  `static Object`
  `selectMethod(CacheableCallSite callSite, Class<?> sender, String methodName, int callID, Boolean safeNavigation, Boolean thisCall, Boolean spreadCall, Object dummyReceiver, Object[] arguments)`
  Deprecated.
  Use the new bootHandle-based approach instead.
  `static CallSite`
  `staticArrayAccess(MethodHandles.Lookup lookup, String name, MethodType type)`

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

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

- ## Field Details

  - ### SAFE_NAVIGATION

    public static final int SAFE_NAVIGATION
    Flags for method and property calls.
    See Also:
      - Constant Field Values

  - ### THIS_CALL

    public static final int THIS_CALL
    Flags for method and property calls.
    See Also:
      - Constant Field Values

  - ### GROOVY_OBJECT

    public static final int GROOVY_OBJECT
    Flags for method and property calls.
    See Also:
      - Constant Field Values

  - ### IMPLICIT_THIS

    public static final int IMPLICIT_THIS
    Flags for method and property calls.
    See Also:
      - Constant Field Values

  - ### SPREAD_CALL

    public static final int SPREAD_CALL
    Flags for method and property calls.
    See Also:
      - Constant Field Values

  - ### UNCACHED_CALL

    public static final int UNCACHED_CALL
    Flags for method and property calls.
    See Also:
      - Constant Field Values

  - ### LOG

    protected static final Logger LOG
    Logger.

  - ### LOG_ENABLED

    protected static final boolean LOG_ENABLED
    Indicates if indy logging is enabled.

  - ### LOOKUP

    public static final MethodHandles.Lookup LOOKUP
    LOOKUP constant used for example in unreflect calls

- ## Constructor Details

  - ### IndyInterface

    public IndyInterface()

- ## Method Details

  - ### invalidateSwitchPoints

    protected static void invalidateSwitchPoints()
    Category enter/leave and `VMPlugin.invalidateCallSites()`. Bulk-invalidates every loaded class SwitchPoint so sites re-link under the new category state. Per-class MetaClass changes use the MetaClass-aware registry path (`IndyInvalidation.invalidateForMetaClassChange(groovy.lang.MetaClassRegistryChangeEvent)`) or `ClassInfo.incVersion()` (exact-class for in-place EMC updates).

    Pre-6.0 this method also rotated a process-wide `switchPoint` field. That field is gone; bulk policy lives entirely in `IndyInvalidation`.

  - ### bootstrap

    public static CallSite bootstrap(MethodHandles.Lookup caller, String callType, MethodType type, String name, int flags)
    Bootstrap method for method calls from Groovy-compiled code with indy.
    Parameters:
      `caller` - - the caller
      `callType` - - the type of call
      `type` - - the parameter(s) and return type specification
      `name` - - the real method name
      `flags` - - call flags
      - 1 is the flag value for safe navigation; see `SAFE_NAVIGATION`
      - 2 is the flag value for a call on this; see `THIS_CALL`
      - 16 is the flag value for a spread call; see `SPREAD_CALL`
    Since:
      2.1.0

  - ### makeFallBack

    protected static MethodHandle makeFallBack(MutableCallSite mc, Class<?> sender, String name, int callID, MethodType type, boolean safeNavigation, boolean thisCall, boolean spreadCall)
    Makes a fallback method for an invalidated method selection.

  - ### fromCache

    @Deprecated public static Object fromCache(CacheableCallSite callSite, Class<?> sender, String methodName, int callID, Boolean safeNavigation, Boolean thisCall, Boolean spreadCall, Object dummyReceiver, Object[] arguments) throws Throwable
    Deprecated.
    Use the new bootHandle-based approach instead.
    Get the cached methodHandle. if the related methodHandle is not found in the inline cache, cache and return it.
    Throws:
      `Throwable`

  - ### selectMethod

    @Deprecated public static Object selectMethod(CacheableCallSite callSite, Class<?> sender, String methodName, int callID, Boolean safeNavigation, Boolean thisCall, Boolean spreadCall, Object dummyReceiver, Object[] arguments) throws Throwable
    Deprecated.
    Use the new bootHandle-based approach instead.
    Core method for indy method selection using runtime types.
    Throws:
      `Throwable`

  - ### staticArrayAccess

    public static CallSite staticArrayAccess(MethodHandles.Lookup lookup, String name, MethodType type)
    Since:
      2.5.0

  - ### packedDispatchers

    public static CallSite packedDispatchers(MethodHandles.Lookup caller, String name, MethodType type) throws Throwable
    Invokedynamic bootstrap for a class's packed-closure dispatcher accessor (GROOVY-12151): links the class's generated dispatch tables into one constant bundle, lazily on first adapter creation. Delegates to `GeneratedDispatcher.bootstrap(java.lang.invoke.MethodHandles.Lookup, java.lang.String, java.lang.invoke.MethodType)`; hosted here so emitted bytecode references only this central bootstrap surface.
    Throws:
      `Throwable`
    Since:
      6.0.0

  - ### packedParamTypes

    public static Class<?>[] packedParamTypes(MethodHandles.Lookup caller, String name, Class<?> type, String descriptor)
    Constant-dynamic bootstrap for a packed closure literal's declared parameter types (GROOVY-12151): decodes a method descriptor into a `Class[]` resolved once per literal site. Delegates to `GeneratedDispatcher.paramTypes(java.lang.invoke.MethodHandles.Lookup, java.lang.String, java.lang.Class<?>, java.lang.String)`; hosted here so emitted bytecode references only this central bootstrap surface.
    Since:
      6.0.0