From 81f025b580be6ce933f0ecb1f96445a3bb4fff4b Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Tue, 7 Jan 2020 23:13:24 +0000 Subject: compiler, runtime: stop using __go_runtime_error Use specific panic functions instead, which are mostly already in the runtime package. Also correct "defer nil" to panic when we execute the defer, rather than throw when we queue it. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/213642 From-SVN: r279979 --- libgo/go/runtime/panic.go | 2 ++ libgo/go/runtime/proc.go | 8 ++++++++ libgo/go/runtime/slice.go | 2 ++ 3 files changed, 12 insertions(+) (limited to 'libgo/go') diff --git a/libgo/go/runtime/panic.go b/libgo/go/runtime/panic.go index 2a11f932..9667181 100644 --- a/libgo/go/runtime/panic.go +++ b/libgo/go/runtime/panic.go @@ -38,6 +38,8 @@ import ( //go:linkname goPanicSlice3BU //go:linkname goPanicSlice3C //go:linkname goPanicSlice3CU +//go:linkname panicshift +//go:linkname panicdivide //go:linkname panicmem // Temporary for C code to call: //go:linkname throw diff --git a/libgo/go/runtime/proc.go b/libgo/go/runtime/proc.go index a0147cf..a025137 100644 --- a/libgo/go/runtime/proc.go +++ b/libgo/go/runtime/proc.go @@ -3157,6 +3157,14 @@ func syscall_runtime_AfterExec() { execLock.unlock() } +// panicgonil is used for gccgo as we need to use a compiler check for +// a nil func, in case we have to build a thunk. +//go:linkname panicgonil +func panicgonil() { + getg().m.throwing = -1 // do not dump full stacks + throw("go of nil func value") +} + // Create a new g running fn passing arg as the single argument. // Put it on the queue of g's waiting to run. // The compiler turns a go statement into a call to this. diff --git a/libgo/go/runtime/slice.go b/libgo/go/runtime/slice.go index c258ebd..49d5a86 100644 --- a/libgo/go/runtime/slice.go +++ b/libgo/go/runtime/slice.go @@ -12,6 +12,8 @@ import ( // For gccgo, use go:linkname to export compiler-called functions. // +//go:linkname panicmakeslicelen +//go:linkname panicmakeslicecap //go:linkname makeslice //go:linkname makeslice64 //go:linkname growslice -- cgit v1.1