Skip to content

Commit b06bf85

Browse files
committed
integrate new source section & continuation changes; skip short circuit op for unary compare operations
1 parent 4e2e925 commit b06bf85

File tree

4 files changed

+127
-123
lines changed

4 files changed

+127
-123
lines changed

Diff for: graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/code/CodeBuiltins.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ static Object lines(PCode self) {
308308
CodeUnit co = self.getCodeUnit();
309309
if (co != null) {
310310
if (PythonOptions.ENABLE_BYTECODE_DSL_INTERPRETER) {
311-
BytecodeIntrospection introspectionData = ((PBytecodeDSLRootNode) self.getRootNode()).getIntrospectionData();
311+
BytecodeIntrospection introspectionData = ((PBytecodeDSLRootNode) self.getRootNodeForExtraction()).getIntrospectionData();
312312
List<PTuple> lines = new ArrayList<>();
313313
for (SourceInformation sourceInfo : introspectionData.getSourceInformation()) {
314314
lines.add(factory.createTuple(new int[]{sourceInfo.getBeginBci(), sourceInfo.getEndBci(), sourceInfo.getSourceSection().getStartLine()}));
@@ -352,7 +352,7 @@ Object positions(PCode self) {
352352
if (co != null) {
353353
List<PTuple> lines = new ArrayList<>();
354354
if (PythonOptions.ENABLE_BYTECODE_DSL_INTERPRETER) {
355-
PBytecodeDSLRootNode rootNode = (PBytecodeDSLRootNode) self.getRootNode();
355+
PBytecodeDSLRootNode rootNode = (PBytecodeDSLRootNode) self.getRootNodeForExtraction();
356356
for (Instruction instruction : rootNode.getIntrospectionData().getInstructions()) {
357357
SourceSection section = rootNode.getSourceSectionForLocation(instruction.getLocation());
358358
lines.add(factory.createTuple(new int[]{

Diff for: graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/code/PCode.java

+4
Original file line numberDiff line numberDiff line change
@@ -429,6 +429,10 @@ RootNode getRootNode() {
429429
return getRootCallTarget().getRootNode();
430430
}
431431

432+
RootNode getRootNodeForExtraction() {
433+
return rootNodeForExtraction(getRootNode());
434+
}
435+
432436
public TruffleString[] getFreeVars() {
433437
if (freevars == null) {
434438
freevars = extractFreeVars(getRootNode());

Diff for: graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/generator/GeneratorBuiltins.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
import com.oracle.graal.python.nodes.function.builtins.PythonUnaryBuiltinNode;
6060
import com.oracle.graal.python.runtime.PythonOptions;
6161
import com.oracle.graal.python.runtime.object.PythonObjectFactory;
62-
import com.oracle.truffle.api.bytecode.BytecodeNode;
62+
import com.oracle.truffle.api.bytecode.BytecodeLocation;
6363
import com.oracle.truffle.api.bytecode.ContinuationResult;
6464
import com.oracle.truffle.api.dsl.Bind;
6565
import com.oracle.truffle.api.dsl.Cached;
@@ -197,11 +197,11 @@ static Object getFrame(PGenerator self,
197197
BytecodeDSLFrameInfo info = (BytecodeDSLFrameInfo) generatorFrame.getFrameDescriptor().getInfo();
198198
PBytecodeDSLRootNode rootNode = info.getRootNode();
199199
ContinuationResult continuation = self.getContinuation();
200-
BytecodeNode bytecodeNode = continuation.getBytecodeNode();
201-
PFrame frame = MaterializeFrameNode.materializeGeneratorFrame(bytecodeNode, generatorFrame, PFrame.Reference.EMPTY, factory);
202-
int bci = continuation.getBci();
200+
BytecodeLocation location = continuation.getBytecodeLocation();
201+
PFrame frame = MaterializeFrameNode.materializeGeneratorFrame(location.getBytecodeNode(), generatorFrame, PFrame.Reference.EMPTY, factory);
202+
int bci = location.getBytecodeIndex();
203203
frame.setBci(bci);
204-
frame.setLine(rootNode.bciToLine(bci, bytecodeNode));
204+
frame.setLine(rootNode.bciToLine(bci, location.getBytecodeNode()));
205205
return frame;
206206
} else {
207207
BytecodeFrameInfo info = (BytecodeFrameInfo) generatorFrame.getFrameDescriptor().getInfo();

0 commit comments

Comments
 (0)