diff options
| author | Damien George | 2017-04-19 09:45:59 +1000 |
|---|---|---|
| committer | Damien George | 2017-04-22 23:39:20 +1000 |
| commit | dd11af209d226b7d18d5148b239662e30ed60bad (patch) | |
| tree | 8343a2ce54172f2f3304ca5dba49f352f37b5c17 /tools | |
| parent | 5335942b599d85263d3c18eb99ff5ebd04a8bc98 (diff) | |
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
Diffstat (limited to 'tools')
| -rwxr-xr-x | tools/mpy-tool.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/tools/mpy-tool.py b/tools/mpy-tool.py index d14e0f4ea..d2a1c67ad 100755 --- a/tools/mpy-tool.py +++ b/tools/mpy-tool.py @@ -57,7 +57,7 @@ class FreezeError(Exception): return 'error while freezing %s: %s' % (self.rawcode.source_file, self.msg) class Config: - MPY_VERSION = 1 + MPY_VERSION = 2 MICROPY_LONGINT_IMPL_NONE = 0 MICROPY_LONGINT_IMPL_LONGLONG = 1 MICROPY_LONGINT_IMPL_MPZ = 2 @@ -94,7 +94,7 @@ def make_opcode_format(): 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 |
