diff --git a/src/core/Rakudo/Iterator.pm6 b/src/core/Rakudo/Iterator.pm6 index 42a7ebbebd8..abc58d1e260 100644 --- a/src/core/Rakudo/Iterator.pm6 +++ b/src/core/Rakudo/Iterator.pm6 @@ -904,12 +904,7 @@ class Rakudo::Iterator { method new(\iterables) { nqp::create(self)!SET-SELF(iterables) } method pull-one() { nqp::if( -#?if jvm - nqp::eqaddr($!next,Mu), -#?endif -#?if !jvm - nqp::isnull($!next), -#?endif + nqp::eqaddr($!next,IterationEnd), IterationEnd, nqp::stmts( @@ -1044,16 +1039,9 @@ class Rakudo::Iterator { ), nqp::if( nqp::iseq_i($level,-1), - # was last iteration, free up everything now - ($!next := - $!iterators := $!reifieds := $!indices := -#?if jvm - Mu) -#?endif -#?if !jvm - nqp::null) -#?endif + ($!next := $!iterators := $!reifieds := $!indices := + IterationEnd) ) ) ), @@ -1177,12 +1165,7 @@ class Rakudo::Iterator { method new(\its,\map) { nqp::create(self)!SET-SELF(its,map) } method pull-one() { nqp::if( -#?if jvm - nqp::eqaddr($!next,Mu), -#?endif -#?if !jvm - nqp::isnull($!next), -#?endif + nqp::eqaddr($!next,IterationEnd), IterationEnd, nqp::stmts( @@ -1319,16 +1302,9 @@ class Rakudo::Iterator { ), nqp::if( nqp::iseq_i($level,-1), - # was last iteration, free up everything now - ($!next := - $!iterators := $!reifieds := $!indices := -#?if jvm - Mu) -#?endif -#?if !jvm - nqp::null) -#?endif + ($!next := $!iterators := $!reifieds := $!indices := + IterationEnd) ) ) ), @@ -2391,56 +2367,32 @@ class Rakudo::Iterator { } method pull-one() is raw { nqp::if( -#?if jvm nqp::eqaddr($!value,IterationEnd), -#?endif -#?if !jvm - nqp::isnull($!value), -#?endif IterationEnd, nqp::stmts( (my Mu $value := $!value), -#?if jvm ($!value := IterationEnd), -#?endif -#?if !jvm - ($!value := nqp::null), -#?endif $value ) ) } method push-all($target --> IterationEnd) { nqp::stmts( -#?if jvm - nqp::unless(nqp::eqaddr($!value,IterationEnd),$target.push($!value)), + nqp::unless( + nqp::eqaddr($!value,IterationEnd), + $target.push($!value) + ), ($!value := IterationEnd) -#?endif -#?if !jvm - nqp::unless(nqp::isnull($!value),$target.push($!value)), - ($!value := nqp::null) -#?endif ) } method skip-one() { nqp::if( -#?if jvm nqp::not_i(nqp::eqaddr($!value,IterationEnd)), nqp::isfalse($!value := IterationEnd) -#?endif -#?if !jvm - nqp::not_i(nqp::isnull($!value)), - nqp::isfalse($!value := nqp::null) -#?endif ) } method sink-all(--> IterationEnd) { -#?if jvm $!value := IterationEnd -#?endif -#?if !jvm - $!value := nqp::null -#?endif } } method OneValue(Mu \value) { OneValue.new(value) } @@ -2884,12 +2836,7 @@ class Rakudo::Iterator { method new(\iter) { nqp::create(self)!SET-SELF(iter) } method pull-one() is raw { nqp::if( -#?if jvm - nqp::eqaddr($!iterator,Mu), -#?endif -#?if !jvm - nqp::isnull($!iterator), -#?endif + nqp::eqaddr($!iterator,IterationEnd), nqp::atpos( # supplying from cache $!reified, nqp::mod_i( @@ -2905,12 +2852,7 @@ class Rakudo::Iterator { nqp::if( nqp::elems($!reified), nqp::stmts( # exhausted, something in cache -#?if jvm - ($!iterator := Mu), -#?endif -#?if !jvm - ($!iterator := nqp::null), -#?endif + ($!iterator := IterationEnd), nqp::atpos($!reified,0) ), IterationEnd # exhausted, nothing in cache @@ -3190,12 +3132,7 @@ class Rakudo::Iterator { method new(\iterables) { nqp::create(self)!SET-SELF(iterables) } method pull-one() { nqp::if( -#?if jvm - nqp::eqaddr($!iters,Mu), -#?endif -#?if !jvm - nqp::isnull($!iters), -#?endif + nqp::eqaddr($!iters,IterationEnd), IterationEnd, nqp::stmts( (my int $i = -1), @@ -3219,15 +3156,7 @@ class Rakudo::Iterator { nqp::if( nqp::elems($buf), $buf.List, - nqp::stmts( # we're done -#?if jvm - ($!iters := Mu), -#?endif -#?if !jvm - ($!iters := nqp::null), -#?endif - IterationEnd - ) + ($!iters := IterationEnd), # we're done ) ) ) @@ -3572,7 +3501,6 @@ class Rakudo::Iterator { } method pull-one() is raw { nqp::if( -#?if jvm nqp::eqaddr($!val1,IterationEnd), nqp::if( nqp::eqaddr($!val2,IterationEnd), @@ -3586,29 +3514,12 @@ class Rakudo::Iterator { nqp::stmts( (my $val1 := $!val1), ($!val1 := IterationEnd), -#?endif -#?if !jvm - nqp::isnull($!val1), - nqp::if( - nqp::isnull($!val2), - IterationEnd, - nqp::stmts( - (my Mu $val2 := $!val2), - ($!val2 := nqp::null), - $val2 - ) - ), - nqp::stmts( - (my $val1 := $!val1), - ($!val1 := nqp::null), -#?endif $val1 ) ) } method push-all($target --> IterationEnd) { nqp::stmts( -#?if jvm nqp::if( nqp::eqaddr($!val1,IterationEnd), nqp::unless(nqp::eqaddr($!val2,Mu),$target.push($!val2)), @@ -3618,46 +3529,20 @@ class Rakudo::Iterator { ) ), ($!val1 := $!val2 := IterationEnd) -#?endif -#?if !jvm - nqp::if( - nqp::isnull($!val1), - nqp::unless(nqp::isnull($!val2),$target.push($!val2)), - nqp::stmts( - $target.push($!val1), - $target.push($!val2) - ) - ), - ($!val1 := $!val2 := nqp::null) -#?endif ) } method skip-one() { nqp::if( -#?if jvm nqp::not_i(nqp::eqaddr($!val1,IterationEnd)), nqp::isfalse($!val1 := IterationEnd), nqp::if( nqp::not_i(nqp::eqaddr($!val2,IterationEnd)), nqp::isfalse($!val2 := IterationEnd) -#?endif -#?if !jvm - nqp::not_i(nqp::isnull($!val1)), - nqp::isfalse($!val1 := nqp::null), - nqp::if( - nqp::not_i(nqp::isnull($!val2)), - nqp::isfalse($!val2 := nqp::null) -#?endif ) ) } method sink-all(--> IterationEnd) { -#?if jvm $!val1 := $!val2 := IterationEnd -#?endif -#?if !jvm - $!val1 := $!val2 := nqp::null -#?endif } } method TwoValues(Mu \val1, Mu \val2) { TwoValues.new(val1, val2) } @@ -4014,12 +3899,7 @@ class Rakudo::Iterator { method new(\iterables) { nqp::create(self)!SET-SELF(iterables) } method pull-one() { nqp::if( -#?if jvm - nqp::eqaddr($!iters,Mu), -#?endif -#?if !jvm - nqp::isnull($!iters), -#?endif + nqp::eqaddr($!iters,IterationEnd), IterationEnd, nqp::stmts( (my int $i = -1), @@ -4039,12 +3919,7 @@ class Rakudo::Iterator { nqp::if( $is_iterend, # at least one exhausted nqp::stmts( -#?if jvm - ($!iters := Mu), -#?endif -#?if !jvm - ($!iters := nqp::null), -#?endif + ($!iters := IterationEnd), IterationEnd ), buf.List @@ -4102,12 +3977,7 @@ class Rakudo::Iterator { method new(\iters,\map) { nqp::create(self)!SET-SELF(iters,map) } method pull-one() { nqp::if( -#?if jvm - nqp::eqaddr($!iters,Mu), -#?endif -#?if !jvm - nqp::isnull($!iters), -#?endif + nqp::eqaddr($!iters,IterationEnd), IterationEnd, nqp::stmts( (my int $i = -1), @@ -4119,7 +3989,8 @@ class Rakudo::Iterator { nqp::islt_i(($i = nqp::add_i($i,1)),$elems), nqp::if( nqp::eqaddr( - (my \pulled := nqp::atpos($!iters,$i).pull-one), IterationEnd + (my \pulled := nqp::atpos($!iters,$i).pull-one), + IterationEnd ), $is_iterend = 1, nqp::bindpos($list,$i,pulled) @@ -4127,15 +3998,7 @@ class Rakudo::Iterator { ), nqp::if( $is_iterend, # at least one exhausted - nqp::stmts( -#?if jvm - ($!iters := Mu), -#?endif -#?if !jvm - ($!iters := nqp::null), -#?endif - IterationEnd - ), + ($!iters := IterationEnd), $!mapper($list) ) )