src/runtime: assert that a gc block addr isn't inside the metadata

Этот коммит содержится в:
Damian Gryski 2022-01-31 10:31:57 -08:00 коммит произвёл Ron Evans
родитель e497b5c5ba
коммит 3fa7d6cc40

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

@ -110,7 +110,11 @@ func (b gcBlock) pointer() unsafe.Pointer {
// Return the address of the start of the allocated object.
func (b gcBlock) address() uintptr {
return heapStart + uintptr(b)*bytesPerBlock
addr := heapStart + uintptr(b)*bytesPerBlock
if gcAsserts && addr > uintptr(metadataStart) {
runtimePanic("gc: block pointing inside metadata")
}
return addr
}
// findHead returns the head (first block) of an object, assuming the block