com.sun.tools.javac.jvm
Class CRTable

java.lang.Object
  extended by com.sun.tools.javac.jvm.CRTable
All Implemented Interfaces:
CRTFlags

public class CRTable
extends java.lang.Object
implements CRTFlags

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 API supported by Sun Microsystems. 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 Class Summary
(package private) static class CRTable.CRTEntry
          This class contains a CharacterRangeTableEntry.
(package private)  class CRTable.SourceComputer
          This class contains methods to compute source positions for trees.
(package private) static class CRTable.SourceRange
          This class contains source positions for some tree or list of trees.
 
Field Summary
private  boolean crtDebug
           
private  java.util.Map<JCTree,java.lang.Integer> endPositions
          The hashtable for ending positions stored in the parser.
private  ListBuffer<CRTable.CRTEntry> entries
          The list of CRTable entries.
(package private)  JCTree.JCMethodDecl methodTree
          The tree of the method this table is intended for.
private  java.util.Map<java.lang.Object,CRTable.SourceRange> positions
          The hashtable for source positions.
 
Fields inherited from interface com.sun.tools.javac.jvm.CRTFlags
CRT_ASSIGNMENT, CRT_BLOCK, CRT_BRANCH_FALSE, CRT_BRANCH_TRUE, CRT_CREATE, CRT_FLOW_CONTROLLER, CRT_FLOW_TARGET, CRT_INVOKE, CRT_STATEMENT, CRT_VALID_FLAGS
 
Constructor Summary
CRTable(JCTree.JCMethodDecl tree, java.util.Map<JCTree,java.lang.Integer> endPositions)
          Constructor
 
Method 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
private  java.lang.String getTypes(int flags)
          Return string describing flags enabled.
 int length()
          Return the number of the entries.
 void put(java.lang.Object tree, int flags, int startPc, int endPc)
          Create a new CRTEntry and add it to the entries.
 int writeCRT(ByteBuffer databuf, Position.LineMap lineMap, Log log)
          Compute source positions and write CRT to the databuf.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

crtDebug

private final boolean crtDebug
See Also:
Constant Field Values

entries

private ListBuffer<CRTable.CRTEntry> entries
The list of CRTable entries.


positions

private java.util.Map<java.lang.Object,CRTable.SourceRange> positions
The hashtable for source positions.


endPositions

private java.util.Map<JCTree,java.lang.Integer> endPositions
The hashtable for ending positions stored in the parser.


methodTree

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

Constructor Detail

CRTable

public CRTable(JCTree.JCMethodDecl tree,
               java.util.Map<JCTree,java.lang.Integer> endPositions)
Constructor

Method Detail

put

public void put(java.lang.Object tree,
                int flags,
                int startPc,
                int endPc)
Create a new CRTEntry and add it to the entries.

Parameters:
tree - The tree or the list of trees for which we are storing the code pointers.
flags - The set of flags designating type of the entry.
startPc - The starting code position.
endPc - The ending code position.

writeCRT

public int writeCRT(ByteBuffer databuf,
                    Position.LineMap lineMap,
                    Log log)
Compute source positions and write CRT to the databuf.

Parameters:
databuf - The buffer to write bytecodes to.

length

public int length()
Return the number of the entries.


getTypes

private java.lang.String getTypes(int flags)
Return string describing flags enabled.


encodePosition

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