src/runtime: assert that a gc block addr isn't inside the metadata
Этот коммит содержится в:
родитель
e497b5c5ba
коммит
3fa7d6cc40
1 изменённых файлов: 5 добавлений и 1 удалений
|
@ -110,7 +110,11 @@ func (b gcBlock) pointer() unsafe.Pointer {
|
||||||
|
|
||||||
// Return the address of the start of the allocated object.
|
// Return the address of the start of the allocated object.
|
||||||
func (b gcBlock) address() uintptr {
|
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
|
// findHead returns the head (first block) of an object, assuming the block
|
||||||
|
|
Загрузка…
Создание таблицы
Сослаться в новой задаче