Skip to content

Commit 489e510

Browse files
committed
Tier 2 TOS caching, working for interpreter.
1 parent 579b758 commit 489e510

File tree

9 files changed

+1799
-1568
lines changed

9 files changed

+1799
-1568
lines changed

Include/internal/pycore_uop_ids.h

Lines changed: 526 additions & 538 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Include/internal/pycore_uop_metadata.h

Lines changed: 105 additions & 129 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Python/bytecodes.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5328,6 +5328,7 @@ dummy_func(
53285328
}
53295329

53305330
tier2 op(_DEOPT, (--)) {
5331+
SYNC_SP();
53315332
GOTO_TIER_ONE(_PyFrame_GetBytecode(frame) + CURRENT_TARGET());
53325333
}
53335334

Python/ceval.c

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -164,13 +164,26 @@ dump_item(_PyStackRef item)
164164
printf("%" PRId64, (int64_t)PyStackRef_UntagInt(item));
165165
return;
166166
}
167-
PyObject *obj = PyStackRef_AsPyObjectBorrow(item);
168-
if (obj == NULL) {
169-
printf("<nil>");
170-
return;
167+
if (PyStackRef_IsValid(item)) {
168+
PyObject *obj = PyStackRef_AsPyObjectBorrow(item);
169+
if (obj == NULL) {
170+
printf("<nil>");
171+
return;
172+
}
173+
// Don't call __repr__(), it might recurse into the interpreter.
174+
printf("<%s at %p>", Py_TYPE(obj)->tp_name, (void *)obj);
175+
}
176+
else {
177+
/* Already handled NULL */
178+
if (PyStackRef_IsError(item)) {
179+
printf("ERROR");
180+
}
181+
else {
182+
// Wrapped item
183+
void *ptr = PyStackRef_Unwrap(item);
184+
printf("Wrapped(pointer %p)", ptr);
185+
}
171186
}
172-
// Don't call __repr__(), it might recurse into the interpreter.
173-
printf("<%s at %p>", Py_TYPE(obj)->tp_name, (void *)obj);
174187
}
175188

176189
static void

0 commit comments

Comments
 (0)