jdk.internal.org.objectweb.asm.MethodVisitor
that removes JSR instructions and inlines the
referenced subroutines.
Modifier and Type | Class and Description |
---|---|
private class | JSRInlinerAdapter.Instantiation
An instantiation of a subroutine. |
Modifier and Type | Field and Description |
---|---|
private final BitSet | mainSubroutineInsns
The instructions that belong to the main "subroutine". |
pack-priv final BitSet | sharedSubroutineInsns
The instructions that belong to more that one subroutine. |
private final Map | subroutinesInsns
The instructions that belong to each subroutine. |
Access | Constructor and Description |
---|---|
public | JSRInlinerAdapter(final MethodVisitor
the method visitor to send the resulting inlined method code to, or methodVisitor, final int
null .the method's access flags. access, final String the method's name. name, final String the method's descriptor. descriptor, final String the method's signature. May be null. signature, final String[] the internal names of the method's exception classes. May be null. exceptions)Constructs a new |
protected | JSRInlinerAdapter(final int
the ASM API version implemented by this visitor. Must be one of the api, final MethodVisitor ASM x values in Opcodes .the method visitor to send the resulting inlined method code to, or methodVisitor, final int
null .the method's access flags (see access, final String Opcodes ). This parameter also indicates if
the method is synthetic and/or deprecated.the method's name. name, final String the method's descriptor. descriptor, final String the method's signature. May be null. signature, final String[] the internal names of the method's exception classes. May be null. exceptions)Constructs a new |
Modifier and Type | Method and Description |
---|---|
private void | emitCode()
Creates the new instructions, inlining each instantiation of each subroutine until the code is fully elaborated. |
private void | emitInstantiation(final JSRInlinerAdapter.
the instantiation that must be performed. instantiation,list of the instantiations that remain to be done. worklist,the instruction list to which the instantiated code must be appended. newInstructions, final List<TryCatchBlockNode> the exception handler list to which the instantiated handlers must be
appended. newTryCatchBlocks, final List<LocalVariableNode> the local variables list to which the instantiated local variables
must be appended. newLocalVariables)Emits an instantiation of a subroutine, specified by |
private void | findReachableInsns(final int
the index of an instruction of the subroutine. insnIndex, final BitSet where the indices of the instructions of the subroutine must be stored. subroutineInsns, final BitSet the indices of the instructions that have been visited so far (including in
previous calls to this method). This bitset is updated by this method each time a new
instruction is visited. It is used to make sure each instruction is visited at most once. visitedInsns)Finds the instructions that are reachable from the given instruction, without following any JSR instruction nor any exception handler. |
private void | findSubroutineInsns(final int
the index of the first instruction of the subroutine. startInsnIndex, final BitSet where the indices of the instructions of the subroutine must be stored. subroutineInsns, final BitSet the indices of the instructions that have been visited so far (including in
previous calls to this method). This bitset is updated by this method each time a new
instruction is visited. It is used to make sure each instruction is visited at most once. visitedInsns)Finds the instructions that belong to the subroutine starting at the given instruction index. |
private void | |
public void | visitEnd()
Overrides jdk. |
public void | visitJumpInsn(final int
the opcode of the type instruction to be visited. This opcode is either IFEQ,
IFNE, IFLT, IFGE, IFGT, IFLE, IF_ICMPEQ, IF_ICMPNE, IF_ICMPLT, IF_ICMPGE, IF_ICMPGT,
IF_ICMPLE, IF_ACMPEQ, IF_ACMPNE, GOTO, JSR, IFNULL or IFNONNULL. opcode, final Label the operand of the instruction to be visited. This operand is a label that
designates the instruction to which the jump instruction may jump. label)Overrides jdk. |
mainSubroutineInsns | back to summary |
---|---|
private final BitSet mainSubroutineInsns The instructions that belong to the main "subroutine". Bit i is set iff instruction at index i belongs to this main "subroutine". |
sharedSubroutineInsns | back to summary |
---|---|
pack-priv final BitSet sharedSubroutineInsns The instructions that belong to more that one subroutine. Bit i is set iff instruction at index i belongs to more than one subroutine. |
subroutinesInsns | back to summary |
---|---|
private final Map<LabelNode, BitSet> subroutinesInsns The instructions that belong to each subroutine. For each label which is the target of a JSR instruction, bit i of the corresponding BitSet in this map is set iff instruction at index i belongs to this subroutine. |
JSRInlinerAdapter | back to summary |
---|---|
public JSRInlinerAdapter(final MethodVisitor methodVisitor, final int access, final String name, final String descriptor, final String signature, final String[] exceptions) Constructs a new
|
JSRInlinerAdapter | back to summary |
---|---|
protected JSRInlinerAdapter(final int api, final MethodVisitor methodVisitor, final int access, final String name, final String descriptor, final String signature, final String[] exceptions) Constructs a new
|
emitCode | back to summary |
---|---|
private void emitCode() Creates the new instructions, inlining each instantiation of each subroutine until the code is fully elaborated. |
emitInstantiation | back to summary |
---|---|
private void emitInstantiation(final JSRInlinerAdapter. Emits an instantiation of a subroutine, specified by
|
findReachableInsns | back to summary |
---|---|
private void findReachableInsns(final int insnIndex, final BitSet subroutineInsns, final BitSet visitedInsns) Finds the instructions that are reachable from the given instruction, without following any JSR instruction nor any exception handler. For this the control flow graph is visited with a depth first search.
|
findSubroutineInsns | back to summary |
---|---|
private void findSubroutineInsns(final int startInsnIndex, final BitSet subroutineInsns, final BitSet visitedInsns) Finds the instructions that belong to the subroutine starting at the given instruction index. For this the control flow graph is visited with a depth first search (this includes the normal control flow and the exception handlers).
|
findSubroutinesInsns | back to summary |
---|---|
private void findSubroutinesInsns() Determines, for each instruction, to which subroutine(s) it belongs. |
visitEnd | back to summary |
---|---|
public void visitEnd() Overrides jdk. Doc from jdk. Visits the end of the method. This method, which is the last one to be called, is used to inform the visitor that all the annotations and attributes of the method have been visited.
|
visitJumpInsn | back to summary |
---|---|
public void visitJumpInsn(final int opcode, final Label label) Overrides jdk. Doc from jdk. Visits a jump instruction. A jump instruction is an instruction that may jump to another instruction.
|
Modifier and Type | Field and Description |
---|---|
pack-priv final Map | clonedLabels
A map from labels from the original code to labels pointing at code specific to this instantiation, for use in remapping try/catch blocks, as well as jumps. |
pack-priv final JSRInlinerAdapter. | parent
The instantiation from which this one was created (or null for the instantiation of the main "subroutine"). |
pack-priv final LabelNode | returnLabel
The return label for this instantiation, to which all original returns will be mapped. |
pack-priv final BitSet | subroutineInsns
The original instructions that belong to the subroutine which is instantiated. |
Access | Constructor and Description |
---|---|
pack-priv |
Modifier and Type | Method and Description |
---|---|
public Set | entrySet()
Implements abstract java. Implements java. Set view of the mappings contained in this map.
|
public boolean | equals(final Object
object to be compared for equality with this map other)Overrides java. Implements java. |
pack-priv JSRInlinerAdapter. | Returns: the "owner" of a particular instruction relative to this instantiation.the index of an instruction in the original code. insnIndex)Returns the "owner" of a particular instruction relative to this instantiation: the owner refers to the Instantiation which will emit the version of this instruction that we will execute. |
public LabelNode | get(final Object
the key whose associated value is to be returned key)Overrides java. Implements java. null if this map contains no mapping for the key.
|
pack-priv LabelNode | Returns: a clone of the given label for use by a try/catch block or a variable annotation in the inlined code.a label of the original code. labelNode)Returns the clone of the given original label that is appropriate for use by a try/catch block or a variable annotation. |
pack-priv LabelNode | Returns: a clone of the given label for use in a jump instruction in the inlined code.a label of the original code. labelNode)Returns the clone of the given original label that is appropriate for use in a jump instruction. |
public int | hashCode()
Overrides java. Implements java. |
clonedLabels | back to summary |
---|---|
pack-priv final Map<LabelNode, LabelNode> clonedLabels A map from labels from the original code to labels pointing at code specific to this instantiation, for use in remapping try/catch blocks, as well as jumps. Note that in the presence of instructions belonging to several subroutines, we map the target label of a GOTO to the label used by the oldest instantiation (parent instantiations are older than their children). This avoids code duplication during inlining in most cases. |
parent | back to summary |
---|---|
pack-priv final JSRInlinerAdapter. The instantiation from which this one was created (or null for the instantiation of the main "subroutine"). |
returnLabel | back to summary |
---|---|
pack-priv final LabelNode returnLabel The return label for this instantiation, to which all original returns will be mapped. |
subroutineInsns | back to summary |
---|---|
pack-priv final BitSet subroutineInsns The original instructions that belong to the subroutine which is instantiated. Bit i is set iff instruction at index i belongs to this subroutine. |
Instantiation | back to summary |
---|---|
pack-priv Instantiation(final JSRInlinerAdapter. |
entrySet | back to summary |
---|---|
public Set Implements abstract java. Implements java. Doc from java. Returns a |
equals | back to summary |
---|---|
public boolean equals(final Object other) Overrides java. Implements java. Doc from java. Compares the specified object with this map for equality. Returns
|
findOwner | back to summary |
---|---|
pack-priv JSRInlinerAdapter. Returns the "owner" of a particular instruction relative to this instantiation: the owner refers to the Instantiation which will emit the version of this instruction that we will execute. Typically, the return value is either Sometimes, however, an instruction can belong to multiple subroutines; this is called a shared instruction, and occurs when multiple subroutines branch to common points of control. In this case, the owner is the oldest instantiation which owns the instruction in question (parent instantiations are older than their children).
|
get | back to summary |
---|---|
public LabelNode get(final Object key) Overrides java. Implements java. Doc from java. Returns the value to which the specified key is mapped,
or More formally, if this map contains a mapping from a key
If this map permits null values, then a return value of
|
getClonedLabel | back to summary |
---|---|
pack-priv LabelNode getClonedLabel(final LabelNode labelNode) Returns the clone of the given original label that is appropriate for use by a try/catch block or a variable annotation. |
getClonedLabelForJumpInsn | back to summary |
---|---|
pack-priv LabelNode getClonedLabelForJumpInsn(final LabelNode labelNode) Returns the clone of the given original label that is appropriate for use in a jump instruction. |
hashCode | back to summary |
---|---|
public int hashCode() Overrides java. Implements java. Doc from java. Returns the hash code value for this map. The hash code of a map is
defined to be the sum of the hash codes of each entry in the map's
|