Skip to content

Commit 2f450f5

Browse files
committed
[GR-67248] Missing @InliningCutoffs in numerical operations.
PullRequest: graalpython/4604
2 parents 97c4e1d + d9c5b67 commit 2f450f5

7 files changed

Lines changed: 25 additions & 16 deletions

File tree

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/lib/PyNumberAddNode.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2024, 2025, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2024, 2026, 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
@@ -57,6 +57,7 @@
5757
import com.oracle.graal.python.nodes.object.GetClassNode;
5858
import com.oracle.graal.python.runtime.object.PFactory;
5959
import com.oracle.graal.python.runtime.sequence.storage.SequenceStorage;
60+
import com.oracle.truffle.api.HostCompilerDirectives.InliningCutoff;
6061
import com.oracle.truffle.api.bytecode.OperationProxy;
6162
import com.oracle.truffle.api.bytecode.StoreBytecodeIndex;
6263
import com.oracle.truffle.api.dsl.Bind;
@@ -103,6 +104,7 @@ public static TruffleString doIt(TruffleString left, TruffleString right,
103104
}
104105

105106
@Fallback
107+
@InliningCutoff
106108
@StoreBytecodeIndex
107109
public static Object doIt(VirtualFrame frame, Object v, Object w,
108110
@Bind Node inliningTarget,

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/lib/PyNumberFloorDivideNode.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2025, 2026, 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
@@ -42,6 +42,7 @@
4242

4343
import com.oracle.graal.python.builtins.objects.type.slots.TpSlotBinaryOp.ReversibleSlot;
4444
import com.oracle.graal.python.lib.fastpath.PyNumberFloorDivideFastPathsBase;
45+
import com.oracle.truffle.api.HostCompilerDirectives.InliningCutoff;
4546
import com.oracle.truffle.api.bytecode.OperationProxy;
4647
import com.oracle.truffle.api.bytecode.StoreBytecodeIndex;
4748
import com.oracle.truffle.api.dsl.Bind;
@@ -60,6 +61,7 @@ public abstract class PyNumberFloorDivideNode extends PyNumberFloorDivideFastPat
6061

6162
@Fallback
6263
@StoreBytecodeIndex
64+
@InliningCutoff
6365
public static Object doIt(VirtualFrame frame, Object v, Object w,
6466
@Bind Node inliningTarget,
6567
@Cached CallBinaryOpNode callBinaryOpNode) {

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/lib/PyNumberInPlaceLshiftNode.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2025, 2026, 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,7 +41,8 @@
4141
package com.oracle.graal.python.lib;
4242

4343
import com.oracle.graal.python.builtins.objects.type.slots.TpSlotBinaryOp.InplaceSlot;
44-
import com.oracle.graal.python.nodes.expression.BinaryOpNode;
44+
import com.oracle.graal.python.lib.fastpath.PyNumberLshiftFastPathsBase;
45+
import com.oracle.truffle.api.HostCompilerDirectives.InliningCutoff;
4546
import com.oracle.truffle.api.bytecode.OperationProxy;
4647
import com.oracle.truffle.api.bytecode.StoreBytecodeIndex;
4748
import com.oracle.truffle.api.dsl.Bind;
@@ -53,13 +54,13 @@
5354
import com.oracle.truffle.api.frame.VirtualFrame;
5455
import com.oracle.truffle.api.nodes.Node;
5556

56-
// TODO: should inherit from PyNumberLshiftFastPathsBase, blocked by GR-64005
5757
@GenerateInline(false)
5858
@GenerateUncached
5959
@OperationProxy.Proxyable(allowUncached = true, storeBytecodeIndex = false)
60-
public abstract class PyNumberInPlaceLshiftNode extends BinaryOpNode {
61-
@Specialization // (replaces = {"doII", "doLL"})
60+
public abstract class PyNumberInPlaceLshiftNode extends PyNumberLshiftFastPathsBase {
61+
@Specialization(replaces = {"doII", "doLL"})
6262
@StoreBytecodeIndex
63+
@InliningCutoff
6364
public static Object doIt(VirtualFrame frame, Object v, Object w,
6465
@Bind Node inliningTarget,
6566
@Cached CallBinaryIOpNode callBinaryOpNode) {

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/lib/PyNumberLshiftNode.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2025, 2026, 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,7 +41,8 @@
4141
package com.oracle.graal.python.lib;
4242

4343
import com.oracle.graal.python.builtins.objects.type.slots.TpSlotBinaryOp.ReversibleSlot;
44-
import com.oracle.graal.python.nodes.expression.BinaryOpNode;
44+
import com.oracle.graal.python.lib.fastpath.PyNumberLshiftFastPathsBase;
45+
import com.oracle.truffle.api.HostCompilerDirectives.InliningCutoff;
4546
import com.oracle.truffle.api.bytecode.OperationProxy;
4647
import com.oracle.truffle.api.bytecode.StoreBytecodeIndex;
4748
import com.oracle.truffle.api.dsl.Bind;
@@ -53,14 +54,14 @@
5354
import com.oracle.truffle.api.frame.VirtualFrame;
5455
import com.oracle.truffle.api.nodes.Node;
5556

56-
// TODO: should inherit from PyNumberLshiftFastPathsBase, blocked by GR-64005
5757
@GenerateInline(false)
5858
@GenerateUncached
5959
@OperationProxy.Proxyable(storeBytecodeIndex = false, allowUncached = true)
60-
public abstract class PyNumberLshiftNode extends BinaryOpNode {
60+
public abstract class PyNumberLshiftNode extends PyNumberLshiftFastPathsBase {
6161

62-
@Specialization // (replaces = {"doII", "doLL"})
62+
@Specialization(replaces = {"doII", "doLL"})
6363
@StoreBytecodeIndex
64+
@InliningCutoff
6465
public static Object doIt(VirtualFrame frame, Object v, Object w,
6566
@Bind Node inliningTarget,
6667
@Cached CallBinaryOpNode callBinaryOpNode) {

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/lib/PyNumberMultiplyNode.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2024, 2025, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2024, 2026, 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
@@ -49,6 +49,7 @@
4949
import com.oracle.graal.python.lib.fastpath.PyNumberMultiplyFastPathsBase;
5050
import com.oracle.graal.python.nodes.PRaiseNode;
5151
import com.oracle.graal.python.nodes.object.GetClassNode;
52+
import com.oracle.truffle.api.HostCompilerDirectives.InliningCutoff;
5253
import com.oracle.truffle.api.bytecode.OperationProxy;
5354
import com.oracle.truffle.api.bytecode.StoreBytecodeIndex;
5455
import com.oracle.truffle.api.dsl.Bind;
@@ -69,6 +70,7 @@ public abstract class PyNumberMultiplyNode extends PyNumberMultiplyFastPathsBase
6970

7071
@Fallback
7172
@StoreBytecodeIndex
73+
@InliningCutoff
7274
public static Object doIt(VirtualFrame frame, Object v, Object w,
7375
@Bind Node inliningTarget,
7476
@Exclusive @Cached GetClassNode getVClass,

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/lib/PyNumberRshiftNode.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2025, 2026, 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
@@ -74,6 +74,7 @@ public abstract class PyNumberRshiftNode extends PyNumberRshiftFastPathsBase {
7474

7575
@Fallback
7676
@StoreBytecodeIndex
77+
@InliningCutoff
7778
public static Object doIt(VirtualFrame frame, Object v, Object w,
7879
@Bind Node inliningTarget,
7980
@Cached GetClassNode getVClass,

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/lib/fastpath/PyNumberLshiftFastPathsBase.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2025, 2026, 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
@@ -47,7 +47,7 @@
4747

4848
/**
4949
* Helper class with shared fast-paths. Must be public so that it is accessible by the Bytecode DSL
50-
* generated code. TODO: unused due to GR-64005
50+
* generated code.
5151
*/
5252
@GenerateCached(false)
5353
public abstract class PyNumberLshiftFastPathsBase extends BinaryOpNode {

0 commit comments

Comments
 (0)