]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-131798: JIT - Use `sym_new_type` instead of `sym_new_not_null` for _BUILD_STRING...
authorNadeshiko Manju <me@manjusaka.me>
Sun, 27 Apr 2025 12:30:28 +0000 (20:30 +0800)
committerGitHub <noreply@github.com>
Sun, 27 Apr 2025 12:30:28 +0000 (20:30 +0800)
Signed-off-by: Manjusaka <me@manjusaka.me>
Misc/NEWS.d/next/Core_and_Builtins/2025-04-26-18-43-31.gh-issue-131798.FsIypo.rst [new file with mode: 0644]
Python/optimizer_bytecodes.c
Python/optimizer_cases.c.h

diff --git a/Misc/NEWS.d/next/Core_and_Builtins/2025-04-26-18-43-31.gh-issue-131798.FsIypo.rst b/Misc/NEWS.d/next/Core_and_Builtins/2025-04-26-18-43-31.gh-issue-131798.FsIypo.rst
new file mode 100644 (file)
index 0000000..a252d2b
--- /dev/null
@@ -0,0 +1,2 @@
+Use ``sym_new_type`` instead of ``sym_new_not_null`` for _BUILD_STRING,
+_BUILD_SET
index f862c9c8c6a840a30c9b76da6d7db7a925f15dfd..567caad22554ead6a34f4bc6a944958ee2b39a1c 100644 (file)
@@ -977,6 +977,14 @@ dummy_func(void) {
         map = sym_new_type(ctx, &PyDict_Type);
     }
 
+    op(_BUILD_STRING, (values[oparg] -- str)) {
+        str = sym_new_type(ctx, &PyUnicode_Type);
+    }
+
+    op(_BUILD_SET, (values[oparg] -- set)) {
+        set = sym_new_type(ctx, &PySet_Type);
+    }
+
     op(_UNPACK_SEQUENCE_TWO_TUPLE, (seq -- val1, val0)) {
         val0 = sym_tuple_getitem(ctx, seq, 0);
         val1 = sym_tuple_getitem(ctx, seq, 1);
index c92b036eb56463569ba8bdb2ea7610c5dd7ca29d..679240b6efa3154d802d231b4417531bc90d7afe 100644 (file)
 
         case _BUILD_STRING: {
             JitOptSymbol *str;
-            str = sym_new_not_null(ctx);
+            str = sym_new_type(ctx, &PyUnicode_Type);
             stack_pointer[-oparg] = str;
             stack_pointer += 1 - oparg;
             assert(WITHIN_STACK_BOUNDS());
 
         case _BUILD_SET: {
             JitOptSymbol *set;
-            set = sym_new_not_null(ctx);
+            set = sym_new_type(ctx, &PySet_Type);
             stack_pointer[-oparg] = set;
             stack_pointer += 1 - oparg;
             assert(WITHIN_STACK_BOUNDS());