Hi Antoine,

Wpython already addressed this with two new opcodes.

RETURN_CONST constant_index

which is an equivalent of:

LOAD_CONST constant_index
RETURN_VALUE

and with:

CALL_PROC_RETURN_CONST function_arguments, constant_index

which is an equivalent of:

CALL_FUNCTION function_arguments
POP_TOP
LOAD_CONST constant_index
RETURN_VALUE

The new opcodes handle common patterns that I found with a stats tool I
made, and helps both on space size and execution speed.

Regards,

Cesare

2009/9/1 Antoine Pitrou <solip...@pitrou.net>

> Gregory P. Smith <greg <at> krypto.org> writes:
> >
> > I was just wondering if a bytecode for a superinstruction of the common
> sequence:
> > 6 POP_TOP
> > 7 LOAD_CONST               0 (None)
> > 10 RETURN_VALUE
> > might be worth it.
>
> I think superinstructions in general would be a good thing to experiment,
> as
> wpython showed. Direct addressing (via a pseudo register file combining
> locals
> and constants) would eliminate many bookkeeping-related opcodes in common
> bytecode.
>
> Regards
>
> Antoine.
>
>
> _______________________________________________
> Python-Dev mailing list
> Python-Dev@python.org
> http://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe:
> http://mail.python.org/mailman/options/python-dev/cesare.dimauro%40a-tono.com
>
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to