I’m finding out the meeting output of unoptimized go construct. There’s a perform that returns nil it doesn’t matter what. Throughout runtime go panics as anticipated because of nil. How does go name the runtime.panic* capabilities as outlined in meeting supply? I dont see any calls to them, just a few couple of checks.
Supply code:
package deal major
sort Some struct {
a int
}
func getSome() *Some {
some := 23
if some == 40 {
return &Some{}
} else {
return nil
}
}
func major() {
some := getSome()
some.a = 13
}
Meeting fragment:
0000000000457660 <major.getSome>:
457660: 55 push %rbp
457661: 48 89 e5 mov %rsp,%rbp
457664: 48 83 ec 10 sub $0x10,%rsp
457668: 48 c7 44 24 08 00 00 movq $0x0,0x8(%rsp)
45766f: 00 00
457671: 48 c7 04 24 17 00 00 movq $0x17,(%rsp)
457678: 00
457679: eb 00 jmp 45767b <major.getSome+0x1b>
45767b: 48 c7 44 24 08 00 00 movq $0x0,0x8(%rsp)
457682: 00 00
457684: 31 c0 xor %eax,%eax
457686: 48 83 c4 10 add $0x10,%rsp
45768a: 5d pop %rbp
45768b: c3 ret
45768c: cc int3
45768d: cc int3
45768e: cc int3
45768f: cc int3
457690: cc int3
457691: cc int3
457692: cc int3
457693: cc int3
457694: cc int3
457695: cc int3
457696: cc int3
457697: cc int3
457698: cc int3
457699: cc int3
45769a: cc int3
45769b: cc int3
45769c: cc int3
45769d: cc int3
45769e: cc int3
45769f: cc int3
00000000004576a0 <major.major>:
4576a0: 49 3b 66 10 cmp 0x10(%r14),%rsp
4576a4: 76 20 jbe 4576c6 <major.major+0x26>
4576a6: 55 push %rbp
4576a7: 48 89 e5 mov %rsp,%rbp
4576aa: 48 83 ec 08 sub $0x8,%rsp
4576ae: e8 advert ff ff ff name 457660 <major.getSome>
4576b3: 48 89 04 24 mov %rax,(%rsp)
4576b7: 84 00 take a look at %al,(%rax)
4576b9: 48 c7 00 0d 00 00 00 movq $0xd,(%rax)
4576c0: 48 83 c4 08 add $0x8,%rsp
4576c4: 5d pop %rbp
4576c5: c3 ret
4576c6: e8 f5 ce ff ff name 4545c0 <runtime.morestack_noctxt.abi0>
4576cb: eb d3 jmp 4576a0 <major.major>
Godbolt makes use of coloration to indicate which components of the assembly-code belong to which Go-code
I pasted your code right here:
Perhaps this helps?