Affected area by change:
- Language Syntax: no
- Language Library (Parac Base Library): yes
- Compiler: yes
- Pre-Processor: no
- Documentation: yes
Short Introduction and Summary
Currently, the implementation of memory is handled through datatypes which are allocated purely on the heap, as they use void* PblMalloc(size_t), though for better optimisations the allocations should happen preferably on the stack, and if possible with stack overflow checking, to avoid undefined behaviour.
Is your request related to a problem? Please describe.
At the moment, the allocation of memory is rather inefficient, as even small data-types are allocated on the stack, causing slow-downs, which could be easily fixed with additional implementation of something like void* PblAlloca(size_t).
Describe the solution you'd like
- Implement a generic function in
pbl-mem.h with the following signature void* PblAlloca(size_t).
- Additional macros called
PBL_ALLOCA_DECLARATION and PBL_ALLOCA_DEFINITION, which should use PblAlloca()
- Rename
PBL_ALLOC_DEFINITION to PBL_MALLOC_DEFINITION, PBL_ALLOC_DECLARATION to PBL_MALLOC_DECLARATION and PBL_ALLOC_ARRAY_DEFINITION to PBL_MALLOC_ARRAY_DEFINITION for clearer signalisation that the heap is used.
Describe alternatives you've considered
Perhaps revert to the old usage of actual finished types, though this would create issues with the current pointer implementations, so re-creating the stack usage is preferable.
Additional context
Affected area by change:
Short Introduction and Summary
Currently, the implementation of memory is handled through datatypes which are allocated purely on the heap, as they use
void* PblMalloc(size_t), though for better optimisations the allocations should happen preferably on the stack, and if possible with stack overflow checking, to avoid undefined behaviour.Is your request related to a problem? Please describe.
At the moment, the allocation of memory is rather inefficient, as even small data-types are allocated on the stack, causing slow-downs, which could be easily fixed with additional implementation of something like
void* PblAlloca(size_t).Describe the solution you'd like
pbl-mem.hwith the following signaturevoid* PblAlloca(size_t).PBL_ALLOCA_DECLARATIONandPBL_ALLOCA_DEFINITION, which should usePblAlloca()PBL_ALLOC_DEFINITIONtoPBL_MALLOC_DEFINITION,PBL_ALLOC_DECLARATIONtoPBL_MALLOC_DECLARATIONandPBL_ALLOC_ARRAY_DEFINITIONtoPBL_MALLOC_ARRAY_DEFINITIONfor clearer signalisation that the heap is used.Describe alternatives you've considered
Perhaps revert to the old usage of actual finished types, though this would create issues with the current pointer implementations, so re-creating the stack usage is preferable.
Additional context
alloca(The GNU C Library)