Last active
December 19, 2018 10:14
-
-
Save mmcloughlin/598774c255f40605e613ffb3361e240c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package argsize | |
func Index3(a [7]byte) byte | |
func Expect(a [7]byte) byte { return a[3] } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TEXT ·Index3(SB),0,$0-16 | |
MOVB a_3+3(FP), AL | |
MOVB AL, ret+8(FP) | |
RET |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package argsize | |
import ( | |
"testing" | |
"testing/quick" | |
) | |
func TestIndex3(t *testing.T) { | |
if err := quick.CheckEqual(Index3, Expect, nil); err != nil { | |
t.Fatal(err) | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
+ go=go1.12beta1 | |
+ go1.12beta1 test -v | |
=== RUN TestIndex3 | |
--- PASS: TestIndex3 (0.00s) | |
PASS | |
ok _/tmp/argsize 0.006s | |
+ go1.12beta1 tool compile -S argsize.go | |
+ grep -A5 'Expect STEXT' | |
"".Expect STEXT nosplit size=10 args=0x10 locals=0x0 | |
0x0000 00000 (argsize.go:6) TEXT "".Expect(SB), NOSPLIT|ABIInternal, $0-16 | |
0x0000 00000 (argsize.go:6) FUNCDATA $0, gclocals·33cdeccccebe80329f1fdbee7f5874cb(SB) | |
0x0000 00000 (argsize.go:6) FUNCDATA $1, gclocals·33cdeccccebe80329f1fdbee7f5874cb(SB) | |
0x0000 00000 (argsize.go:6) FUNCDATA $3, gclocals·33cdeccccebe80329f1fdbee7f5874cb(SB) | |
0x0000 00000 (argsize.go:6) PCDATA $2, $0 | |
+ go1.12beta1 vet | |
# _/tmp/argsize | |
./argsize.s:1:1: [amd64] Index3: wrong argument size 16; expected $...-9 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -x | |
go=go1.12beta1 | |
$go test -v | |
$go tool compile -S argsize.go | grep -A5 'Expect STEXT' | |
$go vet |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment