Quicken, but not specialize, on first execution. #346
Replies: 2 comments 6 replies
-
I am a little vague on the exact definitions of quickening vs. specializing. Is this correct?
(UPDATE: PEP 659 doesn't use the terms in exactly this way -- it seems to agree on the definition of specialization, but the entire process seems to be referred to as quickening: "Quickening is the process of replacing slow instructions with faster variants.") Regarding this idea in particular, it looks like all these instruction sequences take up the same amount of space, so why bother with the unquickened form? If you want to avoid exposing the adaptive opcodes to Python code via the |
Beta Was this translation helpful? Give feedback.
-
You're not the only one 🙂 I should fix up PEP 659 to be more precise. We need to convert from "unquickened" to "quickened" form somewhere.
There are downsides to 1-3.
#338 proposes a different |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Currently we hold a per-code-object count to determine when to quicken, and then specialize on the first execution after that.
Instead we could quicken on the first execution, specializing some number of executions after that. Quickening would be done per-instruction, as we do for specialization.
To do this we would insert a
QUICKEN
instruction in place of any adaptive instructions.So, for instruction
XXX
with adaptive formXXX_ADAPTIVE
, we currently have:On quickening we change this to:
We could instead emit this sequence:
The
QUICKEN
opcode would replace itself with the adaptive form of following opcode, and set the following instruction to the warmup value:This would remove the need for the quickening forms of backward branches and
RESUME
, at the cost of the new instructionQUICKEN
.Beta Was this translation helpful? Give feedback.
All reactions