0
votes

I'm doing some compiler-writing projects and I want to make sure I'm understanding ABI and calling-conventions correctly.

Say I'm writing a compiler for some high-level language L, and it's targeting some system S.

If I'm understanding things correctly, as long as I'm generating instructions for L methods that are calling other L methods, I can use whatever calling conventions I want. The only time I'd have to follow the standard calling conventions specified by S's ABI is whenever I want to make a system call or call a foreign function that adheres to the ABI's calling convention.

Is this understanding correct? And furthermore, are there any negative consequences of a language runtime having a different internal calling convention besides the obvious compatibility with foreign functions?