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

[perl #39597] Problems with string constants in method calls

0 views
Skip to first unread message

Matt Diephouse

unread,
Jun 23, 2006, 3:38:19 AM6/23/06
to bugs-bi...@rt.perl.org
# New Ticket Created by Matt Diephouse
# Please include the string: [perl #39597]
# in the subject line of all future correspondence about this issue.
# <URL: https://rt.perl.org/rt3/Ticket/Display.html?id=39597 >


The following code in lines 108-110 of languages/tcl/src/class/
tclcommand.pir are giving parrot some trouble:

inlined.emit(" if epoch != %0 goto dynamic_%1", epoch, label_num)
inlined .= retval
inlined.emit(" goto end_%0", label_num)

as evidenced here:

mini:~/Projects/parrot/languages/tcl mdiep$ cat test.tcl
puts here
exit
puts nothere
mini:~/Projects/parrot/languages/tcl mdiep$ parrot tcl.pbc test.tcl
src/string.c:712: failed assertion `s->encoding && s->charset && !
PObj_on_free_list_TEST(s)'
Abort trap
mini:~/Projects/parrot/languages/tcl mdiep$

Changing those lines to

$S0 = " if epoch != %0 goto dynamic_%1"
inlined.emit($S0, epoch, label_num)
inlined .= retval
$S0 = " goto end_%0"
inlined.emit($S0, label_num)

makes the code run as expected:

mini:~/Projects/parrot/languages/tcl mdiep$ parrot tcl.pbc test.tcl
here
mini:~/Projects/parrot/languages/tcl mdiep$

Changing just the second .emit line to use an S register:

inlined.emit(" if epoch != %0 goto dynamic_%1", epoch, label_num)
inlined .= retval
$S0 = " goto end_%0"
inlined.emit($S0, label_num)

gives a different error:

mini:~/Projects/parrot/languages/tcl mdiep$ parrot tcl.pbc test.tcl
error:imcc:syntax error, unexpected '\n', expecting '('
in file 'EVAL_2' line 39
mini:~/Projects/parrot/languages/tcl mdiep$

Here, parrot is using the wrong string for the first .emit as shown
in the trace:

20366 set_args PC1567 (4), P1, "__read", P2, S3
PC1567=FixedIntegerArray=PMC(0x2739508) P1=Object(TclCod
eString)=PMC(0x301140c) P2=Integer=PMC(0x301442c: 0) S3="3"
20372 get_results PC1558
20374 callmethodcc P1, "emit" P1=Object(TclCodeString)
=PMC(0x301140c)

Help here would be greatly appreciated.

--
matt diephouse
http://matt.diephouse.com

Matt Diephouse

unread,
Jun 24, 2006, 2:15:02 AM6/24/06
to perl6-i...@perl.org
via RT Matt Diephouse <parrotbug...@parrotcode.org> wrote:
> # New Ticket Created by Matt Diephouse
> # Please include the string: [perl #39597]
> # in the subject line of all future correspondence about this issue.
> # <URL: https://rt.perl.org/rt3/Ticket/Display.html?id=39597 >
>
>
> The following code in lines 108-110 of languages/tcl/src/class/
> tclcommand.pir are giving parrot some trouble:
>
> inlined.emit(" if epoch != %0 goto dynamic_%1", epoch, label_num)
> inlined .= retval
> inlined.emit(" goto end_%0", label_num)

It looks like pbc_merge is the actual source of the trouble here. If I
change languages/tcl/src/tclsh.pir to load the individual bytecode
files instead of the merged file, it works as expected.

Jonathan Worthington

unread,
Jun 25, 2006, 9:13:00 PM6/25/06
to ma...@diephouse.com, perl6-i...@perl.org
"Matt Diephouse" <mdd...@gmail.com> wrote:
>> The following code in lines 108-110 of languages/tcl/src/class/
>> tclcommand.pir are giving parrot some trouble:
>>
>> inlined.emit(" if epoch != %0 goto dynamic_%1", epoch, label_num)
>> inlined .= retval
>> inlined.emit(" goto end_%0", label_num)
>
> It looks like pbc_merge is the actual source of the trouble here. If I
> change languages/tcl/src/tclsh.pir to load the individual bytecode
> files instead of the merged file, it works as expected.
>
It indeed was a pbc_merge bug that's somehow lay hidden for the best part of
a year. Fixed in r13020.

Thanks,

Jonathan

0 new messages