Top Description Inners Fields Constructors Methods
com.sun.tools.javac.jvm

public Class CRTable

extends Object
implements CRTFlags
Class Inheritance
All Implemented Interfaces
com.sun.tools.javac.jvm.CRTFlags
Imports
java.util.*, com.sun.tools.javac.resources.CompilerProperties.Warnings, com.sun.tools.javac.tree.*, com.sun.tools.javac.tree.JCTree.*, .EndPosTable, .JCTree.JCSwitchExpression, com.sun.tools.javac.util.*, .List

This class contains the CharacterRangeTable for some method and the hashtable for mapping trees or lists of trees to their ending positions.

This is NOT part of any supported API. If you write code that depends on this, you do so at your own risk. This code and its internal interfaces are subject to change or deletion without notice.

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class
CRTable.CRTEntry

This class contains a CharacterRangeTableEntry.

pack-priv class
CRTable.SourceComputer

This class contains methods to compute source positions for trees.

pack-priv static class
CRTable.SourceRange

This class contains source positions for some tree or list of trees.

Field Summary

Modifier and TypeField and Description
private final boolean
private EndPosTable
endPosTable

The object for ending positions stored in the parser.

private ListBuffer<CRTable.CRTEntry>
entries

The list of CRTable entries.

pack-priv JCTree.JCMethodDecl
methodTree

The tree of the method this table is intended for.

private Map<Object, CRTable.SourceRange>
positions

The hashtable for source positions.

Constructor Summary

AccessConstructor and Description
public
CRTable(JCTree.JCMethodDecl tree, EndPosTable endPosTable)

Constructor

Method Summary

Modifier and TypeMethod and Description
private int
encodePosition(int pos, Position.LineMap lineMap, Log log)

Source file positions in CRT are integers in the format: line-number << LINESHIFT + column-number

private String
getTypes(int flags)

Return string describing flags enabled.

public int
length()

Return the number of the entries.

public void
put(Object
The tree or the list of trees for which we are storing the code pointers.
tree
,
int
The set of flags designating type of the entry.
flags
,
int
The starting code position.
startPc
,
int
The ending code position.
endPc
)

Create a new CRTEntry and add it to the entries.

public int
writeCRT(ByteBuffer
The buffer to write bytecodes to.
databuf
,
Position.LineMap lineMap, Log log)

Compute source positions and write CRT to the databuf.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

crtDebugback to summary
private final boolean crtDebug
endPosTableback to summary
private EndPosTable endPosTable

The object for ending positions stored in the parser.

entriesback to summary
private ListBuffer<CRTable.CRTEntry> entries

The list of CRTable entries.

methodTreeback to summary
pack-priv JCTree.JCMethodDecl methodTree

The tree of the method this table is intended for. We should traverse this tree to get source ranges.

positionsback to summary
private Map<Object, CRTable.SourceRange> positions

The hashtable for source positions.

Constructor Detail

CRTableback to summary
public CRTable(JCTree.JCMethodDecl tree, EndPosTable endPosTable)

Constructor

Method Detail

encodePositionback to summary
private int encodePosition(int pos, Position.LineMap lineMap, Log log)

Source file positions in CRT are integers in the format: line-number << LINESHIFT + column-number

getTypesback to summary
private String getTypes(int flags)

Return string describing flags enabled.

lengthback to summary
public int length()

Return the number of the entries.

putback to summary
public void put(Object tree, int flags, int startPc, int endPc)

Create a new CRTEntry and add it to the entries.

Parameters
tree:Object

The tree or the list of trees for which we are storing the code pointers.

flags:int

The set of flags designating type of the entry.

startPc:int

The starting code position.

endPc:int

The ending code position.

writeCRTback to summary
public int writeCRT(ByteBuffer databuf, Position.LineMap lineMap, Log log)

Compute source positions and write CRT to the databuf.

Parameters
databuf:ByteBuffer

The buffer to write bytecodes to.

com.sun.tools.javac.jvm back to summary

pack-priv Class CRTable.CRTEntry

extends Object
Class Inheritance

This class contains a CharacterRangeTableEntry.

Field Summary

Modifier and TypeField and Description
pack-priv int
endPc

The ending code position of this entry.

pack-priv int
flags

The flags described in the CharacterRangeTable spec.

pack-priv int
startPc

The starting code position of this entry.

pack-priv Object
tree

A tree or a list of trees to obtain source positions.

Constructor Summary

AccessConstructor and Description
pack-priv
CRTEntry(Object tree, int flags, int startPc, int endPc)

Constructor

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

endPcback to summary
pack-priv int endPc

The ending code position of this entry.

