Permalink
Browse files

Merge branch 'PackfileView' into target-pbc

Conflicts:
	src/HLL/Compiler.pm
	src/NQP/World.pm
	src/QRegex/Cursor.nqp
	src/Regex/Cursor.pir
  • Loading branch information...
2 parents d579a30 + d3a9cc2 commit ca1ba8c160234a6f6f87e79ab858ddb489bb9eb5 @gerdr gerdr committed Feb 16, 2013
Showing with 26 additions and 11 deletions.
  1. +15 −2 src/HLL/Compiler.pm
  2. +9 −7 src/NQP/World.pm
  3. +1 −1 src/QRegex/Cursor.nqp
  4. +1 −1 t/qregex/01-qregex.t
View
@@ -149,7 +149,17 @@ class HLL::Compiler {
pir::set_runcore__0s("subprof_hll");
}
pir::trace__vI(%adverbs<trace>);
- $output := $output(|@args);
+
+ # Execute :init subs
+ if !$output.is_initialized('init') {
+ for $output.subs_by_tag('init') -> $sub { $sub(); }
+ $output.mark_initialized('init');
+ }
+
+ # Now execute the :main sub
+ my $main_sub := $output.main_sub();
+ $output := $main_sub(|@args);
+
pir::trace__0i(0);
}
pir::set_runcore__vs($old_runcore);
@@ -427,7 +437,10 @@ class HLL::Compiler {
method evalpmc($source, *%adverbs) {
my $compiler := pir::compreg__Ps('PIR');
- $compiler($source)
+ my $packfile := $compiler.compile($source);
+ for $packfile.subs_by_tag('init') -> $sub { $sub(); }
+ $packfile.mark_initialized('init');
+ $packfile
}
method dumper($obj, $name, *%options) {
View
@@ -243,23 +243,24 @@ class NQP::World is HLL::World {
my $compiled := $nqpcomp.evalpmc($pir);
# Fix up any code objects holding stubs with the real compiled thing.
- my $c := nqp::elems($compiled);
+ my @all_subs := $compiled.all_subs();
+ my $c := nqp::elems(@all_subs);
my $i := 0;
while $i < $c {
- my $subid := $compiled[$i].get_subid();
+ my $subid := @all_subs[$i].get_subid();
if nqp::existskey(%!code_objects_to_fix_up, $subid) {
# First, go over the code objects. Update the $!do, and the
# entry in the SC. Make sure the newly compiled code is marked
# as a static code ref.
my $static := %!code_objects_to_fix_up{$subid}.shift();
- nqp::bindattr($static, %!code_object_types{$subid}, '$!do', $compiled[$i]);
+ nqp::bindattr($static, %!code_object_types{$subid}, '$!do', @all_subs[$i]);
nqp::bindattr($static, %!code_object_types{$subid}, '$!clone_callback', nqp::null());
for %!code_objects_to_fix_up{$subid} {
- nqp::bindattr($_, %!code_object_types{$subid}, '$!do', nqp::clone($compiled[$i]));
+ nqp::bindattr($_, %!code_object_types{$subid}, '$!do', nqp::clone(@all_subs[$i]));
nqp::bindattr($_, %!code_object_types{$subid}, '$!clone_callback', nqp::null());
}
- pir::setprop__vPsP($compiled[$i], 'STATIC_CODE_REF', $compiled[$i]);
- self.update_root_code_ref(%!code_stub_sc_idx{$subid}, $compiled[$i]);
+ pir::setprop__vPsP(@all_subs[$i], 'STATIC_CODE_REF', @all_subs[$i]);
+ self.update_root_code_ref(%!code_stub_sc_idx{$subid}, @all_subs[$i]);
# Clear up the fixup statements.
my $fixup_stmts := %!code_object_fixup_list{$subid};
@@ -268,7 +269,8 @@ class NQP::World is HLL::World {
$i := $i + 1;
}
- $compiled(|@args, |%named);
+ my $main_sub := $compiled.main_sub();
+ $main_sub(|@args, |%named);
};
# Create code object, if we'll need one.
View
@@ -733,7 +733,7 @@ class NQPCursor does NQPCursorRole {
$var := $res;
}
else {
- $var := $rxcompiler.compile($var);
+ $var := $rxcompiler.compile($var).main_sub();
}
}
return self.'!INTERPOLATE'($var);
View
@@ -45,7 +45,7 @@ sub test_line($line) {
my $rxcomp := pir::compreg__Ps('QRegex::P6Regex');
try {
- my $rxsub := $rxcomp.compile($regex);
+ my $rxsub := $rxcomp.compile($regex).main_sub();
my $cursor := NQPCursor."!cursor_init"($target, :c(0));
my $match := $rxsub($cursor).MATCH;
if $expect_substr {

0 comments on commit ca1ba8c

Please sign in to comment.