> It seems like your Python changes use Py_False "somewhere" without
> Py_INCREF(Py_False).

> Maybe it's COMPARE_OP_REG() which calls SETLOCAL(dst, False).

Yes, this was the problem. Thanks for the fix. Too much blind
adherence on my part to the existing COMPARE_OP logic. I've even
written (relatively speaking) tomes about it in both my in-progress
PEP as well as in various comments throughout the code. I don't think
I had all that sorted out in my mind before implementing the first few
instructions.

Fortunately, I'm not too far into implementing the actual
instructions. I should be able to easily go back and desk check the
others.

> Replacing stack-based bytecode with register-based bytecode requires
> to rethink the lifetime of registers... I had a hard time to fix my
> old "registervm" project to fix the register lifetime: I added
> CLEAR_REG bytecode to explicitly clear a register. Using a stack, all
> "CLEAR_REG" operation are implicit. You have to make them explicit.
> Hopefully, a compiler can easily reuse registers and remove most
> CLEAR_REG.

I'm trying it the simplest way I can think of. Registers are exactly
like local variables, so SETLOCAL Py_XDECREFs whatever is already
there before overwriting it with a new value. At the end of
_PyEval_EvalFrameDefault if the code object's co_flags includes the
(new) CO_REGISTER flag, it loops over the stack/register space calling
Py_CLEAR. The stack/register space is also Py_CLEAR'd when the frame
is first allocated.

Skip
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/OD2ZNQRVDN652JZAPPFYJV67KRXHIMTH/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to