flagsback to summary
pack-priv int flags

The flags described in the CharacterRangeTable spec.

startPcback to summary
pack-priv int startPc

The starting code position of this entry.

treeback to summary
pack-priv Object tree

A tree or a list of trees to obtain source positions.

Constructor Detail

CRTEntryback to summary
pack-priv CRTEntry(Object tree, int flags, int startPc, int endPc)

Constructor

com.sun.tools.javac.jvm back to summary

pack-priv Class CRTable.SourceComputer

extends Visitor
Class Inheritance

This class contains methods to compute source positions for trees. Extends Tree.Visitor to traverse the abstract syntax tree.

Field Summary

Modifier and TypeField and Description
pack-priv CRTable.SourceRange
result

The result of the tree traversal methods.

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public CRTable.SourceRange
csp(JCTree tree)

Visitor method: compute source positions for a single node.

public CRTable.SourceRange
csp(List<? extends JCTree> trees)

Visitor method: compute source positions for a list of nodes.

public CRTable.SourceRange
cspCases(List<JCTree.JCCase> trees)

Visitor method: compute source positions for a list of case blocks of switch statements.

public CRTable.SourceRange
cspCatchers(List<JCTree.JCCatch> trees)

Visitor method: compute source positions for a list of catch clauses in try statements.

public int
endPos(JCTree tree)

The end position of given tree, if it has defined endpos, NOPOS otherwise.

public int
startPos(JCTree tree)

The start position of given tree.

public void
public void
public void
public void
public void
public void
public void
public void
public void
public void
public void
public void
public void
public void
public void
public void
public void
public void
public void
public void
public void
public void
public void
public void
public void
public void
public void
public void
public void
public void
public void
public void
public void
public void
public void
public void
public void
public void
public void
public void
public void
public void
public void
public void
public void
public void
public void
public void
public void
public void
Inherited from com.sun.tools.javac.tree.JCTree.Visitor:
visitAnnotatedTypevisitAnnotationvisitAnyPatternvisitBindingPatternvisitClassDefvisitExportsvisitImportvisitLambdavisitModifiersvisitModuleDefvisitOpensvisitPackageDefvisitProvidesvisitRecordPatternvisitReferencevisitRequiresvisitStringTemplatevisitTopLevelvisitTypeBoundKindvisitTypeIntersectionvisitUses

Field Detail

resultback to summary
pack-priv CRTable.SourceRange result

The result of the tree traversal methods.

Constructor Detail

SourceComputerback to summary
pack-priv SourceComputer()

Method Detail

cspback to summary
public CRTable.SourceRange csp(JCTree tree)

Visitor method: compute source positions for a single node.

cspback to summary
public CRTable.SourceRange csp(List<? extends JCTree> trees)

Visitor method: compute source positions for a list of nodes.

cspCasesback to summary
public CRTable.SourceRange cspCases(List<JCTree.JCCase> trees)

Visitor method: compute source positions for a list of case blocks of switch statements.

cspCatchersback to summary
public CRTable.SourceRange cspCatchers(List<JCTree.JCCatch> trees)

Visitor method: compute source positions for a list of catch clauses in try statements.

endPosback to summary
public int endPos(JCTree tree)

The end position of given tree, if it has defined endpos, NOPOS otherwise.

startPosback to summary
public int startPos(JCTree tree)

The start position of given tree.

visitApplyback to summary
public void visitApply(JCTree.JCMethodInvocation tree)

Overrides com.sun.tools.javac.tree.JCTree.Visitor.visitApply.

visitAssertback to summary
public void visitAssert(JCTree.JCAssert tree)

Overrides com.sun.tools.javac.tree.JCTree.Visitor.visitAssert.

visitAssignback to summary
public void visitAssign(JCTree.JCAssign tree)

Overrides com.sun.tools.javac.tree.JCTree.Visitor.visitAssign.

visitAssignopback to summary
public void visitAssignop(JCTree.JCAssignOp tree)

Overrides com.sun.tools.javac.tree.JCTree.Visitor.visitAssignop.

visitBinaryback to summary
public void visitBinary(JCTree.JCBinary tree)

Overrides com.sun.tools.javac.tree.JCTree.Visitor.visitBinary.

visitBlockback to summary
public void visitBlock(JCTree.JCBlock tree)

Overrides com.sun.tools.javac.tree.JCTree.Visitor.visitBlock.

visitBreakback to summary
public void visitBreak(JCTree.JCBreak tree)

Overrides com.sun.tools.javac.tree.JCTree.Visitor.visitBreak.

visitCaseback to summary
public void visitCase(JCTree.JCCase tree)

