Sam Ruby wrote:
Before this line is executed,

  (gdb) p interpreter->ctx.bp
  $1 = (struct parrot_regs_t *) 0x40b6bd88

After the above line is executed:

  (gdb) p interpreter->ctx.bp
  $2 = (struct parrot_regs_t *) 0x40b6bae8

Then is obviously your implementation of get_repr broken.

Two questions come to mind:

1) Should this call to run_meth change the context?

Yes because a subroutine is run. But returning from it via a (return-) continuation restores the context and the register frame pointer or it ought to.


... In this case, repr happens to be a Closure based on some assumptions I made early on in this process that I need to revisit. Arguably, this is a bug, but in the general case, can one always assume that the context does not change?

Only function calls / returns may change the context. A simple opcode like get_repr isn't allowed to do that.


Note: if the context is not supposed to change as a result of runops, perhaps an internal exception should be thrown.

We can't check that on each opcode. That just must not happen :)

But before you implement more and more methods I'd rather have inheritance and method calling conventions fixed. Parrot should call the approriate method if it exists in the class namespace (if find_method did return something).

- Sam Ruby

leo



Reply via email to