Generic functions
def multiply (float A[I][J], float B[J][K]) for i = 0 to I do for k = 0 to K do sum = 0 for j = 0 to J do sum += A[i][j] * B[j][k] endfor endfor endfor end
MOV register4, (some memory location) SUM register4, register3 CMP register3, #7 JMP (some program address)
When a program calls a function, its parameters are pushed onto the program stack
function foo(int x, float y, char z) { … } foo(5, 7.2, ‘c’) When linking the object code, the linker substitutes (SP-1) for z, (SP-5) for y, and (SP-7) for x. This works as long as both the calling program and the called function follow the same rules. This is what marshaling specifies and it allows libraries to be reused on Unix systems. |
![]() |
In as many ways as possible