use of jdk.vm.ci.meta.LineNumberTable in project graal by oracle.
the class ClassfileBytecode method getLineNumberTable.
@Override
public LineNumberTable getLineNumberTable() {
if (lineNumberTableBytes == null) {
return null;
}
final int lineNumberTableLength = lineNumberTableBytes.length / LINE_NUMBER_TABLE_ENTRY_SIZE_IN_BYTES;
DataInputStream stream = new DataInputStream(new ByteArrayInputStream(lineNumberTableBytes));
int[] bci = new int[lineNumberTableLength];
int[] line = new int[lineNumberTableLength];
for (int i = 0; i < lineNumberTableLength; i++) {
try {
bci[i] = stream.readUnsignedShort();
line[i] = stream.readUnsignedShort();
} catch (IOException e) {
throw new GraalError(e);
}
}
return new LineNumberTable(line, bci);
}
use of jdk.vm.ci.meta.LineNumberTable in project graal by oracle.
the class EncodedLineNumberTable method decode.
public static LineNumberTable decode(byte[] encodedTable) {
if (encodedTable == null) {
return null;
}
UnsafeArrayTypeReader readBuffer = UnsafeArrayTypeReader.create(encodedTable, 0, ByteArrayReader.supportsUnalignedMemoryAccess());
int length = readBuffer.getUVInt();
int[] lineNumbers = new int[length];
int[] bcis = new int[length];
int lastLineNumber = 0;
int lastBci = 0;
for (int i = 0; i < length; i++) {
int curLineNumber = lastLineNumber + readBuffer.getSVInt();
int curBci = lastBci + readBuffer.getSVInt();
lineNumbers[i] = curLineNumber;
bcis[i] = curBci;
lastLineNumber = curLineNumber;
lastBci = curBci;
}
return new LineNumberTable(lineNumbers, bcis);
}
Aggregations