chromatic wrote: > On Wednesday 20 December 2006 11:24, Ron Blaschke wrote: > >> - The assertion seems to check that the lowest two bits of a function >> pointer are zero. Why's that? > > Presumably because pointers need a specific alignment, so those two bits will > always be zero on a raw pointer -- and thus, they're available as flags, > because when you dereference the pointer as a pointer, the compiler will > ignore the flags.
Your hint about the flags is perfect, didn't think about that. It seems like PMC information (searching for C<is_pmc> and C<fake>) is put there. Not sure about the details, though on Windows the function pointer is not the address of the function but to an entry of an Import Lookup Table. The functions themselves seem to be aligned at nibble boundaries, but the table entries don't seem to be. Hope I got things right. I have heard rumors that in prehistoric times only 24 bits of the available 32 bits were used for addressing, and some people used the remaining bits for their own flags. Hope we're not going back to those days. ;-) Ron