Skip to content

Commit 8b6009f

Browse files
committed
[hotfix] Disable ast reuse
PullRequest: graalpython/157
2 parents d45d8e1 + 580ddd9 commit 8b6009f

File tree

15 files changed

+35
-45
lines changed

15 files changed

+35
-45
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/PythonLanguage.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@
7676
import com.oracle.truffle.api.source.Source;
7777
import com.oracle.truffle.api.source.Source.Builder;
7878

79-
@TruffleLanguage.Registration(id = PythonLanguage.ID, name = PythonLanguage.NAME, version = PythonLanguage.VERSION, mimeType = PythonLanguage.MIME_TYPE, interactive = true, internal = false, contextPolicy = TruffleLanguage.ContextPolicy.REUSE)
79+
@TruffleLanguage.Registration(id = PythonLanguage.ID, name = PythonLanguage.NAME, version = PythonLanguage.VERSION, mimeType = PythonLanguage.MIME_TYPE, interactive = true, internal = false, contextPolicy = TruffleLanguage.ContextPolicy.EXCLUSIVE)
8080
@ProvidedTags({StandardTags.CallTag.class, StandardTags.StatementTag.class, StandardTags.RootTag.class, StandardTags.TryBlockTag.class, DebuggerTags.AlwaysHalt.class})
8181
public final class PythonLanguage extends TruffleLanguage<PythonContext> {
8282
public static final String ID = "python";

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/modules/ImpModuleBuiltins.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ public abstract static class CreateDynamic extends PythonBuiltinNode {
150150
@Specialization
151151
@TruffleBoundary
152152
public Object run(PythonObject moduleSpec, @SuppressWarnings("unused") Object filename,
153-
@Cached("createExecute(0).createNode()") Node executeNode,
153+
@Cached("EXECUTE.createNode()") Node executeNode,
154154
@Cached("READ.createNode()") Node readNode) {
155155
String name = moduleSpec.getAttribute("name").toString();
156156
String path = moduleSpec.getAttribute("origin").toString();

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/modules/InteropModuleBuiltins.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ Object remove(TruffleObject receiver, Object key,
227227
public abstract static class executeNode extends PythonBuiltinNode {
228228
@Specialization
229229
Object remove(TruffleObject receiver, Object[] arguments,
230-
@Cached("createExecute(0).createNode()") Node executeNode) {
230+
@Cached("EXECUTE.createNode()") Node executeNode) {
231231
try {
232232
return ForeignAccess.sendExecute(executeNode, receiver, arguments);
233233
} catch (UnsupportedMessageException | UnsupportedTypeException | ArityException e) {
@@ -242,7 +242,7 @@ Object remove(TruffleObject receiver, Object[] arguments,
242242
public abstract static class newNode extends PythonBuiltinNode {
243243
@Specialization
244244
Object remove(TruffleObject receiver, Object[] arguments,
245-
@Cached("createNew(0).createNode()") Node executeNode) {
245+
@Cached("NEW.createNode()") Node executeNode) {
246246
try {
247247
return ForeignAccess.sendNew(executeNode, receiver, arguments);
248248
} catch (UnsupportedMessageException | UnsupportedTypeException | ArityException e) {
@@ -257,7 +257,7 @@ Object remove(TruffleObject receiver, Object[] arguments,
257257
public abstract static class invokeNode extends PythonBuiltinNode {
258258
@Specialization
259259
Object remove(TruffleObject receiver, String key, Object[] arguments,
260-
@Cached("createInvoke(0).createNode()") Node executeNode) {
260+
@Cached("INVOKE.createNode()") Node executeNode) {
261261
try {
262262
return ForeignAccess.sendInvoke(executeNode, receiver, key, arguments);
263263
} catch (UnsupportedMessageException | UnsupportedTypeException | ArityException | UnknownIdentifierException e) {

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/modules/SREModuleBuiltins.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ Object call(TruffleObject callable, Object[] arguments,
273273
}
274274

275275
protected static Node createExecute() {
276-
return Message.createExecute(0).createNode();
276+
return Message.EXECUTE.createNode();
277277
}
278278

279279
}

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/modules/TruffleCextBuiltins.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -595,11 +595,7 @@ public ExternalFunctionNode(PythonLanguage lang, String name, TruffleObject cwra
595595
this.name = name;
596596
this.cwrapper = cwrapper;
597597
this.callable = callable;
598-
if (cwrapper != null) {
599-
this.executeNode = Message.createExecute(3).createNode();
600-
} else {
601-
this.executeNode = Message.createExecute(2).createNode();
602-
}
598+
this.executeNode = Message.EXECUTE.createNode();
603599
}
604600

605601
public TruffleObject getCallable() {

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/cext/CExtNodes.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ public abstract class CExtNodes {
8787
*/
8888
public static class SubtypeNew extends PBaseNode {
8989
private final TruffleObject subtypeFunc;
90-
@Child private Node executeNode = Message.createExecute(2).createNode();
90+
@Child private Node executeNode = Message.EXECUTE.createNode();
9191
@Child private ToSulongNode toSulongNode = ToSulongNode.create();
9292
@Child private ToJavaNode toJavaNode = ToJavaNode.create();
9393

@@ -134,7 +134,7 @@ private PythonBuiltinClass getExpectedClass() {
134134
private Node getExecNode() {
135135
if (executeNode == null) {
136136
CompilerDirectives.transferToInterpreterAndInvalidate();
137-
executeNode = insert(Message.createExecute(1).createNode());
137+
executeNode = insert(Message.EXECUTE.createNode());
138138
}
139139
return executeNode;
140140
}
@@ -362,7 +362,7 @@ Object doWrapper(PythonObjectNativeWrapper value) {
362362
Object doForeign(Object value) {
363363
if (callNativeNode == null) {
364364
CompilerDirectives.transferToInterpreterAndInvalidate();
365-
callNativeNode = insert(PCallNativeNode.create(1));
365+
callNativeNode = insert(PCallNativeNode.create());
366366
}
367367
if (callNativeNode == null) {
368368
CompilerDirectives.transferToInterpreterAndInvalidate();
@@ -388,13 +388,13 @@ public abstract static class AsCharPointer extends CExtBaseNode {
388388

389389
@Specialization
390390
Object doPString(PString str,
391-
@Cached("createExecute(1)") Node executeNode) {
391+
@Cached("createExecute()") Node executeNode) {
392392
return doString(str.getValue(), executeNode);
393393
}
394394

395395
@Specialization
396396
Object doString(String str,
397-
@Cached("createExecute(1)") Node executeNode) {
397+
@Cached("createExecute()") Node executeNode) {
398398
try {
399399
return ForeignAccess.sendExecute(executeNode, getTruffleStringToCstr(), str, str.length());
400400
} catch (UnsupportedTypeException | ArityException | UnsupportedMessageException e) {
@@ -404,7 +404,7 @@ Object doString(String str,
404404

405405
@Specialization
406406
Object doByteArray(byte[] arr,
407-
@Cached("createExecute(2)") Node executeNode) {
407+
@Cached("createExecute()") Node executeNode) {
408408
try {
409409
return ForeignAccess.sendExecute(executeNode, getTruffleByteArrayToNative(), getContext().getEnv().asGuestValue(arr), arr.length);
410410
} catch (UnsupportedTypeException | ArityException | UnsupportedMessageException e) {
@@ -428,8 +428,8 @@ TruffleObject getTruffleByteArrayToNative() {
428428
return truffle_byte_array_to_native;
429429
}
430430

431-
protected Node createExecute(int arity) {
432-
return Message.createExecute(arity).createNode();
431+
protected Node createExecute() {
432+
return Message.EXECUTE.createNode();
433433
}
434434

435435
public static AsCharPointer create() {
@@ -453,7 +453,7 @@ TruffleObject getTruffleStringToCstr() {
453453
private Node getExecuteNode() {
454454
if (executeNode == null) {
455455
CompilerDirectives.transferToInterpreterAndInvalidate();
456-
executeNode = insert(Message.createExecute(1).createNode());
456+
executeNode = insert(Message.EXECUTE.createNode());
457457
}
458458
return executeNode;
459459
}
@@ -495,7 +495,7 @@ private ToJavaNode getToJavaNode() {
495495
private PCallNativeNode getCallGetObTypeNode() {
496496
if (callGetObTypeNode == null) {
497497
CompilerDirectives.transferToInterpreterAndInvalidate();
498-
callGetObTypeNode = insert(PCallNativeNode.create(1));
498+
callGetObTypeNode = insert(PCallNativeNode.create());
499499
}
500500
return callGetObTypeNode;
501501
}
@@ -521,7 +521,7 @@ public long execute() {
521521
if (wcharSize < 0) {
522522
CompilerDirectives.transferToInterpreterAndInvalidate();
523523
try {
524-
wcharSize = (long) ForeignAccess.sendExecute(Message.createExecute(0).createNode(), getNativeFunction());
524+
wcharSize = (long) ForeignAccess.sendExecute(Message.EXECUTE.createNode(), getNativeFunction());
525525
assert wcharSize >= 0L;
526526
} catch (InteropException e) {
527527
throw e.raise();

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/cext/PCallNativeNode.java

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -51,18 +51,12 @@
5151
import com.oracle.truffle.api.nodes.Node;
5252

5353
public class PCallNativeNode extends PBaseNode {
54-
private final int arity;
55-
5654
@Child private Node executeNode;
5755

58-
public PCallNativeNode(int arity) {
59-
this.arity = arity;
60-
}
61-
6256
private Node getExecuteNode() {
6357
if (executeNode == null) {
6458
CompilerDirectives.transferToInterpreterAndInvalidate();
65-
executeNode = insert(Message.createExecute(arity).createNode());
59+
executeNode = insert(Message.EXECUTE.createNode());
6660
}
6761
return executeNode;
6862
}
@@ -76,7 +70,7 @@ public Object execute(TruffleObject func, Object[] args) {
7670
}
7771
}
7872

79-
public static PCallNativeNode create(int arity) {
80-
return new PCallNativeNode(arity);
73+
public static PCallNativeNode create() {
74+
return new PCallNativeNode();
8175
}
8276
}

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/cext/PySequenceArrayWrapperMR.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ protected boolean isNonNative(PythonClass klass) {
313313
private Object callBinaryIntoCapi(TruffleObject fun, Object arg0, Object arg1) {
314314
if (callNativeBinary == null) {
315315
CompilerDirectives.transferToInterpreterAndInvalidate();
316-
callNativeBinary = insert(PCallNativeNode.create(1));
316+
callNativeBinary = insert(PCallNativeNode.create());
317317
}
318318
return callNativeBinary.execute(fun, new Object[]{arg0, arg1});
319319
}
@@ -355,7 +355,7 @@ long access(PySequenceArrayWrapper obj) {
355355
@ImportStatic(SpecialMethodNames.class)
356356
abstract static class GetTypeIDNode extends PBaseNode {
357357

358-
@Child private PCallNativeNode callUnaryNode = PCallNativeNode.create(1);
358+
@Child private PCallNativeNode callUnaryNode = PCallNativeNode.create();
359359

360360
@CompilationFinal TruffleObject funGetByteArrayTypeID;
361361
@CompilationFinal TruffleObject funGetPtrArrayTypeID;

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/cext/PyUnicodeWrapperMR.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ private TruffleObject getPyObjectHandle_ForJavaType() {
203203
private Object callUnaryIntoCapi(TruffleObject fun, Object arg) {
204204
if (callNativeUnary == null) {
205205
CompilerDirectives.transferToInterpreterAndInvalidate();
206-
callNativeUnary = insert(PCallNativeNode.create(1));
206+
callNativeUnary = insert(PCallNativeNode.create());
207207
}
208208
return callNativeUnary.execute(fun, new Object[]{arg});
209209
}

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/cext/PythonObjectNativeWrapperMR.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -890,15 +890,15 @@ protected boolean isManagedPythonClass(PythonAbstractObject klass) {
890890
private Object callUnaryIntoCapi(TruffleObject fun, Object arg) {
891891
if (callNativeUnary == null) {
892892
CompilerDirectives.transferToInterpreterAndInvalidate();
893-
callNativeUnary = insert(PCallNativeNode.create(1));
893+
callNativeUnary = insert(PCallNativeNode.create());
894894
}
895895
return callNativeUnary.execute(fun, new Object[]{arg});
896896
}
897897

898898
private Object callBinaryIntoCapi(TruffleObject fun, Object arg0, Object arg1) {
899899
if (callNativeBinary == null) {
900900
CompilerDirectives.transferToInterpreterAndInvalidate();
901-
callNativeBinary = insert(PCallNativeNode.create(1));
901+
callNativeBinary = insert(PCallNativeNode.create());
902902
}
903903
return callNativeBinary.execute(fun, new Object[]{arg0, arg1});
904904
}

0 commit comments

Comments
 (0)