[perl #60048] CGP Does Not Work with PCC Runcore Reentry

0 views
Skip to first unread message

Chromatic

unread,
Oct 21, 2008, 7:37:25 PM10/21/08
to bugs-bi...@netlabs.develooper.com
# New Ticket Created by chromatic
# Please include the string: [perl #60048]
# in the subject line of all future correspondence about this issue.
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=60048 >


Several tests fail with the CGP runcore (parrot -C) when multidispatch
re-enters bytecode -- in specific, anything that calls into src/pic.c from
Parrot_pcc_invoke_sub_from_sig_object causes failures.

The problem appears to be that CGP's PIC tries to poke into the bytecode
directly to find get_params and similar opcodes, while parameter-passing
information is in a context after Parrot_pcc_invoke_sub_from_sig_object.

One workaround is to enforce the use of the normal runcore only for calls back
into Parrot from Parrot_pcc_invoke_sub_from_sig_object, but that's just a
workaround. A better solution is to fix the PIC code to look in the
appropriate place in the context for return values. That seems like a good
task for the calling conventions branch.

-- c

Allison Randal

unread,
Oct 24, 2008, 1:59:00 AM10/24/08
to perl6-i...@perl.org
chromatic (via RT) wrote:
>
> Several tests fail with the CGP runcore (parrot -C) when multidispatch
> re-enters bytecode -- in specific, anything that calls into src/pic.c from
> Parrot_pcc_invoke_sub_from_sig_object causes failures.
>
> The problem appears to be that CGP's PIC tries to poke into the bytecode
> directly to find get_params and similar opcodes, while parameter-passing
> information is in a context after Parrot_pcc_invoke_sub_from_sig_object.
>
> One workaround is to enforce the use of the normal runcore only for calls back
> into Parrot from Parrot_pcc_invoke_sub_from_sig_object, but that's just a
> workaround. A better solution is to fix the PIC code to look in the
> appropriate place in the context for return values. That seems like a good
> task for the calling conventions branch.

I've been debating whether src/pic.c should be removed entirely. It's a
swodge of code that only gives a tiny speedup for 4 opcodes: 'infix',
'get_params', 'set_args', and 'set_returns'. And the 'infix' opcode has
been deprecated and will be removed in the calling conventions branch
(it was a nasty hack for the old MMD system). And it's not even really
the right speedup for 'get_params', 'set_args', and 'set_returns'.

There are also a pile of old, nasty MMD functions that should be deleted
and are only called from src/pic.c.

Allison

Geoffrey Broadwell

unread,
Dec 23, 2008, 9:47:23 PM12/23/08
to parrotbug...@parrotcode.org, parro...@lists.parrot.org
On Tue, 2008-12-23 at 17:31 -0800, Will Coleda via RT wrote:
> chromatic mentioned on #parrot that if we remove PIC, we're going to break all the
> predereferenced runcores. After some discussion, this probably means ripping out:
>
> 16:42 <@chromatic> Everything other than the default core, the nearly-useless
> profiling core, and the gc-debug core.
>
> So, I vote we update the deprecation notice in trunk to include the runcores (which means
> delaying the removal until post-0.9.0), and then I can continue the mayhem and destruction
> that has begun in the branch.
>
> Comments?

This is certainly a biggie, but I believe we've been doing this on a
smaller scale more and more lately: removing functionality and/or
optimizations that we don't have the spare cycles to support.

On the one hand this is a good thing -- we'll actually hit 1.0 in a few
months. I'm all for getting that wider audience.

On the other hand, I'm somewhat concerned that Parrot 1.0 will either
itself be rather slow, or will architecturally force HLL implementations
to be slow. While looking for the IRC discussion mentioned by Coke, I
found the following interchange (slightly edited for clarity):

<donaldh> Hmm. Bad memory profile for rakudo. A piece of PIR that runs
a SQLite query and prints ~18000 rows tops out at 6 MB when
run with -G. The equivalent in Rakudo tops out at 1.6GB
<chromatic> PGE/PCT/Rakudo uses more STRINGs and PMCs. If you disable
garbage collection, Parrot won't reuse them.
<donaldh> Sure. I'm just realising how much pressure Rakudo is putting
on GC.
<pmichaud> rakudo is somewhat constrained by the architecture Parrot
provides, unfortunately.

This interchange raised a flag for me. Am I incorrect in seeing this as
a problem? Since Parrot 1.0 is supposed to be the stable interface for
HLL implementors to aim for, I'd hate for that interface to be very
suboptimal, performance-wise, even if it is technically sufficient to
get things to *work*. Or is the plan that Parrot 1.5/2.0 are going to
include the needed performance and functional improvements as part of
the push to production?


-'f


Chromatic

unread,
Dec 23, 2008, 10:20:07 PM12/23/08
to parro...@lists.parrot.org, Geoffrey Broadwell, parrotbug...@parrotcode.org
On Tuesday 23 December 2008 18:47:23 Geoffrey Broadwell wrote:

> On the other hand, I'm somewhat concerned that Parrot 1.0 will either
> itself be rather slow, or will architecturally force HLL implementations
> to be slow.  While looking for the IRC discussion mentioned by Coke, I
> found the following interchange (slightly edited for clarity):
>
> <donaldh>   Hmm. Bad memory profile for rakudo. A piece of PIR that runs
>             a SQLite query and prints ~18000 rows tops out at 6 MB when
>             run with -G. The equivalent in Rakudo tops out at 1.6GB
> <chromatic> PGE/PCT/Rakudo uses more STRINGs and PMCs.  If you disable
>             garbage collection, Parrot won't reuse them.
> <donaldh>   Sure. I'm just realising how much pressure Rakudo is putting
>             on GC.
> <pmichaud>  rakudo is somewhat constrained by the architecture Parrot
>             provides, unfortunately.
>
> This interchange raised a flag for me.  Am I incorrect in seeing this as
> a problem?

Yes and no.

That has nothing to do with runcores. The number of GCables allocated is,
more or less, constant between runcores.

Ideally, the PIR emitted from Rakudo would be require just about as many
GCables as hand-written PIR, but if you want to compare that, you're going to
have to precompile Perl 6 source to PIR, so that you're not running PGE and
PCT and seeing all of the memory they use as well. Compare like to like.

I'm not pleased about performance numbers right now either, but the known
problems are the multiple calling conventions conversions to compare an
Integer PMC with anything else through MMD and our garbage collector. (I
suspect Parrot's calling conventions are likewise full of strange decisions.)
You (or anyone else) is very much free to dig into that.

If removing poorly-written, undertested, undocumented, experimental code
that's never worked quite right helps us concentrate on the important things,
I'm all for it.

-- c

Chromatic

unread,
Dec 26, 2008, 12:07:04 PM12/26/08
to parrotbug...@parrotcode.org
On Thursday 25 December 2008 23:29:28 Allison Randal via RT wrote:

> CGP is too important to be deprecated over something as small as this.

If it were important, we'd test it and maintain the code. We don't, ergo....

-- c

James Keenan via RT

unread,
Sep 15, 2009, 9:26:57 PM9/15/09
to parro...@lists.parrot.org, perl6-i...@perl.org
On Wed Feb 25 16:08:29 2009, jk...@verizon.net wrote:
> On Thu Jan 29 06:15:28 2009, Whiteknight wrote:
> >
> > has the remove_pic branch landed yet?
>
>
> Well, it's still an active branch in SVN. So I would guess not.

Per discussion on the mailing list, we're removing the remove_pic branch
(r41287). Whiteknight already has this ticket.

kid51

Reply all
Reply to author
Forward
0 new messages