Skip to content

Commit

Permalink
Use multidimref_* on all backends
Browse files Browse the repository at this point in the history
  • Loading branch information
pmurias committed Oct 25, 2017
1 parent 37ff7c6 commit 580a232
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 151 deletions.
6 changes: 0 additions & 6 deletions src/Perl6/Metamodel/BOOTSTRAP.nqp
Expand Up @@ -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,
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down
10 changes: 0 additions & 10 deletions src/core/ShapedArray.pm
Expand Up @@ -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
}
Expand 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
}
Expand Down
135 changes: 0 additions & 135 deletions src/core/native_array.pm
Expand Up @@ -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),
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
}
Expand All @@ -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
Expand All @@ -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))
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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),
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
}
Expand All @@ -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
Expand All @@ -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))
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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),
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
}
Expand All @@ -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
Expand All @@ -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))
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 580a232

Please sign in to comment.