runtime (gc): do not scan the runqueue when the platform is not baremetal with a scheduler

Этот коммит содержится в:
Jaden Weiss 2020-06-23 18:48:58 -04:00 коммит произвёл Ron Evans
родитель a4f3457747
коммит e8c84d24a0
3 изменённых файлов: 31 добавлений и 20 удалений

Просмотреть файл

@ -38,3 +38,5 @@ func libc_malloc(size uintptr) unsafe.Pointer {
func libc_free(ptr unsafe.Pointer) { func libc_free(ptr unsafe.Pointer) {
free(ptr) free(ptr)
} }
const baremetal = true

Просмотреть файл

@ -297,6 +297,7 @@ func GC() {
markStack() markStack()
markGlobals() markGlobals()
if baremetal && hasScheduler {
// Channel operations in interrupts may move task pointers around while we are marking. // Channel operations in interrupts may move task pointers around while we are marking.
// Therefore we need to scan the runqueue seperately. // Therefore we need to scan the runqueue seperately.
var markedTaskQueue task.Queue var markedTaskQueue task.Queue
@ -323,6 +324,9 @@ runqueueScan:
} }
runqueue = markedTaskQueue runqueue = markedTaskQueue
interrupt.Restore(i) interrupt.Restore(i)
} else {
finishMark()
}
// Sweep phase: free all non-marked objects and unmark marked objects for // Sweep phase: free all non-marked objects and unmark marked objects for
// the next collection cycle. // the next collection cycle.

5
src/runtime/hosted.go Обычный файл
Просмотреть файл

@ -0,0 +1,5 @@
// +build !baremetal
package runtime
const baremetal = false