mirror of
https://github.com/golang/go
synced 2024-11-20 06:44:40 -07:00
b2a950bb73
Rename "gothrow" to "throw" now that the C version of "throw" is no longer needed. This change is purely mechanical except in panic.go where the old version of "throw" has been deleted. sed -i "" 's/[[:<:]]gothrow[[:>:]]/throw/g' runtime/*.go Change-Id: Icf0752299c35958b92870a97111c67bcd9159dc3 Reviewed-on: https://go-review.googlesource.com/2150 Reviewed-by: Minux Ma <minux@golang.org> Reviewed-by: Dave Cheney <dave@cheney.net>
42 lines
945 B
Go
42 lines
945 B
Go
// Copyright 2014 The Go Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style
|
|
// license that can be found in the LICENSE file.
|
|
|
|
package runtime
|
|
|
|
import _ "unsafe" // for go:linkname
|
|
|
|
type stdFunction *byte
|
|
|
|
//go:linkname os_sigpipe os.sigpipe
|
|
func os_sigpipe() {
|
|
throw("too many writes on closed pipe")
|
|
}
|
|
|
|
func sigpanic() {
|
|
g := getg()
|
|
if !canpanic(g) {
|
|
throw("unexpected signal during runtime execution")
|
|
}
|
|
|
|
switch uint32(g.sig) {
|
|
case _EXCEPTION_ACCESS_VIOLATION:
|
|
if g.sigcode1 < 0x1000 || g.paniconfault {
|
|
panicmem()
|
|
}
|
|
print("unexpected fault address ", hex(g.sigcode1), "\n")
|
|
throw("fault")
|
|
case _EXCEPTION_INT_DIVIDE_BY_ZERO:
|
|
panicdivide()
|
|
case _EXCEPTION_INT_OVERFLOW:
|
|
panicoverflow()
|
|
case _EXCEPTION_FLT_DENORMAL_OPERAND,
|
|
_EXCEPTION_FLT_DIVIDE_BY_ZERO,
|
|
_EXCEPTION_FLT_INEXACT_RESULT,
|
|
_EXCEPTION_FLT_OVERFLOW,
|
|
_EXCEPTION_FLT_UNDERFLOW:
|
|
panicfloat()
|
|
}
|
|
throw("fault")
|
|
}
|