use of com.oracle.truffle.espresso.classfile.attributes.LineNumberTableAttribute in project graal by oracle.
the class BytecodeNode method getSourceSectionAtBCI.
public SourceSection getSourceSectionAtBCI(int bci) {
Source s = getSource();
if (s == null) {
return null;
}
LineNumberTableAttribute table = getMethodVersion().getLineNumberTableAttribute();
if (table == LineNumberTableAttribute.EMPTY) {
return null;
}
int line = table.getLineNumber(bci);
return s.createSection(line);
}
use of com.oracle.truffle.espresso.classfile.attributes.LineNumberTableAttribute in project graal by oracle.
the class EspressoMethodNode method getSourceSection.
@TruffleBoundary
@Override
public final SourceSection getSourceSection() {
Source s = getSource();
if (s == null) {
return null;
}
if (sourceSection == null) {
SourceSection localSourceSection = null;
LineNumberTableAttribute lineNumberTable = method.getLineNumberTableAttribute();
if (lineNumberTable != LineNumberTableAttribute.EMPTY) {
List<LineNumberTableAttribute.Entry> entries = lineNumberTable.getEntries();
int startLine = Integer.MAX_VALUE;
int endLine = 0;
for (int i = 0; i < entries.size(); i++) {
int line = entries.get(i).getLineNumber();
if (line > endLine) {
endLine = line;
}
if (line < startLine) {
startLine = line;
}
}
if (startLine >= 1 && endLine >= 1 && startLine <= endLine) {
localSourceSection = s.createSection(startLine, 1, endLine, 1);
}
// (else) Most likely generated bytecodes with dummy LineNumberTable attribute.
}
if (localSourceSection == null) {
localSourceSection = s.createUnavailableSection();
}
synchronized (this) {
if (sourceSection == null) {
sourceSection = localSourceSection;
}
}
}
return sourceSection;
}
use of com.oracle.truffle.espresso.classfile.attributes.LineNumberTableAttribute in project graal by oracle.
the class Method method isLastLine.
public boolean isLastLine(long codeIndex) {
LineNumberTableAttribute table = getLineNumberTable();
int lastLine = table.getLastLine();
int lineAt = table.getLineNumber((int) codeIndex);
return lastLine == lineAt;
}
Aggregations