Overrides com.sun.tools.javac.tree.JCTree.Visitor.visitCase.

visitCatchback to summary
public void visitCatch(JCTree.JCCatch tree)

Overrides com.sun.tools.javac.tree.JCTree.Visitor.visitCatch.

visitConditionalback to summary
public void visitConditional(JCTree.JCConditional tree)

Overrides com.sun.tools.javac.tree.JCTree.Visitor.visitConditional.

visitConstantCaseLabelback to summary
public void visitConstantCaseLabel(JCTree.JCConstantCaseLabel tree)

Overrides com.sun.tools.javac.tree.JCTree.Visitor.visitConstantCaseLabel.

Annotations
@Override
visitContinueback to summary
public void visitContinue(JCTree.JCContinue tree)

Overrides com.sun.tools.javac.tree.JCTree.Visitor.visitContinue.

visitDefaultCaseLabelback to summary
public void visitDefaultCaseLabel(JCTree.JCDefaultCaseLabel that)

Overrides com.sun.tools.javac.tree.JCTree.Visitor.visitDefaultCaseLabel.

Annotations
@Override
visitDoLoopback to summary
public void visitDoLoop(JCTree.JCDoWhileLoop tree)

Overrides com.sun.tools.javac.tree.JCTree.Visitor.visitDoLoop.

visitErroneousback to summary
public void visitErroneous(JCTree.JCErroneous tree)

Overrides com.sun.tools.javac.tree.JCTree.Visitor.visitErroneous.

visitExecback to summary
public void visitExec(JCTree.JCExpressionStatement tree)

Overrides com.sun.tools.javac.tree.JCTree.Visitor.visitExec.

visitForeachLoopback to summary
public void visitForeachLoop(JCTree.JCEnhancedForLoop tree)

Overrides com.sun.tools.javac.tree.JCTree.Visitor.visitForeachLoop.

visitForLoopback to summary
public void visitForLoop(JCTree.JCForLoop tree)

Overrides com.sun.tools.javac.tree.JCTree.Visitor.visitForLoop.

visitIdentback to summary
public void visitIdent(JCTree.JCIdent tree)

Overrides com.sun.tools.javac.tree.JCTree.Visitor.visitIdent.

visitIfback to summary
public void visitIf(JCTree.JCIf tree)

Overrides com.sun.tools.javac.tree.JCTree.Visitor.visitIf.

visitIndexedback to summary
public void visitIndexed(JCTree.JCArrayAccess tree)

Overrides com.sun.tools.javac.tree.JCTree.Visitor.visitIndexed.

visitLabelledback to summary
public void visitLabelled(JCTree.JCLabeledStatement tree)

Overrides com.sun.tools.javac.tree.JCTree.Visitor.visitLabelled.

visitLetExprback to summary
public void visitLetExpr(JCTree.LetExpr tree)

Overrides com.sun.tools.javac.tree.JCTree.Visitor.visitLetExpr.

Annotations
@Override
visitLiteralback to summary
public void visitLiteral(JCTree.JCLiteral tree)

Overrides com.sun.tools.javac.tree.JCTree.Visitor.visitLiteral.

visitMethodDefback to summary
public void visitMethodDef(JCTree.JCMethodDecl tree)

Overrides com.sun.tools.javac.tree.JCTree.Visitor.visitMethodDef.

visitNewArrayback to summary
public void visitNewArray(JCTree.JCNewArray tree)

Overrides com.sun.tools.javac.tree.JCTree.Visitor.visitNewArray.

visitNewClassback to summary
public void visitNewClass(JCTree.JCNewClass tree)

Overrides com.sun.tools.javac.tree.JCTree.Visitor.visitNewClass.

visitParensback to summary
public void visitParens(JCTree.JCParens tree)

Overrides com.sun.tools.javac.tree.JCTree.Visitor.visitParens.

visitPatternCaseLabelback to summary
public void visitPatternCaseLabel(JCTree.JCPatternCaseLabel tree)

Overrides com.sun.tools.javac.tree.JCTree.Visitor.visitPatternCaseLabel.

Annotations
@Override
visitReturnback to summary
public void visitReturn(JCTree.JCReturn tree)

Overrides com.sun.tools.javac.tree.JCTree.Visitor.visitReturn.

visitSelectback to summary
public void visitSelect(JCTree.JCFieldAccess tree)

Overrides com.sun.tools.javac.tree.JCTree.Visitor.visitSelect.

visitSkipback to summary
public void visitSkip(JCTree.JCSkip tree)

Overrides com.sun.tools.javac.tree.JCTree.Visitor.visitSkip.

