Skip to content

Commit 1d93208

Browse files
committed
remove some special cases
1 parent 4bd251e commit 1d93208

File tree

1 file changed

+3
-16
lines changed

1 file changed

+3
-16
lines changed

Python/optimizer.c

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -675,7 +675,6 @@ _PyJit_translate_single_bytecode_to_trace(
675675
_Py_CODEUNIT *this_instr = tracer->prev_state.instr;
676676
_Py_CODEUNIT *target_instr = this_instr;
677677
uint32_t target = 0;
678-
int end_trace_opcode = _DEOPT;
679678

680679
target = Py_IsNone((PyObject *)old_code)
681680
? (uint32_t)(target_instr - _Py_INTERPRETER_TRAMPOLINE_INSTRUCTIONS_PTR)
@@ -780,7 +779,7 @@ _PyJit_translate_single_bytecode_to_trace(
780779
}
781780
if (curr->opcode == _SET_IP) {
782781
int32_t old_target = (int32_t)uop_get_target(curr);
783-
curr->opcode = end_trace_opcode;
782+
curr->opcode = _DEOPT;
784783
curr->format = UOP_FORMAT_TARGET;
785784
curr->target = old_target;
786785
}
@@ -843,12 +842,7 @@ _PyJit_translate_single_bytecode_to_trace(
843842
trace->end -= needs_guard_ip;
844843

845844
int space_needed = expansion->nuops + needs_guard_ip + 2 + (!OPCODE_HAS_NO_SAVE_IP(opcode));
846-
if (uop_buffer_remaining_space(trace) < space_needed) {
847-
DPRINTF(2, "No room for expansions and guards (need %d, got %d)\n",
848-
space_needed, uop_buffer_remaining_space(trace));
849-
OPT_STAT_INC(trace_too_long);
850-
goto done;
851-
}
845+
assert(uop_buffer_remaining_space(trace) > space_needed);
852846

853847
ADD_TO_TRACE(_CHECK_VALIDITY, 0, 0, target);
854848

@@ -1011,14 +1005,7 @@ _PyJit_translate_single_bytecode_to_trace(
10111005
else if (uop == _PUSH_FRAME) {
10121006
_PyJitTracerTranslatorState *ts_depth = &tracer->translator_state;
10131007
ts_depth->frame_depth++;
1014-
if (ts_depth->frame_depth >= MAX_ABSTRACT_FRAME_DEPTH) {
1015-
// The optimizer can't handle frames this deep,
1016-
// so there's no point continuing the trace.
1017-
DPRINTF(2, "Unsupported: frame depth %d >= MAX_ABSTRACT_FRAME_DEPTH\n",
1018-
ts_depth->frame_depth);
1019-
end_trace_opcode = _EXIT_TRACE;
1020-
goto unsupported;
1021-
}
1008+
assert(ts_depth->frame_depth < MAX_ABSTRACT_FRAME_DEPTH);
10221009
int32_t frame_penalty = compute_frame_penalty(&tstate->interp->opt_config);
10231010
int32_t cost = frame_penalty * ts_depth->frame_depth;
10241011
ts_depth->fitness -= cost;

0 commit comments

Comments
 (0)