org.objectweb.asm.commons
Class JSRInlinerAdapter.Instantiation

java.lang.Object
  extended by java.util.AbstractMap
      extended by org.objectweb.asm.commons.JSRInlinerAdapter.Instantiation
All Implemented Interfaces:
java.util.Map
Enclosing class:
JSRInlinerAdapter

private class JSRInlinerAdapter.Instantiation
extends java.util.AbstractMap

A class that represents an instantiation of a subroutine. Each instantiation has an associate "stack" --- which is a listing of those instantiations that were active when this particular instance of this subroutine was invoked. Each instantiation also has a map from the original labels of the program to the labels appropriate for this instantiation, and finally a label to return to.


Nested Class Summary
 
Nested classes/interfaces inherited from class java.util.AbstractMap
java.util.AbstractMap.SimpleEntry<K,V>, java.util.AbstractMap.SimpleImmutableEntry<K,V>
 
Nested classes/interfaces inherited from interface java.util.Map
java.util.Map.Entry<K,V>
 
Field Summary
(package private)  JSRInlinerAdapter.Instantiation previous
          Previous instantiations; the stack must be statically predictable to be inlinable.
 java.util.Map rangeTable
          This table maps Labels from the original source to Labels pointing at code specific to this instantiation, for use in remapping try/catch blocks,as well as gotos.
 LabelNode returnLabel
          All returns for this instantiation will be mapped to this label
 JSRInlinerAdapter.Subroutine subroutine
          The subroutine this is an instantiation of.
 
Constructor Summary
JSRInlinerAdapter.Instantiation(JSRInlinerAdapter.Instantiation prev, JSRInlinerAdapter.Subroutine sub)
           
 
Method Summary
 java.util.Set entrySet()
           
 JSRInlinerAdapter.Instantiation findOwner(int i)
          Returns the "owner" of a particular instruction relative to this instantiation: the owner referes to the Instantiation which will emit the version of this instruction that we will execute.
 java.lang.Object get(java.lang.Object o)
           
 LabelNode gotoLabel(LabelNode l)
          Looks up the label l in the gotoTable, thus translating it from a Label in the original code, to a Label in the inlined code that is appropriate for use by an instruction that branched to the original label.
 LabelNode rangeLabel(LabelNode l)
          Looks up the label l in the rangeTable, thus translating it from a Label in the original code, to a Label in the inlined code that is appropriate for use by an try/catch or variable use annotation.
 
Methods inherited from class java.util.AbstractMap
clear, clone, containsKey, containsValue, equals, hashCode, isEmpty, keySet, put, putAll, remove, size, toString, values
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

previous

final JSRInlinerAdapter.Instantiation previous
Previous instantiations; the stack must be statically predictable to be inlinable.


subroutine

public final JSRInlinerAdapter.Subroutine subroutine
The subroutine this is an instantiation of.


rangeTable

public final java.util.Map rangeTable
This table maps Labels from the original source to Labels pointing at code specific to this instantiation, for use in remapping try/catch blocks,as well as gotos. Note that in the presence of dual citizens instructions, that is, instructions which belong to more than one subroutine due to the merging of control flow without a RET instruction, we will map the target label of a GOTO to the label used by the instantiation lowest on the stack. This avoids code duplication during inlining in most cases.

See Also:
findOwner(int)

returnLabel

public final LabelNode returnLabel
All returns for this instantiation will be mapped to this label

Constructor Detail

JSRInlinerAdapter.Instantiation

public JSRInlinerAdapter.Instantiation(JSRInlinerAdapter.Instantiation prev,
                                       JSRInlinerAdapter.Subroutine sub)
Method Detail

findOwner

public JSRInlinerAdapter.Instantiation findOwner(int i)
Returns the "owner" of a particular instruction relative to this instantiation: the owner referes to the Instantiation which will emit the version of this instruction that we will execute. Typically, the return value is either this or null. this indicates that this instantiation will generate the version of this instruction that we will execute, and null indicates that this instantiation never executes the given instruction. Sometimes, however, an instruction can belong to multiple subroutines; this is called a "dual citizen" instruction (though it may belong to more than 2 subroutines), and occurs when multiple subroutines branch to common points of control. In this case, the owner is the subroutine that appears lowest on the stack, and which also owns the instruction in question.

Parameters:
i - the index of the instruction in the original code
Returns:
the "owner" of a particular instruction relative to this instantiation.

gotoLabel

public LabelNode gotoLabel(LabelNode l)
Looks up the label l in the gotoTable, thus translating it from a Label in the original code, to a Label in the inlined code that is appropriate for use by an instruction that branched to the original label.

Parameters:
l - The label we will be translating
Returns:
a label for use by a branch instruction in the inlined code
See Also:
#gotoTable

rangeLabel

public LabelNode rangeLabel(LabelNode l)
Looks up the label l in the rangeTable, thus translating it from a Label in the original code, to a Label in the inlined code that is appropriate for use by an try/catch or variable use annotation.

Parameters:
l - The label we will be translating
Returns:
a label for use by a try/catch or variable annotation in the original code
See Also:
rangeTable

entrySet

public java.util.Set entrySet()
Specified by:
entrySet in interface java.util.Map
Specified by:
entrySet in class java.util.AbstractMap

get

public java.lang.Object get(java.lang.Object o)
Specified by:
get in interface java.util.Map
Overrides:
get in class java.util.AbstractMap