
The wasm build tag together with GOARCH=arm was causing problems in the internal/cpu package. In general, I think having two architecture build tag will only cause problems (in this case, wasm and arm) so I've removed the wasm build tag and replaced it with tinygo.wasm. This is similar to the tinygo.riscv build tag, which is used for older Go versions that don't yet have RISC-V support in the standard library (and therefore pretend to be GOARCH=arm instead).
35 строки
992 Б
Go
35 строки
992 Б
Go
// +build gc.conservative gc.extalloc
|
|
// +build !baremetal,!tinygo.wasm
|
|
|
|
package runtime
|
|
|
|
import (
|
|
"unsafe"
|
|
)
|
|
|
|
//go:extern runtime.trackedGlobalsStart
|
|
var trackedGlobalsStart uintptr
|
|
|
|
//go:extern runtime.trackedGlobalsLength
|
|
var trackedGlobalsLength uintptr
|
|
|
|
//go:extern runtime.trackedGlobalsBitmap
|
|
var trackedGlobalsBitmap [0]uint8
|
|
|
|
// markGlobals marks all globals, which are reachable by definition.
|
|
//
|
|
// This implementation relies on a compiler pass that stores all globals in a
|
|
// single global (adjusting all uses of them accordingly) and creates a bit
|
|
// vector with the locations of each pointer. This implementation then walks the
|
|
// bit vector and for each pointer it indicates, it marks the root.
|
|
//
|
|
//go:nobounds
|
|
func markGlobals() {
|
|
for i := uintptr(0); i < trackedGlobalsLength; i++ {
|
|
if trackedGlobalsBitmap[i/8]&(1<<(i%8)) != 0 {
|
|
addr := trackedGlobalsStart + i*unsafe.Alignof(uintptr(0))
|
|
root := *(*uintptr)(unsafe.Pointer(addr))
|
|
markRoot(addr, root)
|
|
}
|
|
}
|
|
}
|