summaryrefslogtreecommitdiffstatshomepage
path: root/py/mpqstr.h
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2014-01-04 15:57:35 +0000
committerDamien George <damien.p.george@gmail.com>2014-01-04 15:57:35 +0000
commiteb7bfcb28697f6fb2d4d933bc39233aa15423a20 (patch)
tree54b38d50cac986fba791fb0eb00804069c41e9c3 /py/mpqstr.h
parente67ed5d285bb2ae7b83eb8be3ee488ab08fa4db1 (diff)
downloadmicropython-eb7bfcb28697f6fb2d4d933bc39233aa15423a20.tar.gz
micropython-eb7bfcb28697f6fb2d4d933bc39233aa15423a20.zip
Split qstr into pools, and put initial pool in ROM.
Qstr's are now split into a linked-list of qstr pools. This has 2 benefits: the first pool can be in ROM (huge benefit, since we no longer use RAM for the core qstrs), and subsequent pools use m_new for the next pool instead of m_renew (thus avoiding a huge single table for all the qstrs). Still would be better to use a hash table, but this scheme takes us part of the way (eventually convert the pools to hash tables). Also fixed bug with import. Also improved the way the module code is referenced (not magic number 1 anymore).
Diffstat (limited to 'py/mpqstr.h')
-rw-r--r--py/mpqstr.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/py/mpqstr.h b/py/mpqstr.h
new file mode 100644
index 0000000000..1440fb3b80
--- /dev/null
+++ b/py/mpqstr.h
@@ -0,0 +1,13 @@
+// See mpqstrraw.h for a list of qstr's that are available as constants.
+// Reference them as MP_QSTR_xxxx.
+//
+// Note: it would be possible to define MP_QSTR_xxx as qstr_from_str_static("xxx")
+// for qstrs that are referenced this way, but you don't want to have them in ROM.
+
+enum {
+ MP_QSTR_nil = 0,
+#define Q(id) MP_QSTR_##id,
+#include "mpqstrraw.h"
+#undef Q
+ MP_QSTR_number_of,
+} category_t;