summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2019-10-10 15:30:16 +1100
committerDamien George <damien.p.george@gmail.com>2019-10-15 16:56:27 +1100
commit23f0691fddfc35acd2f81f54b15ad2ecaa15c6d4 (patch)
treed8aa64136f0e5d6437e825835a08b985c9593f55 /tests
parent858e992d2e25cf50b06abc33978040092e6f1e16 (diff)
py/persistentcode: Make .mpy more compact with qstr directly in prelude.
Instead of encoding 4 zero bytes as placeholders for the simple_name and source_file qstrs, and storing the qstrs after the bytecode, store the qstrs at the location of these 4 bytes. This saves 4 bytes per bytecode function stored in a .mpy file (for example lcd160cr.mpy drops by 232 bytes, 4x 58 functions). And resulting code size is slightly reduced on ports that use this feature.
Diffstat (limited to 'tests')
-rw-r--r--tests/import/mpy_native.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/tests/import/mpy_native.py b/tests/import/mpy_native.py
index 749320dbb..c33b3350c 100644
--- a/tests/import/mpy_native.py
+++ b/tests/import/mpy_native.py
@@ -57,11 +57,11 @@ user_files = {
b'M\x05\x0b\x1f\x20' # header
b'\x20' # n bytes, bytecode
- b'\x00\x08\x00\x00\x00\x00' # prelude
+ b'\x00\x08\x02m\x02m' # prelude
b'\x51' # LOAD_CONST_NONE
b'\x63' # RETURN_VALUE
- b'\x02m\x02m\x00\x02' # simple_name, source_file, n_obj, n_raw_code
+ b'\x00\x02' # n_obj, n_raw_code
b'\x22' # n bytes, viper code
b'\x00\x00\x00\x00\x00\x00' # dummy machine code