For PIC18 devices, the function call depth is the same as the depth of the hardware return address stack.
Check the datasheet for the device you are using.
Baseline PIC® devices have a very small hardware stack depth (2 calls) and to work around this, the compiler can employ a call mechanism based on lookup tables. This allows a much larger level of function nesting, with no theoretical limit. Use of the alternate call mechanism is automatic.
You must ensure that the maximum hardware stack depth is not exceeded; otherwise, the code may fail functionally. Nesting function calls too deeply will overflow the stack. It is important to take into account implicitly called library functions and interrupts, which also use levels of the stack. The compiler can be made to manage stack usage, for non-PIC18 devices, by using the “stackcall” suboption supplied to the “—RUNTIME” compiler option.
The call graph produced by the code generator in the assembler list file will indicate the stack levels at each function call and can be used as a guide to stack depth. The code generator will also produce warnings if the maximum stack depth is exceeded.
See your MPLAB® XC8 compiler manual for more information on function calls.