diff options
Diffstat (limited to 'Python')
-rw-r--r-- | Python/bytecodes.c | 1 | ||||
-rw-r--r-- | Python/generated_cases.c.h | 1 | ||||
-rw-r--r-- | Python/optimizer.c | 21 |
3 files changed, 22 insertions, 1 deletions
diff --git a/Python/bytecodes.c b/Python/bytecodes.c index 8a7dcb8..bd81dc1 100644 --- a/Python/bytecodes.c +++ b/Python/bytecodes.c @@ -1210,6 +1210,7 @@ dummy_func( }; specializing op(_SPECIALIZE_UNPACK_SEQUENCE, (counter/1, seq -- seq)) { + TIER_ONE_ONLY #if ENABLE_SPECIALIZATION if (ADAPTIVE_COUNTER_IS_ZERO(counter)) { next_instr = this_instr; diff --git a/Python/generated_cases.c.h b/Python/generated_cases.c.h index fe0cbfe..a74529d 100644 --- a/Python/generated_cases.c.h +++ b/Python/generated_cases.c.h @@ -1731,6 +1731,7 @@ seq = stack_pointer[-1]; { uint16_t counter = read_u16(&this_instr[1].cache); + TIER_ONE_ONLY #if ENABLE_SPECIALIZATION if (ADAPTIVE_COUNTER_IS_ZERO(counter)) { next_instr = this_instr; diff --git a/Python/optimizer.c b/Python/optimizer.c index e14ad89..5d1ef8a 100644 --- a/Python/optimizer.c +++ b/Python/optimizer.c @@ -325,7 +325,8 @@ uop_dealloc(_PyUOpExecutorObject *self) { } static const char * -uop_name(int index) { +uop_name(int index) +{ if (index <= MAX_REAL_OPCODE) { return _PyOpcode_OpName[index]; } @@ -832,6 +833,24 @@ make_executor_from_uops(_PyUOpInstruction *buffer, _PyBloomFilter *dependencies) assert(dest == -1); executor->base.execute = _PyUopExecute; _Py_ExecutorInit((_PyExecutorObject *)executor, dependencies); +#ifdef Py_DEBUG + char *python_lltrace = Py_GETENV("PYTHON_LLTRACE"); + int lltrace = 0; + if (python_lltrace != NULL && *python_lltrace >= '0') { + lltrace = *python_lltrace - '0'; // TODO: Parse an int and all that + } + if (lltrace >= 2) { + printf("Optimized executor (length %d):\n", length); + for (int i = 0; i < length; i++) { + printf("%4d %s(%d, %d, %" PRIu64 ")\n", + i, + uop_name(executor->trace[i].opcode), + executor->trace[i].oparg, + executor->trace[i].target, + executor->trace[i].operand); + } + } +#endif return (_PyExecutorObject *)executor; } |