Skip to content

Commit ec6eac8

Browse files
committed
docs
1 parent 6af5940 commit ec6eac8

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

Lib/test/test_capi/test_opt.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1565,8 +1565,8 @@ def fn(a):
15651565
def test_init_resolves_callable(self):
15661566
"""
15671567
_CHECK_AND_ALLOCATE_OBJECT should resolve __init__ to a constant,
1568-
enabling the optimizer to trace into the init frame and eliminate
1569-
redundant function version and arg count checks.
1568+
enabling the optimizer to propagate type information through the frame
1569+
and eliminate redundant function version and arg count checks.
15701570
"""
15711571
class MyPoint:
15721572
def __init__(self, x, y):

Python/bytecodes.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2721,6 +2721,11 @@ dummy_func(
27212721
}
27222722

27232723
op(_GUARD_TYPE_VERSION_LOCKED, (type_version/2, owner -- owner)) {
2724+
// Guard that type version matches expected value. Object is assumed to be
2725+
// locked on entry. If version matches, lock is retained for subsequent
2726+
// operations. If mismatch, unlock and exit (deopt). This allows the JIT
2727+
// optimizer to eliminate this guard entirely if type version is proven,
2728+
// in which case the lock is held for the entire trace duration.
27242729
PyObject *owner_o = PyStackRef_AsPyObjectBorrow(owner);
27252730
assert(type_version != 0);
27262731
PyTypeObject *tp = Py_TYPE(owner_o);

0 commit comments

Comments
 (0)