Add Stop-the-World Mark & Sweep GC for single-threaded programs.

GC implementation for testing purposes

* Only works for a single mutator
* Runs on the same thread as the mutator
* Runs every nth checkpoint and after every m bytes are allocated
* Runs finalizers after sweeping on the mutator thread.
This commit is contained in:
Alexander Shabalin
2021-04-02 12:13:44 +00:00
committed by Space
parent e7102cd63f
commit 71397a06fb
16 changed files with 2161 additions and 22 deletions
@@ -1024,8 +1024,7 @@ task freeze5(type: KonanLocalTest) {
}
task freeze6(type: KonanLocalTest) {
enabled = (project.testTarget != 'wasm32') && // No exceptions on WASM.
!isExperimentalMM // Experimental MM does not have a GC yet.
enabled = (project.testTarget != 'wasm32') // No exceptions on WASM.
goldValue = "OK\nOK\n"
source = "runtime/workers/freeze6.kt"
}
@@ -1057,13 +1056,11 @@ task lazy1(type: KonanLocalTest) {
}
standaloneTest("lazy2") {
enabled = !isExperimentalMM // Experimental MM does not have a GC yet.
goldValue = "123\nOK\n"
source = "runtime/workers/lazy2.kt"
}
standaloneTest("lazy3") {
enabled = !isExperimentalMM // Experimental MM does not have a GC yet.
source = "runtime/workers/lazy3.kt"
}
@@ -2876,13 +2873,11 @@ task memory_escape1(type: KonanLocalTest) {
}
task memory_cycles0(type: KonanLocalTest) {
enabled = !isExperimentalMM // Experimental MM does not have a GC yet.
goldValue = "42\n"
source = "runtime/memory/cycles0.kt"
}
task memory_cycles1(type: KonanLocalTest) {
enabled = !isExperimentalMM // Experimental MM does not have a GC yet.
source = "runtime/memory/cycles1.kt"
}
@@ -2896,7 +2891,6 @@ task memory_escape2(type: KonanLocalTest) {
}
task memory_weak0(type: KonanLocalTest) {
enabled = !isExperimentalMM // Experimental MM does not have a GC yet.
goldValue = "Data(s=Hello)\nnull\nOK\n"
source = "runtime/memory/weak0.kt"
}
@@ -2907,7 +2901,6 @@ task memory_weak1(type: KonanLocalTest) {
}
standaloneTest("memory_only_gc") {
enabled = !isExperimentalMM // Experimental MM does not have a GC yet.
source = "runtime/memory/only_gc.kt"
}
@@ -4207,7 +4200,6 @@ standaloneTest("interop_opengl_teapot") {
if (PlatformInfo.isAppleTarget(project)) {
interopTest("interop_objc_smoke") {
enabled = !isExperimentalMM // Experimental MM does not have a GC yet.
goldValue = "84\nFoo\nDeallocated\n" +
"Hello, World!\nKotlin says: Hello, everybody!\nHello from Kotlin\n2, 1\n" +
"true\ntrue\n" +
@@ -4242,7 +4234,7 @@ if (PlatformInfo.isAppleTarget(project)) {
}
interopTestMultifile("interop_objc_tests") {
enabled = !isExperimentalMM // Experimental MM does not have a GC yet.
enabled = !isExperimentalMM // Experimental MM does not support Obj-C weaks yet.
source = "interop/objc/tests/"
interop = 'objcTests'
flags = ['-tr', '-e', 'main']
@@ -4492,7 +4484,7 @@ dynamicTest("interop_kt42397") {
dynamicTest("interop_cleaners_main_thread") {
disabled = (project.target.name != project.hostName) ||
isExperimentalMM // Experimental MM does not have a GC yet.
isExperimentalMM // Experimental MM doesn't support multiple mutators yet.
source = "interop/cleaners/cleaners.kt"
cSource = "$projectDir/interop/cleaners/main_thread.cpp"
clangTool = "clang++"
@@ -4826,7 +4818,6 @@ if (isAppleTarget(project)) {
}
frameworkTest("testStdlibFramework") {
enabled = !isExperimentalMM // Experimental MM does not have GC yet.
framework('Stdlib') {
sources = ['framework/stdlib']
bitcode = true