Closed
Description
For this code https://is.gd/JbfHAI
#![crate_type = "lib"]
pub extern fn clone(bits: &mut Box<[u64; 1024]>) -> Box<[u64; 1024]> {
Box::new(**bits)
}
It copies data to the stack first, before allocating and copying again to the heap.
.cfi_offset rbx, -16
mov rsi, qword ptr [rdi]
lea rdi, [rsp]
mov edx, 8192
call memcpy@PLT
mov edi, 8192
mov esi, 8
call __rust_allocate@PLT
mov rbx, rax
test rbx, rbx
je .LBB0_2
lea rsi, [rsp]
mov edx, 8192
mov rdi, rbx
call memcpy@PLT
mov rax, rbx
add rsp, 8192
pop rbx
ret