File: 211-Add-pop-NULL-to-CALL_FUNCTION_EX-byteflow-analysis.patch

package info (click to toggle)
numba 0.56.4%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 23,672 kB
  • sloc: python: 183,651; ansic: 15,370; cpp: 2,259; javascript: 424; sh: 308; makefile: 174
file content (30 lines) | stat: -rw-r--r-- 1,182 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
From 1d3056d12dbf676eb50e400f0233e1384b58976e Mon Sep 17 00:00:00 2001
From: Stuart Archibald <stuartarchibald@users.noreply.github.com>
Origin: https://github.com/numba/numba/pull/8639
Date: Mon, 28 Nov 2022 13:36:52 +0000
Subject: [PATCH 11/20] Add pop NULL to CALL_FUNCTION_EX byteflow analysis.

The cPython compiler seems to add a PUSH_NULL ahead of a CALL-like
instruction irrespective of whether it will be used. This causes
confusion in the byteflow analysis in the case of a loop containing
a CALL-like that doesn't consume the NULL as the state at the end
of the loop has the NULL on the stack and so it appears to be a
"new" state with the same PC offset.
---
 numba/core/byteflow.py | 5 +++++
 1 file changed, 5 insertions(+)

--- a/numba/core/byteflow.py
+++ b/numba/core/byteflow.py
@@ -1070,6 +1070,11 @@
             varkwarg = None
         vararg = state.pop()
         func = state.pop()
+
+        if PYVERSION == (3, 11):
+            if "$null" in state.peek(1):
+                state.pop() # pop NULL, it's not used
+
         res = state.make_temp()
         state.append(inst, func=func, vararg=vararg, varkwarg=varkwarg, res=res)
         state.push(res)