New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cmd/compile: inline of a predicate uses temporary bool #4397
Comments
related discussion: https://groups.google.com/d/topic/golang-dev/NTuctRBO1aQ/discussion |
Here's what comes out of the linker: 002000 main.main | (7) TEXT main.main+0(SB),$24 002000 65488b0c25a0080000 | (7) MOVQ 2208(GS),CX 002009 483b21 | (7) CMPQ SP,(CX) 00200c 7705 | (7) JHI ,2013 00200e e82d130100 | (7) CALL ,13340+runtime.morestack00 002013 4883ec18 | (7) SUBQ $24,SP 002017 488d1c25e0b00100 | (8) LEAQ go.string.""+0(SB),BX 00201f 488b33 | (8) MOVQ (BX),SI 002022 488b5308 | (8) MOVQ 8(BX),DX 002026 488b0b | (9) MOVQ (BX),CX 002029 488b6b08 | (9) MOVQ 8(BX),BP 00202d c644241700 | (10) MOVB $0,main..anon2+23(SP) 002032 4839ea | (10) CMPQ DX,BP 002035 7431 | (10) JEQ ,2068 002037 4831c0 | (10) MOVQ $0,AX 00203a 88442417 | (10) MOVB AL,main..anon2+23(SP) 00203e 480fb65c2417 | (10) MOVBQZX main..anon2+23(SP),BX 002044 80fb00 | (10) CMPB BL,$0 002047 741a | (10) JEQ ,2063 002049 488d342508bc0100 | (11) LEAQ go.string."ok"+0(SB),SI 002051 488d3c24 | (11) LEAQ (SP),DI 002055 48a5 | (11) MOVSQ , 002057 48a5 | (11) MOVSQ , 002059 e802900000 | (11) CALL ,b060+runtime.printstring 00205e e86d900000 | (11) CALL ,b0d0+runtime.printnl 002063 4883c418 | (13) ADDQ $24,SP 002067 c3 | (13) RET , |
The anons are gone in the latest copy of the code, but the inlined function is still computing a value into AL and then the AL value gets tested after the "return". I don't think this is terribly important, but maybe it will happen for Go 1.1. 002000 main.main | (7) TEXT main.main+0(SB),$16 002000 65488b0c25a0080000 | (7) MOVQ 2208(GS),CX 002009 483b21 | (7) CMPQ SP,(CX) 00200c 7705 | (7) JHI ,2013 00200e e82d380100 | (7) CALL ,15840+runtime.morestack00 002013 4883ec10 | (7) SUBQ $16,SP 002017 488d1c25e0f00100 | (8) LEAQ go.string.""+0(SB),BX 00201f 488b3b | (8) MOVQ (BX),DI 002022 488b5308 | (8) MOVQ 8(BX),DX 002026 488b33 | (9) MOVQ (BX),SI 002029 488b6b08 | (9) MOVQ 8(BX),BP 00202d 4831c0 | (10) MOVQ $0,AX 002030 4839ea | (10) CMPQ DX,BP 002033 742d | (10) JEQ ,2062 002035 4831c0 | (10) MOVQ $0,AX 002038 80f800 | (10) CMPB AL,$0 00203b 7420 | (10) JEQ ,205d 00203d 488d1c2588fd0100 | (11) LEAQ go.string."ok"+0(SB),BX 002045 488d2c24 | (11) LEAQ (SP),BP 002049 4889ef | (11) MOVQ BP,DI 00204c 4889de | (11) MOVQ BX,SI 00204f 48a5 | (11) MOVSQ , 002051 48a5 | (11) MOVSQ , 002053 e8a8ad0000 | (11) CALL ,ce00+runtime.printstring 002058 e813ae0000 | (11) CALL ,ce70+runtime.printnl 00205d 4883c410 | (13) ADDQ $16,SP 002061 c3 | (13) RET , 002062 48c7c001000000 | (10) MOVQ $1,AX 002069 ebcd | (10) JMP ,2038 Labels changed: added go1.1maybe, removed go1.1. |
I think this is all right. 0000000000401000 <main.main>: looks fixed. |
by jeff.allen:
The text was updated successfully, but these errors were encountered: