diff options
| author | Keith Randall <khr@golang.org> | 2022-06-26 21:18:19 -0700 |
|---|---|---|
| committer | Keith Randall <khr@golang.org> | 2022-08-18 17:32:44 +0000 |
| commit | 661146bc0bb0fad22d561eef2c0b48974aca32b6 (patch) | |
| tree | f7cd36bb49ccca4ba823fae90c96b518562f8ae3 /test/codegen | |
| parent | 52016be3f4e6deba54020ad8c969f1e2dba1eee3 (diff) | |
| download | go-661146bc0bb0fad22d561eef2c0b48974aca32b6.tar.xz | |
cmd/compile: don't use OFORUNTIL when implementing range loops
We don't need this special loop construct anymore now that we do
conservative GC scanning of the top of stack. Rewrite instead to a simple
pointer increment on every iteration. This leads to having a potential
past-the-end pointer at the end of the last iteration, but that value
immediately goes dead after the loop condition fails, and the past-the-end
pointer is never live across any call.
This simplifies and speeds up loops.
R=go1.20
TODO: actually delete all support for OFORUNTIL. It is now never generated,
but code to handle it (e.g. in ssagen) is still around.
TODO: in "for _, x := range" loops, we could get rid of the index
altogether and use a "pointer to the last element" reference to determine
when the loop is complete.
Fixes #53409
Change-Id: Ifc141600ff898a8bc6a75f793e575f8862679ba1
Reviewed-on: https://go-review.googlesource.com/c/go/+/414876
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Reviewed-by: Keith Randall <khr@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Diffstat (limited to 'test/codegen')
0 files changed, 0 insertions, 0 deletions
