Bryan --

Thanks for the message.

> You've got a disaster waiting to happen when sizeof(pointer) != 
> sizeof(opcode).  (64 bit/32 bit mix would be valid.)

My intent in allocating a second memory block as an array of (void *) was
to make sure that I handled this case, even though it does not occur on my
setup.

You point out a place where I'm trying to resynch pc (which points into
real bytecode) with pc_prederef (which points into the array of void *s):

> interpreter.c, line 204:
> ----------------------------
> static void **
> prederef(void ** pc_prederef, struct Parrot_Interp * interpreter)
> {
>   size_t      offset = pc_prederef - interpreter->prederef_code; 
>   opcode_t *  pc     = ((opcode_t *)interpreter->code->byte_code) + offset;

This is supposed to be calculating offset = # opcodes not # bytes.
I didn't look it up, and I don't do lots of address arithmetic code,
but I assumed that pointer differences give offsets that can be passed
into array indexing / pointer arithmetic to get back where I want. If
its giving the *byte* difference, then most definitely this code doesn't
DWIM and offset needs to be divided by a sizeof(void *) factor.

> I'm not sure to what extent this problem reaches, or how you want to 
> approach this, so I've no quick patch, sorry.

I don't recall doing such pointer mucking anywhere else but at this
point in the code.


Regards,

-- Gregor

Reply via email to