Browse files

Use new packfile API [GH #937]

evalpmc can now be removed.
  • Loading branch information...
1 parent fcd58e0 commit 1cce717e610469b06ae59a7dbeb16f2858a30864 @gerdr gerdr committed with rurban Feb 20, 2013
View
1 compilers/data_json/data_json.pir
@@ -85,6 +85,7 @@ the documentation at L<http://www.json.org/>.
.local pmc pirc, result
pirc = compreg 'PIR'
result = pirc(pir)
+ result = result.'first_sub_in_const_table'()
.return (result)
failed:
View
9 compilers/pct/src/PCT/HLLCompiler.pir
@@ -550,6 +550,15 @@ Transform PAST C<source> into POST.
$P0 = compreg 'PIR'
$P1 = $P0(source)
+ $P2 = $P1.'subs_by_tag'('init')
+ $P3 = iter $P2
+ loop_top:
+ unless $P3 goto loop_bottom
+ $P4 = shift $P3
+ $P4()
+ goto loop_top
+ loop_bottom:
+ $P1 = $P1.'first_sub_in_const_table'()
.return($P1)
.end
View
5 compilers/pct/src/POST/Compiler.pir
@@ -433,9 +433,14 @@ the sub.
compiler = compreg $S0
$I0 = isa compiler, 'Sub'
if $I0 goto compiler_sub
+ $I0 = isa compiler, 'PackfileView'
+ if $I0 goto compiler_packfileview
.tailcall compiler.'compile'(source, options :flat :named)
compiler_sub:
.tailcall compiler(source, options :flat :named)
+ compiler_packfileview:
+ $P0 = compiler.'first_sub_in_const_table'()
+ .tailcall $P0(source, options :flat :named)
.end
=back
View
2 compilers/pge/PGE/Exp.pir
@@ -90,6 +90,7 @@ C<target> adverbs.
bytecode:
$P0 = compreg 'PIR'
$P1 = $P0(code)
+ $P1 = $P1.'first_sub_in_const_table'()
make_grammar:
if grammar == '' goto end
.local pmc p6meta
@@ -1525,6 +1526,7 @@ tree as a PIR code object that can be compiled.
unless null $P1 goto %0_1
$P1 = compreg %1
$P1 = $P1($S1)
+ $P1 = $P1.'first_sub_in_const_table'()
$P0[$S1] = $P1
%0_1:
CODE
View
1 compilers/tge/TGE/Compiler.pir
@@ -345,6 +345,7 @@ loop_end:
code = $S1 . code
named_grammar:
libloader = compiler(code)
+ libloader = libloader.'first_sub_in_const_table'()
libloader()
new_grammar = new grammarname
View
4 runtime/parrot/library/PGE/Perl6Grammar.pir
@@ -227,7 +227,9 @@ the output to the correct output file.
compile_pir:
$P0 = compreg 'PIR'
- .tailcall $P0(out)
+ $P1 = $P0(out)
+ $P2 = $P1.'first_sub_in_const_table'()
+ .return($P2)
.end
View
15 runtime/parrot/library/Test/More.pir
@@ -1114,7 +1114,8 @@ Otherwise, fail the test.
.local string source
source = invokable
compiler = compreg 'PIR'
- invokable = compiler(source)
+ $P9 = compiler(source)
+ invokable = $P9.'first_sub_in_const_table'()
goto invokeit
badinvoke:
@@ -1168,7 +1169,8 @@ Passes a test if the PIR code throws any exception, fails a test otherwise.
push_eh eh
compfun = compiler(target)
- compfun() # eval the target code
+ $P9 = compfun.'first_sub_in_const_table'()
+ $P9() # eval the target code
pop_eh
@@ -1229,7 +1231,8 @@ Passes a test if the PIR does not throw any exception, fails a test otherwise.
push_eh eh
compfun = compiler(target)
- compfun() # eval the target code
+ $P9 = compfun.'first_sub_in_const_table'()
+ $P9() # eval the target code
pop_eh
@@ -1293,7 +1296,8 @@ an exception that matches the pattern, fails the test otherwise.
push_eh eh
compfun = compiler(target)
- compfun() # eval the target code
+ $P9 = compfun.'first_sub_in_const_table'()
+ $P9() # eval the target code
pop_eh
@@ -1352,7 +1356,8 @@ an exception that matches the pattern, fails the test otherwise.
push_eh eh
compfun = compiler(target)
- compfun() # eval the target code
+ $P9 = compfun.'first_sub_in_const_table'()
+ $P9() # eval the target code
pop_eh
View
4 t/compilers/imcc/syn/tail.t
@@ -351,6 +351,10 @@ pir_output_is( <<'CODE', <<'OUTPUT', ".tailcall into an NCI" );
say "A"
$P0 = 'Foo'("C")
$S0 = typeof $P0
+ $P9 = $P0.'subs_by_tag'('init')
+ $P8 = $P9[0]
+ $P8()
+ $P0 = $P0.'all_subs'()
$P1 = $P0[0]
$P1 = 'Bar'($P1, "F")
say $P1
View
1 t/compilers/pge/pge_examples.t
@@ -96,6 +96,7 @@ END_FASTA
( code ) = p6grammar.'compile'(fasta_grammar, 'target'=>'PIR')
$P0 = compreg 'PIR'
$P1 = $P0(code)
+ $P1 = $P1.'first_sub_in_const_table'()
$P1()
# print code
View
1 t/op/calling.t
@@ -1307,6 +1307,7 @@ OUTPUT
pir_output_is( <<'CODE', <<'OUTPUT', "tailcall to NCI - 2" );
.sub main :main
$P0 = eval("print \"Foo!\\n\"")
+ $P0 = $P0.'first_sub_in_const_table'()
$P0()
end
.end
View
2 t/op/lexicals.t
@@ -798,7 +798,7 @@ EOC
.local pmc compiler
compiler = compreg "PIR"
$P1 = compiler(code)
- $P2 = $P1[0] # first sub of eval
+ $P2 = $P1.'main_sub'()
$P3 = newclosure $P2
.return($P3)
.end
View
2 t/pmc/key.t
@@ -173,7 +173,7 @@ code
.local pmc pir_compiler
pir_compiler = compreg 'PIR'
$P0 = pir_compiler($S0)
- $P0 = $P0[0]
+ $P0 = $P0.'first_sub_in_const_table'()
$P1 = new ['TclProc']
assign $P1, $P0
.local pmc ns_target
View
2 t/pmc/namespace.t
@@ -543,6 +543,7 @@ CODE
CODE
$P0 = compreg "PIR"
$P1 = $P0($S0)
+ $P1 = $P1.'main_sub'()
$P2 = $P1()
$S0 = typeof $P2
is($S0, "NameSpace", "get_namespace from anon sub")
@@ -574,6 +575,7 @@ CODE
CODE
$P0 = compreg "PIR"
$P1 = $P0($S0)
+ $P1 = $P1.'main_sub'()
$I0 = $P1()
is($I0, 1, "find_name sub with sigil in namespace")
.end
View
7 t/pmc/sub.t
@@ -1464,10 +1464,10 @@ PIR
$P3 = new 'ParrotInterpreter'
$P3 = $P3['sub']
- $P2 = $P1[0]
+ $P2 = $P1.'main_sub'()
$P2.'set_outer'($P3)
- $P1()
+ $P2()
.end
CODE
I can has outer from eval?
@@ -1625,7 +1625,10 @@ PIR
$P0 = compreg 'PIR'
say "got compiler"
$P1 = $P0($S0)
+ $P2 = $P1.'single_sub_by_tag'('init')
+ $P2()
say "compiled"
+ $P1 = $P1.'main_sub'()
$P1()
say "lived"
.end
View
10 t/profiling/profiling.t
@@ -2,10 +2,9 @@
# Copyright (C) 2010, Parrot Foundation.
-INIT {
- pir::load_bytecode('ProfTest.pbc');
- Q:PIR{ .include "test_more.pir" };
-}
+my $lib := pir::load_bytecode__ps('ProfTest.pbc');
+for $lib.subs_by_tag('load') -> $sub { $sub(); }
+Q:PIR{ .include "test_more.pir" };
plan(13);
@@ -178,6 +177,9 @@ CODE
push_eh eh
f = comp(s)
+ f = f."main_sub"()
+ $S0 = typeof f
+ say $S0
f()
pop_eh

0 comments on commit 1cce717

Please sign in to comment.