1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
TEXT main.f00(SB) /mnt/hgfs/g/hello1/t1.go
func f00(is []int, bs []byte) {
0x4552e0 4883ec50 SUBQ $0x50, SP
0x4552e4 48896c2448 MOVQ BP, 0x48(SP)
0x4552e9 488d6c2448 LEAQ 0x48(SP), BP
0x4552ee 4889442458 MOVQ AX, 0x58(SP)
0x4552f3 48895c2460 MOVQ BX, 0x60(SP)
0x4552f8 48894c2468 MOVQ CX, 0x68(SP)
0x4552fd 48897c2470 MOVQ DI, 0x70(SP)
0x455302 4889742478 MOVQ SI, 0x78(SP)
0x455307 4c89842480000000 MOVQ R8, 0x80(SP)
if len(is) >= 256 {
0x45530f 48895c2428 MOVQ BX, 0x28(SP)
0x455314 4881fb00010000 CMPQ $0x100, BX # 256 与 is.len 比较
0x45531b 7d02 JGE 0x45531f
0x45531d eb54 JMP 0x455373
is = is[:256] // 消除边界检查
0x45531f 488b542468 MOVQ 0x68(SP), DX # DX=is.cap
0x455324 4881fa00010000 CMPQ $0x100, DX # 256 与 is.cap 比较
0x45532b 7305 JAE 0x455332
0x45532d e993000000 JMP 0x4553c5
0x455332 eb00 JMP 0x455334
0x455334 48c744246000010000 MOVQ $0x100, 0x60(SP) # is.len=256
for _, n := range bs {
0x45533d 488b542470 MOVQ 0x70(SP), DX # DX=bs.data
0x455342 488b5c2478 MOVQ 0x78(SP), BX # BX=bs.len
0x455347 488bb42480000000 MOVQ 0x80(SP), SI # SI=bs.cap
0x45534f 4889542430 MOVQ DX, 0x30(SP)
0x455354 48895c2438 MOVQ BX, 0x38(SP)
0x455359 4889742440 MOVQ SI, 0x40(SP)
0x45535e 48c744242000000000 MOVQ $0x0, 0x20(SP)
0x455367 488b542438 MOVQ 0x38(SP), DX # DX=bs.len
0x45536c 4889542418 MOVQ DX, 0x18(SP)
0x455371 eb0c JMP 0x45537f
}
0x455373 eb00 JMP 0x455375
0x455375 488b6c2448 MOVQ 0x48(SP), BP
0x45537a 4883c450 ADDQ $0x50, SP
0x45537e c3 RET
for _, n := range bs {
0x45537f 488b542420 MOVQ 0x20(SP), DX # DX=0
0x455384 4839542418 CMPQ DX, 0x18(SP) # 0 与 bs.len 比较
0x455389 7f02 JG 0x45538d
0x45538b eb2e JMP 0x4553bb
0x45538d 488b542430 MOVQ 0x30(SP), DX # DX=bs.data
0x455392 4803542420 ADDQ 0x20(SP), DX # DX=0+DX
0x455397 0fb602 MOVZX 0(DX), AX # AX=*bs.data
0x45539a 88442417 MOVB AL, 0x17(SP)
_ = is[n]
0x45539e 488b4c2460 MOVQ 0x60(SP), CX # CX=256
0x4553a3 4839c1 CMPQ AX, CX # 越界判断
0x4553a6 7702 JA 0x4553aa
0x4553a8 eb13 JMP 0x4553bd
0x4553aa eb00 JMP 0x4553ac
for _, n := range bs {
0x4553ac 488b542420 MOVQ 0x20(SP), DX
0x4553b1 48ffc2 INCQ DX
0x4553b4 4889542420 MOVQ DX, 0x20(SP)
0x4553b9 ebc4 JMP 0x45537f
}
0x4553bb ebb8 JMP 0x455375
_ = is[n]
0x4553bd 0f1f00 NOPL 0(AX)
0x4553c0 e8fbd2ffff CALL runtime.panicIndex(SB)
is = is[:256] // 消除边界检查
0x4553c5 b900010000 MOVL $0x100, CX
0x4553ca e871d3ffff CALL runtime.panicSliceAcap(SB)
0x4553cf 90 NOPL
|