On Fri, 2 Dec 2005, David Berry wrote:
>> Clearly I was ascribing properties to AST that it doesn't have. Looking
>> closer I see it just checks that the memory pointed at hasn't been
>> corrupted since allocation and not that the pointer is also valid.
>>
>> If we want to check the pointer validity we'd clearly need to keep a table
>> of these when allocated and check the value of any returned pointers
>> against this list before dereferencing. A chore that CNF nearly does (for
>> 64 bit pointers)? Maybe now that all the locators are being _call()
>> checked for validity my heightened HDS alert state will reduce...
>
> This is what AST does, but only for the public interface. The "pointers"
> returned by the public interface for AST are not genuine pointers at all,
> but integer object handles packing into pointer form. On entry to any
> public AST routine, the handle is extracted from the supplied pointer
> value and checked for validity. If it is valid, the *real* pointer is
> extracted from a table of pointers, using the handle to index the table,
> and the real pointer is then used throughout the private AST functions.
OK, so I was on the right track the first time. What files should I have
looked at to see how this is implemented?
> Internally, the only functions which do any checks before using a pointer
> are the low-level memory-management functions such as astFree, astGrow,
> astStore, etc. These dereference the supplied pointer and check that the
> magic value stored with the memory block is correct.
as my closer look revealed only this part.
Cheers,
Peter.
|