From 88b6b2e7f5a3f513d75efdebf0df872b10b37333 Mon Sep 17 00:00:00 2001 From: Ayke van Laethem Date: Sun, 2 Sep 2018 16:24:50 +0200 Subject: Optimize/eliminate bounds checking TODO: do better at it by tracking min/max values of integers. The following straightforward code doesn't have its bounds checks removed: for _, n := range slice { println(n) } --- src/runtime/runtime.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/runtime/runtime.go') diff --git a/src/runtime/runtime.go b/src/runtime/runtime.go index 07cf049cb..94b1f270d 100644 --- a/src/runtime/runtime.go +++ b/src/runtime/runtime.go @@ -56,7 +56,7 @@ func _panic(message interface{}) { abort() } -// Check for bounds in *ssa.IndexAddr and *ssa.Lookup. +// Check for bounds in *ssa.Index, *ssa.IndexAddr and *ssa.Lookup. func lookupBoundsCheck(length, index int) { if index < 0 || index >= length { // printstring() here is safe as this function is excluded from bounds -- cgit v1.2.3