Top Description Inners Fields Constructors Methods
java.lang.invoke

pack-priv Class LambdaFormEditor

extends Object
Class Inheritance
Imports
sun.invoke.util.Wrapper, java.lang.ref.SoftReference, java.util.Arrays, .Comparator, .TreeMap, java.util.concurrent.ConcurrentHashMap

Transforms on LFs. A lambda-form editor can derive new LFs from its base LF. The editor can cache derived LFs, which simplifies the reuse of their underlying bytecodes. To support this caching, a LF has an optional pointer to its editor.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
LambdaFormEditor.Transform

A description of a cached transform, possibly associated with the result of the transform.

private static class
LambdaFormEditor.TransformKey

Used as a lookup key to find existing Transforms

Field Summary

Modifier and TypeField and Description
private static final byte
private static final byte
private static final byte
private static final byte
private static final byte
private static final byte
private static final byte
private static final byte
private static final byte
private static final byte
private static final byte
pack-priv final LambdaForm
private static final byte
private static final int
MAX_CACHE_ARRAY_SIZE

Arbitrary but reasonable limits on Transform[] size for cache.

private static final int
MIN_CACHE_ARRAY_SIZE

Arbitrary but reasonable limits on Transform[] size for cache.

private static final byte
private static final byte
private static final byte

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
pack-priv LambdaForm
pack-priv BoundMethodHandle
bindArgumentD(BoundMethodHandle mh, int pos, double value)

pack-priv BoundMethodHandle
bindArgumentF(BoundMethodHandle mh, int pos, float value)

pack-priv LambdaForm
pack-priv BoundMethodHandle
bindArgumentI(BoundMethodHandle mh, int pos, int value)

pack-priv BoundMethodHandle
bindArgumentJ(BoundMethodHandle mh, int pos, long value)

pack-priv BoundMethodHandle
private MethodType
private LambdaFormBuffer
pack-priv LambdaForm
collectArgumentsForm(int pos, MethodType collectorType)

pack-priv LambdaForm
pack-priv LambdaForm
dupArgumentForm(int srcPos, int dstPos)

pack-priv LambdaForm
pack-priv LambdaForm
filterArgumentsForm(int filterPos, MethodType combinerType, int... argPositions)

pack-priv LambdaForm
filterRepeatedArgumentForm(LambdaForm.BasicType newType, int... argPositions)

This creates a LF that will repeatedly invoke some unary filter function at each of the given positions.

pack-priv LambdaForm
filterReturnForm(LambdaForm.BasicType newType, boolean constantZero)

pack-priv LambdaForm
foldArgumentsForm(int foldPos, boolean dropResult, MethodType combinerType)

pack-priv LambdaForm
foldArgumentsForm(int foldPos, boolean dropResult, MethodType combinerType, int... argPositions)

private boolean
formParametersMatch(LambdaForm form, LambdaForm.BasicType newType, int... argPositions)

private LambdaForm
getInCache(LambdaFormEditor.TransformKey key)

Find a previously cached transform equivalent to the given one, and return its result.

pack-priv static LambdaFormEditor
private LambdaForm
makeArgumentCombinationForm(int pos, MethodType combinerType, boolean keepArguments, boolean dropResult)

private LambdaForm
makeArgumentCombinationForm(int pos, MethodType combinerType, int[] argPositions, boolean keepArguments, boolean dropResult)

private LambdaForm
makeRepeatedFilterForm(MethodType combinerType, int... positions)

private BoundMethodHandle.SpeciesData
pack-priv LambdaForm
private BoundMethodHandle.SpeciesData
pack-priv LambdaForm
permuteArgumentsForm(int skip, int[] reorder)

pack-priv static boolean
permutedTypesMatch(int[] reorder, LambdaForm.BasicType[] types, LambdaForm.Name[] names, int skip)

private LambdaForm
putInCache(LambdaFormEditor.TransformKey key, LambdaForm form)

Cache a transform with its result, and return that result.

pack-priv LambdaForm
spreadArgumentsForm(int pos, Class<?> arrayType, int arrayLength)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

