mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-09-11 15:09:32 +00:00
runtime: make fatal failures unrecoverable
Match the Go runtime by terminating for deadlocks, stack overflows, runtime and GC invariants, invalid lock operations, and platform initialization failures instead of routing them through panic/recover. Keep language-level runtime errors and unsupported user operations recoverable. Add crash coverage that verifies fatal errors bypass deferred recover calls.
This commit is contained in:
@@ -51,7 +51,7 @@ var (
|
||||
func deadlock() {
|
||||
// call yield without requesting a wakeup
|
||||
task.Pause()
|
||||
panic("unreachable")
|
||||
runtimeFatal("unreachable")
|
||||
}
|
||||
|
||||
func goexit() {
|
||||
@@ -78,7 +78,7 @@ func addSleepTask(t *task.Task, duration timeUnit) {
|
||||
if schedulerDebug {
|
||||
println(" set sleep:", t, duration)
|
||||
if t.Next != nil {
|
||||
panic("runtime: addSleepTask: expected next task to be nil")
|
||||
runtimeFatal("runtime: addSleepTask: expected next task to be nil")
|
||||
}
|
||||
}
|
||||
now := ticks()
|
||||
|
||||
Reference in New Issue
Block a user