어셈블리 코드 분석 -- 설명좀 해주세요!!

mud0107의 이미지

TestOptBinding`main:
0x100001460 <+0>: pushq %rbp
0x100001461 <+1>: movq %rsp, %rbp
0x100001464 <+4>: subq $0xc0, %rsp
0x10000146b <+11>: leaq 0x518f3e(%rip), %rax ; "sdfl;js"
0x100001472 <+18>: movl $0x7, %ecx
0x100001477 <+23>: movl %ecx, %edx
0x100001479 <+25>: movl $0x1, %ecx
0x10000147e <+30>: movl %edi, -0x4c(%rbp)
0x100001481 <+33>: movq %rax, %rdi
0x100001484 <+36>: movq %rsi, -0x58(%rbp)
0x100001488 <+40>: movq %rdx, %rsi
0x10000148b <+43>: movl %ecx, %edx
0x10000148d <+45>: callq 0x100094690 ; Swift.String.init(_builtinStringLiteral: Builtin.RawPointer, utf8CodeUnitCount: Builtin.Word, isASCII: Builtin.Int1) -> Swift.String
0x100001492 <+50>: leaq 0x5a46bf(%rip), %rsi ; type metadata for Swift.String
0x100001499 <+57>: leaq 0x5959c0(%rip), %rdi ; protocol witness table for Swift.String : Swift.LosslessStringConvertible in Swift
0x1000014a0 <+64>: leaq 0x595b29(%rip), %r8 ; protocol witness table for Swift.String : Swift.Sequence in Swift
0x1000014a7 <+71>: leaq -0x18(%rbp), %r9

//////////////
// 여기서 부터
0x1000014ab <+75>: movq %rax, -0x18(%rbp)
0x1000014af <+79>: movq %rdx, -0x10(%rbp)
0x1000014b3 <+83>: movq %rcx, -0x8(%rbp)
0x1000014b7 <+87>: movq %rdi, -0x60(%rbp)
0x1000014bb <+91>: movq %r9, %rdi
0x1000014be <+94>: movq -0x60(%rbp), %rdx
0x1000014c2 <+98>: movq %r8, %rcx
0x1000014c5 <+101>: callq 0x100337520 ; Swift.String.init(A) -> Swift.String
0x1000014ca <+106>: movq %rax, 0x5e077f(%rip) ; TestOptBinding.aaa : Swift.Optional
0x1000014d1 <+113>: movq %rdx, 0x5e0780(%rip) ; TestOptBinding.aaa : Swift.Optional + 8
0x1000014d8 <+120>: movq %rcx, 0x5e0781(%rip) ; TestOptBinding.aaa : Swift.Optional + 16
0x1000014df <+127>: movb $0x0, 0x5e0782(%rip) ; TestOptBinding.aaa : Swift.Optional + 23
-> 0x1000014e6 <+134>: movq 0x5e0763(%rip), %rax ; TestOptBinding.aaa : Swift.Optional
0x1000014ed <+141>: movq 0x5e0764(%rip), %rcx ; TestOptBinding.aaa : Swift.Optional + 8
0x1000014f4 <+148>: movq 0x5e0765(%rip), %rdx ; TestOptBinding.aaa : Swift.Optional + 16
0x1000014fb <+155>: movb 0x5e0766(%rip), %r10b ; TestOptBinding.aaa : Swift.Optional + 24
0x100001502 <+162>: movzbl %r10b, %r11d
0x100001506 <+166>: movq %rax, %rdi
0x100001509 <+169>: movq %rcx, %rsi
0x10000150c <+172>: movq %rdx, -0x68(%rbp)
0x100001510 <+176>: movq %rcx, -0x70(%rbp)
0x100001514 <+180>: movl %r11d, %ecx
0x100001517 <+183>: movq %rax, -0x78(%rbp)
0x10000151b <+187>: movb %r10b, -0x79(%rbp)
0x10000151f <+191>: callq 0x100001400 ; outlined copy of Swift.Optional
0x100001524 <+196>: movb -0x79(%rbp), %r10b
0x100001528 <+200>: testb $0x1, %r10b
0x10000152c <+204>: jne 0x100001551 ; <+241> at main.swift:13
0x10000152e <+206>: movq -0x78(%rbp), %rax
0x100001532 <+210>: movq -0x70(%rbp), %rcx
0x100001536 <+214>: movq -0x68(%rbp), %rdx
0x10000153a <+218>: movq %rax, -0x88(%rbp)
0x100001541 <+225>: movq %rcx, -0x90(%rbp)
0x100001548 <+232>: movq %rdx, -0x98(%rbp)
0x10000154f <+239>: jmp 0x100001556 ; <+246> at main.swift
0x100001551 <+241>: jmp 0x1000015f2 ; <+402> at main.swift
0x100001556 <+246>: movq -0x98(%rbp), %rax
0x10000155d <+253>: movq -0x90(%rbp), %rcx
0x100001564 <+260>: movq -0x88(%rbp), %rdx
0x10000156b <+267>: movq %rdx, -0x30(%rbp)
0x10000156f <+271>: movq %rcx, -0x28(%rbp)
0x100001573 <+275>: movq %rax, -0x20(%rbp)
0x100001577 <+279>: movq %rax, -0xa0(%rbp)
0x10000157e <+286>: movq %rcx, -0xa8(%rbp)
0x100001585 <+293>: movq %rdx, -0xb0(%rbp

//////////////////////////////////////////////
// 여기까지.........
0x10000158c <+300>: movq -0xa0(%rbp), %rdi
0x100001593 <+307>: callq 0x100507de0 ; swift_unknownRetain
0x100001598 <+312>: leaq 0x518e19(%rip), %rdi ; "ddddddd"
0x10000159f <+319>: movl $0x7, %eax
0x1000015a4 <+324>: movl %eax, %esi
0x1000015a6 <+326>: movl $0x1, %edx
0x1000015ab <+331>: movq -0xb0(%rbp), %rcx
0x1000015b2 <+338>: movq %rcx, -0x48(%rbp)
0x1000015b6 <+342>: movq -0xa8(%rbp), %r8
0x1000015bd <+349>: movq %r8, -0x40(%rbp)
0x1000015c1 <+353>: movq -0xa0(%rbp), %r9
0x1000015c8 <+360>: movq %r9, -0x38(%rbp)
0x1000015cc <+364>: callq 0x100094690 ; Swift.String.init(_builtinStringLiteral: Builtin.RawPointer, utf8CodeUnitCount: Builtin.Word, isASCII: Builtin.Int1) -> Swift.String
0x1000015d1 <+369>: leaq -0x48(%rbp), %rdi
0x1000015d5 <+373>: movq %rax, %rsi
0x1000015d8 <+376>: callq 0x1000b9b70 ; static Swift.String.+= infix(inout Swift.String, Swift.String) -> ()
0x1000015dd <+381>: movq -0x38(%rbp), %rdi
0x1000015e1 <+385>: callq 0x100507e20 ; swift_unknownRelease
0x1000015e6 <+390>: movq -0xa0(%rbp), %rdi
0x1000015ed <+397>: callq 0x100507e20 ; swift_unknownRelease
0x1000015f2 <+402>: movl $0x1, %edi
0x1000015f7 <+407>: callq 0x10051956c ; symbol stub for: sleep
0x1000015fc <+412>: xorl %edi, %edi
0x1000015fe <+414>: movl %eax, -0xb4(%rbp)
0x100001604 <+420>: movl %edi, %eax
0x100001606 <+422>: addq $0xc0, %rsp
0x10000160d <+429>: popq %rbp
0x10000160e <+430>: retq

/////////////////////////////////////////////////
// 실제 코드는 ......................
let aaa : String? = String("sdfl;js")

if let bbb = aaa
{
var kkk = bbb
kkk += "ddddddd"
}

sleep(1)

// 제가 알고 싶은 코드는
if let bbb = aaa

이게 스위프트의 옵셔널 바인딩이라는 부분인대........
bbb에 aaa를 할당하고 비교를 하는지
아님 aaa가 nil(null)인지 먼저 비교를 하고 할당을 하는지가 궁금합니다.
현재 모든 책에서는 후자를 말하고 있습니다.
대부분의 언어에서는 '=' 연산자를 먼저 수행하고 비교를 하게 되는대...........

그럼.......... 아시는분................ 꼭 쫌 분석 후 알려주세요!!!
미리 감사합니다.

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

BBCode

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param>
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

Textile

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • You can use Textile markup to format text.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Markdown

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • Quick Tips:
    • Two or more spaces at a line's end = Line break
    • Double returns = Paragraph
    • *Single asterisks* or _single underscores_ = Emphasis
    • **Double** or __double__ = Strong
    • This is [a link](http://the.link.example.com "The optional title text")
    For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Plain text

  • HTML 태그를 사용할 수 없습니다.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 줄과 단락은 자동으로 분리됩니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.