Why is it not possible to use "jump and reference" and "jump register" for recursion?

Hopefully this is the right place for my question. Why is it not possible to use these two instructions to recursively call a subroutine?

Thanks in advance!

+3


source to share


1 answer


If you "jump and link", the return address is stored in the register. If you "jump and link" again, the return address is overwritten with a new one, destroying the original return address and preventing the caller from returning.



You can use "jump and reference" in recursive functions (or any functions that call other functions), but then you need to manually store the contents of the reference register on the stack.

+5


source







All Articles