[z-machine] Replicating txd subroutine-finding functionality

Matthew T. Russotto mrussotto@speakeasy.net
Tue, 25 May 2004 20:03:06 -0400


On May 20, 2004, at 11:18 PM, Amir Karger wrote:

> Note that I didn't even have to use my "if we jump ahead to an
> address, then this sub goes at least to that address". I could
> probably use that within the "less sure" piece to make it more sure.

This is txd's approach -- it assumes if you jump ahead to an address, 
it's within the subroutine.
The other thing it does is examines the low area (below main, above the 
globals) and the high area (between the highest located subroutine and 
the strings).  I think txd's approach is theoretically sound given the 
constraints of the compilers -- namely, that all subroutines are 
contiguous, all subroutines end, no subroutines contain unreachable 
code at the end (this is violated in one case but it is not really 
important) and there are not any cross subroutine jumps.