Skip to content

Commit fca7296

Browse files
committed
[hotfix] [GR-13642] [GR-9307] Update jvmci and truffle imports
PullRequest: graalpython/418
2 parents 36aaba8 + 4390139 commit fca7296

File tree

19 files changed

+132
-86
lines changed

19 files changed

+132
-86
lines changed

ci.jsonnet

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@
128128

129129
local labsjdk8Mixin = {
130130
downloads +: {
131-
JAVA_HOME: utils.download("labsjdk", "8u192-jvmci-0.54"),
131+
JAVA_HOME: utils.download("labsjdk", "8u202-jvmci-0.55"),
132132
EXTRA_JAVA_HOMES : { pathlist: [utils.download("oraclejdk", "11+20")] },
133133
},
134134
environment +: {

graalpython/com.oracle.graal.python.shell/src/com/oracle/graal/python/shell/GraalPythonMain.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -554,12 +554,6 @@ protected void printHelp(OptionCategory maxCategory) {
554554
"GRAAL_PYTHON_OPTIONS: This environment variable can include default options that\n" +
555555
" are always passed to the launcher. These are not shell expanded and given to\n" +
556556
" the launcher as-is.");
557-
if (maxCategory.compareTo(OptionCategory.DEBUG) >= 0) {
558-
print("\nGraalPython performance debugging options:\n" +
559-
"-debug-perf : Enable tracing of Truffle compilations and its warnings\n" +
560-
"-dump : Enable dumping of compilation graphs to IGV\n" +
561-
"-compile-truffle-immediately : Start compiling on first invocation and throw compilation exceptions");
562-
}
563557
}
564558

565559
@Override

graalpython/com.oracle.graal.python.tck/src/com/oracle/graal/python/tck/PythonProvider.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
import static org.graalvm.polyglot.tck.TypeDescriptor.NUMBER;
5151
import static org.graalvm.polyglot.tck.TypeDescriptor.OBJECT;
5252
import static org.graalvm.polyglot.tck.TypeDescriptor.STRING;
53+
import static org.graalvm.polyglot.tck.TypeDescriptor.INSTANTIABLE;
5354
import static org.graalvm.polyglot.tck.TypeDescriptor.array;
5455
import static org.graalvm.polyglot.tck.TypeDescriptor.executable;
5556
import static org.graalvm.polyglot.tck.TypeDescriptor.intersection;
@@ -81,6 +82,9 @@ public class PythonProvider implements LanguageProvider {
8182
private static final TypeDescriptor NUMBER_OBJECT = TypeDescriptor.union(NUMBER, BOOLEAN, OBJECT, array(ANY));
8283
private static final TypeDescriptor PSEQUENCE_OBJECT = TypeDescriptor.union(array(ANY), STRING);
8384

85+
// Python types are just objects
86+
private static final TypeDescriptor PYTHON_TYPE = TypeDescriptor.union(OBJECT, INSTANTIABLE);
87+
8488
public String getId() {
8589
return ID;
8690
}
@@ -268,7 +272,7 @@ public Collection<? extends Snippet> createStatements(Context context) {
268272
addStatementSnippet(context, snippets, "class", "class Custom0:\n" +
269273
" def __init__(self, val):\n" +
270274
" self.val = val\n" +
271-
"Custom0", OBJECT, ANY);
275+
"Custom0", PYTHON_TYPE, ANY);
272276
addStatementSnippet(context, snippets, "class", "class Custom1:\n" +
273277
" def __call__(self, val):\n" +
274278
" return val\n" +

graalpython/com.oracle.graal.python.test/src/com/oracle/graal/python/test/debug/PythonDebugTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ public void testSteppingAsExpected() throws Throwable {
168168
});
169169
expectSuspended((SuspendedEvent event) -> {
170170
DebugStackFrame frame = event.getTopStackFrame();
171-
assertEquals(9, frame.getSourceSection().getStartLine());
171+
assertEquals(8, frame.getSourceSection().getStartLine());
172172
event.prepareStepOut(1);
173173
});
174174
expectSuspended((SuspendedEvent event) -> {

graalpython/com.oracle.graal.python.test/src/com/oracle/graal/python/test/grammar/TestParserTranslator.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@
8686
import com.oracle.graal.python.nodes.frame.WriteNode;
8787
import com.oracle.graal.python.nodes.function.FunctionDefinitionNode;
8888
import com.oracle.graal.python.nodes.function.GeneratorExpressionNode;
89+
import com.oracle.graal.python.nodes.function.InnerRootNode;
8990
import com.oracle.graal.python.nodes.generator.DictConcatNode;
9091
import com.oracle.graal.python.nodes.literal.BooleanLiteralNode;
9192
import com.oracle.graal.python.nodes.literal.ComplexLiteralNode;
@@ -155,6 +156,8 @@ private Node unpackModuleBodyWrappers(Node n) {
155156
if (((WriteLocalVariableNode) n).getIdentifier().equals(FrameSlotIDs.RETURN_SLOT_ID)) {
156157
actual = ((WriteLocalVariableNode) n).getRhs();
157158
}
159+
} else if (n instanceof InnerRootNode) {
160+
actual = n.getChildren().iterator().next();
158161
}
159162
if (actual == n) {
160163
return n;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ private static String extractName(RootNode rootNode) {
204204
if (rootNode instanceof ModuleRootNode) {
205205
name = rootNode.getName();
206206
} else if (rootNode instanceof FunctionRootNode) {
207-
name = ((FunctionRootNode) rootNode).getFunctionName();
207+
name = ((FunctionRootNode) rootNode).getName();
208208
} else {
209209
name = rootNode.getName();
210210
}

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/exception/PBaseException.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
*/
4141
package com.oracle.graal.python.builtins.objects.exception;
4242

43-
import java.util.ArrayList;
4443
import java.util.Iterator;
4544
import java.util.List;
4645

@@ -61,6 +60,7 @@
6160
import com.oracle.graal.python.runtime.sequence.storage.SequenceStorage;
6261
import com.oracle.truffle.api.CompilerAsserts;
6362
import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
63+
import com.oracle.truffle.api.TruffleStackTrace;
6464
import com.oracle.truffle.api.TruffleStackTraceElement;
6565
import com.oracle.truffle.api.frame.Frame;
6666
import com.oracle.truffle.api.nodes.RootNode;
@@ -191,8 +191,8 @@ public List<TruffleStackTraceElement> getStackTrace() {
191191
@TruffleBoundary
192192
public void reifyException() {
193193
if (stackTrace == null && traceback == null) {
194-
TruffleStackTraceElement.fillIn(exception);
195-
stackTrace = new ArrayList<>(TruffleStackTraceElement.getStackTrace(exception));
194+
TruffleStackTrace.fillIn(exception);
195+
stackTrace = TruffleStackTrace.getStacktrace(exception);
196196
Iterator<TruffleStackTraceElement> iter = stackTrace.iterator();
197197
while (iter.hasNext()) {
198198
TruffleStackTraceElement element = iter.next();

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/nodes/ModuleRootNode.java

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import com.oracle.graal.python.PythonLanguage;
2929
import com.oracle.graal.python.nodes.expression.ExpressionNode;
3030
import com.oracle.graal.python.nodes.frame.WriteGlobalNode;
31+
import com.oracle.graal.python.nodes.function.InnerRootNode;
3132
import com.oracle.truffle.api.CompilerAsserts;
3233
import com.oracle.truffle.api.CompilerDirectives;
3334
import com.oracle.truffle.api.frame.FrameDescriptor;
@@ -49,7 +50,7 @@ public ModuleRootNode(PythonLanguage language, String name, String doc, Expressi
4950
super(language, descriptor, freeVarSlots);
5051
this.name = "<module '" + name + "'>";
5152
this.doc = doc;
52-
this.body = file;
53+
this.body = new InnerRootNode(this, file);
5354
}
5455

5556
private WriteGlobalNode getWriteModuleDoc() {
@@ -62,15 +63,15 @@ private WriteGlobalNode getWriteModuleDoc() {
6263

6364
@Override
6465
public Object execute(VirtualFrame frame) {
66+
return body.execute(frame);
67+
}
68+
69+
@Override
70+
public void initializeFrame(VirtualFrame frame) {
6571
addClosureCellsToLocals(frame);
6672
if (doc != null) {
6773
getWriteModuleDoc().doWrite(frame, doc);
6874
}
69-
return body.execute(frame);
70-
}
71-
72-
public ExpressionNode getBody() {
73-
return body;
7475
}
7576

7677
@Override
@@ -84,10 +85,6 @@ public String getName() {
8485
return name;
8586
}
8687

87-
public String getDoc() {
88-
return doc;
89-
}
90-
9188
@Override
9289
public SourceSection getSourceSection() {
9390
return body.getSourceSection();

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/nodes/NodeFactory.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,18 +134,15 @@ public <T> T duplicate(Node orig, Class<T> clazz) {
134134
}
135135

136136
public ModuleRootNode createModuleRoot(String name, String doc, ExpressionNode file, FrameDescriptor fd) {
137-
file.markAsRoot();
138137
return new ModuleRootNode(language, name, doc, file, fd, null);
139138
}
140139

141140
public FunctionRootNode createFunctionRoot(SourceSection sourceSection, String functionName, boolean isGenerator, FrameDescriptor frameDescriptor, ExpressionNode body,
142141
ExecutionCellSlots cellSlots) {
143-
body.markAsRoot();
144142
return new FunctionRootNode(language, sourceSection, functionName, isGenerator, frameDescriptor, body, cellSlots);
145143
}
146144

147145
public ClassBodyRootNode createClassBodyRoot(SourceSection sourceSection, String functionName, FrameDescriptor frameDescriptor, ExpressionNode body, ExecutionCellSlots cellSlots) {
148-
body.markAsRoot();
149146
return new ClassBodyRootNode(language, sourceSection, functionName, frameDescriptor, body, cellSlots);
150147
}
151148

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/nodes/PClosureRootNode.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
import com.oracle.truffle.api.frame.Frame;
4848
import com.oracle.truffle.api.frame.FrameDescriptor;
4949
import com.oracle.truffle.api.frame.FrameSlot;
50+
import com.oracle.truffle.api.frame.VirtualFrame;
5051
import com.oracle.truffle.api.nodes.ExplodeLoop;
5152

5253
public abstract class PClosureRootNode extends PRootNode {
@@ -89,6 +90,8 @@ public boolean hasFreeVars() {
8990
return freeVarSlots != null && freeVarSlots.length > 0;
9091
}
9192

93+
public abstract void initializeFrame(VirtualFrame frame);
94+
9295
public String[] getFreeVars() {
9396
if (freeVarSlots != null) {
9497
String[] freeVars = new String[freeVarSlots.length];

0 commit comments

Comments
 (0)