Skip to content

Instantly share code, notes, and snippets.

@longlongjump
Last active March 15, 2016 15:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save longlongjump/4da600f097ebb989b2a9 to your computer and use it in GitHub Desktop.
Save longlongjump/4da600f097ebb989b2a9 to your computer and use it in GitHub Desktop.
// foo(42)
movq __TMdSi@GOTPCREL(%rip), %rsi // assigning of direct type metadata for Swift.Int to argument register\
leaq -8(%rbp), %rax // assigning stack adress to $rax
movq $42, -8(%rbp) // move 42 to stack
movq %rax, %rdi // assigning address of 42 to function arg
callq __TF4test4testurFq_T_ // test.test <A> (A) -> () function call to test<T>(val: T) with Int
////////////////////////////////////////////////////////////////////////
// foo(42.0)
movq __TMdSd@GOTPCREL(%rip), %rsi // assigning direct type metadata for Swift.Double to argument register
leaq -16(%rbp), %rax // assigning stack adress to $rax
movsd LCPI0_0(%rip), %xmm0 // loading 42.0
movsd %xmm0, -16(%rbp) // move 42.0 to stack
movq %rax, %rdi // assigning address of 42.0 to function arg
callq __TF4test4testurFq_T_ // test.test <A> (A) -> () function call to test<T>(val: T) with Double
////////////////////////////////////////////////////////////////////////
// foo("42")
movq __TMdSS@GOTPCREL(%rip), %rsi // assigning direct type metadata for Swift.String to argument register
// initialization of String
leaq L___unnamed_1(%rip), %rdi
movl $2, %r8d
movl %r8d, %esi
movl $1, %edx
callq __TFSSCfMSSFT21_builtinStringLiteralBp8byteSizeBw7isASCIIBi1__SS
leaq -40(%rbp), %rdi
movq %rax, -40(%rbp)
movq %rdx, -32(%rbp)
movq %rcx, -24(%rbp)
callq __TF4test4testurFq_T_ // test.test <A> (A) -> () function call to test<T>(val: T) with String
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment