qemu/main: Make GC heap size configurable on a per-arch basis.

In certain circumstances depending on the code size, the
`deflate_decompress` test fails on both ARM and RV32 with a memory
allocation failure error.  The issue is mitigated by having a larger GC
heap, in this case around 20 KBytes more than the original 100 KBytes
default.

This commit makes the GC heap size configurable on a per-arch basis, with
both ARM and RV32 using the enlarged 120 KBytes heap.

Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
This commit is contained in:
Alessandro Gatti
2024-09-06 12:43:54 +02:00
committed by Damien George
parent 268acb714d
commit 36aa7545b0
3 changed files with 11 additions and 3 deletions

View File

@@ -34,14 +34,16 @@
#include "shared/runtime/gchelper.h"
#include "shared/runtime/pyexec.h"
#define HEAP_SIZE (100 * 1024)
#if MICROPY_HEAP_SIZE <= 0
#error MICROPY_HEAP_SIZE must be a positive integer.
#endif
static uint32_t gc_heap[HEAP_SIZE / sizeof(uint32_t)];
static uint32_t gc_heap[MICROPY_HEAP_SIZE / sizeof(uint32_t)];
int main(int argc, char **argv) {
mp_stack_ctrl_init();
mp_stack_set_limit(10240);
gc_init(gc_heap, (char *)gc_heap + HEAP_SIZE);
gc_init(gc_heap, (char *)gc_heap + MICROPY_HEAP_SIZE);
for (;;) {
mp_init();