8000 make `next_code_allocation` and `prev_traceback_allocation` movable · domdfcoding/circuitpython@7316c74 · GitHub
[go: up one dir, main page]

Skip to content

Commit 7316c74

Browse files
committed
make next_code_allocation and prev_traceback_allocation movable
1 parent cf5c32b commit 7316c74

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ STATIC void cleanup_after_vm(supervisor_allocation* heap, mp_obj_t exception) {
236236
size_t traceback_len = 0;
237237
mp_print_t print_count = {&traceback_len, count_strn};
238238
mp_obj_print_exception(&print_count, exception);
239-
prev_traceback_allocation = allocate_memory(align32_size(traceback_len + 1), false, false);
239+
prev_traceback_allocation = allocate_memory(align32_size(traceback_len + 1), false, true);
240240
// Empirically, this never fails in practice - even when the heap is totally filled up
241241
// with single-block-sized objects referenced by a root pointer, exiting the VM frees
242242
// up several hundred bytes, sufficient for the traceback (which tends to be shortened

shared-bindings/supervisor/__init__.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ STATIC mp_obj_t supervisor_set_next_code_file(size_t n_args, const mp_obj_t *pos
195195
const char *filename = mp_obj_str_get_data(args.filename.u_obj, &len);
196196
free_memory(next_code_allocation);
197197
if (options != 0 || len != 0) {
198-
next_code_allocation = allocate_memory(align32_size(sizeof(next_code_info_t) + len + 1), false, false);
198+
next_code_allocation = allocate_memory(align32_size(sizeof(next_code_info_t) + len + 1), false, true);
199199
if (next_code_allocation == NULL) {
200200
m_malloc_fail(sizeof(next_code_info_t) + len + 1);
201201
}

supervisor/shared/memory.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,9 @@
3434

3535
enum {
3636
CIRCUITPY_SUPERVISOR_IMMOVABLE_ALLOC_COUNT =
37+
0
3738
// stack + heap
38-
2
39-
// next_code_allocation
40-
+ 1
41-
// prev_traceback_allocation
42-
+ 1
39+
+ 2
4340

4441
#if INTERNAL_FLASH_FILESYSTEM == 0
4542
+ 1
@@ -59,6 +56,10 @@ enum {
5956

6057
CIRCUITPY_SUPERVISOR_MOVABLE_ALLOC_COUNT =
6158
0
59+
// next_code_allocation
60+
+ 1
61+
// prev_traceback_allocation
62+
+ 1
6263
#if CIRCUITPY_DISPLAYIO
6364
#if CIRCUITPY_TERMINALIO
6465
+ 1

0 commit comments

Comments
 (0)
0