ADD_ARGback to summary
private static final byte ADD_ARG
BIND_ARGback to summary
private static final byte BIND_ARG
COLLECT_ARGSback to summary
private static final byte COLLECT_ARGS
COLLECT_ARGS_TO_VOIDback to summary
private static final byte COLLECT_ARGS_TO_VOID
DUP_ARGback to summary
private static final byte DUP_ARG
FILTER_ARGback to summary
private static final byte FILTER_ARG
FILTER_RETURNback to summary
private static final byte FILTER_RETURN
FILTER_SELECT_ARGSback to summary
private static final byte FILTER_SELECT_ARGS
FOLD_ARGSback to summary
private static final byte FOLD_ARGS
FOLD_ARGS_TO_VOIDback to summary
private static final byte FOLD_ARGS_TO_VOID
FOLD_SELECT_ARGSback to summary
private static final byte FOLD_SELECT_ARGS
lambdaFormback to summary
pack-priv final LambdaForm lambdaForm
LOCAL_TYPESback to summary
private static final byte LOCAL_TYPES
MAX_CACHE_ARRAY_SIZEback to summary
private static final int MAX_CACHE_ARRAY_SIZE

Arbitrary but reasonable limits on Transform[] size for cache.

MIN_CACHE_ARRAY_SIZEback to summary
private static final int MIN_CACHE_ARRAY_SIZE

Arbitrary but reasonable limits on Transform[] size for cache.

PERMUTE_ARGSback to summary
private static final byte PERMUTE_ARGS
REPEAT_FILTER_ARGSback to summary
private static final byte REPEAT_FILTER_ARGS
SPREAD_ARGSback to summary
private static final byte SPREAD_ARGS

Constructor Detail

LambdaFormEditorback to summary
private LambdaFormEditor(LambdaForm lambdaForm)

Method Detail

addArgumentFormback to summary
pack-priv LambdaForm addArgumentForm(int pos, LambdaForm.BasicType type)
bindArgumentDback to summary
pack-priv BoundMethodHandle bindArgumentD(BoundMethodHandle mh, int pos, double value)
bindArgumentFback to summary
pack-priv BoundMethodHandle bindArgumentF(BoundMethodHandle mh, int pos, float value)
bindArgumentFormback to summary
pack-priv LambdaForm bindArgumentForm(int pos)
bindArgumentIback to summary
pack-priv BoundMethodHandle bindArgumentI(BoundMethodHandle mh, int pos, int value)
bindArgumentJback to summary
pack-priv BoundMethodHandle bindArgumentJ(BoundMethodHandle mh, int pos, long value)
bindArgumentLback to summary
pack-priv BoundMethodHandle bindArgumentL(BoundMethodHandle mh, int pos, Object value)
bindArgumentTypeback to summary
private MethodType bindArgumentType(BoundMethodHandle mh, int pos, LambdaForm.BasicType bt)
bufferback to summary
private LambdaFormBuffer buffer()
collectArgumentsFormback to summary
pack-priv LambdaForm collectArgumentsForm(int pos, MethodType collectorType)
collectReturnValueFormback to summary
pack-priv LambdaForm collectReturnValueForm(MethodType combinerType)
dupArgumentFormback to summary
pack-priv LambdaForm dupArgumentForm(int srcPos, int dstPos)
filterArgumentFormback to summary
pack-priv LambdaForm filterArgumentForm(int pos, LambdaForm.BasicType newType)
filterArgumentsFormback to summary
pack-priv LambdaForm filterArgumentsForm(int filterPos, MethodType combinerType, int... argPositions)
filterRepeatedArgumentFormback to summary
pack-priv LambdaForm filterRepeatedArgumentForm(LambdaForm.BasicType newType, int... argPositions)

This creates a LF that will repeatedly invoke some unary filter function at each of the given positions. This allows fewer LFs and BMH species classes to be generated in typical cases compared to building up the form by reapplying of filterArgumentForm(int,BasicType), and should do no worse in the worst case.

filterReturnFormback to summary
pack-priv LambdaForm filterReturnForm(LambdaForm.BasicType newType, boolean constantZero)
foldArgumentsFormback to summary
pack-priv LambdaForm foldArgumentsForm(int foldPos, boolean dropResult, MethodType combinerType)
foldArgumentsFormback to summary
pack-priv LambdaForm foldArgumentsForm(int foldPos, boolean dropResult, MethodType combinerType, int... argPositions)
formParametersMatchback to summary
private boolean formParametersMatch(LambdaForm form, LambdaForm.BasicType newType, int... argPositions)
getInCacheback to summary
private LambdaForm getInCache(LambdaFormEditor.TransformKey key)

