edu.rice.cs.cunit.classFile.code.instructions
Class LineNumberTable

java.lang.Object
  extended by edu.rice.cs.cunit.classFile.code.instructions.LineNumberTable

public class LineNumberTable
extends java.lang.Object

A table that relates PC values to line numbers.

Author:
Mathias Ricken

Field Summary
(package private)  java.util.Hashtable<java.lang.Integer,java.lang.Integer> _lineNumberToPC
          Hash table to convert from line numbers to PCs.
(package private)  int _maxLineNo
          Line number value just after the last instruction.
(package private)  int _maxPC
          PC value just after the last instruction.
(package private)  java.util.Hashtable<java.lang.Integer,java.lang.Integer> _pcToLineNumber
          Hash table to convert from PC to line numbers.
 
Constructor Summary
LineNumberTable(byte[] bytecode)
          Create the line number table from bytecode.
LineNumberTable(InstructionList ilist)
          Create a line number table from a list of instructions.
LineNumberTable(java.util.LinkedList<AInstruction> instrList)
          Create a line number table from a list of instructions.
 
Method Summary
 int getLineNumber(int pc)
          Get the line number from the PC.
 int getPC(int lineNo)
          Get the PC from the line number.
protected  void put(int pc, int lineNo)
          Put this PC-line number pair into the hash tables.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_pcToLineNumber

java.util.Hashtable<java.lang.Integer,java.lang.Integer> _pcToLineNumber
Hash table to convert from PC to line numbers.


_lineNumberToPC

java.util.Hashtable<java.lang.Integer,java.lang.Integer> _lineNumberToPC
Hash table to convert from line numbers to PCs.


_maxPC

int _maxPC
PC value just after the last instruction.


_maxLineNo

int _maxLineNo
Line number value just after the last instruction.

Constructor Detail

LineNumberTable

public LineNumberTable(byte[] bytecode)
Create the line number table from bytecode.

Parameters:
bytecode - bytecode

LineNumberTable

public LineNumberTable(java.util.LinkedList<AInstruction> instrList)
Create a line number table from a list of instructions.

Parameters:
instrList - list of instructions

LineNumberTable

public LineNumberTable(InstructionList ilist)
Create a line number table from a list of instructions.

Parameters:
ilist - list of instructions
Method Detail

put

protected void put(int pc,
                   int lineNo)
Put this PC-line number pair into the hash tables.

Parameters:
pc - PC value
lineNo - line number

getLineNumber

public int getLineNumber(int pc)
                  throws java.util.NoSuchElementException
Get the line number from the PC.

Parameters:
pc - program counter
Returns:
line number
Throws:
java.util.NoSuchElementException

getPC

public int getPC(int lineNo)
          throws java.util.NoSuchElementException
Get the PC from the line number.

Parameters:
lineNo - line number
Returns:
program counter
Throws:
java.util.NoSuchElementException