At 07:21 PM 10/26/2003 +0100, Leopold Toetsch wrote:
Steve Fink <[EMAIL PROTECTED]> wrote:

> Although this does bring up another issue -- should parrot really be
> seg faulting when it gets a uninitialized (null) PMC?

The problem is of course that we call pmc->vtable->some_meth_od() on a
NULL PMC. We could do the checks always, slowing down each PMC
operation. But OTOH a correct HLL compiler wouldn't produce such broken
code (hopefully). So that's probably something for the bounds-checking

This is an old discussion. While I agree with Leo (and Dan) on not putting checks everywhere, I also think segfaulting on faulty bytecode is violating the "Virtual Machine" contract.

I also don't wan't to see the performance hit of checking PMC regs everywhere.

I think a compromise would be to do define a interpreter global PMCNull
and point (or init) all Px registers to it.

All methods in this class would be implemented to throw an exception or
dump the bytecode for debugging and we could always trap a "NULL"
register access.

This way we never have a NULL pointer access with regards to Px regs.

The downside is fast initialization of register blocks. memsetting with NULL (0)
will not be possible, but I'd have to actually go check and see if that
is really all that common.


-Melvin




Reply via email to