Refactor the pooled ArenaAllocator.
authorPat Gavlin <pagavlin@microsoft.com>
Fri, 26 Feb 2016 19:17:03 +0000 (11:17 -0800)
committerPat Gavlin <pagavlin@microsoft.com>
Mon, 29 Feb 2016 17:47:31 +0000 (09:47 -0800)
commitdf2ce4932da33ffc42d3ecda948e4d6c642e7d52
treef09f7df5c4128e4c5c4b4e0de907ff150f3dca79
parent4f5e9acb92a8f9c8523fded39d05df300af0ac30
Refactor the pooled ArenaAllocator.

The mark/release functionality on `ArenaAllocator` was only being used by the pooled
allocator, and caused some complications in API and implementation. Instead of
providing this functionality on all allocators, refactor this functionality out of
`ArenaAllocator` and into a new subclass, `PooledAllocator`, that provides the
singleton pooled allocator.

A number of additional usability/reliability changes have been enabled as part of this
change:
- `ArenaAllocator::initialize` has been replaced with move assignment
- Asserts have been added on all relevant instance methods to ensure that
  `ArenaAllocator` values are initialized before use
- `ArenaAllocator::returnPooledAllocator` has been replaced by making
  `ArenaAllocator::destroy` virtual and having `PooledAllocator::destroy` return the
  singleton
- The teardown of the pooled allocator is now thread-safe w.r.t. the shutdown of the
  arena allocator subsystem

Commit migrated from https://github.com/dotnet/coreclr/commit/688e7869d18be350f3e32b6a6bd8f347d722b3dd
src/coreclr/src/jit/alloc.cpp
src/coreclr/src/jit/alloc.h
src/coreclr/src/jit/compiler.cpp