Skip to content

Commit b9c5641

Browse files
committed
[GR-44432] Resolve Truffle DSL warnings, optimize AST footprint, tune hosted inlining heuristics.
PullRequest: graalpython/2672
2 parents 4c892dc + 8b8962a commit b9c5641

File tree

722 files changed

+15736
-16936
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

722 files changed

+15736
-16936
lines changed

ci.jsonnet

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{ "overlay": "0475af00203f3b004249bc9d0e0c1ac9700be1a9" }
1+
{ "overlay": "49d2e0a6fb13325d4d9e9e5687cec4afe54991ff" }

graalpython/com.oracle.graal.python.test/src/com/oracle/graal/python/nodes/util/CastToJavaUnsignedLongNodeTests.java

Lines changed: 3 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,6 @@
5656
import com.oracle.graal.python.runtime.exception.PException;
5757
import com.oracle.graal.python.runtime.object.PythonObjectFactory;
5858
import com.oracle.graal.python.test.PythonTests;
59-
import com.oracle.truffle.api.frame.VirtualFrame;
60-
import com.oracle.truffle.api.nodes.RootNode;
6159

6260
public class CastToJavaUnsignedLongNodeTests {
6361
private static PythonObjectFactory factory = PythonObjectFactory.getUncached();
@@ -145,35 +143,14 @@ private static void expect(PythonBuiltinClassType errorType, Runnable test) {
145143
}
146144

147145
private static long castInt(int arg) {
148-
return (Long) new RootNode(null) {
149-
@Child private CastToJavaUnsignedLongNode castNode = CastToJavaUnsignedLongNode.create();
150-
151-
@Override
152-
public Object execute(VirtualFrame frame) {
153-
return castNode.execute(arg);
154-
}
155-
}.getCallTarget().call();
146+
return CastToJavaUnsignedLongNode.executeUncached(arg);
156147
}
157148

158149
private static long castLong(long arg) {
159-
return (Long) new RootNode(null) {
160-
@Child private CastToJavaUnsignedLongNode castNode = CastToJavaUnsignedLongNode.create();
161-
162-
@Override
163-
public Object execute(VirtualFrame frame) {
164-
return castNode.execute(arg);
165-
}
166-
}.getCallTarget().call();
150+
return CastToJavaUnsignedLongNode.executeUncached(arg);
167151
}
168152

169153
private static long castObject(Object arg) {
170-
return (Long) new RootNode(null) {
171-
@Child private CastToJavaUnsignedLongNode castNode = CastToJavaUnsignedLongNode.create();
172-
173-
@Override
174-
public Object execute(VirtualFrame frame) {
175-
return castNode.execute(arg);
176-
}
177-
}.getCallTarget().call();
154+
return CastToJavaUnsignedLongNode.executeUncached(arg);
178155
}
179156
}

graalpython/com.oracle.graal.python.test/src/com/oracle/graal/python/nodes/util/NarrowBigIntegerNodeTests.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2019, 2021, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2019, 2023, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* The Universal Permissive License (UPL), Version 1.0
@@ -63,8 +63,6 @@ public void tearDown() {
6363
PythonTests.closeContext();
6464
}
6565

66-
private static NarrowBigIntegerNode narrow = NarrowBigIntegerNodeGen.getUncached();
67-
6866
@Test
6967
public void smallInts() {
7068
expectInt(-2);
@@ -108,19 +106,19 @@ public void longPIntBoundary() {
108106
}
109107

110108
private static void expectInt(int expected) {
111-
Object actual = narrow.execute(BigInteger.valueOf(expected));
109+
Object actual = NarrowBigIntegerNode.executeUncached(BigInteger.valueOf(expected));
112110
Assert.assertTrue(actual instanceof Integer);
113111
Assert.assertEquals(expected, (int) actual);
114112
}
115113

116114
private static void expectLong(long expected) {
117-
Object actual = narrow.execute(BigInteger.valueOf(expected));
115+
Object actual = NarrowBigIntegerNode.executeUncached(BigInteger.valueOf(expected));
118116
Assert.assertTrue(actual instanceof Long);
119117
Assert.assertEquals(expected, (long) actual);
120118
}
121119

122120
private static void expectPInt(BigInteger expected) {
123-
Object actual = narrow.execute(expected);
121+
Object actual = NarrowBigIntegerNode.executeUncached(expected);
124122
Assert.assertTrue(actual instanceof PInt);
125123
Assert.assertEquals(expected, ((PInt) actual).getValue());
126124
}

graalpython/com.oracle.graal.python.test/src/com/oracle/graal/python/nodes/util/PyObjectLookupAttrTests.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2019, 2022, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2019, 2023, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* The Universal Permissive License (UPL), Version 1.0
@@ -41,20 +41,20 @@
4141

4242
package com.oracle.graal.python.nodes.util;
4343

44-
import com.oracle.graal.python.builtins.PythonBuiltinClassType;
45-
import com.oracle.graal.python.builtins.objects.PNone;
46-
import com.oracle.graal.python.lib.PyObjectLookupAttr;
47-
import com.oracle.truffle.api.frame.VirtualFrame;
48-
import com.oracle.truffle.api.nodes.Node;
49-
import com.oracle.truffle.api.nodes.RootNode;
44+
import static com.oracle.graal.python.util.PythonUtils.tsLiteral;
45+
5046
import org.junit.After;
5147
import org.junit.Assert;
5248
import org.junit.Before;
5349
import org.junit.Test;
5450

51+
import com.oracle.graal.python.builtins.PythonBuiltinClassType;
52+
import com.oracle.graal.python.builtins.objects.PNone;
53+
import com.oracle.graal.python.lib.PyObjectLookupAttr;
5554
import com.oracle.graal.python.test.PythonTests;
56-
57-
import static com.oracle.graal.python.util.PythonUtils.tsLiteral;
55+
import com.oracle.truffle.api.frame.VirtualFrame;
56+
import com.oracle.truffle.api.nodes.Node;
57+
import com.oracle.truffle.api.nodes.RootNode;
5858

5959
public class PyObjectLookupAttrTests {
6060

@@ -78,7 +78,7 @@ public void lookupThroughMRO() {
7878

7979
@Override
8080
public Object execute(VirtualFrame frame) {
81-
return lookupNode.execute(frame, PythonBuiltinClassType.Boolean, tsLiteral("real"));
81+
return lookupNode.executeCached(frame, PythonBuiltinClassType.Boolean, tsLiteral("real"));
8282
}
8383
}.getCallTarget().call();
8484
Assert.assertNotSame(PNone.NO_VALUE, v);

0 commit comments

Comments
 (0)