Language Implementation
7-29
7
used by the dispatcher to search the stack for the existing recursive
activation. If found, the function is called immediately.
The dispatcher decompresses and executes secondary functions on the
current runtime stack. Allocation and freeing of decompression memory
is performed automatically through the call and return mechanism.
You must allocate more stack when using CAVE. The maximum
additional runtime stack requirement is the total size of all secondary
functions that may be active simultaneously.
Special Code Generation for Secondary Functions
When a decompressed secondary function is loaded on the runtime stack,
its runtime location is different from the link-time one. Absolute intra-
function and IP-relative inter-function references are invalid. These types
of reference are not used during code generation for CAVE functions.
Since taking the address of a label is illegal in C, intra-function absolute
references can be generated only in a jump-table implementation of the
switch statement. Restricting the switch statement implementation in
secondary functions to compare-and-branch instructions eliminates
absolute intra-function references.
The IP-relative inter-function references are avoided in secondary
functions by generating the 80960
callx instruction instead of the call
instruction. The callx instruction transfers control to absolute rather than
IP-relative locations.
Debugging CAVE Functions
CAVE functions are decompressed and executed on the runtime stack.
The source-level debug information cannot be properly maintained in the
current implementation. Consequently, secondary functions can be
debugged only at the machine level. To debug:
1. Set a breakpoint on a CAVE function. Execution breaks on the first
interceptor instruction (
lda L1, reg).
2. Step into the dispatcher.
3. Display the disassembled instructions of the dispatcher.