Leopold Toetsch wrote:
On Jul 29, 2005, at 10:38, Klaas-Jan Stol wrote:
Anybody an idea what I'm doing wrong here?
By far the simplest thing is either look at the opcode in
ops/core_ops.c or use a debugger and set a breakpoint at the
appropriate opcode, e.g.
Parrot_set_p_p_kc (or _kic)
From ops/set.ops, I can see:
=head2 Keyed get operations: Ax = Px[ KEY ]
=item B<set>(out PMC, in PMC, in KEY)
inline op set (out PMC, in PMC, in KEY) :base_core {
$1 = $2->vtable->get_pmc_keyed(interpreter, $2, $3);
goto NEXT();
}
So, whenever an instruction like "Ax = Px[KEY]" is executed,
get_pmc_keyed() is called from the vtable of $2, in my case the Hash
PMC. This .ops file is preprocessed to a C file, which in fact says the
same thing:
from ops/core_ops.c, I found:
opcode_t * Parrot_set_p_p_k (opcode_t *cur_opcode, Interp * interpreter);
opcode_t *
Parrot_set_p_p_k (opcode_t *cur_opcode, Interp * interpreter) {
#line 516 "ops/set.ops"
PREG(1) = VTABLE_get_pmc_keyed(interpreter, PREG(2), PREG(3));
return (opcode_t *)cur_opcode + 4;
(the same is true for Parrot_set_p_p_kc)
So, apparently, it seems to me the get_pmc_keyed method is called. I
tried to run the Parrot Debugger (pdb), but I get this:
PackFile_unpack: Bytecode not valid for this interpreter: fingerprint
mismatch
Parrot VM: Can't unpack packfile .//./tabletest.pbc.
So unfortunately, this doesnt' work currently (at least, here it
doesnt'). I couldn't find any more instructions on running the pdb
except in the docs section. Maybe I'm doing something wrong/forgetting
something?
and step on from there
(The keyed_str variants are only used internally to avoid constructing
key PMCs at runtime. For opcodes this isn't a problem because these
key pmcs are created just once at PBC load tine)
Thanks,
klaas-jan
leo
klaas-jan