summaryrefslogtreecommitdiff
path: root/src/jit/hostallocator.cpp
AgeCommit message (Collapse)AuthorFilesLines
2018-07-17 Add pooling for JIT scratch memory (#18924)Jan Kotas1-2/+2
Fixes #3408
2018-06-30Pass CompAllocator by value (#15025)mikedn1-24/+2
Passing CompAllocator objects by value is advantageous because it no longer needs to be dynamically allocated and cached. CompAllocator instances can now be freely created, copied and stored, which makes adding new CompMemKind values easier. Together with other cleanup this also improves memory allocation performance by removing some extra levels of indirection that were previously required - jitstd::allocator had a pointer to CompAllocator, CompAllocator had a pointer to Compiler and Compiler finally had a pointer to ArenaAllocator. Without MEASURE_MEM_ALLOC enabled, both jitstd::allocator and CompAllocator now just contain a pointer to ArenaAllocator. When MEASURE_MEM_ALLOC is enabled CompAllocator also contains a pointer but to a MemStatsAllocator object that holds the relevant memory kind. This way CompAllocator is always pointer sized so that enabling MEASURE_MEM_ALLOC does not result in increased memory usage due to objects that store a CompAllocator instance. In order to implement this, 2 additional signficant changes have been made: * MemStats has been moved to ArenaAllocator, it's after all the allocator's job to maintain statistics. This also fixes some issues related to memory statistics, such as not tracking the memory allocated by the inlinee compiler (since that one used its own MemStats instance). * Extract the arena page pooling logic out of the allocator. It doesn't make sense to pool an allocator, it has very little state that can actually be reused and everyting else (including MemStats) needs to be reset on reuse. What really needs to be pooled is just a page of memory. Since this was touching allocation code the opportunity has been used to perform additional cleanup: * Remove unnecessary LSRA ListElementAllocator * Remove compGetMem and compGetMemArray * Make CompAllocator and HostAllocator more like the std allocator * Update HashTable to use CompAllocator * Update ArrayStack to use CompAllocator * Move CompAllocator & friends to alloc.h
2016-03-03Refactor Utilcode's IAllocators.Pat Gavlin1-0/+40
- `DefaultAllocator` has been replaced with `HostAllocator` in RyuJIT, which uses the JIT hosting interface to allocate and free memory. - The definition of `DefaultAllocator` has been moved into its own file, as it remains in use by the interpreter and the binder. - `ProcessHeapAllocator` has been moved into JIT32, as that was its only remaining user. - `AllowZeroAllocator`'s static field has been changed to an instance field to avoid the need to define storage for the static field in Utilcode. [tfs-changeset: 1581242]