Yes, this should totally be attempted. All the stack manipulation opcodes could be dropped if we just made (nearly) everything use 3-address codes, e.g. ADD would take the names of three registers, left, right and result. The compiler would keep track of which registers contain a live object (for reference counting) but that can't be much more complicated than checking for stack under- and over-flow.

Also, nothing new indeed -- my first computer (a control data cyber mainframe) had 3-address code.
https://en.wikipedia.org/wiki/CDC_6600#Central_Processor_(CP)

On Tue, Feb 26, 2019 at 1:01 PM Neil Schemenauer <nas-python@python.ca> wrote:
On 2019-02-26, Victor Stinner wrote:
> I made an attempt once and it was faster:
> https://faster-cpython.readthedocs.io/registervm.html

Interesting.  I don't think I have seen that before.  Were you aware
of "Rattlesnake" before you started on that?  It seems your approach
is similar.  Probably not because I don't think it is easy to find.
I uploaded a tarfile I had on my PC to my web site:

    http://python.ca/nas/python/rattlesnake20010813/

It seems his name doesn't appear in the readme or source but I think
Rattlesnake was Skip Montanaro's project.  I suppose my idea of
unifying the local variables and the registers could have came from
Rattlesnake.  Very little new in the world. ;-P

Cheers,

  Neil
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: https://mail.python.org/mailman/options/python-dev/guido%40python.org


--
--Guido van Rossum (python.org/~guido)