Skip to content

Commit d549596

Browse files
committed
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.
1 parent 3dea8c9 commit d549596

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

py/scope.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ typedef struct _scope_t {
7171
struct _scope_t *parent;
7272
struct _scope_t *next;
7373
mp_parse_node_t pn;
74-
qstr source_file;
75-
qstr simple_name;
74+
uint16_t source_file; // a qstr
75+
uint16_t simple_name; // a qstr
7676
mp_raw_code_t *raw_code;
7777
uint8_t scope_flags; // see runtime0.h
7878
uint8_t emit_options; // see compile.h

0 commit comments

Comments
 (0)