mirror of
https://github.com/golang/go
synced 2025-10-04 14:09:41 +00:00
When a function panics then recovers, it needs to return to the caller with named results having the correct values. For in-register results, we need to load them into registers at the defer return path. For non-open-coded defers, we already generate correct code, as the defer return path is part of the SSA CFG and contains the instructions that are the same as an ordinary return statement, including putting the results to the right places. For open-coded defers, we have a special code generation that emits a disconnected block that currently contains only the deferreturn call and a RET instruction. It leaves the result registers unset. This CL adds instructions that load the result registers on that path. Updates #40724. Change-Id: I1f60514da644fd5fb4b4871a1153c62f42927282 Reviewed-on: https://go-review.googlesource.com/c/go/+/307231 Trust: Cherry Zhang <cherryyz@google.com> Reviewed-by: David Chase <drchase@google.com> Reviewed-by: Austin Clements <austin@google.com>
800 B
800 B