Am Freitag, 27. April 2007 22:10 schrieb chromatic:
> This part bothers me:
Indeed, your feeling is totally legitimate.
> +++ src/mmd.c (working copy)
> @@ -1703,7 +1703,12 @@
> +#ifndef __INTEL_COMPILER
> assert((PTR2UINTVAL(mmd_table[i].func_ptr) & 3) == 0);
The assert is of course there for some reason. The lower bit(s) are used for
flagging the contents of the MMD table:
From mmd.c:147 ff
*is_pmc = (UINTVAL)func & 3;
func_ = (funcptr_t)((UINTVAL)func & ~3);
#ifndef PARROT_HAS_ALIGNED_FUNCPTR
... and as the snippet reveals, there's also alternate code to deal with
compilers which don't align function pointers (ususally there is a compiler
flag to achieve this too).
Background:
The mmd_table is a huge cache of known binary MMD functions, which are coded
in C or are PMCs. But as the table is quadratic (per function) and very
sparse, it should be replaced with some better structures e.g. per PMC or by
some compressed table.
leo