Instantly share code, notes, and snippets.

Embed
What would you like to do?
rustc -C opt-level=2 --emit asm closure.rs -o closure.s && rustc -C opt-level=2 --emit asm function.rs -o function.s && diff -Naur closure.s function.s
--- closure.s 2015-10-11 11:18:44.000000000 +0100
+++ function.s 2015-10-11 11:18:44.000000000 +0100
@@ -1,6 +1,6 @@
.section __TEXT,__text,regular,pure_instructions
.align 4, 0x90
-__ZN4main20h7b2594820b9cacc4eaaE:
+__ZN4main20h47f1f4c08b3bd344oaaE:
Lfunc_begin0:
.cfi_startproc
.cfi_personality 155, _rust_eh_personality
@@ -13,106 +13,76 @@
movq %rsp, %rbp
Ltmp8:
.cfi_def_cfa_register %rbp
- pushq %r15
- pushq %r14
pushq %rbx
subq $88, %rsp
Ltmp9:
- .cfi_offset %rbx, -40
-Ltmp10:
- .cfi_offset %r14, -32
-Ltmp11:
- .cfi_offset %r15, -24
- movl $12, %edi
- movl $4, %esi
- callq ___rust_allocate
- movq %rax, %r15
- testq %r15, %r15
- je LBB0_15
- movl _const3977+8(%rip), %eax
- movl %eax, 8(%r15)
- movq _const3977(%rip), %rax
- movq %rax, (%r15)
+ .cfi_offset %rbx, -24
movl $12, %edi
movl $4, %esi
callq ___rust_allocate
- movq %rax, %rbx
- testq %rbx, %rbx
- je LBB0_2
- movabsq $17179869186, %rax
- movq %rax, (%rbx)
- movl 8(%r15), %eax
- addl %eax, %eax
- movl %eax, 8(%rbx)
- movl $12, %esi
- movl $4, %edx
- movq %r15, %rdi
- callq ___rust_deallocate
- movq %rbx, -112(%rbp)
- movq $3, -104(%rbp)
- movq $3, -96(%rbp)
- leaq __ZN3vec23Vec$LT$T$GT$.fmt..Debug3fmt21h13580533641886887853E(%rip), %rax
- movq %rax, -80(%rbp)
- leaq -112(%rbp), %rax
- movq %rax, -88(%rbp)
- leaq _ref4276(%rip), %rax
+ testq %rax, %rax
+ je LBB0_1
+ movl $2, (%rax)
+ movl $4, 4(%rax)
+ movl $6, 8(%rax)
+ movq %rax, -96(%rbp)
+ movq $3, -88(%rbp)
+ movq $3, -80(%rbp)
+ leaq __ZN3vec23Vec$LT$T$GT$.fmt..Debug3fmt20h7846768527019415933E(%rip), %rax
+ movq %rax, -64(%rbp)
+ leaq -96(%rbp), %rax
movq %rax, -72(%rbp)
- movq $2, -64(%rbp)
- movq $0, -48(%rbp)
- movq $0, -56(%rbp)
- leaq -88(%rbp), %rax
- movq %rax, -40(%rbp)
- movq $1, -32(%rbp)
+ leaq _ref4278(%rip), %rax
+ movq %rax, -56(%rbp)
+ movq $2, -48(%rbp)
+ movq $0, -32(%rbp)
+ movq $0, -40(%rbp)
+ leaq -72(%rbp), %rax
+ movq %rax, -24(%rbp)
+ movq $1, -16(%rbp)
Ltmp0:
- leaq -72(%rbp), %rdi
+ leaq -56(%rbp), %rdi
callq __ZN2io5stdio6_print20he16d866c4af8e764V5gE
Ltmp1:
- movq -104(%rbp), %rsi
+ movq -88(%rbp), %rsi
testq %rsi, %rsi
- je LBB0_14
+ je LBB0_12
movabsq $2097865012304223517, %rax
cmpq %rax, %rsi
- je LBB0_14
+ je LBB0_12
shlq $2, %rsi
- movq -112(%rbp), %rdi
+ movq -96(%rbp), %rdi
movl $4, %edx
callq ___rust_deallocate
-LBB0_14:
+LBB0_12:
addq $88, %rsp
popq %rbx
- popq %r14
- popq %r15
popq %rbp
retq
-LBB0_15:
- callq __ZN3oom20h633c9ae9af23387batbE
-LBB0_2:
+LBB0_1:
Ltmp3:
callq __ZN3oom20h633c9ae9af23387batbE
Ltmp4:
-LBB0_7:
+LBB0_5:
Ltmp2:
- movq %rax, %r14
- movq -104(%rbp), %rsi
+ movq %rax, %rbx
+ movq -88(%rbp), %rsi
testq %rsi, %rsi
- je LBB0_6
+ je LBB0_4
movabsq $2097865012304223517, %rax
cmpq %rax, %rsi
- je LBB0_6
+ je LBB0_4
shlq $2, %rsi
- movq -112(%rbp), %rdi
- movl $4, %edx
- jmp LBB0_5
-LBB0_4:
-Ltmp5:
- movq %rax, %r14
- movl $12, %esi
+ movq -96(%rbp), %rdi
movl $4, %edx
- movq %r15, %rdi
-LBB0_5:
callq ___rust_deallocate
-LBB0_6:
- movq %r14, %rdi
+ movq %rbx, %rdi
+ callq __Unwind_Resume
+LBB0_3:
+Ltmp5:
+ movq %rax, %rbx
+LBB0_4:
+ movq %rbx, %rdi
callq __Unwind_Resume
Lfunc_end0:
.cfi_endproc
@@ -122,9 +92,9 @@
Lexception0:
.byte 255
.byte 155
- .asciz "\266\200\200"
+ .byte 41
.byte 3
- .byte 52
+ .byte 39
Lset0 = Ltmp0-Lfunc_begin0
.long Lset0
Lset1 = Ltmp1-Ltmp0
@@ -132,38 +102,32 @@
Lset2 = Ltmp2-Lfunc_begin0
.long Lset2
.byte 0
-Lset3 = Ltmp1-Lfunc_begin0
+Lset3 = Ltmp3-Lfunc_begin0
.long Lset3
-Lset4 = Ltmp3-Ltmp1
+Lset4 = Ltmp4-Ltmp3
.long Lset4
- .long 0
- .byte 0
-Lset5 = Ltmp3-Lfunc_begin0
+Lset5 = Ltmp5-Lfunc_begin0
.long Lset5
-Lset6 = Ltmp4-Ltmp3
+ .byte 0
+Lset6 = Ltmp4-Lfunc_begin0
.long Lset6
-Lset7 = Ltmp5-Lfunc_begin0
+Lset7 = Lfunc_end0-Ltmp4
.long Lset7
- .byte 0
-Lset8 = Ltmp4-Lfunc_begin0
- .long Lset8
-Lset9 = Lfunc_end0-Ltmp4
- .long Lset9
.long 0
.byte 0
.align 2
.section __TEXT,__text,regular,pure_instructions
.align 4, 0x90
-__ZN3vec23Vec$LT$T$GT$.fmt..Debug3fmt21h13580533641886887853E:
+__ZN3vec23Vec$LT$T$GT$.fmt..Debug3fmt20h7846768527019415933E:
.cfi_startproc
pushq %rbp
-Ltmp12:
+Ltmp10:
.cfi_def_cfa_offset 16
-Ltmp13:
+Ltmp11:
.cfi_offset %rbp, -16
movq %rsp, %rbp
-Ltmp14:
+Ltmp12:
.cfi_def_cfa_register %rbp
pushq %r15
pushq %r14
@@ -171,15 +135,15 @@
pushq %r12
pushq %rbx
subq $24, %rsp
-Ltmp15:
+Ltmp13:
.cfi_offset %rbx, -56
-Ltmp16:
+Ltmp14:
.cfi_offset %r12, -48
-Ltmp17:
+Ltmp15:
.cfi_offset %r13, -40
-Ltmp18:
+Ltmp16:
.cfi_offset %r14, -32
-Ltmp19:
+Ltmp17:
.cfi_offset %r15, -24
movq (%rdi), %rbx
movq 16(%rdi), %r13
@@ -188,7 +152,7 @@
testq %r13, %r13
je LBB1_3
shlq $2, %r13
- leaq _vtable4242(%rip), %r14
+ leaq _vtable4244(%rip), %r14
leaq -64(%rbp), %r15
leaq -48(%rbp), %r12
.align 4, 0x90
@@ -215,19 +179,19 @@
.cfi_endproc
.align 4, 0x90
-__ZN2i89drop.423817hbeebf6ea8e707b19E:
+__ZN2i89drop.424017h394f068857b35ecfE:
retq
.align 4, 0x90
-__ZN3fmt23_$RF$$u27$a$u20$T.Debug3fmt21h14413325998897563779E:
+__ZN3fmt23_$RF$$u27$a$u20$T.Debug3fmt21h14440093934698046107E:
.cfi_startproc
pushq %rbp
-Ltmp20:
+Ltmp18:
.cfi_def_cfa_offset 16
-Ltmp21:
+Ltmp19:
.cfi_offset %rbp, -16
movq %rsp, %rbp
-Ltmp22:
+Ltmp20:
.cfi_def_cfa_register %rbp
movq (%rdi), %rdi
popq %rbp
@@ -240,40 +204,33 @@
.cfi_startproc
movq %rsi, %rax
movq %rdi, %rcx
- leaq __ZN4main20h7b2594820b9cacc4eaaE(%rip), %rdi
+ leaq __ZN4main20h47f1f4c08b3bd344oaaE(%rip), %rdi
movq %rcx, %rsi
movq %rax, %rdx
jmp __ZN2rt10lang_start20h3a9e1691abb4cd9cfSwE
.cfi_endproc
- .section __TEXT,__const
- .align 2
-_const3977:
- .long 1
- .long 2
- .long 3
-
.section __DATA,__const
.align 4
-_vtable4242:
- .quad __ZN2i89drop.423817hbeebf6ea8e707b19E
+_vtable4244:
+ .quad __ZN2i89drop.424017h394f068857b35ecfE
.quad 8
.quad 8
- .quad __ZN3fmt23_$RF$$u27$a$u20$T.Debug3fmt21h14413325998897563779E
+ .quad __ZN3fmt23_$RF$$u27$a$u20$T.Debug3fmt21h14440093934698046107E
.section __TEXT,__const
-_str4274:
+_str4276:
.byte 0
-_str4275:
+_str4277:
.byte 10
.section __DATA,__const
.align 4
-_ref4276:
- .quad _str4274
+_ref4278:
+ .quad _str4276
.quad 0
- .quad _str4275
+ .quad _str4277
.quad 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment