[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
@@ -315,7 +315,7 @@ class K2NativeCompilerArguments : CommonCompilerArguments() {
@Argument(value="-Xoverride-clang-options", valueDescription = "<arg1,arg2,...>", description = "Explicit list of Clang options")
var clangOptions: Array<String>? = null
@Argument(value="-Xallocator", valueDescription = "std | mimalloc", description = "Allocator used in runtime")
@Argument(value="-Xallocator", valueDescription = "std | mimalloc | custom", description = "Allocator used in runtime")
var allocator: String? = null
@Argument(value = "-Xmetadata-klib", description = "Produce a klib that only contains the declarations metadata")