Skip to content

Commit 1ae5bbd

Browse files
Address review
1 parent 0b05457 commit 1ae5bbd

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

Python/optimizer_bytecodes.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1771,7 +1771,8 @@ dummy_func(void) {
17711771
PyCodeObject *co = get_current_code_object(ctx);
17721772
if (co->co_version == version) {
17731773
_Py_BloomFilter_Add(dependencies, co);
1774-
if (sym_get_func_version(ctx->frame->callable) != 0) {
1774+
// Functions derive their version from code objects.
1775+
if (sym_get_func_version(ctx->frame->callable) == version) {
17751776
REPLACE_OP(this_instr, _NOP, 0, 0);
17761777
}
17771778
}

Python/optimizer_cases.c.h

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Python/optimizer_symbols.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ NULL | | RECORDED_VALUE*
3737
| KNOWN_CLASS--+ | | |
3838
| | | | | | PREDICATE RECORDED_VALUE(known type)
3939
| | | INT* | | | |
40-
| | | | FUNC_VERSION | | | <- Anything below this level has a known truthiness.
40+
| | | | | | | | <- Anything below this level has a known truthiness.
41+
| | | | FUNC_VERSION | | |
4142
| TUPLE | | | TRUTHINESS | |
4243
| | | | | | | | <- Anything below this level is a known constant.
4344
| KNOWN_VALUE--+-------+----+------+
@@ -100,7 +101,7 @@ _PyUOpSymPrint(JitOptRef ref)
100101
printf("<v%u at %p>", sym->version.version, (void *)sym);
101102
break;
102103
case JIT_SYM_FUNC_VERSION_TAG:
103-
printf("<fv%u at %p>", sym->func_version.func_version, (void *)sym);
104+
printf("<function version=%u>", sym->func_version.func_version);
104105
break;
105106
case JIT_SYM_KNOWN_CLASS_TAG:
106107
printf("<%s at %p>", sym->cls.type->tp_name, (void *)sym);
@@ -527,7 +528,7 @@ _Py_uop_sym_set_func_version(JitOptContext *ctx, JitOptRef ref, uint32_t version
527528
((PyFunctionObject *)sym->recorded_value.value)->func_version != version) {
528529
sym_set_bottom(ctx, sym);
529530
return false;
530-
}
531+
}
531532
// Promote to known value, as we have guarded/checked on it.
532533
sym->tag = JIT_SYM_KNOWN_VALUE_TAG;
533534
// New ownership. We need to NewRef here, as

0 commit comments

Comments
 (0)