mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-06 12:03:41 +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:
@@ -15,7 +15,7 @@ func (q *Queue) Push(t *Task) {
|
||||
mask := lockAtomics()
|
||||
if asserts && t.Next != nil {
|
||||
unlockAtomics(mask)
|
||||
panic("runtime: pushing a task to a queue with a non-nil Next pointer")
|
||||
runtimeFatal("runtime: pushing a task to a queue with a non-nil Next pointer")
|
||||
}
|
||||
if q.tail != nil {
|
||||
q.tail.Next = t
|
||||
@@ -78,7 +78,7 @@ func (s *Stack) Push(t *Task) {
|
||||
mask := lockAtomics()
|
||||
if asserts && t.Next != nil {
|
||||
unlockAtomics(mask)
|
||||
panic("runtime: pushing a task to a stack with a non-nil Next pointer")
|
||||
runtimeFatal("runtime: pushing a task to a stack with a non-nil Next pointer")
|
||||
}
|
||||
s.top, t.Next = t, s.top
|
||||
unlockAtomics(mask)
|
||||
|
||||
Reference in New Issue
Block a user