Skip to content

Commit 6e3156b

Browse files
Address review
1 parent 9dc536b commit 6e3156b

File tree

6 files changed

+3
-22
lines changed

6 files changed

+3
-22
lines changed

Include/internal/pycore_optimizer_types.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,6 @@ typedef struct _Py_UOpsAbstractFrame {
140140
int stack_len;
141141
int locals_len;
142142
bool caller; // We have made a call from this frame during the trace
143-
bool known_callee;
144143
PyFunctionObject *func;
145144
PyCodeObject *code;
146145

Lib/test/test_capi/test_opt.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -630,9 +630,6 @@ def dummy(x):
630630
self.assertIn("_PUSH_FRAME", uops)
631631
self.assertIn("_BINARY_OP_ADD_INT", uops)
632632
self.assertNotIn("_CHECK_PEP_523", uops)
633-
# The callee is known, so these should be missing.
634-
self.assertNotIn("_GUARD_IP__PUSH_FRAME", uops)
635-
self.assertNotIn("_GUARD_CODE_VERSION__PUSH_FRAME", uops)
636633

637634
def test_int_type_propagate_through_range(self):
638635
def testfunc(n):

Python/optimizer_analysis.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ optimize_guard_code_version(JitOptContext *ctx, _PyBloomFilter *dependencies,
390390
if (co->co_version == version) {
391391
_Py_BloomFilter_Add(dependencies, co);
392392
// If frame func is known, that means we can get rid of the code guard.
393-
if (ctx->frame->caller || ctx->frame->known_callee) {
393+
if (ctx->frame->func != NULL && ctx->frame->func->func_version != 0) {
394394
REPLACE_OP(this_instr, _NOP, 0, 0);
395395
}
396396
}

Python/optimizer_bytecodes.c

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -904,11 +904,7 @@ dummy_func(void) {
904904
}
905905

906906
if (sym_is_null(self_or_null) || sym_is_not_null(self_or_null)) {
907-
_Py_UOpsAbstractFrame *new_frame_f = frame_new_from_symbol(ctx, callable, args, argcount);
908-
new_frame = PyJitRef_WrapInvalid(new_frame_f);
909-
if (new_frame_f != NULL) {
910-
new_frame_f->known_callee = true;
911-
}
907+
new_frame = PyJitRef_WrapInvalid(frame_new_from_symbol(ctx, callable, args, argcount));
912908
} else {
913909
new_frame = PyJitRef_WrapInvalid(frame_new_from_symbol(ctx, callable, NULL, 0));
914910
}
@@ -1790,9 +1786,6 @@ dummy_func(void) {
17901786
op(_GUARD_IP__PUSH_FRAME, (ip/4 --)) {
17911787
(void)ip;
17921788
stack_pointer = sym_set_stack_depth((int)this_instr->operand1, stack_pointer);
1793-
if (ctx->frame->known_callee) {
1794-
REPLACE_OP(this_instr, _NOP, 0, 0);
1795-
}
17961789
}
17971790

17981791
op(_GUARD_IP_YIELD_VALUE, (ip/4 --)) {

Python/optimizer_cases.c.h

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

Python/optimizer_symbols.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1329,7 +1329,6 @@ _Py_uop_frame_new_from_symbol(
13291329
assert(PyFunction_Check(func));
13301330
frame->func = func;
13311331
}
1332-
frame->known_callee = false;
13331332
assert(frame->stack_pointer != NULL);
13341333
return frame;
13351334
}

0 commit comments

Comments
 (0)