# New Ticket Created by Kenneth A Graves # Please include the string: [perl #23337] # in the subject line of all future correspondence about this issue. # <URL: http://rt.perl.org/rt2/Ticket/Display.html?id=23337 >
I know it's less than a day old, but I thought I'd point it out. If there's more than one sub in the packfile, then global has difficulty finding the right one. I added a test to t/syn/file.t to demonstrate. It's identical to test 5, except there are two subs in the external file. I get: 1..7 ok 1 - include pasm ok 2 - include pir ok 3 - include .inc ok 4 - subroutine in external file ok 5 - call sub in external pbc ok 6 - call sub in external pbc, return not ok 7 - call sub in external pbc with 2 subs # Failed test (file.t at line 215) # got: 'sub1 # loaded # ' # expected: 'sub1 # loaded # sub2 # ' # Looks like you failed 1 tests of 7. This is with the desired sub second. It works when the desired sub is first. --kag -- attachment 1 ------------------------------------------------------ url: http://rt.perl.org/rt2/attach/62756/46221/3c66f2/file.patch
--- file.t~ 2003-08-15 22:16:10.000000000 -0400 +++ file.t 2003-08-15 22:24:04.000000000 -0400 @@ -1,6 +1,6 @@ #!perl use strict; -use TestCompiler tests => 6; +use TestCompiler tests => 7; use lib '../../lib'; use Parrot::Config; @@ -195,6 +195,41 @@ back OUT +# write sub2 +open FOO, ">temp.imc" or die "Cant write temp.imc\n"; +print FOO <<'ENDF'; +.pcc_sub _not_sub2 prototyped + print "not sub2\n" + end +.end + +.pcc_sub _sub2 prototyped + print "sub2\n" + end +.end +ENDF +# compile it + +system("imcc$PConfig{exe} -o temp.pbc temp.imc"); + +output_is(<<'CODE', <<'OUT', "call sub in external pbc with 2 subs"); +.pcc_sub _sub1 prototyped + print "sub1\n" + load_bytecode "temp.pbc" + print "loaded\n" + $P0 = global "_sub2" + .pcc_begin prototyped + .pcc_call $P0 + ret: + .pcc_end + end +.end +CODE +sub1 +loaded +sub2 +OUT + END { unlink $file;