diff --git a/doc/asm.html b/doc/asm.html index debb1e2fc6..77defdbd28 100644 --- a/doc/asm.html +++ b/doc/asm.html @@ -57,59 +57,66 @@ func main() { println(3) } $ GOOS=linux GOARCH=amd64 go tool compile -S x.go # or: go build -gcflags -S x.go - ---- prog list "main" --- -0000 (x.go:3) TEXT main+0(SB),$8-0 -0001 (x.go:3) FUNCDATA $0,gcargs·0+0(SB) -0002 (x.go:3) FUNCDATA $1,gclocals·0+0(SB) -0003 (x.go:4) MOVQ $3,(SP) -0004 (x.go:4) PCDATA $0,$8 -0005 (x.go:4) CALL ,runtime.printint+0(SB) -0006 (x.go:4) PCDATA $0,$-1 -0007 (x.go:4) PCDATA $0,$0 -0008 (x.go:4) CALL ,runtime.printnl+0(SB) -0009 (x.go:4) PCDATA $0,$-1 -0010 (x.go:5) RET , +"".main STEXT size=74 args=0x0 locals=0x10 + 0x0000 00000 (x.go:3) TEXT "".main(SB), $16-0 + 0x0000 00000 (x.go:3) MOVQ (TLS), CX + 0x0009 00009 (x.go:3) CMPQ SP, 16(CX) + 0x000d 00013 (x.go:3) JLS 67 + 0x000f 00015 (x.go:3) SUBQ $16, SP + 0x0013 00019 (x.go:3) MOVQ BP, 8(SP) + 0x0018 00024 (x.go:3) LEAQ 8(SP), BP + 0x001d 00029 (x.go:3) FUNCDATA $0, gclocals·33cdeccccebe80329f1fdbee7f5874cb(SB) + 0x001d 00029 (x.go:3) FUNCDATA $1, gclocals·33cdeccccebe80329f1fdbee7f5874cb(SB) + 0x001d 00029 (x.go:3) FUNCDATA $2, gclocals·33cdeccccebe80329f1fdbee7f5874cb(SB) + 0x001d 00029 (x.go:4) PCDATA $0, $0 + 0x001d 00029 (x.go:4) PCDATA $1, $0 + 0x001d 00029 (x.go:4) CALL runtime.printlock(SB) + 0x0022 00034 (x.go:4) MOVQ $3, (SP) + 0x002a 00042 (x.go:4) CALL runtime.printint(SB) + 0x002f 00047 (x.go:4) CALL runtime.printnl(SB) + 0x0034 00052 (x.go:4) CALL runtime.printunlock(SB) + 0x0039 00057 (x.go:5) MOVQ 8(SP), BP + 0x003e 00062 (x.go:5) ADDQ $16, SP + 0x0042 00066 (x.go:5) RET + 0x0043 00067 (x.go:5) NOP + 0x0043 00067 (x.go:3) PCDATA $1, $-1 + 0x0043 00067 (x.go:3) PCDATA $0, $-1 + 0x0043 00067 (x.go:3) CALL runtime.morestack_noctxt(SB) + 0x0048 00072 (x.go:3) JMP 0 ...
The FUNCDATA and PCDATA directives contain information
for use by the garbage collector; they are introduced by the compiler.
-
@@ -266,7 +273,7 @@ that assembly programming is a fraught endeavor.
-In Go object files and binaries, the full name of a symbol is the
+In Go object files and binaries, the full name of a symbol is the
package path followed by a period and the symbol name:
fmt.Printf or math/rand.Int.
Because the assembler's parser treats period and slash as punctuation,
@@ -485,7 +492,7 @@ even for assembly functions not called directly from Go.
At the start of the function, the arguments are assumed
to be initialized but the results are assumed uninitialized.
If the results will hold live pointers during a call instruction,
-the function should start by zeroing the results and then
+the function should start by zeroing the results and then
executing the pseudo-instruction GO_RESULTS_INITIALIZED.
This instruction records that the results are now initialized
and should be scanned during stack movement and garbage collection.
@@ -503,7 +510,7 @@ on the TEXT instruction.
The pointer information can also be omitted if the
function contains no call instructions.
Otherwise, the local stack frame must not contain pointers,
-and the assembly must confirm this fact by executing the
+and the assembly must confirm this fact by executing the
pseudo-instruction NO_LOCAL_POINTERS.
Because stack resizing is implemented by moving the stack,
the stack pointer may change during any function call: