To learn continuous stack in golang , i wrote a test program, like this:
package main
func f() int {
sum := 0
elements := make([]int, 1000)
for _, e := range elements {
sum += e
}
return sum
}
func main() {
f()
}
check the compile code generated by go tool:
"".f t=1 size=160 value=0 args=0x8 locals=0x1f40
0x0000 00000 (test.go:3) TEXT "".f(SB), $8000-8
0x0000 00000 (test.go:3) MOVQ (TLS), CX
0x0009 00009 (test.go:3) MOVQ 16(CX), SI
0x000d 00013 (test.go:3) CMPQ SI, $-1314
0x0014 00020 (test.go:3) JEQ 138
.....
0x008a 00138 (test.go:3) CALL runtime.morestack_noctxt(SB)
.....
i am so confused by the CMPQ SI, $-1314, what does -1314 mean?
tx for replying.
--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
For more options, visit https://groups.google.com/d/optout.