From dd11af209d226b7d18d5148b239662e30ed60bad Mon Sep 17 00:00:00 2001 From: Damien George Date: Wed, 19 Apr 2017 09:45:59 +1000 Subject: py: Add LOAD_SUPER_METHOD bytecode to allow heap-free super meth calls. This patch allows the following code to run without allocating on the heap: super().foo(...) Before this patch such a call would allocate a super object on the heap and then load the foo method and call it right away. The super object is only needed to perform the lookup of the method and not needed after that. This patch makes an optimisation to allocate the super object on the C stack and discard it right after use. Changes in code size due to this patch are: bare-arm: +128 minimal: +232 unix x64: +416 unix nanbox: +364 stmhal: +184 esp8266: +340 cc3200: +128 --- py/bc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'py/bc.c') diff --git a/py/bc.c b/py/bc.c index 4c0eb5391..fc1794683 100644 --- a/py/bc.c +++ b/py/bc.c @@ -304,7 +304,7 @@ STATIC const byte opcode_format_table[64] = { OC4(U, U, U, U), // 0x0c-0x0f OC4(B, B, B, U), // 0x10-0x13 OC4(V, U, Q, V), // 0x14-0x17 - OC4(B, U, V, V), // 0x18-0x1b + OC4(B, V, V, Q), // 0x18-0x1b OC4(Q, Q, Q, Q), // 0x1c-0x1f OC4(B, B, V, V), // 0x20-0x23 OC4(Q, Q, Q, B), // 0x24-0x27 -- cgit v1.2.3