ABI Anda kemungkinan besar salah

ABI, atau Application Binary Interface, mendefinisikan bagaimana binari berinteraksi satu sama lain pada platform tertentu dan menyertakan konvensi pemanggilan. Sebagian besar ABI memiliki satu cacat desain yang memperlambat kinerja.





Mari kita mulai dengan melihat System V ABI untuk jajaran prosesor x86. ABI mengklasifikasikan argumen fungsi ke dalam sejumlah kategori yang berbeda; kami hanya akan mempertimbangkan dua:





INTEGER: , .





MEMORY: , .





; , :





  1. , INTEGER .





  2. , MEMORY .





  3. , , , .





, , .





? , , , . , ; , , .





:





void foo(int*);
void bar(void);

int x = 5;
foo(&x);   //   , foo   &x   
x = 7;
bar();       //  , bar   x
return x;   //  ,       ;       

	     // (   ,   x    , ,   ,       .)

      
      



restrict



! foo



restrict



, foo (C11Β§6.7.3.1p4,11). , . , restrict



C , , , ABI C .





, ABI . void foo



(struct bla



) , void foo



(const struct bla *restrict



), , .





, System V. ABI? Microsoft , : 





[ ] , .





( , , ), . Β«, Β», , , - .





ABI! ARM (, AAA arch 64):





, 16 , , , .





RISC-V:





2Γ—XLEN [: ?] .





[...]





, , .





PowerPC:





[] (GPR), , .





MIPS n32:





(structs), (unions), (doublewords), , , , , .





.






ABI immutable , . , , , , . , .





, ABI!






:





  • SysV ABI





  • Microsoft ABI





  • ARM ABI





  • RISC-V ABI





  • PowerPC ABI





  • MIPS n32 ABI





  • C11






"C++ Developer. Professional". , , , .





- DEMO DAY








All Articles