Package: org.codehaus.groovy.vmplugin.v8

## [Java] Class IndyInterface

- 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
    Modifiers | Name | Description
    --- | --- | ---
    `enum` | `IndyInterface.CallType` | Enum for easy differentiation between call types.

  - ### Field Summary

    Fields
    Modifiers | Name | Description
    --- | --- | ---
    `protected static Logger` | `LOG` | Logger.
    `protected static boolean` | `LOG_ENABLED` | Indicates if indy logging is enabled.
    `static Lookup` | `LOOKUP` | LOOKUP constant used for example in unreflect calls
    `static int` | `SAFE_NAVIGATION` | Flags for method and property calls.

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `public static CallSite` | `bootstrap(Lookup caller, String callType, MethodType type, String name, int flags)` Bootstrap method for method calls from Groovy-compiled code with indy.
    `` | `public static Object` | `fromCache(CacheableCallSite callSite, Class<?> sender, String methodName, int callID, Boolean safeNavigation, Boolean thisCall, Boolean spreadCall, Object dummyReceiver, Object[] arguments)` Get the cached methodHandle. if the related methodHandle is not found in the inline cache, cache and return it.
    `` | `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.
    `` | `public static CallSite` | `packedDispatchers(Lookup caller, String name, MethodType type)` Legacy invokedynamic bootstrap for a class's packed-closure dispatcher accessor (GROOVY-12151), kept for class files emitted by earlier 6.0 pre-releases: links the class's generated dispatch tables into one constant bundle, lazily on first adapter creation.
    `` | `public static CallSite` | `packedDispatchers(Lookup caller, String name, MethodType type, MethodHandle factory)` Invokedynamic bootstrap for a class's packed-closure dispatcher accessor (GROOVY-12151): the hosting class supplies a factory that builds the bundle from its own bytecode-level `LambdaMetafactory` sites.
    `` | `public static Class<?>[]` | `packedParamTypes(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.
    `` | `public static Object` | `selectMethod(CacheableCallSite callSite, Class<?> sender, String methodName, int callID, Boolean safeNavigation, Boolean thisCall, Boolean spreadCall, Object dummyReceiver, Object[] arguments)` Core method for indy method selection using runtime types.
    `` | `public static CallSite` | `staticArrayAccess(Lookup lookup, String name, MethodType type)` Since: 2.5.0

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class Object` | `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### protected static final Logger LOG

      Logger.

    - #### protected static final boolean LOG_ENABLED

      Indicates if indy logging is enabled.

    - #### public static final Lookup LOOKUP

      LOOKUP constant used for example in unreflect calls

    - #### public static final int SAFE_NAVIGATION

      Flags for method and property calls.

  - ### Method Detail

    - #### @GroovyABI(since = "2.1.0")
      public static CallSite bootstrap(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
        - {@value #SAFE_NAVIGATION} is the flag value for safe navigation; see SAFE_NAVIGATION
        - {@value #THIS_CALL} is the flag value for a call on this; see THIS_CALL
        - {@value #SPREAD_CALL} is the flag value for a spread call; see SPREAD_CALL
      Since:
        2.1.0

    - #### @Deprecated
      public static Object fromCache(CacheableCallSite callSite, Class<?> sender, String methodName, int callID, Boolean safeNavigation, Boolean thisCall, Boolean spreadCall, Object dummyReceiver, Object[] arguments)

      Get the cached methodHandle. if the related methodHandle is not found in the inline cache, cache and return it.

      deprecated:
        Use the new bootHandle-based approach instead.

    - #### 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) 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.

    - #### 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.

    - #### @GroovyABI(since = "6.0.0")
      public static CallSite packedDispatchers(Lookup caller, String name, MethodType type)

      Legacy invokedynamic bootstrap for a class's packed-closure dispatcher accessor (GROOVY-12151), kept for class files emitted by earlier 6.0 pre-releases: links the class's generated dispatch tables into one constant bundle, lazily on first adapter creation. Delegates to GeneratedDispatcher.bootstrap; hosted here so emitted bytecode references only this central bootstrap surface.

      Since:
        6.0.0

    - #### public static CallSite packedDispatchers(Lookup caller, String name, MethodType type, MethodHandle factory)

      Invokedynamic bootstrap for a class's packed-closure dispatcher accessor (GROOVY-12151): the hosting class supplies a factory that builds the bundle from its own bytecode-level `LambdaMetafactory` sites. Nothing is looked up and no class is defined at link time, so this links unchanged in ahead-of-time environments that restrict either — GraalVM native image being the verified case (GROOVY-12227). The three-argument form remains for class files emitted by earlier 6.0 pre-releases.

      Since:
        6.0.0

    - #### @GroovyABI(since = "6.0.0")
      public static Class<?>[] packedParamTypes(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; hosted here so emitted bytecode references only this central bootstrap surface.

      Since:
        6.0.0

    - #### @Deprecated
      public static Object selectMethod(CacheableCallSite callSite, Class<?> sender, String methodName, int callID, Boolean safeNavigation, Boolean thisCall, Boolean spreadCall, Object dummyReceiver, Object[] arguments)

      Core method for indy method selection using runtime types.

      deprecated:
        Use the new bootHandle-based approach instead.

    - #### @GroovyABI(since = "2.5.0")
      public static CallSite staticArrayAccess(Lookup lookup, String name, MethodType type)

      Since:
        2.5.0