Re: A92: TI92 "HeapLock" function


[Prev][Next][Index][Thread]

Re: A92: TI92 "HeapLock" function




At 12:31 PM 7/2/98 +0200, MXM-TriX wrote:
>Does anyone know, what the HeapLock function is? I found it in the TI92-ROM
>with the address, when I use it and debug into the ROM function I don't see,
>what it is for ( It doesn't lock a handle )

I believe it locks the memory block referred to by the handle as long is it
is outside the main heap. I'm guessing it that being locked will prevent
its address from being modified. However, if it is inside the heap's linked
list, the actual data of the block will be moved anyway, while the handle's
pointer stays unmodified.

For example, the routine to delete a block would move everything above it
downward. The best way to do this is in one single memmove operation. Any
memory blocks _outside_ the linked list will not be moved. But the routine
also has to adjust the addresses of all the handles which reference blocks
that were just moved. For the routine to check each handle's address's
range to see if it was moved down would be inefficient, so instead, it only
adjusts the addresses of handles that are not locked.

Besides, since the TI-92 maintains the heap as a continuous linked list of
blocks, it would be impossible for one of those blocks inside the list to
be kept in one place while the ones around it moved, unless that block was
at the very end of the list.

I still haven't tested this hypothesis, however.


---
David Ellsworth
davidell@earthling.net
IRC: eXocomp
ICQ: 2300673


References: