10000 Merge pull request #5333 from microDev1/patch · unwiredben/circuitpython@59b1bed · GitHub
[go: up one dir, main page]

Skip to content

Commit 59b1bed

Browse files
authored
Merge pull request adafruit#5333 from microDev1/patch
Make `next_code_allocation` and `prev_traceback_allocation` movable
2 parents dfba2ee + 0ab4df6 commit 59b1bed

File tree

8 files changed

+18
-8
lines changed

8 files changed

+18
-8
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

ports/atmel-samd/boards/arduino_mkr1300/mpconfigboard.mk

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,5 @@ CHIP_FAMILY = samd21
99
INTERNAL_FLASH_FILESYSTEM = 1
1010
LONGINT_IMPL = NONE
1111
CIRCUITPY_FULL_BUILD = 0
12+
13+
CIRCUITPY_RAINBOWIO = 0

ports/atmel-samd/boards/arduino_nano_33_iot/mpconfigboard.mk

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,5 @@ CHIP_FAMILY = samd21
99
INTERNAL_FLASH_FILESYSTEM = 1
1010
LONGINT_IMPL = NONE
1111
CIRCUITPY_FULL_BUILD = 0
12+
13+
CIRCUITPY_RAINBOWIO = 0

ports/atmel-samd/boards/arduino_zero/mpconfigboard.mk

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,5 @@ CHIP_FAMILY = samd21
99
INTERNAL_FLASH_FILESYSTEM = 1
1010
LONGINT_IMPL = NONE
1111
CIRCUITPY_FULL_BUILD = 0
12+
13+
CIRCUITPY_RAINBOWIO = 0

ports/atmel-samd/boards/sensebox_mcu/mpconfigboard.mk

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,6 @@ LONGINT_IMPL = NONE
1111
CIRCUITPY_FULL_BUILD = 0
1212

1313
# There are many pin definitions on this board; it doesn't quite fit on very large translations.
14-
# So remove what might be least likely module to be used.
14+
# Remove a couple of modules.
15+
CIRCUITPY_ONEWIREIO = 0
1516
CIRCUITPY_RAINBOWIO = 0

ports/nrf/boards/simmel/mpconfigboard.mk

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,15 @@ CIRCUITPY_COUNTIO = 0
2020
CIRCUITPY_DISPLAYIO = 0
2121
CIRCUITPY_ERRNO = 0
2222
CIRCUITPY_FRAMEBUFFERIO = 0
23+
CIRCUITPY_GETPASS = 0
2324
CIRCUITPY_KEYPAD = 0
2425
CIRCUITPY_MSGPACK = 0
2526
CIRCUITPY_NEOPIXEL_WRITE = 0
2627
CIRCUITPY_NVM = 0
2728
CIRCUITPY_PIXELBUF = 0
2829
CIRCUITPY_PULSEIO = 0
2930
CIRCUITPY_PWMIO = 1
31+
CIRCUITPY_RAINBOWIO = 0
3032
CIRCUITPY_RGBMATRIX = 0
3133
CIRCUITPY_ROTARYIO = 0
3234
CIRCUITPY_RTC = 1

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
< 57AE code>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