Skip to content

Instantly share code, notes, and snippets.

@jnthn
Created May 27, 2014 23:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jnthn/e9263006684a566d6992 to your computer and use it in GitHub Desktop.
Save jnthn/e9263006684a566d6992 to your computer and use it in GitHub Desktop.
diff --git a/src/Perl6/Optimizer.nqp b/src/Perl6/Optimizer.nqp
index 239a171..d2ea6f3 100644
--- a/src/Perl6/Optimizer.nqp
+++ b/src/Perl6/Optimizer.nqp
@@ -31,6 +31,7 @@ my class Symbols {
has $!Block;
has $!PseudoStash;
has $!Routine;
+ has $!Nil;
# Top routine, for faking it when optimizing post-inline.
has $!fake_top_routine;
@@ -55,6 +56,7 @@ my class Symbols {
$!Block := self.find_lexical('Block');
$!PseudoStash := self.find_lexical('PseudoStash');
$!Routine := self.find_lexical('Routine');
+ $!Nil := self.find_lexical('Nil');
nqp::pop(@!block_stack);
}
@@ -94,6 +96,7 @@ my class Symbols {
method Any() { $!Any }
method Block() { $!Block }
method PseudoStash() { $!PseudoStash }
+ method Nil() { $!Nil }
# The following function is a nearly 1:1 copy of World.find_symbol.
# Finds a symbol that has a known value at compile time from the
@@ -1239,7 +1242,8 @@ class Perl6::Optimizer {
:op('add_i'),
QAST::Var.new( :name($it_var), :scope('local'), :returns(int) ),
QAST::IVal.new( :value(1) )
- )))));
+ ))),
+ QAST::WVal.new( :value($!symbols.Nil) )));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment