Here is an approximate grammar:
Names are numbered consecutively from left to right starting at zero. (The letters are merely a taste of syntax sugar.) Thus, the first temporary (if any) is always numbered N (where N=arity). Every occurrence of a name reference in an argument list must refer to a name previously defined within the same lambda. A lambda has a void result if and only if its result index is -1. If a temporary has the type "V", it cannot be the subject of a NameRef, even though possesses a number. Note that all reference types are erased to "L", which stands forLambdaForm = "(" ArgName* ")=>{" TempName* Result "}" ArgName = "a" N ":" T TempName = "t" N ":" T "=" Function "(" Argument* ");" Function = ConstantValue Argument = NameRef | ConstantValue Result = NameRef | "void" NameRef = "a" N | "t" N N = (any whole number) T = "L" | "I" | "J" | "F" | "D" | "V"
Object
.
All subword types (boolean, byte, short, char) are erased to "I" which is int
.
The other types stand for the usual primitive types.
Function invocation closely follows the static rules of the Java verifier. Arguments and return values must exactly match when their "Name" types are considered. Conversions are allowed only if they do not change the erased type.
explicitCastArguments
)
Examples:
(a0:J)=>{ a0 } == identity(long) (a0:I)=>{ t1:V = System.out#println(a0); void } == System.out#println(int) (a0:L)=>{ t1:V = System.out#println(a0); a0 } == identity, with printing side-effect (a0:L, a1:L)=>{ t2:L = BoundMethodHandle#argument(a0); t3:L = BoundMethodHandle#target(a0); t4:L = MethodHandle#invoke(t3, t2, a1); t4 } == general invoker for unary insertArgument combination (a0:L, a1:L)=>{ t2:L = FilterMethodHandle#filter(a0); t3:L = MethodHandle#invoke(t2, a1); t4:L = FilterMethodHandle#target(a0); t5:L = MethodHandle#invoke(t4, t3); t5 } == general invoker for unary filterArgument combination (a0:L, a1:L)=>{ ...(same as previous example)... t5:L = MethodHandle#invoke(t4, t3, a1); t5 } == general invoker for unary/unary foldArgument combination (a0:L, a1:I)=>{ t2:I = identity(long).asType((int)->long)(a1); t2 } == invoker for identity method handle which performs i2l (a0:L, a1:L)=>{ t2:L = BoundMethodHandle#argument(a0); t3:L = Class#cast(t2,a1); t3 } == invoker for identity method handle which performs cast
Modifier and Type | Class and Description |
---|---|
pack-priv static enum | |
pack-priv static @interface | LambdaForm.
Internal marker for byte-compiled LambdaForms. |
pack-priv class | |
pack-priv static enum | |
pack-priv static class | |
pack-priv static class |
Modifier and Type | Field and Description |
---|---|
pack-priv final int | |
private static final int | COMPILE_THRESHOLD
If the invocation count hits the threshold we spin bytecodes and call that subsequently. |
private static final Object | |
pack-priv final MethodHandle | |
private static final HashMap | |
private static final HashMap | |
private static final MethodHandle | |
private static final boolean | |
private static final LambdaForm. | |
private static final int | |
pack-priv final boolean | |
private static final MemberName. | |
pack-priv static final int | |
private static final LambdaForm. | |
private int | |
private boolean | |
pack-priv final LambdaForm. | |
public static final int | |
private static PerfCounter | |
private static final LambdaForm[] | |
private static final LambdaForm[] | |
pack-priv final LambdaForm. | |
private static final LambdaForm. | |
private static final LambdaForm. | |
pack-priv final int | |
private static final boolean | |
pack-priv volatile Object | |
pack-priv MemberName | |
public static final int |
Access | Constructor and Description |
---|---|
private | LambdaForm(int arity, int result, boolean forceInline, MethodHandle customized, LambdaForm.
|
Modifier and Type | Method and Description |
---|---|
pack-priv static LambdaForm. | |
pack-priv static LambdaForm. | |
private static boolean | |
pack-priv int | |
private boolean | |
pack-priv static void | |
pack-priv final String | basicTypeSignature()
Return ABC_Z, where the ABC are parameter type characters, and Z is the return type character. |
public static String | |
private static LambdaForm. | |
private static boolean | |
private void | |
private static boolean | |
pack-priv void | |
pack-priv static LambdaForm. | |
pack-priv boolean | |
private static LambdaForm | create(int arity, LambdaForm.
|
pack-priv static LambdaForm | |
pack-priv static LambdaForm | |
pack-priv static LambdaForm | |
pack-priv static LambdaForm | |
pack-priv static LambdaForm | |
private static LambdaForm | |
private static void | |
pack-priv LambdaForm | |
pack-priv static boolean | |
pack-priv String | |
pack-priv LambdaFormEditor | |
public boolean | equals(Object
the reference object with which to compare. obj)Overrides java. Indicates whether some other object is "equal to" this one. |
public boolean | |
pack-priv int | |
private static PerfCounter | |
private static int | |
private boolean | |
private String | |
public int | |
pack-priv static LambdaForm. | |
private static double | |
private static float | |
private static int | |
private static long | |
private static Object | |
private static void | |
pack-priv static LambdaForm | |
pack-priv static LambdaForm. | |
pack-priv Object | interpretName(LambdaForm.
Evaluate a single Name within this form, applying its function to its arguments. |
pack-priv Object | interpretWithArguments(Object... argumentValues)
Interpretively invoke this form on the given arguments. |
pack-priv Object | |
private boolean | |
pack-priv boolean | |
pack-priv boolean | |
private boolean | |
pack-priv boolean | |
pack-priv boolean | |
pack-priv boolean | |
pack-priv static boolean | |
pack-priv String | |
pack-priv int | |
pack-priv MethodType | |
pack-priv boolean | nameRefsAreLegal()
Check that all embedded Name references are localizable to this lambda, and are properly ordered after their corresponding definitions. |
private static boolean | |
private static boolean | Returns: true if we can interpretRenumber and/or replace params so that they are interned and canonically numbered. |
pack-priv LambdaForm. | |
pack-priv Object | |
pack-priv LambdaForm. | |
public void | |
private boolean | |
pack-priv LambdaForm. | |
public static String | Returns: same sequence, with repetitions counted by decimal numeralssequence of uppercase ASCII letters with possible repetitions signature)Hack to make signatures more readable when they show up in method names. |
pack-priv static int | |
public String | |
pack-priv static void | |
pack-priv static void | |
pack-priv LambdaForm | |
pack-priv int | |
private static boolean | |
private static double | |
private static float | |
private static int | |
private static long | |
private static Object | |
pack-priv static LambdaForm |