| |
|
Salih Dinçer 
| Bakalım neler oluyor...:)
void main() {
ubyte[] dizi=[4, 5, 6 ];
ubyte a = *dizi.ptr; // mov BL,[RDX]
ubyte b = dizi[0]; // mov CL,[RDX]
assert(a == b); // cmp BL,CL
}
Alıntı:
> '_Dmain:
push RBP
mov RBP,RSP
sub RSP,018h
push RBX
'; ========== Bellekte 3 birimlik dizi kurar =========='
mov RSI,3
mov RDI,offset FLAT:_D11TypeInfo_Ah6__initZ@64
call _d_arrayliteralTX@PC32
'; ========== Her birime değerlerini yerleştirir =========='
mov byte ptr [RAX],4 '; a[0] = 4'
mov byte ptr 1[RAX],5 '; a[1] = 5'
mov byte ptr 2[RAX],6 '; a[2] = 6'
mov RCX,RAX
mov RAX,3
mov -010h[RBP],RAX '; a.length = 3'
mov -8[RBP],RCX '; &a'
mov RDX,-8[RBP]
mov BL,[RDX]
'; ========== Taşma var mı? (0 > a.length ise 1 satır atla) =========='
cmp qword ptr -010h[RBP],0
jne DEVAM
mov EDI,4 ' ; hata kodu olsa gerek...:)'
call _D4aptr7__arrayZ@PC32
DEVAM: mov RDX,-8[RBP]
mov RAX,-010h[RBP]
mov CL,[RDX]
'; ========== Eşitler mi? ( a != b ise 1 satır atla) =========='
cmp BL,CL
je ÇIK
mov EDI,6
call _D4aptr8__assertFiZv@PC32
ÇIK: xor EAX,EAX
pop RBX
leave
ret
nop
nop
'
Alıntı:
> '_D4aptr7__arrayZ:
push RBP
mov RBP,RSP
sub RSP,010h
mov RSI,RDI
mov RDI,offset FLAT:_D4aptr12__ModuleInfoZ@64
call _d_array_bounds@PC32
nop
nop
'
Alıntı:
> '_D4aptr8__assertFiZv:
push RBP
mov RBP,RSP
sub RSP,010h
mov RSI,RDI
mov RDI,offset FLAT:_D4aptr12__ModuleInfoZ@64
call _d_assertm@PC32
'
--
[ Bu gönderi, http://ddili.org/forum'dan dönüştürülmüştür. ]
|