[K/N] Add custom allocator prototype ^KT-55364

Enable custom allocator with -Xallocator=custom.

If the gc is cms (default):
 * a patched version of the memory manager is used that does not build a
   list of allocated objects.
 * a patched version of the cms is used that defers to the allocator for
   sweeping.

Otherwise, a warning is printed, and the allocator is used using the
standard api.

Design doc:
https://docs.google.com/document/d/15xMp-nE-DWL8OrtOc8DoXB80AHUphFICEGjj5K0aNFc

Co-authored-by: Troels Lund <troels@google.com>

Merge-request: KOTLIN-MR-546
Merged-by: Alexander Shabalin <alexander.shabalin@jetbrains.com>
This commit is contained in:
Troels Bjerre Lund
2022-12-08 17:22:04 +00:00
committed by Space
parent 40f38c8adb
commit bb1acf729b
33 changed files with 1519 additions and 15 deletions
@@ -324,8 +324,9 @@ class K2Native : CLICompiler<K2NativeCompilerArguments>() {
null -> null
"std" -> AllocationMode.STD
"mimalloc" -> AllocationMode.MIMALLOC
"custom" -> AllocationMode.CUSTOM
else -> {
configuration.report(ERROR, "Expected 'std' or 'mimalloc' for allocator")
configuration.report(ERROR, "Expected 'std', 'mimalloc', or 'custom' for allocator")
AllocationMode.STD
}
})