-
- Downloads
cmd/compile: for rangefunc, add checks and tests, fix panic interactions
Modify rangefunc #next protocol to make it more robust Extra-terrible nests of rangefunc iterators caused the prior implementation to misbehave non-locally (in outer loops). Add more rangefunc exit flag tests, parallel and tricky This tests the assertion that a rangefunc iterator running in parallel can trigger the race detector if any of the parallel goroutines attempts an early exit. It also verifies that if everything else is carefully written, that it does NOT trigger the race detector if all the parts run time completion. Another test tries to rerun a yield function within a loop, so that any per-line shared checking would be fooled. Added all the use-of-body/yield-function checking. These checks handle pathological cases that would cause rangefunc for loops to behave in surprising ways (compared to "regular" for loops). For example, a rangefunc iterator might defer-recover a panic thrown in the syntactic body of a loop; this notices the fault and panics with an explanation Modified closure naming to ID rangefunc bodies Add a "-range<N>" suffix to the name of any closure generated for a rangefunc loop body, as provided in Alessandro Arzilli's CL (which is merged into this one). Fix return values for panicky range functions This removes the delayed implementation of "return x" by ensuring that return values (in rangefunc-return-containing functions) always have names and translating the "return x" into "#rv1 = x" where #rv1 is the synthesized name of the first result. Updates #61405. Change-Id: I933299ecce04ceabcf1c0c2de8e610b2ecd1cfd8 Reviewed-on: https://go-review.googlesource.com/c/go/+/584596 Reviewed-by:Matthew Dempsky <mdempsky@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by:
Tim King <taking@google.com>
Showing
- src/cmd/compile/internal/inline/inl.go 1 addition, 1 deletionsrc/cmd/compile/internal/inline/inl.go
- src/cmd/compile/internal/ir/func.go 32 additions, 14 deletionssrc/cmd/compile/internal/ir/func.go
- src/cmd/compile/internal/ir/sizeof_test.go 1 addition, 1 deletionsrc/cmd/compile/internal/ir/sizeof_test.go
- src/cmd/compile/internal/noder/irgen.go 4 additions, 3 deletionssrc/cmd/compile/internal/noder/irgen.go
- src/cmd/compile/internal/noder/reader.go 8 additions, 4 deletionssrc/cmd/compile/internal/noder/reader.go
- src/cmd/compile/internal/noder/unified.go 2 additions, 2 deletionssrc/cmd/compile/internal/noder/unified.go
- src/cmd/compile/internal/noder/writer.go 10 additions, 7 deletionssrc/cmd/compile/internal/noder/writer.go
- src/cmd/compile/internal/rangefunc/rangefunc_test.go 847 additions, 43 deletionssrc/cmd/compile/internal/rangefunc/rangefunc_test.go
- src/cmd/compile/internal/rangefunc/rewrite.go 456 additions, 289 deletionssrc/cmd/compile/internal/rangefunc/rewrite.go
- src/cmd/compile/internal/ssagen/ssa.go 5 additions, 1 deletionsrc/cmd/compile/internal/ssagen/ssa.go
- src/cmd/compile/internal/typecheck/_builtin/runtime.go 2 additions, 2 deletionssrc/cmd/compile/internal/typecheck/_builtin/runtime.go
- src/cmd/compile/internal/typecheck/builtin.go 202 additions, 201 deletionssrc/cmd/compile/internal/typecheck/builtin.go
- src/cmd/compile/internal/types2/compiler_internal.go 50 additions, 0 deletionssrc/cmd/compile/internal/types2/compiler_internal.go
- src/cmd/internal/goobj/builtinlist.go 3 additions, 1 deletionsrc/cmd/internal/goobj/builtinlist.go
- src/runtime/panic.go 23 additions, 3 deletionssrc/runtime/panic.go
- src/runtime/race/testdata/rangefunc_test.go 77 additions, 0 deletionssrc/runtime/race/testdata/rangefunc_test.go
Loading
Please register or sign in to comment