From 580a232e2fa6898e7db7ed4a97d1df8bd55241ec Mon Sep 17 00:00:00 2001 From: pmurias Date: Wed, 25 Oct 2017 13:58:16 +0200 Subject: [PATCH] Use multidimref_* on all backends --- src/Perl6/Metamodel/BOOTSTRAP.nqp | 6 -- src/core/ShapedArray.pm | 10 --- src/core/native_array.pm | 135 ------------------------------ 3 files changed, 151 deletions(-) diff --git a/src/Perl6/Metamodel/BOOTSTRAP.nqp b/src/Perl6/Metamodel/BOOTSTRAP.nqp index 037a2fb4500..f823a23e5ce 100644 --- a/src/Perl6/Metamodel/BOOTSTRAP.nqp +++ b/src/Perl6/Metamodel/BOOTSTRAP.nqp @@ -86,11 +86,9 @@ my stub StrAttrRef metaclass Perl6::Metamodel::NativeRefHOW { ... }; my stub IntPosRef metaclass Perl6::Metamodel::NativeRefHOW { ... }; my stub NumPosRef metaclass Perl6::Metamodel::NativeRefHOW { ... }; my stub StrPosRef metaclass Perl6::Metamodel::NativeRefHOW { ... }; -#?if moar my stub IntMultidimRef metaclass Perl6::Metamodel::NativeRefHOW { ... }; my stub NumMultidimRef metaclass Perl6::Metamodel::NativeRefHOW { ... }; my stub StrMultidimRef metaclass Perl6::Metamodel::NativeRefHOW { ... }; -#?endif # Implement the signature binder. # The JVM backend really only uses trial_bind, @@ -1359,11 +1357,9 @@ BEGIN { setup_native_ref_type(IntPosRef, int, 'positional'); setup_native_ref_type(NumPosRef, num, 'positional'); setup_native_ref_type(StrPosRef, str, 'positional'); -#?if moar setup_native_ref_type(IntMultidimRef, int, 'multidim'); setup_native_ref_type(NumMultidimRef, num, 'multidim'); setup_native_ref_type(StrMultidimRef, str, 'multidim'); -#?endif # class Proxy is Any { # has Mu &!FETCH; @@ -3370,11 +3366,9 @@ nqp::sethllconfig('perl6', nqp::hash( 'int_pos_ref', IntPosRef, 'num_pos_ref', NumPosRef, 'str_pos_ref', StrPosRef, -#?if moar 'int_multidim_ref', IntMultidimRef, 'num_multidim_ref', NumMultidimRef, 'str_multidim_ref', StrMultidimRef, -#?endif )); #?if jvm diff --git a/src/core/ShapedArray.pm b/src/core/ShapedArray.pm index 2db7a9abe0c..2752efa360f 100644 --- a/src/core/ShapedArray.pm +++ b/src/core/ShapedArray.pm @@ -258,12 +258,7 @@ nqp::ifnull( nqp::atposnd($!list,$!indices), nqp::bindposnd($!list,$!indices,nqp::p6scalarfromdesc(Mu)) -#?if moar ) = nqp::multidimref_i($!from,$!indices) -#?endif -#?if !moar - ) = nqp::atposnd_i($!from,$!indices) -#?endif } }.new(to,from).sink-all } @@ -281,12 +276,7 @@ nqp::ifnull( nqp::atposnd($!list,$!indices), nqp::bindposnd($!list,$!indices,nqp::p6scalarfromdesc(Mu)) -#?if moar ) = nqp::multidimref_n($!from,$!indices) -#?endif -#?if !moar - ) = nqp::atposnd_n($!from,$!indices) -#?endif } }.new(to,from).sink-all } diff --git a/src/core/native_array.pm b/src/core/native_array.pm index cfe590c1d19..6b78d793f44 100644 --- a/src/core/native_array.pm +++ b/src/core/native_array.pm @@ -1034,12 +1034,7 @@ my class array does Iterable { nqp::isge_i(($numdims = nqp::sub_i($numdims,1)),0), nqp::push_i($idxs,nqp::shift($indices)) ), -#?if moar nqp::multidimref_i(self,$idxs) -#?endif -#?if !moar - nqp::atposnd_i(self,$idxs) -#?endif ), nqp::if( nqp::isgt_i($numind,$numdims), @@ -1099,12 +1094,7 @@ my class array does Iterable { } method result(--> Nil) { nqp::bindposnd_i($!list,$!indices, -#?if moar nqp::multidimref_i($!from,$!indices)) -#?endif -#?if !moar - nqp::atposnd_i($!from,$!indices)) -#?endif } }.new(to,from).sink-all; to @@ -1237,12 +1227,7 @@ my class array does Iterable { method iterator(::?CLASS:D:) { class :: does Rakudo::Iterator::ShapeLeaf { method result() is raw { -#?if moar nqp::multidimref_i($!list,nqp::clone($!indices)) -#?endif -#?if !moar - nqp::atposnd_i($!list,nqp::clone($!indices)) -#?endif } }.new(self) } @@ -1258,12 +1243,7 @@ my class array does Iterable { nqp::sub_i(nqp::atpos_i($!indices,$!maxdim),1))), $result ), -#?if moar nqp::multidimref_i($!list,nqp::clone($!indices)) -#?endif -#?if !moar - nqp::atposnd_i($!list,nqp::clone($!indices)) -#?endif ) } # needs its own push-all since it fiddles with $!indices @@ -1280,12 +1260,7 @@ my class array does Iterable { method result() { Pair.new( self.indices, -#?if moar nqp::multidimref_i($!list,nqp::clone($!indices)) -#?endif -#?if !moar - nqp::atposnd_i($!list,nqp::clone($!indices)) -#?endif ) } }.new(self)) @@ -1476,20 +1451,10 @@ my class array does Iterable { role shaped2intarray does shapedintarray { multi method AT-POS(::?CLASS:D: int \one, int \two) is raw { -#?if moar nqp::multidimref_i(self,nqp::list_i(one, two)) -#?endif -#?if !moar - nqp::atpos2d_i(self,one,two) -#?endif } multi method AT-POS(::?CLASS:D: Int:D \one, Int:D \two) is raw { -#?if moar nqp::multidimref_i(self,nqp::list_i(one, two)) -#?endif -#?if !moar - nqp::atpos2d_i(self,one,two) -#?endif } multi method ASSIGN-POS(::?CLASS:D: int \one, int \two, Int:D \value) { @@ -1519,20 +1484,10 @@ my class array does Iterable { role shaped3intarray does shapedintarray { multi method AT-POS(::?CLASS:D: int \one, int \two, int \three) is raw { -#?if moar nqp::multidimref_i(self,nqp::list_i(one, two, three)) -#?endif -#?if !moar - nqp::atpos3d_i(self,one,two,three) -#?endif } multi method AT-POS(::?CLASS:D: Int:D \one, Int:D \two, Int:D \three) is raw { -#?if moar nqp::multidimref_i(self,nqp::list_i(one, two, three)) -#?endif -#?if !moar - nqp::atpos3d_i(self,one,two,three) -#?endif } multi method ASSIGN-POS(::?CLASS:D: int \one, int \two, int \three, Int:D \value) { @@ -1584,12 +1539,7 @@ my class array does Iterable { nqp::isge_i(($numdims = nqp::sub_i($numdims,1)),0), nqp::push_i($idxs,nqp::shift($indices)) ), -#?if moar nqp::multidimref_n(self,$idxs) -#?endif -#?if !moar - nqp::atposnd_n(self,$idxs) -#?endif ), nqp::if( nqp::isgt_i($numind,$numdims), @@ -1649,12 +1599,7 @@ my class array does Iterable { } method result(--> Nil) { nqp::bindposnd_n($!list,$!indices, -#?if moar nqp::multidimref_n($!from,$!indices)) -#?endif -#?if !moar - nqp::atposnd_n($!from,$!indices)) -#?endif } }.new(to,from).sink-all; to @@ -1787,12 +1732,7 @@ my class array does Iterable { method iterator(::?CLASS:D:) { class :: does Rakudo::Iterator::ShapeLeaf { method result() is raw { -#?if moar nqp::multidimref_n($!list,nqp::clone($!indices)) -#?endif -#?if !moar - nqp::atposnd_n($!list,nqp::clone($!indices)) -#?endif } }.new(self) } @@ -1808,12 +1748,7 @@ my class array does Iterable { nqp::sub_i(nqp::atpos_i($!indices,$!maxdim),1))), $result ), -#?if moar nqp::multidimref_n($!list,nqp::clone($!indices)) -#?endif -#?if !moar - nqp::atposnd_n($!list,nqp::clone($!indices)) -#?endif ) } # needs its own push-all since it fiddles with $!indices @@ -1830,12 +1765,7 @@ my class array does Iterable { method result() { Pair.new( self.indices, -#?if moar nqp::multidimref_n($!list,nqp::clone($!indices)) -#?endif -#?if !moar - nqp::atposnd_n($!list,nqp::clone($!indices)) -#?endif ) } }.new(self)) @@ -2026,20 +1956,10 @@ my class array does Iterable { role shaped2numarray does shapednumarray { multi method AT-POS(::?CLASS:D: int \one, int \two) is raw { -#?if moar nqp::multidimref_n(self,nqp::list_i(one, two)) -#?endif -#?if !moar - nqp::atpos2d_n(self,one,two) -#?endif } multi method AT-POS(::?CLASS:D: Int:D \one, Int:D \two) is raw { -#?if moar nqp::multidimref_n(self,nqp::list_i(one, two)) -#?endif -#?if !moar - nqp::atpos2d_n(self,one,two) -#?endif } multi method ASSIGN-POS(::?CLASS:D: int \one, int \two, Num:D \value) { @@ -2069,20 +1989,10 @@ my class array does Iterable { role shaped3numarray does shapednumarray { multi method AT-POS(::?CLASS:D: int \one, int \two, int \three) is raw { -#?if moar nqp::multidimref_n(self,nqp::list_i(one, two, three)) -#?endif -#?if !moar - nqp::atpos3d_n(self,one,two,three) -#?endif } multi method AT-POS(::?CLASS:D: Int:D \one, Int:D \two, Int:D \three) is raw { -#?if moar nqp::multidimref_n(self,nqp::list_i(one, two, three)) -#?endif -#?if !moar - nqp::atpos3d_n(self,one,two,three) -#?endif } multi method ASSIGN-POS(::?CLASS:D: int \one, int \two, int \three, Num:D \value) { @@ -2134,12 +2044,7 @@ my class array does Iterable { nqp::isge_i(($numdims = nqp::sub_i($numdims,1)),0), nqp::push_i($idxs,nqp::shift($indices)) ), -#?if moar nqp::multidimref_s(self,$idxs) -#?endif -#?if !moar - nqp::atposnd_s(self,$idxs) -#?endif ), nqp::if( nqp::isgt_i($numind,$numdims), @@ -2199,12 +2104,7 @@ my class array does Iterable { } method result(--> Nil) { nqp::bindposnd_s($!list,$!indices, -#?if moar nqp::multidimref_s($!from,$!indices)) -#?endif -#?if !moar - nqp::atposnd_s($!from,$!indices)) -#?endif } }.new(to,from).sink-all; to @@ -2337,12 +2237,7 @@ my class array does Iterable { method iterator(::?CLASS:D:) { class :: does Rakudo::Iterator::ShapeLeaf { method result() is raw { -#?if moar nqp::multidimref_s($!list,nqp::clone($!indices)) -#?endif -#?if !moar - nqp::atposnd_s($!list,nqp::clone($!indices)) -#?endif } }.new(self) } @@ -2358,12 +2253,7 @@ my class array does Iterable { nqp::sub_i(nqp::atpos_i($!indices,$!maxdim),1))), $result ), -#?if moar nqp::multidimref_s($!list,nqp::clone($!indices)) -#?endif -#?if !moar - nqp::atposnd_s($!list,nqp::clone($!indices)) -#?endif ) } # needs its own push-all since it fiddles with $!indices @@ -2380,12 +2270,7 @@ my class array does Iterable { method result() { Pair.new( self.indices, -#?if moar nqp::multidimref_s($!list,nqp::clone($!indices)) -#?endif -#?if !moar - nqp::atposnd_s($!list,nqp::clone($!indices)) -#?endif ) } }.new(self)) @@ -2576,20 +2461,10 @@ my class array does Iterable { role shaped2strarray does shapedstrarray { multi method AT-POS(::?CLASS:D: int \one, int \two) is raw { -#?if moar nqp::multidimref_s(self,nqp::list_i(one, two)) -#?endif -#?if !moar - nqp::atpos2d_s(self,one,two) -#?endif } multi method AT-POS(::?CLASS:D: Int:D \one, Int:D \two) is raw { -#?if moar nqp::multidimref_s(self,nqp::list_i(one, two)) -#?endif -#?if !moar - nqp::atpos2d_s(self,one,two) -#?endif } multi method ASSIGN-POS(::?CLASS:D: int \one, int \two, Str:D \value) { @@ -2619,20 +2494,10 @@ my class array does Iterable { role shaped3strarray does shapedstrarray { multi method AT-POS(::?CLASS:D: int \one, int \two, int \three) is raw { -#?if moar nqp::multidimref_s(self,nqp::list_i(one, two, three)) -#?endif -#?if !moar - nqp::atpos3d_s(self,one,two,three) -#?endif } multi method AT-POS(::?CLASS:D: Int:D \one, Int:D \two, Int:D \three) is raw { -#?if moar nqp::multidimref_s(self,nqp::list_i(one, two, three)) -#?endif -#?if !moar - nqp::atpos3d_s(self,one,two,three) -#?endif } multi method ASSIGN-POS(::?CLASS:D: int \one, int \two, int \three, Str:D \value) {