Package com.saxonica.ee.bytecode.util
Class GeneratedMethodInfo
- java.lang.Object
-
- com.saxonica.ee.bytecode.util.GeneratedMethodInfo
-
public class GeneratedMethodInfo extends java.lang.Object
Information about the current method whose bytecode is being generated
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
GeneratedMethodInfo.LocalSlotInfo
-
Field Summary
Fields Modifier and Type Field Description Generator
currentGenerator
boolean
debug
java.util.Set<LabelInfo>
labelMap
java.util.List<GeneratedMethodInfo.LocalSlotInfo>
slotList
-
Constructor Summary
Constructors Constructor Description GeneratedMethodInfo()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
allocateLocal(java.lang.Class theClass)
Allocate a local bytecode variable.void
checkLabels()
Check (on completion of the method) that all labels that have been used have also been markedint
getContextVariablePosition()
Generator
getCurrentGenerator()
int
getOutputterPosition()
LabelInfo
getTailCallLabel()
Get the label to act as the target of a jump for a self-recursive tail call.java.util.Stack<LabelInfo>
getXslIterateBreakLabelStack()
Get the stack of labels representing entry points to xsl:iterate instructions within this methodjava.util.Stack<LabelInfo>
getXslIterateLoopLabelStack()
Get the stack of labels representing entry points to xsl:iterate instructions within this methodboolean
isContextVariableAnArgument()
boolean
isOutputterInitialized()
LabelInfo
newLabel(java.lang.String name)
Allocate a new label within the methodvoid
placeLabel(LabelInfo labelInfo)
Place a label at the current position in the bytecodeLabelInfo
placeNewLabel(java.lang.String name)
Place a new label at the current position in the bytecodevoid
popContextVariableInfo()
void
popOutputterInfo()
void
pushContextVariableInfo(int position, boolean isArgument)
void
pushOutputterInfo(int position)
void
releaseLocal(int slotNumber)
Return a local variable to the pool for reusevoid
setTailCallLabel(LabelInfo label)
Supply the label to act as the target of a jump for a self-recursive tail call.
-
-
-
Field Detail
-
currentGenerator
public Generator currentGenerator
-
debug
public boolean debug
-
labelMap
public java.util.Set<LabelInfo> labelMap
-
slotList
public java.util.List<GeneratedMethodInfo.LocalSlotInfo> slotList
-
-
Method Detail
-
pushContextVariableInfo
public void pushContextVariableInfo(int position, boolean isArgument)
-
pushOutputterInfo
public void pushOutputterInfo(int position)
-
popContextVariableInfo
public void popContextVariableInfo()
-
popOutputterInfo
public void popOutputterInfo()
-
getContextVariablePosition
public int getContextVariablePosition()
-
getOutputterPosition
public int getOutputterPosition()
-
isOutputterInitialized
public boolean isOutputterInitialized()
-
isContextVariableAnArgument
public boolean isContextVariableAnArgument()
-
getCurrentGenerator
public Generator getCurrentGenerator()
-
newLabel
public LabelInfo newLabel(java.lang.String name)
Allocate a new label within the method- Parameters:
name
- a diagnostic name for the label, used if errors are reported- Returns:
- the constructed label information
-
placeLabel
public void placeLabel(LabelInfo labelInfo)
Place a label at the current position in the bytecode- Parameters:
labelInfo
- the label to be placed (marked)- Throws:
java.lang.AssertionError
- if the label has already been marked
-
placeNewLabel
public LabelInfo placeNewLabel(java.lang.String name)
Place a new label at the current position in the bytecode- Parameters:
name
- the name of the label- Returns:
- the Label that has been placed
- Throws:
java.lang.AssertionError
- if the label has already been marked
-
checkLabels
public void checkLabels()
Check (on completion of the method) that all labels that have been used have also been marked- Throws:
java.lang.AssertionError
- if this is not the case
-
getXslIterateLoopLabelStack
public java.util.Stack<LabelInfo> getXslIterateLoopLabelStack()
Get the stack of labels representing entry points to xsl:iterate instructions within this method- Returns:
- the stack of labels
-
getXslIterateBreakLabelStack
public java.util.Stack<LabelInfo> getXslIterateBreakLabelStack()
Get the stack of labels representing entry points to xsl:iterate instructions within this method- Returns:
- the stack of labels
-
allocateLocal
public int allocateLocal(java.lang.Class theClass)
Allocate a local bytecode variable. Reuse an existing slot if available- Parameters:
theClass
- the class of value to be held in the local variable- Returns:
- the slot number on the stack to be used for the variable
-
releaseLocal
public void releaseLocal(int slotNumber)
Return a local variable to the pool for reuse- Parameters:
slotNumber
- the slot number to be released for reuse
-
setTailCallLabel
public void setTailCallLabel(LabelInfo label)
Supply the label to act as the target of a jump for a self-recursive tail call. Before jumping to this label, the code implementing the function call must adjust the stack frame to make sure that it contains the parameters for the new call.- Parameters:
label
- the target label for a tail call loop (or null if there is to be no tail call)
-
getTailCallLabel
public LabelInfo getTailCallLabel()
Get the label to act as the target of a jump for a self-recursive tail call. Before jumping to this label, the code implementing the function call must adjust the stack frame to make sure that it contains the parameters for the new call.- Returns:
- the designated label (which will be null if not in the body of a tail-recursive function)
-
-