mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-09-12 07:29:30 +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:
@@ -145,7 +145,7 @@ func setupDeferFrame(frame *deferFrame, jumpSP unsafe.Pointer) {
|
||||
// Defer is not currently allowed in interrupts.
|
||||
// We could add support for this, but since defer might also allocate
|
||||
// (especially in loops) it might not be a good idea anyway.
|
||||
runtimePanicAt(returnAddress(0), "defer in interrupt")
|
||||
runtimeFatal("defer in interrupt")
|
||||
}
|
||||
currentTask := task.Current()
|
||||
frame.Previous = (*deferFrame)(currentTask.DeferFrame)
|
||||
@@ -272,5 +272,5 @@ func blockingPanic() {
|
||||
|
||||
//go:linkname fips_fatal crypto/internal/fips140.fatal
|
||||
func fips_fatal(msg string) {
|
||||
runtimePanic(msg)
|
||||
runtimeFatal(msg)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user