Find a previously cached transform equivalent to the given one, and return its result.

lambdaFormEditorback to summary
pack-priv static LambdaFormEditor lambdaFormEditor(LambdaForm lambdaForm)
makeArgumentCombinationFormback to summary
private LambdaForm makeArgumentCombinationForm(int pos, MethodType combinerType, boolean keepArguments, boolean dropResult)
makeArgumentCombinationFormback to summary
private LambdaForm makeArgumentCombinationForm(int pos, MethodType combinerType, int[] argPositions, boolean keepArguments, boolean dropResult)
makeRepeatedFilterFormback to summary
private LambdaForm makeRepeatedFilterForm(MethodType combinerType, int... positions)
newSpeciesDataback to summary
private BoundMethodHandle.SpeciesData newSpeciesData(LambdaForm.BasicType type)
noteLoopLocalTypesFormback to summary
pack-priv LambdaForm noteLoopLocalTypesForm(int pos, LambdaForm.BasicType[] localTypes)
oldSpeciesDataback to summary
private BoundMethodHandle.SpeciesData oldSpeciesData()
permuteArgumentsFormback to summary
pack-priv LambdaForm permuteArgumentsForm(int skip, int[] reorder)
permutedTypesMatchback to summary
pack-priv static boolean permutedTypesMatch(int[] reorder, LambdaForm.BasicType[] types, LambdaForm.Name[] names, int skip)
putInCacheback to summary
private LambdaForm putInCache(LambdaFormEditor.TransformKey key, LambdaForm form)

Cache a transform with its result, and return that result. But if an equivalent transform has already been cached, return its result instead.

spreadArgumentsFormback to summary
pack-priv LambdaForm spreadArgumentsForm(int pos, Class<?> arrayType, int arrayLength)
java.lang.invoke back to summary

private final Class LambdaFormEditor.Transform

extends SoftReference<LambdaForm>
Class Inheritance

A description of a cached transform, possibly associated with the result of the transform. The logical content is a sequence of byte values, starting with a kind value. The sequence is unterminated, ending with an indefinite number of zero bytes. Sequences that are simple (short enough and with small enough values) pack into a 64-bit long. Tightly coupled with the TransformKey class, which is used to lookup existing Transforms.

Field Summary

Modifier and TypeField and Description
pack-priv final byte[]
pack-priv final long

Constructor Summary

AccessConstructor and Description
private
Transform(long packedBytes, byte[] fullBytes, LambdaForm result)

Method Summary

Modifier and TypeMethod and Description
public boolean
equals(Object
the reference object with which to compare.
obj
)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

private boolean
private boolean
public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this object.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.lang.ref.SoftReference:
get

Field Detail

fullBytesback to summary
pack-priv final byte[] fullBytes
packedBytesback to summary
pack-priv final long packedBytes

Constructor Detail

Transformback to summary
private Transform(long packedBytes, byte[] fullBytes, LambdaForm result)

Method Detail

equalsback to summary
public boolean equals(Object obj)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Parameters
obj:Object

the reference object with which to compare.

Returns:boolean

true if this object is the same as the obj argument; false otherwise.

Annotations
@Override
equalsback to summary
private boolean equals(LambdaFormEditor.TransformKey that)
equalsback to summary
private boolean equals(LambdaFormEditor.Transform that)
hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for this object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

a hash code value for this object

Annotations
@Override
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override
java.lang.invoke back to summary

private final Class LambdaFormEditor.TransformKey

extends Object
Class Inheritance

Used as a lookup key to find existing Transforms

Field Summary

Modifier and TypeField and Description
pack-priv final byte[]
private static final int
private static final int
private static final int
pack-priv final long
private static final boolean

Constructor Summary

AccessConstructor and Description
private
TransformKey(long packedBytes)

private
TransformKey(byte[] fullBytes)

private
TransformKey(long packedBytes, byte[] fullBytes)

