Skip to content

Commit 04aaa3d

Browse files
Merge branch 'main' into isolate-elementtree
2 parents 2175f66 + a1e051a commit 04aaa3d

File tree

10 files changed

+413
-387
lines changed

10 files changed

+413
-387
lines changed

Doc/whatsnew/3.12.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ Other Language Changes
157157
in :gh:`96670`.)
158158

159159
* The Garbage Collector now runs only on the eval breaker mechanism of the
160-
Python bytecode evaluation loop instead on object allocations. The GC can
160+
Python bytecode evaluation loop instead of object allocations. The GC can
161161
also run when :c:func:`PyErr_CheckSignals` is called so C extensions that
162162
need to run for a long time without executing any Python code also have a
163163
chance to execute the GC periodically. (Contributed by Pablo Galindo in

Makefile.pre.in

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1466,8 +1466,12 @@ regen-cases:
14661466
-o $(srcdir)/Python/opcode_metadata.h.new
14671467
$(UPDATE_FILE) $(srcdir)/Python/opcode_metadata.h $(srcdir)/Python/opcode_metadata.h.new
14681468

1469-
Python/ceval.o: $(srcdir)/Python/opcode_targets.h $(srcdir)/Python/condvar.h $(srcdir)/Python/generated_cases.c.h
1470-
1469+
Python/ceval.o: \
1470+
$(srcdir)/Python/ceval_macros.h \
1471+
$(srcdir)/Python/condvar.h \
1472+
$(srcdir)/Python/generated_cases.c.h \
1473+
$(srcdir)/Python/opcode_metadata.h \
1474+
$(srcdir)/Python/opcode_targets.h
14711475

14721476
Python/frozen.o: $(FROZEN_FILES_OUT)
14731477

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Allows -Wno-int-conversion for wasm-sdk 17 and onwards, thus enables
2+
building WASI builds once against the latest sdk.

Parser/pegen.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ typedef struct {
4242
} Token;
4343

4444
typedef struct {
45-
char *str;
45+
const char *str;
4646
int type;
4747
} KeywordToken;
4848

Python/bytecodes.c

Lines changed: 8 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -34,58 +34,29 @@
3434
#include "setobject.h"
3535
#include "structmember.h" // struct PyMemberDef, T_OFFSET_EX
3636

37-
void _PyFloat_ExactDealloc(PyObject *);
38-
void _PyUnicode_ExactDealloc(PyObject *);
39-
40-
/* Stack effect macros
41-
* These will be mostly replaced by stack effect descriptions,
42-
* but the tooling need to recognize them.
43-
*/
44-
#define SET_TOP(v) (stack_pointer[-1] = (v))
45-
#define SET_SECOND(v) (stack_pointer[-2] = (v))
46-
#define PEEK(n) (stack_pointer[-(n)])
47-
#define POKE(n, v) (stack_pointer[-(n)] = (v))
48-
#define PUSH(val) (*(stack_pointer++) = (val))
49-
#define POP() (*(--stack_pointer))
50-
#define TOP() PEEK(1)
51-
#define SECOND() PEEK(2)
52-
#define STACK_GROW(n) (stack_pointer += (n))
53-
#define STACK_SHRINK(n) (stack_pointer -= (n))
54-
#define EMPTY() 1
55-
#define STACK_LEVEL() 2
56-
57-
/* Local variable macros */
58-
#define GETLOCAL(i) (frame->localsplus[i])
59-
#define SETLOCAL(i, val) \
60-
do { \
61-
PyObject *_tmp = frame->localsplus[i]; \
62-
frame->localsplus[i] = (val); \
63-
Py_XDECREF(_tmp); \
64-
} while (0)
37+
#define USE_COMPUTED_GOTOS 0
38+
#include "ceval_macros.h"
6539

6640
/* Flow control macros */
6741
#define DEOPT_IF(cond, instname) ((void)0)
6842
#define ERROR_IF(cond, labelname) ((void)0)
69-
#define JUMPBY(offset) ((void)0)
7043
#define GO_TO_INSTRUCTION(instname) ((void)0)
71-
#define DISPATCH_SAME_OPARG() ((void)0)
44+
#define PREDICT(opname) ((void)0)
7245

7346
#define inst(name, ...) case name:
7447
#define op(name, ...) /* NAME is ignored */
7548
#define macro(name) static int MACRO_##name
7649
#define super(name) static int SUPER_##name
7750
#define family(name, ...) static int family_##name
7851

79-
#define NAME_ERROR_MSG \
80-
"name '%.200s' is not defined"
81-
8252
// Dummy variables for stack effects.
8353
static PyObject *value, *value1, *value2, *left, *right, *res, *sum, *prod, *sub;
8454
static PyObject *container, *start, *stop, *v, *lhs, *rhs;
85-
static PyObject *list, *tuple, *dict, *owner;
55+
static PyObject *list, *tuple, *dict, *owner, *set, *str, *tup, *map, *keys;
8656
static PyObject *exit_func, *lasti, *val, *retval, *obj, *iter;
8757
static PyObject *aiter, *awaitable, *iterable, *w, *exc_value, *bc;
8858
static PyObject *orig, *excs, *update, *b, *fromlist, *level, *from;
59+
static PyObject **pieces, **values;
8960
static size_t jump;
9061
// Dummy variables for cache effects
9162
static uint16_t invert, counter, index, hint;
@@ -456,7 +427,7 @@ dummy_func(
456427
PREDICT(JUMP_BACKWARD);
457428
}
458429

459-
inst(SET_ADD, (set, unused[oparg-1], v -- set, unused[oparg-1])) {
430+
inst(SET_ADD, (set, unused[oparg-1], v -- set, unused[oparg-1])) {
460431
int err = PySet_Add(set, v);
461432
Py_DECREF(v);
462433
ERROR_IF(err, error);
@@ -3336,8 +3307,10 @@ dummy_func(
33363307
// END BYTECODES //
33373308

33383309
}
3310+
dispatch_opcode:
33393311
error:
33403312
exception_unwind:
3313+
exit_unwind:
33413314
handle_eval_breaker:
33423315
resume_frame:
33433316
resume_with_error:

0 commit comments

Comments
 (0)