From d5495966cea38f452646b2f171859f66bebcf05e Mon Sep 17 00:00:00 2001 From: Damien George <damien.p.george@gmail.com> Date: Fri, 30 Sep 2016 12:45:00 +1000 Subject: [PATCH] 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. --- py/scope.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/py/scope.h b/py/scope.h index 23a863ac5..52cbbf118 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 -- GitLab