Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Bug in method calling with nonconst keys

3 views
Skip to first unread message

Luke Palmer

unread,
Nov 22, 2004, 4:27:46 AM11/22/04
to Internals List
There's a pretty bad problem with calling the vtable proxy methods with
keys that aren't constant. Best illustrated by example:

.sub _main
newclass $P0, "Foo"

find_type $I0, "Foo"
new $P1, $I0

$I1 = $P1["foo"]

$S0 = "foo"
$I1 = $P1[$S0]

end
.end

.namespace ["Foo"]

.sub __get_integer_keyed
.param pmc key
print "Key = "
print key
print "\n"
.return(0)
.end

The output is:

Key = foo
Key =

Thanks,
Luke

Leopold Toetsch

unread,
Nov 22, 2004, 6:43:17 AM11/22/04
to Luke Palmer, perl6-i...@perl.org
Luke Palmer <lu...@luqui.org> wrote:
> There's a pretty bad problem with calling the vtable proxy methods with
> keys that aren't constant. Best illustrated by example:

> .sub _main
> newclass $P0, "Foo"
>
> find_type $I0, "Foo"
> new $P1, $I0

> $I1 = $P1["foo"]

> $S0 = "foo"
> $I1 = $P1[$S0]

Oouch. The key is e.g. S30. The method is run in a fresh register frame
and S30 isn't passed on to that runloop only the key PMC, which
references S30.

C<runops_args> in inter_run.c has to check for keys that contain
registers and pass these registers on to the method.

> Thanks,
> Luke

leo

Leopold Toetsch

unread,
Nov 22, 2004, 7:03:08 AM11/22/04
to Luke Palmer, perl6-i...@perl.org
Luke Palmer <lu...@luqui.org> wrote:
> There's a pretty bad problem with calling the vtable proxy methods with
> keys that aren't constant. Best illustrated by example:

Fixed. Thanks for reporting

leo

0 new messages