Skip to content

Commit afb0102

Browse files
committed
qemu/main: Make GC heap size configurable on a per-arch basis.
On certain circumstances depending on the code size, the `deflate_decompress` test fails on RV32 with a memory allocation failure error. The issue is mitigated by having a larger GC heap, in this case around 20KBytes more than the 100KBytes default. This commit makes the GC heap size configurable on a per-arch basis, with Arm using the default 100KBytes heap, and RV32 using a 120KBytes heap. Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
1 parent 1c8f0b5 commit afb0102

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

ports/qemu/Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,20 @@ QSTR_DEFS = qstrdefsport.h
1919
MICROPY_ROM_TEXT_COMPRESSION ?= 1
2020

2121
ifeq ($(QEMU_ARCH),arm)
22+
QEMU_GC_HEAP_SIZE ?= 100
2223
FROZEN_MANIFEST ?= "freeze('test-frzmpy', ('frozen_asm_thumb.py', 'frozen_const.py', 'frozen_viper.py', 'native_frozen_align.py'))"
2324
endif
2425
ifeq ($(QEMU_ARCH),riscv32)
26+
QEMU_GC_HEAP_SIZE ?= 120
2527
FROZEN_MANIFEST ?= "freeze('test-frzmpy', ('frozen_asm_rv32imc.py', 'frozen_const.py', 'frozen_viper.py', 'native_frozen_align.py'))"
2628
endif
2729

2830
# include py core make definitions
2931
include $(TOP)/py/py.mk
3032
include $(TOP)/extmod/extmod.mk
3133

34+
CFLAGS += -DGC_HEAP_SIZE=$(QEMU_GC_HEAP_SIZE)
35+
3236
################################################################################
3337
# ARM specific settings
3438

ports/qemu/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,3 +110,5 @@ The following options can be specified on the `make` command line:
110110
- `QEMU_DEBUG_ARGS`: defaults to `-s` (gdb on TCP port 1234), but can be overridden
111111
with different qemu gdb arguments.
112112
- `QEMU_DEBUG_EXTRA`: extra options to pass to qemu when `QEMU_DEBUG=1` is used.
113+
- `QEMU_GC_HEAP_SIZE`: pass in an optional value (in KBytes) for overriding the GC
114+
heap size used by the port.

ports/qemu/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
#include "shared/runtime/gchelper.h"
3535
#include "shared/runtime/pyexec.h"
3636

37-
#define HEAP_SIZE (100 * 1024)
37+
#define HEAP_SIZE (GC_HEAP_SIZE * 1024)
3838

3939
static uint32_t gc_heap[HEAP_SIZE / sizeof(uint32_t)];
4040

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy