Sketch GC interface (#4682)

This commit is contained in:
Alexander Shabalin
2021-02-08 11:10:22 +03:00
committed by Vasily Levchenko
parent 61d3ae1477
commit d875cb39c9
10 changed files with 436 additions and 147 deletions
+25 -1
View File
@@ -253,6 +253,11 @@ extern "C" RUNTIME_NOTHROW void GC_CollectorCallback(void* worker) {
// Nothing to do
}
extern "C" void Kotlin_native_internal_GC_collect(ObjHeader*) {
auto* threadData = mm::ThreadRegistry::Instance().CurrentThreadData();
threadData->gc().PerformFullGC();
}
extern "C" void Kotlin_native_internal_GC_collectCyclic(ObjHeader*) {
// TODO: Remove when legacy MM is gone.
ThrowIllegalArgumentException();
@@ -289,6 +294,10 @@ extern "C" void Kotlin_Any_share(ObjHeader* thiz) {
// Nothing to do
}
extern "C" RUNTIME_NOTHROW void PerformFullGC(MemoryState* memory) {
GetThreadData(memory)->gc().PerformFullGC();
}
extern "C" RUNTIME_NOTHROW bool ClearSubgraphReferences(ObjHeader* root, bool checked) {
// TODO: Remove when legacy MM is gone.
return true;
@@ -366,7 +375,22 @@ extern "C" void AdoptReferenceFromSharedVariable(ObjHeader* object) {
// Nothing to do.
}
void CheckGlobalsAccessible() {
extern "C" void CheckGlobalsAccessible() {
// TODO: Remove when legacy MM is gone.
// Always accessible
}
extern "C" RUNTIME_NOTHROW void Kotlin_mm_safePointFunctionEpilogue() {
auto* threadData = mm::ThreadRegistry::Instance().CurrentThreadData();
threadData->gc().SafePointFunctionEpilogue();
}
extern "C" RUNTIME_NOTHROW void Kotlin_mm_safePointWhileLoopBody() {
auto* threadData = mm::ThreadRegistry::Instance().CurrentThreadData();
threadData->gc().SafePointLoopBody();
}
extern "C" RUNTIME_NOTHROW void Kotlin_mm_safePointExceptionUnwind() {
auto* threadData = mm::ThreadRegistry::Instance().CurrentThreadData();
threadData->gc().SafePointExceptionUnwind();
}