Method Summary

Modifier and TypeMethod and Description
private static byte
bval(int b)

public boolean
equals(Object
the reference object with which to compare.
obj
)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

private boolean
private boolean
private static byte[]
fullBytes(int... byteValues)

public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this object.

private static boolean
inRange(int bitset)

private static int
ival(int b)

pack-priv static LambdaFormEditor.TransformKey
of(byte k, int b1)

pack-priv static LambdaFormEditor.TransformKey
of(byte b0, int b1, int b2)

pack-priv static LambdaFormEditor.TransformKey
of(byte b0, int b1, int b2, int b3)

pack-priv static LambdaFormEditor.TransformKey
of(byte kind, int... b123)

pack-priv static LambdaFormEditor.TransformKey
of(byte kind, int b1, int... b234)

pack-priv static LambdaFormEditor.TransformKey
of(byte kind, int b1, int b2, int... b345)

private static long
packedBytes(byte b0, int b1, int b2, int[] b345)

private static long
packedBytes(byte b0, int b1, int[] b234)

private static long
packedBytes(byte b0, int[] b123)

private static long
packedBytes(byte[] bytes)

private static long
packedBytes(int b0, int b1)

private static long
packedBytes(int b0, int b1, int b2)

private static long
packedBytes(int b0, int b1, int b2, int b3)

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

pack-priv LambdaFormEditor.Transform
Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait

Field Detail

fullBytesback to summary
pack-priv final byte[] fullBytes
PACKED_BYTE_MASKback to summary
private static final int PACKED_BYTE_MASK
PACKED_BYTE_MAX_LENGTHback to summary
private static final int PACKED_BYTE_MAX_LENGTH
PACKED_BYTE_SIZEback to summary
private static final int PACKED_BYTE_SIZE
packedBytesback to summary
pack-priv final long packedBytes
STRESS_TESTback to summary
private static final boolean STRESS_TEST

Constructor Detail

TransformKeyback to summary
private TransformKey(long packedBytes)
TransformKeyback to summary
private TransformKey(byte[] fullBytes)
TransformKeyback to summary
private TransformKey(long packedBytes, byte[] fullBytes)

Method Detail

bvalback to summary
private static byte bval(int b)
equalsback to summary
public boolean equals(Object obj)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Parameters
obj:Object

the reference object with which to compare.

Returns:boolean

true if this object is the same as the obj argument; false otherwise.

Annotations
@Override
equalsback to summary
private boolean equals(LambdaFormEditor.TransformKey that)
equalsback to summary
private boolean equals(LambdaFormEditor.Transform that)
fullBytesback to summary
private static byte[] fullBytes(int... byteValues)
hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for this object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

a hash code value for this object

Annotations
@Override
inRangeback to summary
private static boolean inRange(int bitset)
ivalback to summary
private static int ival(int b)
ofback to summary
pack-priv static LambdaFormEditor.TransformKey of(byte k, int b1)
ofback to summary
pack-priv static LambdaFormEditor.TransformKey of(byte b0, int b1, int b2)
ofback to summary
pack-priv static LambdaFormEditor.TransformKey of(byte b0, int b1, int b2, int b3)
ofback to summary
pack-priv static LambdaFormEditor.TransformKey of(byte kind, int... b123)
ofback to summary
pack-priv static LambdaFormEditor.TransformKey of(byte kind, int b1, int... b234)
ofback to summary
pack-priv static LambdaFormEditor.TransformKey of(byte kind, int b1, int b2, int... b345)
packedBytesback to summary
private static long packedBytes(byte b0, int b1, int b2, int[] b345)
packedBytesback to summary
private static long packedBytes(byte b0, int b1, int[] b234)
packedBytesback to summary
private static long packedBytes(byte b0, int[] b123)
packedBytesback to summary
private static long packedBytes(byte[] bytes)
packedBytesback to summary
private static long packedBytes(int b0, int b1)
packedBytesback to summary
private static long packedBytes(int b0, int b1, int b2)
packedBytesback to summary
private static long packedBytes(int b0, int b1, int b2, int b3)
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override
withResultback to summary
pack-priv LambdaFormEditor.Transform withResult(LambdaForm result)