[Python-Dev] Register-based VM [Was: Possible performance regression]
vstinner at redhat.com
Tue Feb 26 18:05:41 EST 2019
Le mar. 26 févr. 2019 à 23:40, Greg Ewing
<greg.ewing at canterbury.ac.nz> a écrit :
> Victor Stinner wrote:
> > LOAD_CONST_REG R0, 2 (const#2)
> > LOAD_GLOBAL_REG R1, 'range' (name#0)
> > CALL_FUNCTION_REG 4, R1, R1, R0, 'n'
> Out of curiosity, why is the function being passed twice here?
Ah, I should have explained that :-) The first argument of
CALL_FUNCTION_REG is the name of the register used to store the
The compiler begins with using static single assignment form (SSA) but
then uses a register allocator to reduce the number of used registers.
Usually, at the end you have less than 5 registers for a whole
Since R1 was only used to store the function before the call and isn't
used after, the R1 register can be re-used.
Using a different register may require an explicit "CLEAR_REG R1"
(decref the reference to the builtin range function) which is less
Note: The CALL_FUNCTION instruction using the stack implicitly put the
result into the stack (and "pop" function arguments from the stack).
Night gathers, and now my watch begins. It shall not end until my death.
More information about the Python-Dev