py/gc: Make GC block size be configurable.

This commit is contained in:
Paul Sokolovsky 2015-12-03 01:40:52 +02:00
parent 0077958ad0
commit 75feece208
2 changed files with 6 additions and 2 deletions

View File

@ -46,8 +46,8 @@
// make this 1 to dump the heap each time it changes // make this 1 to dump the heap each time it changes
#define EXTENSIVE_HEAP_PROFILING (0) #define EXTENSIVE_HEAP_PROFILING (0)
#define WORDS_PER_BLOCK (4) #define WORDS_PER_BLOCK ((MICROPY_BYTES_PER_GC_BLOCK) / BYTES_PER_WORD)
#define BYTES_PER_BLOCK (WORDS_PER_BLOCK * BYTES_PER_WORD) #define BYTES_PER_BLOCK (MICROPY_BYTES_PER_GC_BLOCK)
// ATB = allocation table byte // ATB = allocation table byte
// 0b00 = FREE -- free block // 0b00 = FREE -- free block

View File

@ -96,6 +96,10 @@
/*****************************************************************************/ /*****************************************************************************/
/* Memory allocation policy */ /* Memory allocation policy */
// Number of bytes in memory allocation/GC block. Any size allocated will be
// rounded up to be multiples of this.
#define MICROPY_BYTES_PER_GC_BLOCK (4 * BYTES_PER_WORD)
// Number of words allocated (in BSS) to the GC stack (minimum is 1) // Number of words allocated (in BSS) to the GC stack (minimum is 1)
#ifndef MICROPY_ALLOC_GC_STACK_SIZE #ifndef MICROPY_ALLOC_GC_STACK_SIZE
#define MICROPY_ALLOC_GC_STACK_SIZE (64) #define MICROPY_ALLOC_GC_STACK_SIZE (64)