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

[perl #27504] find_method op problems

2 views
Skip to first unread message

Ilya Martynov

unread,
Mar 8, 2004, 7:33:07 AM3/8/04
to bugs-bi...@rt.perl.org
# New Ticket Created by Ilya Martynov
# Please include the string: [perl #27504]
# in the subject line of all future correspondence about this issue.
# <URL: http://rt.perl.org:80/rt3/Ticket/Display.html?id=27504 >

1. find_method crashes parrot when used with dynclasses

For example if I build Foo.pmc from "dynclasses" directory following
code crashes parrot:

.sub main
loadlib $P1, "foo"
$P0 = new Foo
find_method $P1, $P0, 'find_method'
.pcc_begin_return
.pcc_end_return
.end

Stacktrace:

(gdb) bt
#0 0x081861d9 in Parrot_default_find_method (interpreter=0x820fa90,
pmc=0x403057c0, method_name=0x40208200) at default.c:314
#1 0x080e9a1d in Parrot_find_method_p_p_sc (cur_opcode=0x82352f8,
interpreter=0x820fa90) at ops/pmc.ops:196
#2 0x08085241 in runops_slow_core (interpreter=0x820fa90, pc=0x82352f8)
at src/runops_cores.c:144
#3 0x0807aed0 in runops_int (interpreter=0x820fa90, offset=0)
at src/interpreter.c:833
#4 0x0807af6d in runops_ex (interpreter=0x820fa90, offset=0)
at src/interpreter.c:863
#5 0x0807b141 in runops (interpreter=0x820fa90, offset=0)
at src/interpreter.c:921
#6 0x080c0fdf in Parrot_runcode (interpreter=0x820fa90, argc=1,
argv=0xbffff9d8) at src/embed.c:692
#7 0x08079f62 in main (argc=1, argv=0xbffff9d8) at imcc/main.c:557

2. Why following code emits "Method 'find_method' not found"?
Shouldn't find_method be defined in vtable of Boolean PMC?

.sub main
$P0 = new Boolean
find_method $P1, $P0, 'find_method'
.pcc_begin_return
.pcc_end_return
.end


--
Ilya Martynov, il...@iponweb.net
CTO IPonWEB (UK) Ltd
Quality Perl Programming and Unix Support
UK managed @ offshore prices - http://www.iponweb.net
Personal website - http://martynov.org

Jens Rieks

unread,
Mar 8, 2004, 10:05:55 AM3/8/04
to perl6-i...@perl.org, il...@iponweb.net
Hi,

On Monday 08 March 2004 13:33, Ilya Martynov wrote:
> # New Ticket Created by Ilya Martynov
> # Please include the string: [perl #27504]
> # in the subject line of all future correspondence about this issue.
> # <URL: http://rt.perl.org:80/rt3/Ticket/Display.html?id=27504 >
>
>
>
> 1. find_method crashes parrot when used with dynclasses
>
> For example if I build Foo.pmc from "dynclasses" directory following
> code crashes parrot:
>
> .sub main
> loadlib $P1, "foo"
> $P0 = new Foo

This is wrong. Use $P0 = new "Foo" instead.
"new Foo" evaules to "new -1" due to a bug (?) in IMCC.

jens

Jens Rieks

unread,
Mar 8, 2004, 10:20:23 AM3/8/04
to perl6-i...@perl.org
Hi again,

<offtopic>
(small note for little jens: first read _everything_, then write an answer,
then read it and send it afterwards...)
</offtopic>


> On Monday 08 March 2004 13:33, Ilya Martynov wrote:
> > # New Ticket Created by Ilya Martynov
> > # Please include the string: [perl #27504]
> > # in the subject line of all future correspondence about this issue.
> > # <URL: http://rt.perl.org:80/rt3/Ticket/Display.html?id=27504 >
> >
> >
> >
> > 1. find_method crashes parrot when used with dynclasses
> >
> > For example if I build Foo.pmc from "dynclasses" directory following
> > code crashes parrot:
> >
> > .sub main
> > loadlib $P1, "foo"
> > $P0 = new Foo
>
> This is wrong. Use $P0 = new "Foo" instead.
> "new Foo" evaules to "new -1" due to a bug (?) in IMCC.

s/evaules/evaluates/

This is because find_method is an opcode and not a method.

jens

Leopold Toetsch

unread,
Mar 8, 2004, 10:24:21 AM3/8/04
to perl6-i...@perl.org
Ilya Martynov <bugs-...@netlabs.develooper.com> wrote:

> 1. find_method crashes parrot when used with dynclasses

Fixed.

> 2. Why following code emits "Method 'find_method' not found"?
> Shouldn't find_method be defined in vtable of Boolean PMC?

> .sub main
> $P0 = new Boolean
> find_method $P1, $P0, 'find_method'

Well Boolean doesn't implement or better export a 'find_method' method.

Only a few PMC classes have methods like ParrotIO. These are NCI mthods
inside the class.

You can't create real classes derived from an arbitrary PMC yet.

> .pcc_begin_return
> .pcc_end_return

end

for main.

leo

Leopold Toetsch

unread,
Mar 8, 2004, 10:40:44 AM3/8/04
to Jens Rieks, perl6-i...@perl.org
Jens Rieks <par...@jensbeimsurfen.de> wrote:
>> $P0 = new Foo
> This is wrong. Use $P0 = new "Foo" instead.

No. There isn't even such an opcode. Above code is fine and working,
because during compilation of "loadlib", the class file gets already
loaded so that the type is registered. This might change in the future,
so that

find_type I0, "Foo"
new P0, I0

must be used.

> "new Foo" evaules to "new -1" due to a bug (?) in IMCC.

It is 52 as you can see in the trace.

> jens

leo

Jens Rieks

unread,
Mar 8, 2004, 1:00:55 PM3/8/04
to perl6-i...@perl.org
Hi,

On Monday 08 March 2004 16:40, Leopold Toetsch wrote:
> Jens Rieks <par...@jensbeimsurfen.de> wrote:
> >> $P0 = new Foo
> >
> > This is wrong. Use $P0 = new "Foo" instead.
>
> No. There isn't even such an opcode. Above code is fine and working,
> because during compilation of "loadlib", the class file gets already
> loaded so that the type is registered. This might change in the future,
> so that
>
> find_type I0, "Foo"
> new P0, I0
>
> must be used.

Oops, sorry for the wrong information. I mixed up new and find_type...

> > "new Foo" evaules to "new -1" due to a bug (?) in IMCC.
>
> It is 52 as you can see in the trace.

> > jens
>
> leo
jens

0 new messages