Skip to content

Commit e3d2ffe

Browse files
committed
py/persistentcode.c: Explain the "special" fixed QSTRs.
These are part of the .mpy ABI and avoid needing to duplicate string data for QSTRs known to already be in the firmware. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
1 parent 354d5ba commit e3d2ffe

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

py/makeqstrdata.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@
5252
codepoint2name[ord("|")] = "pipe"
5353
codepoint2name[ord("~")] = "tilde"
5454

55-
# static qstrs, should be sorted
55+
# static qstrs, these must maintain a specific order for .mpy compatibility
56+
# See QSTR_LAST_STATIC at the top of py/persistentcode.c
5657

5758
static_qstr_list = [
5859
"",

py/persistentcode.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@
4040

4141
#include "py/smallint.h"
4242

43+
// makeqstrdata.py has a fixed list of qstrs at the start that we can assume
44+
// are available with know indices on all MicroPython implementations, and
45+
// avoid needing to duplicate the string data in the .mpy file. This is the
46+
// last one in that list (anything with a qstr less than or equal to this is
47+
// assumed to be in the list).
4348
#define QSTR_LAST_STATIC MP_QSTR_zip
4449

4550
#if MICROPY_DYNAMIC_COMPILER

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy