all: Rename BYTES_PER_WORD to MP_BYTES_PER_OBJ_WORD.

The "word" referred to by BYTES_PER_WORD is actually the size of mp_obj_t
which is not always the same as the size of a pointer on the target
architecture.  So rename this config value to better reflect what it
measures, and also prefix it with MP_.

For uses of BYTES_PER_WORD in setting the stack limit this has been
changed to sizeof(void *), because the stack usually grows with
machine-word sized values (eg an nlr_buf_t has many machine words in it).

Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
Damien George
2021-02-04 16:39:09 +11:00
parent 7e956fae28
commit ad4656b861
11 changed files with 16 additions and 19 deletions

View File

@@ -53,7 +53,7 @@ mp_obj_t execute_from_str(const char *str) {
int main() {
// Initialized stack limit
mp_stack_set_limit(40000 * (BYTES_PER_WORD / 4));
mp_stack_set_limit(40000 * (sizeof(void *) / 4));
// Initialize heap
gc_init(heap, heap + sizeof(heap));
// Initialize interpreter