public final class DefBootstrap
extends java.lang.Object
Has 11 flavors (passed as static bootstrap parameters): dynamic method call, dynamic field load (getter), and dynamic field store (setter), dynamic array load, dynamic array store, iterator, method reference, unary operator, binary operator, shift operator, and dynamic array index normalize.
When a new type is encountered at the call site, we lookup from the appropriate whitelist, and cache with a guard. If we encounter too many types, we stop caching.
Based on the cascaded inlining cache from the JSR 292 cookbook (https://code.google.com/archive/p/jsr292-cookbook/, BSD license)
| Modifier and Type | Field and Description |
|---|---|
static int |
ARRAY_LOAD
static bootstrap parameter indicating a dynamic array load, e.g.
|
static int |
ARRAY_STORE
static bootstrap parameter indicating a dynamic array store, e.g.
|
static int |
BINARY_OPERATOR
static bootstrap parameter indicating a binary math operator, e.g.
|
static int |
INDEX_NORMALIZE
static bootstrap parameter indicating a request to normalize an index for array-like-access
|
static int |
ITERATOR
static bootstrap parameter indicating a dynamic iteration, e.g.
|
static int |
LOAD
static bootstrap parameter indicating a dynamic load (getter), e.g.
|
static int |
METHOD_CALL
static bootstrap parameter indicating a dynamic method call, e.g.
|
static int |
OPERATOR_ALLOWS_NULL
static bootstrap parameter indicating the binary operator allows nulls (e.g.
|
static int |
OPERATOR_COMPOUND_ASSIGNMENT
static bootstrap parameter indicating the binary operator is part of compound assignment (e.g.
|
static int |
OPERATOR_EXPLICIT_CAST
static bootstrap parameter indicating an explicit cast to the return type.
|
static int |
REFERENCE
static bootstrap parameter indicating a dynamic method reference, e.g.
|
static int |
SHIFT_OPERATOR
static bootstrap parameter indicating a shift operator, e.g.
|
static int |
STORE
static bootstrap parameter indicating a dynamic store (setter), e.g.
|
static int |
UNARY_OPERATOR
static bootstrap parameter indicating a unary math operator, e.g.
|
| Modifier and Type | Method and Description |
|---|---|
static java.lang.invoke.CallSite |
bootstrap(PainlessLookup painlessLookup,
java.util.Map<java.lang.String,Locals.LocalMethod> localMethods,
java.lang.invoke.MethodHandles.Lookup methodHandlesLookup,
java.lang.String name,
java.lang.invoke.MethodType type,
int initialDepth,
int flavor,
java.lang.Object... args)
invokeDynamic bootstrap method
|
public static final int METHOD_CALL
public static final int LOAD
public static final int STORE
public static final int ARRAY_LOAD
public static final int ARRAY_STORE
public static final int ITERATOR
public static final int REFERENCE
public static final int UNARY_OPERATOR
public static final int BINARY_OPERATOR
public static final int SHIFT_OPERATOR
public static final int INDEX_NORMALIZE
public static final int OPERATOR_ALLOWS_NULL
requires additional MethodHandles.catchException(java.lang.invoke.MethodHandle, java.lang.Class<? extends java.lang.Throwable>, java.lang.invoke.MethodHandle) guard, which will invoke
the fallback if a null is encountered.
public static final int OPERATOR_COMPOUND_ASSIGNMENT
may require MethodHandles.explicitCastArguments(java.lang.invoke.MethodHandle, java.lang.invoke.MethodType), or a dynamic cast
to cast back to the receiver's type, depending on types seen.
public static final int OPERATOR_EXPLICIT_CAST
may require MethodHandles.explicitCastArguments(java.lang.invoke.MethodHandle, java.lang.invoke.MethodType), depending on types seen.
public static java.lang.invoke.CallSite bootstrap(PainlessLookup painlessLookup, java.util.Map<java.lang.String,Locals.LocalMethod> localMethods, java.lang.invoke.MethodHandles.Lookup methodHandlesLookup, java.lang.String name, java.lang.invoke.MethodType type, int initialDepth, int flavor, java.lang.Object... args)
In addition to ordinary parameters, we also take some parameters defined at the call site:
initialDepth: initial call site depth. this is used to exercise megamorphic fallback.
flavor: type of dynamic call it is (and which part of whitelist to look at).
args: flavor-specific args.
PainlessLookup used to compile the script for whitelist checking.
see https://docs.oracle.com/javase/specs/jvms/se7/html/jvms-6.html#jvms-6.5.invokedynamic