visitSwitchback to summary
public void visitSwitch(JCTree.JCSwitch tree)

Overrides com.sun.tools.javac.tree.JCTree.Visitor.visitSwitch.

visitSwitchExpressionback to summary
public void visitSwitchExpression(JCTree.JCSwitchExpression tree)

Overrides com.sun.tools.javac.tree.JCTree.Visitor.visitSwitchExpression.

Annotations
@Override
visitSynchronizedback to summary
public void visitSynchronized(JCTree.JCSynchronized tree)

Overrides com.sun.tools.javac.tree.JCTree.Visitor.visitSynchronized.

visitThrowback to summary
public void visitThrow(JCTree.JCThrow tree)

Overrides com.sun.tools.javac.tree.JCTree.Visitor.visitThrow.

visitTreeback to summary
public void visitTree(JCTree tree)

Overrides com.sun.tools.javac.tree.JCTree.Visitor.visitTree.

visitTryback to summary
public void visitTry(JCTree.JCTry tree)

Overrides com.sun.tools.javac.tree.JCTree.Visitor.visitTry.

visitTypeApplyback to summary
public void visitTypeApply(JCTree.JCTypeApply tree)

Overrides com.sun.tools.javac.tree.JCTree.Visitor.visitTypeApply.

visitTypeArrayback to summary
public void visitTypeArray(JCTree.JCArrayTypeTree tree)

Overrides com.sun.tools.javac.tree.JCTree.Visitor.visitTypeArray.

visitTypeCastback to summary
public void visitTypeCast(JCTree.JCTypeCast tree)

Overrides com.sun.tools.javac.tree.JCTree.Visitor.visitTypeCast.

visitTypeIdentback to summary
public void visitTypeIdent(JCTree.JCPrimitiveTypeTree tree)

Overrides com.sun.tools.javac.tree.JCTree.Visitor.visitTypeIdent.

visitTypeParameterback to summary
public void visitTypeParameter(JCTree.JCTypeParameter tree)

Overrides com.sun.tools.javac.tree.JCTree.Visitor.visitTypeParameter.

visitTypeTestback to summary
public void visitTypeTest(JCTree.JCInstanceOf tree)

Overrides com.sun.tools.javac.tree.JCTree.Visitor.visitTypeTest.

visitTypeUnionback to summary
public void visitTypeUnion(JCTree.JCTypeUnion tree)

Overrides com.sun.tools.javac.tree.JCTree.Visitor.visitTypeUnion.

Annotations
@Override
visitUnaryback to summary
public void visitUnary(JCTree.JCUnary tree)

Overrides com.sun.tools.javac.tree.JCTree.Visitor.visitUnary.

visitVarDefback to summary
public void visitVarDef(JCTree.JCVariableDecl tree)

Overrides com.sun.tools.javac.tree.JCTree.Visitor.visitVarDef.

visitWhileLoopback to summary
public void visitWhileLoop(JCTree.JCWhileLoop tree)

Overrides com.sun.tools.javac.tree.JCTree.Visitor.visitWhileLoop.

visitWildcardback to summary
public void visitWildcard(JCTree.JCWildcard tree)

Overrides com.sun.tools.javac.tree.JCTree.Visitor.visitWildcard.

visitYieldback to summary
public void visitYield(JCTree.JCYield tree)

Overrides com.sun.tools.javac.tree.JCTree.Visitor.visitYield.

com.sun.tools.javac.jvm back to summary

pack-priv Class CRTable.SourceRange

extends Object
Class Inheritance

This class contains source positions for some tree or list of trees.

Field Summary

Modifier and TypeField and Description
pack-priv int
endPos

The ending source position.

pack-priv int
startPos

The starting source position.

Constructor Summary

AccessConstructor and Description
pack-priv
SourceRange()

Constructor

pack-priv
SourceRange(int startPos, int endPos)

Constructor

Method Summary

Modifier and TypeMethod and Description
pack-priv CRTable.SourceRange
mergeWith(CRTable.SourceRange sr)

Compare the starting and the ending positions of the source range and combines them assigning the widest range to this.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

endPosback to summary
pack-priv int endPos

The ending source position.

startPosback to summary
pack-priv int startPos

The starting source position.

Constructor Detail

SourceRangeback to summary
pack-priv SourceRange()

Constructor

SourceRangeback to summary
pack-priv SourceRange(int startPos, int endPos)

Constructor

Method Detail

mergeWithback to summary
pack-priv CRTable.SourceRange mergeWith(CRTable.SourceRange sr)

Compare the starting and the ending positions of the source range and combines them assigning the widest range to this.