]> Cypherpunks.ru repositories - gostls13.git/commit
cmd/compile: restore zero-copy string->[]byte optimization
authorMatthew Dempsky <mdempsky@google.com>
Thu, 17 Aug 2023 21:15:04 +0000 (14:15 -0700)
committerGopher Robot <gobot@golang.org>
Fri, 18 Aug 2023 11:58:37 +0000 (11:58 +0000)
commit925d2fb36c8e4c9c0e6e240a1621db36c34e5d31
tree2394fb00600d937042524a80e59da78d540e8ffe
parent243c8c0eec20d981d8e76a3aac82f97cca991571
cmd/compile: restore zero-copy string->[]byte optimization

This CL implements the remainder of the zero-copy string->[]byte
conversion optimization initially attempted in go.dev/cl/520395, but
fixes the tracking of mutations due to ODEREF/ODOTPTR assignments, and
adds more comprehensive tests that I should have included originally.

However, this CL also keeps it behind the -d=zerocopy flag. The next
CL will enable it by default (for easier rollback).

Updates #2205.

Change-Id: Ic330260099ead27fc00e2680a59c6ff23cb63c2b
Reviewed-on: https://go-review.googlesource.com/c/go/+/520599
Auto-Submit: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
src/cmd/compile/internal/base/debug.go
src/cmd/compile/internal/escape/assign.go
src/cmd/compile/internal/escape/escape.go
src/cmd/compile/internal/ssagen/ssa.go
src/cmd/compile/internal/walk/order.go
src/cmd/compile/internal/walk/switch.go
test/escape_mutations.go [new file with mode: 0644]
test/inline_big.go