summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2016-09-30 12:45:00 +1000
committerDamien George <damien.p.george@gmail.com>2016-09-30 12:45:00 +1000
commitd5495966cea38f452646b2f171859f66bebcf05e (patch)
treea52f75fde5c9bfb47bd75599a1cfda410aec85f8
parent3dea8c9e926d0c1b1049ff9d5abeedfb001fc201 (diff)
downloadmicropython-d5495966cea38f452646b2f171859f66bebcf05e.tar.gz
micropython-d5495966cea38f452646b2f171859f66bebcf05e.zip
py/scope: Shrink scope_t struct by 1 machine word.
On 32-bit archs this makes the scope_t struct 48 bytes in size, which fits in 3 GC blocks (previously it used 4 GC blocks). This will lead to some savings when compiling scripts because there are usually quite a few scopes, one for each function and class. Note that qstrs will fit in 16 bits, this assumption is made in a few other places.
-rw-r--r--py/scope.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/py/scope.h b/py/scope.h
index 23a863ac52..52cbbf118f 100644
--- a/py/scope.h
+++ b/py/scope.h
@@ -71,8 +71,8 @@ typedef struct _scope_t {
struct _scope_t *parent;
struct _scope_t *next;
mp_parse_node_t pn;
- qstr source_file;
- qstr simple_name;
+ uint16_t source_file; // a qstr
+ uint16_t simple_name; // a qstr
mp_raw_code_t *raw_code;
uint8_t scope_flags; // see runtime0.h
uint8_t emit_options; // see compile.h