The IAR 8051 C compiler has an overlay mechanism whereby function parameters and non-static local variables are not stored on the stack (due to very small processor stack) but instead are stored in shared RAM (either on-chip RAM or external RAM). The RAM locations used for the local variables of one function might be the same locations as for another function, if the linker determines that those functions are never "active" at the same time i.e. that one doesn't directly or indirectly call the other.
For functions that are called by interrupts, the compiler appears to realise that the shared RAM used by these functions must be separate from the shared RAM used by non-interrupt functions. The compiler help file I have doesn't describe this very well though.
My question is : if one interrupt service routine can interrupt another (because they have different priorities), does the compiler/linker realise that each interrupt service routine must have separate shared RAM from any other interrupt service routine (regardless of whether the reentrant keyword is used or not).
Also, is it safe to assume that the IAR 8051 C compiler won't re-order accesses to non-local variables "across a function call" if the function being called is in another module?