diff options
author | Damien George <damien.p.george@gmail.com> | 2017-02-24 13:43:43 +1100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2017-02-24 13:43:43 +1100 |
commit | 5255255fb9ea003db65935fe6cf2ac9d17410faa (patch) | |
tree | 6128e37b20f9440f387f5d3d36c9110dd19950a7 /py/emitinlinethumb.c | |
parent | f62503dc4757902a1f68c55b938bcd6ddfd6e002 (diff) | |
download | micropython-5255255fb9ea003db65935fe6cf2ac9d17410faa.tar.gz micropython-5255255fb9ea003db65935fe6cf2ac9d17410faa.zip |
py: Create str/bytes objects in the parser, not the compiler.
Previous to this patch any non-interned str/bytes objects would create a
special parse node that held a copy of the str/bytes data. Then in the
compiler this data would be turned into a str/bytes object. This actually
lead to 2 copies of the data, one in the parse node and one in the object.
The parse node's copy of the data would be freed at the end of the compile
stage but nevertheless it meant that the peak memory usage of the
parse/compile stage was higher than it needed to be (by an amount equal to
the number of bytes in all the non-interned str/bytes objects).
This patch changes the behaviour so that str/bytes objects are created
directly in the parser and the object stored in a const-object parse node
(which already exists for bignum, float and complex const objects). This
reduces peak RAM usage of the parse/compile stage, simplifies the parser
and compiler, and reduces code size by about 170 bytes on Thumb2 archs,
and by about 300 bytes on Xtensa archs.
Diffstat (limited to 'py/emitinlinethumb.c')
-rw-r--r-- | py/emitinlinethumb.c | 2 |
1 files changed, 0 insertions, 2 deletions
diff --git a/py/emitinlinethumb.c b/py/emitinlinethumb.c index 89bcebfead..c1a4eac5d0 100644 --- a/py/emitinlinethumb.c +++ b/py/emitinlinethumb.c @@ -42,8 +42,6 @@ typedef enum { #include "py/grammar.h" #undef DEF_RULE #undef DEF_RULE_NC - PN_string, // special node for non-interned string - PN_bytes, // special node for non-interned bytes PN_const_object, // special node for a constant, generic Python object // define rules without a compile function #define DEF_RULE(rule, comp, kind, ...) |