cmd/compile: group all calls to runtime.panicindex #17371
Labels
FrozenDueToAge
NeedsFix
The path to resolution is known, but the work has not been done.
Performance
Milestone
What version of Go are you using (
go version
)?go version go1.7.1 windows/amd64
What operating system and processor architecture are you using (
go env
)?set GOARCH=amd64
set GOBIN=
set GOEXE=.exe
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOOS=windows
set GOPATH=C:\Users\rillig\go
set GORACE=
set GOROOT=C:\Program Files (x86)\Go1.7.1
set GOTOOLDIR=C:\Program Files (x86)\Go1.7.1\pkg\tool\windows_amd64
set CGO_ENABLED=1
What did you do?
https://play.golang.org/p/vTaV_KfhNg
What did you expect to see?
All calls to
runtime.panicindex
andruntime.panicslice
are grouped at the end of the function, so that they don't interrupt the control flow when a human reads the assembly code. This could also prevent some cache lines from being loaded, since the calls topanic
are unlikely to be ever executed.Alternatively, these
panic
calls should be near the code that could produce them, to make theJAE
instruction shorter, using 2 bytes instead of 6.What did you see instead?
The calls to
panicindex
andpanicslice
appear in the middle of the application code.The
RET
instruction at 0x401440 even starts on a cache line on its own, and the rest of the cache line is probably unused.The text was updated successfully, but these errors were encountered: