runtime: use a specialized runtime panic function

This specifically fixes unix alloc(): previously when allocation fails
it would (recursively) call alloc() again to create an interface due to
lacking escape analysis.
Also, all other cases shouldn't try to allocate just because something
bad happens at runtime.

TODO: implement escape analysis.
This commit is contained in:
Ayke van Laethem
2018-09-11 19:46:40 +02:00
parent 4ad6df3227
commit 31e0662856
2 changed files with 12 additions and 9 deletions
+1 -1
View File
@@ -48,7 +48,7 @@ func abort() {
func alloc(size uintptr) unsafe.Pointer {
buf := _Cfunc_calloc(1, size)
if buf == nil {
panic("cannot allocate memory")
runtimePanic("cannot allocate memory")
}
return buf
}