Implement a bit more of GC object interface

This commit is contained in:
Alexander Shabalin
2021-05-19 07:29:27 +00:00
committed by Space
parent a3105da32e
commit 94076300ec
6 changed files with 38 additions and 27 deletions
@@ -264,6 +264,25 @@ extern "C" void Kotlin_native_internal_GC_collectCyclic(ObjHeader*) {
ThrowIllegalArgumentException();
}
// TODO: Maybe a pair of suspend/resume or start/stop may be useful in the future?
// The other pair is likely to be removed.
extern "C" void Kotlin_native_internal_GC_suspend(ObjHeader*) {
// Nothing to do
}
extern "C" void Kotlin_native_internal_GC_resume(ObjHeader*) {
// Nothing to do
}
extern "C" void Kotlin_native_internal_GC_stop(ObjHeader*) {
// Nothing to do
}
extern "C" void Kotlin_native_internal_GC_start(ObjHeader*) {
// Nothing to do
}
extern "C" void Kotlin_native_internal_GC_setThreshold(ObjHeader*, int32_t value) {
if (value < 0) {
ThrowIllegalArgumentException();
@@ -306,6 +325,14 @@ extern "C" int64_t Kotlin_native_internal_GC_getThresholdAllocations(ObjHeader*)
return static_cast<int64_t>(maxValue);
}
extern "C" void Kotlin_native_internal_GC_setTuneThreshold(ObjHeader*, KBoolean value) {
mm::GlobalData::Instance().gc().SetAutoTune(value);
}
extern "C" KBoolean Kotlin_native_internal_GC_getTuneThreshold(ObjHeader*) {
return mm::GlobalData::Instance().gc().GetAutoTune();
}
extern "C" OBJ_GETTER(Kotlin_native_internal_GC_detectCycles, ObjHeader*) {
// TODO: Remove when legacy MM is gone.
RETURN_OBJ(nullptr);