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

[perl #38594] [BUG] source line numbers

4 views
Skip to first unread message

Leopold Toetsch

unread,
Feb 20, 2006, 10:19:24 AM2/20/06
to bugs-bi...@rt.perl.org
# New Ticket Created by Leopold Toetsch
# Please include the string: [perl #38594]
# in the subject line of all future correspondence about this issue.
# <URL: https://rt.perl.org/rt3/Ticket/Display.html?id=38594 >


PASM/PIR source line info is off by one (at least) on several instructions.

Please run:

$ parrot -d10 <your>.pir 2>&1 | less

and compare line numbers (2nd columns) with src lines in $EDITOR.

Fixes and tests welcome. Re test: There is an opcode C<getline>, which
would be handy just for testing this stuff, if it's filled with some
functionality (see also C<Parrot_Context_info()>).

Thanks,
leo

Vishal Soni

unread,
Jun 30, 2006, 11:39:39 AM6/30/06
to parrotbug...@parrotcode.org, l...@toetsch.at
Hi,

The .end seems to be replaced by an implicit end.

-Vishal


On 6/29/06, Will Coleda via RT <parrotbug...@parrotcode.org> wrote:
>
> Hey, Vishal:
>
> > [vsoni - Tue Jun 27 05:48:27 2006]:
> >
> > Hi,
> >
> > This was a straight forward fix. The line number was being decremented
> > at the start of a 'sub' token imcc.y.
> >
> >
> > Thanks,
> > Vishal
> >
> > Here is a sample run
> >
> > Sample Code:
> > -------------------
> > .sub main :main
> > print "2\n"
> > print "3\n"
> > print "4\n"
> > .end
> >
> > Output:
> > --------
> > ./parrot -d 10 ./hello.pir
> > 1
> > last:5
> > pcc_sub main nparams 0
> >
> > Dumping the instructions status:
> > -------------------------------
> > nins line blck deep flags type opnr size pc X ins
> > 0 1 0 0 0 80000 -1 0 0 main:
> > 1 2 0 0 1 0 413 2 0 print "2\n"
> > 2 3 0 0 1 0 413 2 2 print "3\n"
> > 3 4 0 0 1 0 413 2 4 print "4\n"
> > 4 4 0 0 0 18000 0 1 6 end
>
> Looks like the first line is fixed there (1) and then the guts are fixed
> (2,3,4), but is the
> duplicate line 4 correct? (is that corresponding to the implicit end that
> PIR puts in, or the .end
> of the subroutine?
>
> If you can just validate that, we can apply this.
>
> >
> > Labels
> > name pos last ref
> > -----------------------
> >
> >
> > Dumping the CFG:
> > -------------------------------
> > 0 (0) -> <-
> >
> >
> > Dumping the Dominators Tree:
> > -------------------------------
> > 0 <- ( 0) 0
> >
> > Loop info
> > ---------
> >
> >
> >
> > Patch
> > --------
> >
> > Index: compilers/imcc/imcc.y
> >
> =========================================================
> ==========
> > --- compilers/imcc/imcc.y (revision 13035)
> > +++ compilers/imcc/imcc.y (working copy)
> > @@ -202,7 +202,7 @@
> > r->type = (r->type & VT_ENCODED) ? VT_PCC_SUB|VT_ENCODED :
> > VT_PCC_SUB;
> > r->pcc_sub = calloc(1, sizeof(struct pcc_sub_t));
> > cur_call = r;
> > - i->line = line - 1;
> > + i->line = line ;
> > add_namespace(interp, unit);
> > return i;
> > }
> >
> >
> >
> >
> >
>
>


--
Thanks,
Vishal

Vishal Soni

unread,
Jul 3, 2006, 1:16:09 AM7/3/06
to parrotbug...@parrotcode.org
Will,

Did we get this one in?

-Vishal

--
Thanks,
Vishal

Vishal Soni

unread,
Jul 6, 2006, 1:06:34 PM7/6/06
to parrotbug...@parrotcode.org, Chip Salzenberg
Hi Chip,

Can you please apply this patch for me? This is a fix to the YACC file. As a
result you will also have to checkin the imcparser.c and imcparser.h after
applying the patch and recompiling the source.

Thanks,
Vishal

Index: compilers/imcc/imcc.y
===================================================================


--- compilers/imcc/imcc.y (revision 13035)
+++ compilers/imcc/imcc.y (working copy)
@@ -202,7 +202,7 @@
r->type = (r->type & VT_ENCODED) ? VT_PCC_SUB|VT_ENCODED : VT_PCC_SUB;
r->pcc_sub = calloc(1, sizeof(struct pcc_sub_t));
cur_call = r;
- i->line = line - 1;
+ i->line = line ;
add_namespace(interp, unit);
return i;
}

--
Thanks,
Vishal

0 new messages