, x86-64 SystemV ABI rdi rsi arg, Windows 64-bit ABI . . x86 wiki ABI docs .
(, structs), , . ( 128 ) , , RDX: RAX. , .
asm docs, , : , . D, . 64-, , RDX: RAX, .
, Cycle(),:
- RDI: "" ( 64- )
- RSI: arg ( range_start)
- RDX: arg ( range_end)
, asm , , D , clang gcc, . -O -release -inline ( ), - / .
pure nothrow @nogc @safe std.range.Cycle!(int[]).Cycle std.range.cycle!(int[]).cycle(int[]):
sub rsp,0x28
mov QWORD PTR [rsp+0x20],rdi
mov QWORD PTR [rsp+0x8],0x0
mov QWORD PTR [rsp+0x10],0x0
mov QWORD PTR [rsp+0x8],rsi
mov QWORD PTR [rsp+0x10],rdx
xor eax,eax
xor edx,edx
div QWORD PTR [rsp+0x8]
mov QWORD PTR [rsp+0x18],rdx
lea rsi,[rsp+0x8]
movs QWORD PTR es:[rdi],QWORD PTR ds:[rsi]
movs QWORD PTR es:[rdi],QWORD PTR ds:[rsi]
movs QWORD PTR es:[rdi],QWORD PTR ds:[rsi]
mov rax,QWORD PTR [rsp+0x20]
add rsp,0x28
ret
ABI , RAX, . RAX.
:
std.range.Cycle...:
mov [rdi], rsi # cycle_start
mov [rdi+0x8], rdx # cycle_end
mov [rdi+0x10], 0 # index
mov rax, rdi
ret
, . , , foo(), () .
, foo() , , , - .o( ) . , 00 00 00 00, . , , , esi = 2 edi = 0. ( mov edi, 0 ! Yuck!). , rel32 .
, LDC GDC , (LLVM gcc), -, , . , Matt Godbolt, D .