Skip to content

Instantly share code, notes, and snippets.

@alex
Created May 24, 2020 16:16
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 alex/7cb86520bf8a4fe799a728180c257675 to your computer and use it in GitHub Desktop.
Save alex/7cb86520bf8a4fe799a728180c257675 to your computer and use it in GitHub Desktop.
.text
.file "t.3a1fbbbh-cgu.0"
.section .text.repeat_take_collect,"ax",@progbits
.globl repeat_take_collect
.p2align 4, 0x90
.type repeat_take_collect,@function
repeat_take_collect:
.cfi_startproc
pushq %r14
.cfi_def_cfa_offset 16
pushq %rbx
.cfi_def_cfa_offset 24
pushq %rax
.cfi_def_cfa_offset 32
.cfi_offset %rbx, -24
.cfi_offset %r14, -16
movq %rdi, %r14
movl $100000, %edi
movl $1, %esi
callq *__rust_alloc@GOTPCREL(%rip)
testq %rax, %rax
je .LBB0_1
movq %rax, %rbx
movl $100000, %edx
movq %rax, %rdi
movl $42, %esi
callq *memset@GOTPCREL(%rip)
movq %rbx, (%r14)
movq $100000, 8(%r14)
movq $100000, 16(%r14)
movq %r14, %rax
addq $8, %rsp
.cfi_def_cfa_offset 24
popq %rbx
.cfi_def_cfa_offset 16
popq %r14
.cfi_def_cfa_offset 8
retq
.LBB0_1:
.cfi_def_cfa_offset 32
movl $100000, %edi
movl $1, %esi
callq *_ZN5alloc5alloc18handle_alloc_error17h95a515922c515945E@GOTPCREL(%rip)
ud2
.Lfunc_end0:
.size repeat_take_collect, .Lfunc_end0-repeat_take_collect
.cfi_endproc
.section ".note.GNU-stack","",@progbits
.text
.file "t.3a1fbbbh-cgu.0"
.section .text._ZN4core3ptr13drop_in_place17h2c2f733c21d42e6bE,"ax",@progbits
.p2align 4, 0x90
.type _ZN4core3ptr13drop_in_place17h2c2f733c21d42e6bE,@function
_ZN4core3ptr13drop_in_place17h2c2f733c21d42e6bE:
.cfi_startproc
movq 16(%rdi), %rax
movq 24(%rdi), %rcx
movq %rcx, (%rax)
retq
.Lfunc_end0:
.size _ZN4core3ptr13drop_in_place17h2c2f733c21d42e6bE, .Lfunc_end0-_ZN4core3ptr13drop_in_place17h2c2f733c21d42e6bE
.cfi_endproc
.section .text._ZN4core3ptr13drop_in_place17h83e065ba23a366a3E,"ax",@progbits
.p2align 4, 0x90
.type _ZN4core3ptr13drop_in_place17h83e065ba23a366a3E,@function
_ZN4core3ptr13drop_in_place17h83e065ba23a366a3E:
.cfi_startproc
movq 8(%rdi), %rsi
testq %rsi, %rsi
je .LBB1_1
movq (%rdi), %rdi
movl $1, %edx
jmpq *__rust_dealloc@GOTPCREL(%rip)
.LBB1_1:
retq
.Lfunc_end1:
.size _ZN4core3ptr13drop_in_place17h83e065ba23a366a3E, .Lfunc_end1-_ZN4core3ptr13drop_in_place17h83e065ba23a366a3E
.cfi_endproc
.section .text.repeat_take_collect,"ax",@progbits
.globl repeat_take_collect
.p2align 4, 0x90
.type repeat_take_collect,@function
repeat_take_collect:
.Lfunc_begin0:
.cfi_startproc
.cfi_personality 155, DW.ref.rust_eh_personality
.cfi_lsda 27, .Lexception0
pushq %r14
.cfi_def_cfa_offset 16
pushq %rbx
.cfi_def_cfa_offset 24
subq $56, %rsp
.cfi_def_cfa_offset 80
.cfi_offset %rbx, -24
.cfi_offset %r14, -16
movq %rdi, %rbx
movq $1, (%rdi)
xorps %xmm0, %xmm0
movups %xmm0, 8(%rdi)
movl $100000, %edi
movl $1, %esi
callq *__rust_alloc@GOTPCREL(%rip)
testq %rax, %rax
je .LBB2_8
movq %rax, %rcx
leaq 16(%rbx), %rdi
movq %rax, (%rbx)
movq $100000, 8(%rbx)
movb $42, 16(%rsp)
leaq 8(%rsp), %rax
movq %rax, 24(%rsp)
movq %rcx, 32(%rsp)
movq %rdi, 40(%rsp)
movq $0, 48(%rsp)
movb $42, (%rcx)
movq $99998, 8(%rsp)
movb $42, 1(%rcx)
movq $99997, 8(%rsp)
movb $42, 2(%rcx)
addq $3, %rcx
movl $3, %esi
.p2align 4, 0x90
.LBB2_2:
movq 8(%rsp), %rax
testq %rax, %rax
je .LBB2_7
movzbl 16(%rsp), %edx
addq $-1, %rax
movq %rax, 8(%rsp)
movb %dl, (%rcx)
addq $1, %rcx
incq %rsi
jne .LBB2_2
movq %rcx, 32(%rsp)
movq $-1, 48(%rsp)
.Ltmp0:
leaq str.0(%rip), %rdi
leaq .L__unnamed_1(%rip), %rdx
movl $28, %esi
callq *_ZN4core9panicking5panic17hed82ea7bfab0ba01E@GOTPCREL(%rip)
.Ltmp1:
ud2
.LBB2_7:
movq %rsi, (%rdi)
movq %rbx, %rax
addq $56, %rsp
.cfi_def_cfa_offset 24
popq %rbx
.cfi_def_cfa_offset 16
popq %r14
.cfi_def_cfa_offset 8
retq
.LBB2_8:
.cfi_def_cfa_offset 80
movl $100000, %edi
movl $1, %esi
callq *_ZN5alloc5alloc18handle_alloc_error17hb2c978dc513a9d3cE@GOTPCREL(%rip)
ud2
.LBB2_6:
.Ltmp2:
movq %rax, %r14
leaq 24(%rsp), %rdi
callq _ZN4core3ptr13drop_in_place17h2c2f733c21d42e6bE
movq %rbx, %rdi
callq _ZN4core3ptr13drop_in_place17h83e065ba23a366a3E
movq %r14, %rdi
callq _Unwind_Resume@PLT
ud2
.Lfunc_end2:
.size repeat_take_collect, .Lfunc_end2-repeat_take_collect
.cfi_endproc
.section .gcc_except_table,"a",@progbits
.p2align 2
GCC_except_table2:
.Lexception0:
.byte 255
.byte 255
.byte 1
.uleb128 .Lcst_end0-.Lcst_begin0
.Lcst_begin0:
.uleb128 .Ltmp0-.Lfunc_begin0
.uleb128 .Ltmp1-.Ltmp0
.uleb128 .Ltmp2-.Lfunc_begin0
.byte 0
.uleb128 .Ltmp1-.Lfunc_begin0
.uleb128 .Lfunc_end2-.Ltmp1
.byte 0
.byte 0
.Lcst_end0:
.p2align 2
.type str.0,@object
.section .rodata.str.0,"a",@progbits
.p2align 4
str.0:
.ascii "attempt to add with overflow"
.size str.0, 28
.type .L__unnamed_2,@object
.section .rodata..L__unnamed_2,"a",@progbits
.L__unnamed_2:
.ascii "/home/alex/p/rust/src/liballoc/vec.rs"
.size .L__unnamed_2, 37
.type .L__unnamed_1,@object
.section .data.rel.ro..L__unnamed_1,"aw",@progbits
.p2align 3
.L__unnamed_1:
.quad .L__unnamed_2
.asciz "%\000\000\000\000\000\000\000\272\006\000\000\t\000\000"
.size .L__unnamed_1, 24
.hidden DW.ref.rust_eh_personality
.weak DW.ref.rust_eh_personality
.section .data.DW.ref.rust_eh_personality,"aGw",@progbits,DW.ref.rust_eh_personality,comdat
.p2align 3
.type DW.ref.rust_eh_personality,@object
.size DW.ref.rust_eh_personality, 8
DW.ref.rust_eh_personality:
.quad rust_eh_personality
.section ".note.GNU-stack","",@progbits
use std::iter;
// CHECK-LABEL: @repeat_take_collect
#[no_mangle]
pub fn repeat_take_collect() -> Vec<u8> {
// CHECK: call void @llvm.memset.p0i8.i{{[0-9]+}}(i8* {{(nonnull )?}}align 1{{.*}} %{{[0-9]+}}, i8 42, i{{[0-9]+}} 100000, i1 false)
iter::repeat(42).take(100000).collect()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment