Skip to content

Instantly share code, notes, and snippets.

@k0nserv
Created February 26, 2016 21:57
Show Gist options
  • Save k0nserv/2efbef650f09a6ee3e58 to your computer and use it in GitHub Desktop.
Save k0nserv/2efbef650f09a6ee3e58 to your computer and use it in GitHub Desktop.
Swift inlining
@inline(__always) private func isComment(marker: String) -> Bool {
return marker == "#"
}
isComment("#")
isComment("vt")
.section __TEXT,__text,regular,pure_instructions
.macosx_version_min 10, 9
.globl _main
.align 4, 0x90
_main:
.cfi_startproc
pushq %rbp
Ltmp0:
.cfi_def_cfa_offset 16
Ltmp1:
.cfi_offset %rbp, -16
movq %rsp, %rbp
Ltmp2:
.cfi_def_cfa_register %rbp
subq $16, %rsp
movq _globalinit_33_1BDF70FFC18749BAB495A73B459ED2F0_token5@GOTPCREL(%rip), %rax
movq __TZvOs7Process5_argcVs5Int32@GOTPCREL(%rip), %rcx
movl %edi, (%rcx)
cmpq $-1, (%rax)
movq %rsi, -8(%rbp)
je LBB0_2
movq _globalinit_33_1BDF70FFC18749BAB495A73B459ED2F0_token5@GOTPCREL(%rip), %rdi
movq _globalinit_33_1BDF70FFC18749BAB495A73B459ED2F0_func5@GOTPCREL(%rip), %rax
movq %rax, %rsi
callq _swift_once
LBB0_2:
leaq L___unnamed_1(%rip), %rdi
movl $1, %eax
movl %eax, %esi
movl $1, %edx
movq __TZvOs7Process11_unsafeArgvGSpGSpVs4Int8__@GOTPCREL(%rip), %rcx
movq -8(%rbp), %r8
movq %r8, (%rcx)
callq __TFSSCfT21_builtinStringLiteralBp8byteSizeBw7isASCIIBi1__SS
movq %rax, %rdi
movq %rdx, %rsi
movq %rcx, %rdx
callq __TF4TestP33_FD30D9FC47D6AC50355EEC3A2CA8155C9isCommentFSSSb
leaq L___unnamed_2(%rip), %rdi
movl $2, %r9d
movl %r9d, %esi
movl $1, %edx
movb %al, -9(%rbp)
callq __TFSSCfT21_builtinStringLiteralBp8byteSizeBw7isASCIIBi1__SS
movq %rax, %rdi
movq %rdx, %rsi
movq %rcx, %rdx
callq __TF4TestP33_FD30D9FC47D6AC50355EEC3A2CA8155C9isCommentFSSSb
xorl %r9d, %r9d
movb %al, -10(%rbp)
movl %r9d, %eax
addq $16, %rsp
popq %rbp
retq
.cfi_endproc
.align 4, 0x90
__TF4TestP33_FD30D9FC47D6AC50355EEC3A2CA8155C9isCommentFSSSb:
.cfi_startproc
pushq %rbp
Ltmp3:
.cfi_def_cfa_offset 16
Ltmp4:
.cfi_offset %rbp, -16
movq %rsp, %rbp
Ltmp5:
.cfi_def_cfa_register %rbp
subq $48, %rsp
movq %rdi, -8(%rbp)
movq %rdx, %rdi
movq %rsi, -16(%rbp)
movq %rdx, -24(%rbp)
callq _swift_unknownRetain
leaq L___unnamed_1(%rip), %rdi
movl $1, %eax
movl %eax, %esi
movl $1, %edx
callq __TFSSCfT21_builtinStringLiteralBp8byteSizeBw7isASCIIBi1__SS
movq -8(%rbp), %rdi
movq -16(%rbp), %rsi
movq -24(%rbp), %r8
movq %rdx, -32(%rbp)
movq %r8, %rdx
movq %rcx, -40(%rbp)
movq %rax, %rcx
movq -32(%rbp), %r8
movq -40(%rbp), %r9
callq __TZFsoi2eeFTSSSS_Sb
movb %al, %r10b
movq -24(%rbp), %rdi
movb %al, -41(%rbp)
movb %r10b, -42(%rbp)
callq _swift_unknownRelease
movb -41(%rbp), %al
addq $48, %rsp
popq %rbp
retq
.cfi_endproc
.section __TEXT,__cstring,cstring_literals
L___unnamed_1:
.asciz "#"
L___unnamed_2:
.asciz "vt"
.linker_option "-lswiftCore"
.linker_option "-lobjc"
.section __DATA,__objc_imageinfo,regular,no_dead_strip
L_OBJC_IMAGE_INFO:
.long 0
.long 768
.subsections_via_symbols
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment