Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Port something to QAST that somehow got missed. Fixes Zavolaj.
  • Loading branch information
jnthn committed Jul 25, 2012
1 parent 135013d commit ba93c1d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 44 deletions.
1 change: 1 addition & 0 deletions src/Perl6/Grammar.pm
Expand Up @@ -29,6 +29,7 @@ grammar Perl6::Grammar is HLL::Grammar {
my $*W := nqp::isnull($file) ??
Perl6::World.new(:handle($source_id)) !!
Perl6::World.new(:handle($source_id), :description($file));
$*W.add_initializations();

# XXX Hack: clear any marks.
pir::set_hll_global__vPsP(['HLL', 'Grammar'], '%!MARKHASH', nqp::null());
Expand Down
56 changes: 12 additions & 44 deletions src/Perl6/World.pm
Expand Up @@ -1882,53 +1882,21 @@ class Perl6::World is HLL::World {
}
}

# Generates a series of PAST operations that will build this context if
# it doesn't exist, and fix it up if it already does.
method to_past() {
# Adds various bits of initialization that must always be done early on.
method add_initializations() {
if self.is_precompilation_mode() {
my $load_tasks := QAST::Stmts.new();
for self.load_dependency_tasks() {
$load_tasks.push(QAST::Stmt.new($_));
}
my $fixup_tasks := QAST::Stmts.new();
for self.fixup_tasks() {
$fixup_tasks.push(QAST::Stmt.new($_));
}
return QAST::Stmts.new(
PAST::Op.new( :pirop('nqp_dynop_setup v') ),
PAST::Op.new( :pirop('nqp_bigint_setup v') ),
PAST::Op.new( :pirop('nqp_native_call_setup v') ),
PAST::Op.new( :pirop('rakudo_dynop_setup v') ),
self.add_load_dependency_task(:deserialize_past(QAST::Stmts.new(
QAST::VM.new( :pirop('nqp_dynop_setup v') ),
QAST::VM.new( :pirop('nqp_bigint_setup v') ),
QAST::VM.new( :pirop('nqp_native_call_setup v') ),
QAST::VM.new( :pirop('rakudo_dynop_setup v') ),
QAST::Op.new(
:op('callmethod'), :name('hll_map'),
PAST::Op.new( :pirop('getinterp P') ),
PAST::Op.new( :pirop('get_class Ps'), 'LexPad' ),
PAST::Op.new( :pirop('get_class Ps'), 'Perl6LexPad' )
),
PAST::Op.new(
:pasttype('bind_6model'),
PAST::Var.new( :name('cur_sc'), :scope('register'), :isdecl(1) ),
PAST::Op.new( :pirop('nqp_create_sc Ps'), self.handle() )
),
QAST::Op.new(
:op('callmethod'), :name('set_description'),
PAST::Var.new( :name('cur_sc'), :scope('register') ),
self.sc.description
),
$load_tasks,
self.serialize_and_produce_deserialization_past('cur_sc'),
$fixup_tasks
)
}
else {
my $tasks := QAST::Stmts.new();
for self.load_dependency_tasks() {
$tasks.push(QAST::Stmt.new($_));
}
for self.fixup_tasks() {
$tasks.push(QAST::Stmt.new($_));
}
return $tasks
QAST::VM.new( :pirop('getinterp P') ),
QAST::VM.new( :pirop('get_class Ps'), QAST::SVal.new( :value('LexPad') ) ),
QAST::VM.new( :pirop('get_class Ps'), QAST::SVal.new( :value('Perl6LexPad') ) )
)
)));
}
}

Expand Down

0 comments on commit ba93c1d

Please sign in to comment.