LOOKS_LIKE_... problem
Sebastien Carlier
sebastien@posse42.net
Wed, 25 Apr 2001 16:03:17 +0200
I have just tried to implement plan C from Storage.h:
> Hence, Plan C: (unregisterised, compile-through-vanilla-C route only)
> If we didn't manage to get info tables into the text section, then
> we can distinguish between a static closure pointer and an info
> pointer as follows: the first word of an info table is a code
> pointer,
> and therefore in text space, whereas the first word of a closure
> pointer
> is an info pointer, and therefore not. Shazam!
My current problem is that the first word of an info table is not a
code pointer, it is the SRT table (a pointer to an array of closures).
For my build configuration, the entry pointer is actually the 4th word in
the info table - but that varies, if profiling is enabled for example.
The following will not work:
#define LOOKS_LIKE_GHC_INFO(p) \
(IS_CODE_PTR(((InfoTable*)p)->entry))
If p is a closure, nothing guarantees that the accessed word exists,
or it may be an arbitrary integer which looks like a code pointer.
So, when going unregisterised, could the entry code pointer please
be moved to the start of info tables ? Or is there a smarter solution ?