runtime: rename gothrow to throw
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>
diff --git a/src/runtime/panic.go b/src/runtime/panic.go
index 07cdd4e..ff1ef2a 100644
--- a/src/runtime/panic.go
+++ b/src/runtime/panic.go
@@ -43,11 +43,11 @@
}
func throwreturn() {
- gothrow("no return at end of a typed function - compiler is broken")
+ throw("no return at end of a typed function - compiler is broken")
}
func throwinit() {
- gothrow("recursive call during initialization - linker skew")
+ throw("recursive call during initialization - linker skew")
}
// Create a new deferred function fn with siz bytes of arguments.
@@ -56,7 +56,7 @@
func deferproc(siz int32, fn *funcval) { // arguments of fn follow fn
if getg().m.curg != getg() {
// go code on the system stack can't defer
- gothrow("defer on system stack")
+ throw("defer on system stack")
}
// the arguments of fn are in a perilous state. The stack map
@@ -71,7 +71,7 @@
systemstack(func() {
d := newdefer(siz)
if d._panic != nil {
- gothrow("deferproc: d.panic != nil after newdefer")
+ throw("deferproc: d.panic != nil after newdefer")
}
d.fn = fn
d.pc = callerpc
@@ -137,7 +137,7 @@
}
if m[defersc] != int32(siz) {
print("bad defer size class: i=", i, " siz=", siz, " defersc=", defersc, "\n")
- gothrow("bad defer size class")
+ throw("bad defer size class")
}
}
}
@@ -209,12 +209,12 @@
// Windows otherwise runs out of stack space.
func freedeferpanic() {
// _panic must be cleared before d is unlinked from gp.
- gothrow("freedefer with d._panic != nil")
+ throw("freedefer with d._panic != nil")
}
func freedeferfn() {
// fn must be cleared before d is unlinked from gp.
- gothrow("freedefer with d.fn != nil")
+ throw("freedefer with d.fn != nil")
}
// Run a deferred function if there is one.
@@ -287,7 +287,7 @@
d.started = true
reflectcall(unsafe.Pointer(d.fn), deferArgs(d), uint32(d.siz), uint32(d.siz))
if gp._defer != d {
- gothrow("bad defer entry in Goexit")
+ throw("bad defer entry in Goexit")
}
d._panic = nil
d.fn = nil
@@ -319,7 +319,7 @@
print("panic: ")
printany(e)
print("\n")
- gothrow("panic on system stack")
+ throw("panic on system stack")
}
// m.softfloat is set during software floating point.
@@ -329,25 +329,25 @@
if gp.m.softfloat != 0 {
gp.m.locks--
gp.m.softfloat = 0
- gothrow("panic during softfloat")
+ throw("panic during softfloat")
}
if gp.m.mallocing != 0 {
print("panic: ")
printany(e)
print("\n")
- gothrow("panic during malloc")
+ throw("panic during malloc")
}
if gp.m.gcing != 0 {
print("panic: ")
printany(e)
print("\n")
- gothrow("panic during gc")
+ throw("panic during gc")
}
if gp.m.locks != 0 {
print("panic: ")
printany(e)
print("\n")
- gothrow("panic holding locks")
+ throw("panic holding locks")
}
var p _panic
@@ -390,7 +390,7 @@
// reflectcall did not panic. Remove d.
if gp._defer != d {
- gothrow("bad defer entry in panic")
+ throw("bad defer entry in panic")
}
d._panic = nil
d.fn = nil
@@ -416,7 +416,7 @@
gp.sigcode0 = uintptr(sp)
gp.sigcode1 = pc
mcall(recovery)
- gothrow("recovery failed") // mcall should not return
+ throw("recovery failed") // mcall should not return
}
}
@@ -482,19 +482,7 @@
}
//go:nosplit
-func throw(s *byte) {
- gp := getg()
- if gp.m.throwing == 0 {
- gp.m.throwing = 1
- }
- startpanic()
- print("fatal error: ", gostringnocopy(s), "\n")
- dopanic(0)
- *(*int)(nil) = 0 // not reached
-}
-
-//go:nosplit
-func gothrow(s string) {
+func throw(s string) {
print("fatal error: ", s, "\n")
gp := getg()
if gp.m.throwing == 0 {