Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Backports 1.6-beta #38949

Merged
merged 40 commits into from
Jan 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
06171f6
Switch back to LLVM ORC v2, take two (#38804)
vtjnash Dec 17, 2020
264d855
fix #38888, pessimistic sparam inference with concrete upper bound (#…
JeffBezanson Dec 18, 2020
c678cef
Carry MBedTLS patch that works around CMake 3.18.2 bug. (#38933) (#38…
Sacha0 Dec 25, 2020
0372159
Source tarballs should contain `StdlibArtifacts.toml` files (#38962) …
Sacha0 Dec 25, 2020
715eb60
minor inferrability tweak for `manifest_deps_get` (#38954)
aviatesk Dec 21, 2020
f676019
Repair jl_init. (#38950)
GunnarFarneback Dec 21, 2020
e550e87
[Artifacts] Note the platform we're looking for in our error message …
staticfloat Dec 22, 2020
a67b662
Assert that _artifact_str returns a String (#38975)
timholy Dec 24, 2020
f190c53
Construct constant LLVMPtr correctly (#38958)
vchuravy Dec 25, 2020
9475802
Fix trampoline on PPC (#38980)
vchuravy Dec 25, 2020
f42b28e
Update the AST docs on `nothing` `:method` expressions (#38496)
timholy Dec 26, 2020
8d41bf7
[loader] Must invalidate `.o` files when `VERSION` changes (#38800)
staticfloat Dec 26, 2020
14a646c
build: pack checksums into fewer files by target (#38963)
vtjnash Dec 22, 2020
30ce7da
win: Set correct folder permissions after folder creation (#38942)
musm Dec 27, 2020
d73f866
Export jl_n_threads from the public libjulia library [#38925]
imciner2 Dec 18, 2020
a881030
[cli/trampolines]: Fix `aarch64-apple-darwin` trampoline ASM syntax
staticfloat Dec 19, 2020
dd7d025
[cli/trampolines]: Fix `i686-w64-mingw32` name mangling
staticfloat Dec 19, 2020
8984d13
Define `jl_n_threads` in only `libjulia`
staticfloat Dec 19, 2020
3be9b23
Fix visibility of jl_n_threads
imciner2 Dec 20, 2020
22a907b
Allow libjulia to contain non-pointer variables
imciner2 Dec 20, 2020
ac9c203
Remove second declaration of jl_n_threads
imciner2 Dec 20, 2020
c32c796
Use proper interprocedural register on aarch64
staticfloat Dec 21, 2020
b2484a7
Adapt Windows `cglobal()` search for `libjulia-internal`
staticfloat Dec 22, 2020
ea9d2bb
Revert "win: Set correct folder permissions after folder creation (#3…
KristofferC Dec 28, 2020
7d6594d
[libuv] Bump to include `DELETE` win ACL patch (#39038)
staticfloat Dec 30, 2020
c992850
Bump Documenter to 0.26.1 (#39097)
mortenpi Jan 5, 2021
bacbb97
Improve consistency of SONAME usage, fix debug installation
staticfloat Dec 26, 2020
3b809f7
Fix lack of `JL_MAJOR_SHLIB_EXT` on Windows
staticfloat Dec 27, 2020
b4f2c66
Fixes for non-Int based lengths (#37741)
dlfivefifty Jan 4, 2021
616cb5d
[cli/trampolines] Fix section directive for windows trampolines
staticfloat Dec 30, 2020
eb1efe5
[cli/loader]: Don't allow initialization to run more than once
staticfloat Dec 30, 2020
b6590d4
FileWatching: Dump open file descriptors on failure
Keno Apr 21, 2020
f452173
Don't detach rr workers in SharedArrays tests
Keno Apr 22, 2020
0d21397
Disable thread affinity test under rr
Keno Apr 22, 2020
2ed26a0
Exclude `threads` test from rr tracing
Keno Dec 16, 2020
c70397e
Use universal LIBUV_INC instead of build_includedir
vchuravy Sep 23, 2020
c8029bb
stage flisp.boot into host
vchuravy Sep 23, 2020
327f298
use BUILD_EXE for flisp
vchuravy Sep 24, 2020
55154b3
Measure compile time only when using time macros pt.2: handling when …
IanButterworth Jan 6, 2021
f34a4d8
fix Meta.partially_inline! again (#39112)
simeonschaub Jan 6, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
18 changes: 14 additions & 4 deletions Make.inc
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,10 @@ endef
$(foreach D,libdir private_libdir datarootdir libexecdir docdir sysconfdir includedir,$(eval $(call cache_rel_path,$(D),$(bindir))))
$(foreach D,build_libdir build_private_libdir,$(eval $(call cache_rel_path,$(D),$(build_bindir))))

# Save a special one: reverse_private_libdir_rel: usually just `../`, but good to be general:
reverse_private_libdir_rel_eval = $(call rel_path,$(private_libdir),$(libdir))
reverse_private_libdir_rel = $(call hit_cache,reverse_private_libdir_rel_eval)

INSTALL_F := $(JULIAHOME)/contrib/install.sh 644
INSTALL_M := $(JULIAHOME)/contrib/install.sh 755

Expand Down Expand Up @@ -662,6 +666,7 @@ endif
# put the version number before the .dylib. Otherwise, put it after.
ifeq ($(OS), WINNT)
JL_MAJOR_MINOR_SHLIB_EXT := $(SHLIB_EXT)
JL_MAJOR_SHLIB_EXT := $(SHLIB_EXT)
else
ifeq ($(OS), Darwin)
JL_MAJOR_MINOR_SHLIB_EXT := $(SOMAJOR).$(SOMINOR).$(SHLIB_EXT)
Expand Down Expand Up @@ -795,6 +800,11 @@ XC_HOST := $(ARCH)$(shell echo $(BUILD_MACHINE) | sed "s/[^-]*\(.*\)$$/\1/")
endif
endif

# Normalize ppc64le to powerpc64le
ifeq ($(ARCH), ppc64le)
override ARCH := powerpc64le
endif

ifeq ($(ARCH),mingw32)
$(error "the mingw32 compiler you are using fails the openblas testsuite. please see the README.windows document for a replacement")
else ifeq (cygwin, $(shell $(CC) -dumpmachine | cut -d\- -f3))
Expand Down Expand Up @@ -1528,11 +1538,11 @@ define dep_lib_path
$$($(PYTHON) $(call python_cygpath,$(JULIAHOME)/contrib/relative_path.py) $(1) $(2))
endef

LIBJULIAINTERNAL_BUILD_DEPLIB := $(call dep_lib_path,$(build_libdir),$(build_shlibdir)/libjulia-internal.$(JL_MAJOR_MINOR_SHLIB_EXT))
LIBJULIAINTERNAL_INSTALL_DEPLIB := $(call dep_lib_path,$(libdir),$(private_shlibdir)/libjulia-internal.$(JL_MAJOR_MINOR_SHLIB_EXT))
LIBJULIAINTERNAL_BUILD_DEPLIB := $(call dep_lib_path,$(build_libdir),$(build_shlibdir)/libjulia-internal.$(JL_MAJOR_SHLIB_EXT))
LIBJULIAINTERNAL_INSTALL_DEPLIB := $(call dep_lib_path,$(libdir),$(private_shlibdir)/libjulia-internal.$(JL_MAJOR_SHLIB_EXT))

LIBJULIAINTERNAL_DEBUG_BUILD_DEPLIB := $(call dep_lib_path,$(build_libdir),$(build_shlibdir)/libjulia-internal-debug.$(JL_MAJOR_MINOR_SHLIB_EXT))
LIBJULIAINTERNAL_DEBUG_INSTALL_DEPLIB := $(call dep_lib_path,$(libdir),$(private_shlibdir)/libjulia-internal-debug.$(JL_MAJOR_MINOR_SHLIB_EXT))
LIBJULIAINTERNAL_DEBUG_BUILD_DEPLIB := $(call dep_lib_path,$(build_libdir),$(build_shlibdir)/libjulia-internal-debug.$(JL_MAJOR_SHLIB_EXT))
LIBJULIAINTERNAL_DEBUG_INSTALL_DEPLIB := $(call dep_lib_path,$(libdir),$(private_shlibdir)/libjulia-internal-debug.$(JL_MAJOR_SHLIB_EXT))

ifeq ($(OS),WINNT)
ifeq ($(BINARY),32)
Expand Down
14 changes: 12 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ julia-sysimg-bc : julia-stdlib julia-base julia-cli-$(JULIA_BUILD_MODE) julia-sr
julia-sysimg-release julia-sysimg-debug : julia-sysimg-% : julia-sysimg-ji julia-cli-%
@$(MAKE) $(QUIET_MAKE) -C $(BUILDROOT) -f sysimage.mk sysimg-$*

julia-debug julia-release : julia-% : julia-sysimg-% julia-symlink julia-libccalltest julia-libllvmcalltest julia-base-cache
julia-debug julia-release : julia-% : julia-sysimg-% julia-src-% julia-symlink julia-libccalltest julia-libllvmcalltest julia-base-cache

debug release : % : julia-%

Expand Down Expand Up @@ -163,7 +163,7 @@ endif
# private libraries, that are installed in $(prefix)/lib/julia
JL_PRIVATE_LIBS-0 := libccalltest libllvmcalltest libjulia-internal
ifeq ($(BUNDLE_DEBUG_LIBS),1)
JL_TARGETS += libjulia-internal-debug
JL_PRIVATE_LIBS-0 += libjulia-internal-debug
endif
ifeq ($(USE_GPL_LIBS), 1)
JL_PRIVATE_LIBS-0 += libsuitesparse_wrapper
Expand Down Expand Up @@ -357,6 +357,15 @@ endif
$(call stringreplace,$${DEBUG_TARGET},sys-debug.$(SHLIB_EXT)$$,$(private_libdir_rel)/sys-debug.$(SHLIB_EXT)); \
fi;
endif

# Set rpath for libjulia-internal, which is moving from `../lib` to `../lib/julia`. We only need to do this for Linux/FreeBSD
ifneq (,$(findstring $(OS),Linux FreeBSD))
$(PATCHELF) --set-rpath '$$ORIGIN:$$ORIGIN/$(reverse_private_libdir_rel)' $(DESTDIR)$(private_libdir)/libjulia-internal.$(SHLIB_EXT)
ifeq ($(BUNDLE_DEBUG_LIBS),1)
$(PATCHELF) --set-rpath '$$ORIGIN:$$ORIGIN/$(reverse_private_libdir_rel)' $(DESTDIR)$(private_libdir)/libjulia-internal-debug.$(SHLIB_EXT)
endif
endif


ifneq ($(LOADER_BUILD_DEP_LIBS),$(LOADER_INSTALL_DEP_LIBS))
# Next, overwrite relative path to libjulia-internal in our loader if $(LOADER_BUILD_DEP_LIBS) != $(LOADER_INSTALL_DEP_LIBS)
Expand Down Expand Up @@ -442,6 +451,7 @@ endif
# Download all stdlibs and include the tarball filenames in light-source-dist.tmp
@$(MAKE) -C stdlib getall NO_GIT=1
-ls stdlib/srccache/*.tar.gz >> light-source-dist.tmp
-ls stdlib/*/StdlibArtifacts.toml >> light-source-dist.tmp

# Exclude git, github and CI config files
git ls-files | sed -E -e '/^\..+/d' -e '/\/\..+/d' -e '/appveyor.yml/d' >> light-source-dist.tmp
Expand Down
2 changes: 1 addition & 1 deletion base/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ $(BUILDDIR)/errno_h.jl:
$(BUILDDIR)/file_constants.jl: $(SRCDIR)/../src/file_constants.h
@$(call PRINT_PERL, $(CPP_STDOUT) -DJULIA $< | perl -nle 'print "$$1 0o$$2" if /^(\s*const\s+[A-z_]+\s+=)\s+(0[0-9]*)\s*$$/; print "$$1" if /^\s*(const\s+[A-z_]+\s+=\s+([1-9]|0x)[0-9A-z]*)\s*$$/' > $@)

$(BUILDDIR)/uv_constants.jl: $(SRCDIR)/../src/uv_constants.h $(build_includedir)/uv/errno.h
$(BUILDDIR)/uv_constants.jl: $(SRCDIR)/../src/uv_constants.h $(LIBUV_INC)/uv/errno.h
@$(call PRINT_PERL, $(CPP_STDOUT) "-I$(LIBUV_INC)" -DJULIA $< | tail -n 16 > $@)

$(BUILDDIR)/build_h.jl.phony:
Expand Down
23 changes: 11 additions & 12 deletions base/abstractarray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ julia> axes(A)
"""
function axes(A)
@_inline_meta
map(OneTo, size(A))
map(oneto, size(A))
end

"""
Expand All @@ -107,10 +107,10 @@ require_one_based_indexing(A...) = !has_offset_axes(A...) || throw(ArgumentError
# in other applications.
axes1(A::AbstractArray{<:Any,0}) = OneTo(1)
axes1(A::AbstractArray) = (@_inline_meta; axes(A)[1])
axes1(iter) = OneTo(length(iter))
axes1(iter) = oneto(length(iter))

unsafe_indices(A) = axes(A)
unsafe_indices(r::AbstractRange) = (OneTo(unsafe_length(r)),) # Ranges use checked_sub for size
unsafe_indices(r::AbstractRange) = (oneto(unsafe_length(r)),) # Ranges use checked_sub for size

keys(a::AbstractArray) = CartesianIndices(axes(a))
keys(a::AbstractVector) = LinearIndices(a)
Expand Down Expand Up @@ -308,7 +308,7 @@ function eachindex(A::AbstractArray, B::AbstractArray...)
@_inline_meta
eachindex(IndexStyle(A,B...), A, B...)
end
eachindex(::IndexLinear, A::AbstractArray) = (@_inline_meta; OneTo(length(A)))
eachindex(::IndexLinear, A::AbstractArray) = (@_inline_meta; oneto(length(A)))
eachindex(::IndexLinear, A::AbstractVector) = (@_inline_meta; axes1(A))
function eachindex(::IndexLinear, A::AbstractArray, B::AbstractArray...)
@_inline_meta
Expand Down Expand Up @@ -1481,12 +1481,11 @@ vcat(V::AbstractVector{T}...) where {T} = typed_vcat(T, V...)
# but that solution currently fails (see #27188 and #27224)
AbstractVecOrTuple{T} = Union{AbstractVector{<:T}, Tuple{Vararg{T}}}

function _typed_vcat(::Type{T}, V::AbstractVecOrTuple{AbstractVector}) where T
n = 0
for Vk in V
n += Int(length(Vk))::Int
end
a = similar(V[1], T, n)
_typed_vcat_similar(V, T, n) = similar(V[1], T, n)
_typed_vcat(::Type{T}, V::AbstractVecOrTuple{AbstractVector}) where T =
_typed_vcat!(_typed_vcat_similar(V, T, mapreduce(length, +, V)), V)

function _typed_vcat!(a::AbstractVector{T}, V::AbstractVecOrTuple{AbstractVector}) where T
pos = 1
for k=1:Int(length(V))::Int
Vk = V[k]
Expand Down Expand Up @@ -1632,15 +1631,15 @@ _cat(dims, X...) = cat_t(promote_eltypeof(X...), X...; dims=dims)
@inline cat_t(::Type{T}, X...; dims) where {T} = _cat_t(dims, T, X...)
@inline function _cat_t(dims, ::Type{T}, X...) where {T}
catdims = dims2cat(dims)
shape = cat_shape(catdims, map(cat_size, X)::Tuple{Vararg{Union{Int,Dims}}})::Dims
shape = cat_shape(catdims, map(cat_size, X))
A = cat_similar(X[1], T, shape)
if count(!iszero, catdims)::Int > 1
fill!(A, zero(T))
end
return __cat(A, shape, catdims, X...)
end

function __cat(A, shape::NTuple{M,Int}, catdims, X...) where M
function __cat(A, shape::NTuple{M}, catdims, X...) where M
N = M::Int
offsets = zeros(Int, N)
inds = Vector{UnitRange{Int}}(undef, N)
Expand Down
12 changes: 8 additions & 4 deletions base/arrayshow.jl
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ Alignment is reported as a vector of (left,right) tuples, one for each
column going across the screen.
"""
function alignment(io::IO, X::AbstractVecOrMat,
rows::AbstractVector, cols::AbstractVector,
cols_if_complete::Integer, cols_otherwise::Integer, sep::Integer)
a = Tuple{Int, Int}[]
rows::AbstractVector{T}, cols::AbstractVector{V},
cols_if_complete::Integer, cols_otherwise::Integer, sep::Integer) where {T,V}
a = Tuple{T, V}[]
for j in cols # need to go down each column one at a time
l = r = 0
for i in rows # plumb down and see what largest element sizes are
Expand Down Expand Up @@ -166,6 +166,11 @@ function print_matrix(io::IO, @nospecialize(X::AbstractVecOrMat),
vdots::AbstractString = "\u22ee",
ddots::AbstractString = " \u22f1 ",
hmod::Integer = 5, vmod::Integer = 5)
# use invokelatest to avoid backtracing in type invalidation, ref #37741
invokelatest(_print_matrix, io, X, pre, sep, post, hdots, vdots, ddots, hmod, vmod, unitrange(axes(X,1)), unitrange(axes(X,2)))
end

function _print_matrix(io, @nospecialize(X::AbstractVecOrMat), pre, sep, post, hdots, vdots, ddots, hmod, vmod, rowsA, colsA)
hmod, vmod = Int(hmod)::Int, Int(vmod)::Int
if !(get(io, :limit, false)::Bool)
screenheight = screenwidth = typemax(Int)
Expand All @@ -178,7 +183,6 @@ function print_matrix(io::IO, @nospecialize(X::AbstractVecOrMat),
postsp = ""
@assert textwidth(hdots) == textwidth(ddots)
sepsize = length(sep)::Int
rowsA, colsA = UnitRange{Int}(axes(X,1)), UnitRange{Int}(axes(X,2))
m, n = length(rowsA), length(colsA)
# To figure out alignments, only need to look at as many rows as could
# fit down screen. If screen has at least as many rows as A, look at A.
Expand Down
32 changes: 31 additions & 1 deletion base/compiler/utilities.jl
Original file line number Diff line number Diff line change
Expand Up @@ -139,15 +139,45 @@ end
const nonfunction_mt = typename(SimpleVector).mt

function get_compileable_sig(method::Method, @nospecialize(atypes), sparams::SimpleVector)
isa(atypes, DataType) || return Nothing
isa(atypes, DataType) || return nothing
mt = ccall(:jl_method_table_for, Any, (Any,), atypes)
mt === nothing && return nothing
return ccall(:jl_normalize_to_compilable_sig, Any, (Any, Any, Any, Any),
mt, atypes, sparams, method)
end

# eliminate UnionAll vars that might be degenerate due to having identical bounds,
# or a concrete upper bound and appearing covariantly.
function subst_trivial_bounds(@nospecialize(atypes))
if !isa(atypes, UnionAll)
return atypes
end
v = atypes.var
if isconcretetype(v.ub) || v.lb === v.ub
return subst_trivial_bounds(atypes{v.ub})
end
return UnionAll(v, subst_trivial_bounds(atypes.body))
end

# If removing trivial vars from atypes results in an equivalent type, use that
# instead. Otherwise we can get a case like issue #38888, where a signature like
# f(x::S) where S<:Int
# gets cached and matches a concrete dispatch case.
function normalize_typevars(method::Method, @nospecialize(atypes), sparams::SimpleVector)
at2 = subst_trivial_bounds(atypes)
if at2 !== atypes && at2 == atypes
atypes = at2
sp_ = ccall(:jl_type_intersection_with_env, Any, (Any, Any), at2, method.sig)::SimpleVector
sparams = sp_[2]::SimpleVector
end
return atypes, sparams
end

# get a handle to the unique specialization object representing a particular instantiation of a call
function specialize_method(method::Method, @nospecialize(atypes), sparams::SimpleVector, preexisting::Bool=false, compilesig::Bool=false)
if isa(atypes, UnionAll)
atypes, sparams = normalize_typevars(method, atypes, sparams)
end
if compilesig
new_atypes = get_compileable_sig(method, atypes, sparams)
new_atypes === nothing && return nothing
Expand Down
5 changes: 3 additions & 2 deletions base/loading.jl
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,8 @@ function project_deps_get(env::String, name::String)::Union{Nothing,PkgId}
end

function manifest_deps_get(env::String, where::PkgId, name::String)::Union{Nothing,PkgId}
@assert where.uuid !== nothing
uuid = where.uuid
@assert uuid !== nothing
project_file = env_project_file(env)
if project_file isa String
# first check if `where` names the Project itself
Expand All @@ -371,7 +372,7 @@ function manifest_deps_get(env::String, where::PkgId, name::String)::Union{Nothi
return PkgId(pkg_uuid, name)
end
# look for manifest file and `where` stanza
return explicit_manifest_deps_get(project_file, where.uuid, name)
return explicit_manifest_deps_get(project_file, uuid, name)
elseif project_file
# if env names a directory, search it
return implicit_manifest_deps_get(env, where, name)
Expand Down
2 changes: 1 addition & 1 deletion base/meta.jl
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ function _partially_inline!(@nospecialize(x), slot_replacements::Vector{Any},
return Core.GotoIfNot(
_partially_inline!(x.cond, slot_replacements, type_signature, static_param_values,
slot_offset, statement_offset, boundscheck),
x.dest,
x.dest + statement_offset,
)
end
if isa(x, Expr)
Expand Down
1 change: 1 addition & 0 deletions base/options.jl
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ struct JLOptions
image_file_specified::Int8
warn_scope::Int8
image_codegen::Int8
rr_detach::Int8
end

# This runs early in the sysimage != is not defined yet
Expand Down
3 changes: 3 additions & 0 deletions base/range.jl
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,8 @@ unitrange_last(start::T, stop::T) where {T} =
ifelse(stop >= start, convert(T,start+floor(stop-start)),
convert(T,start-oneunit(stop-start)))

unitrange(x) = UnitRange(x)

if isdefined(Main, :Base)
# Constant-fold-able indexing into tuples to functionally expose Base.tail and Base.front
function getindex(@nospecialize(t::Tuple), r::UnitRange)
Expand Down Expand Up @@ -332,6 +334,7 @@ struct OneTo{T<:Integer} <: AbstractUnitRange{T}
end
OneTo(stop::T) where {T<:Integer} = OneTo{T}(stop)
OneTo(r::AbstractRange{T}) where {T<:Integer} = OneTo{T}(r)
oneto(r) = OneTo(r)

## Step ranges parameterized by length

Expand Down
4 changes: 2 additions & 2 deletions base/reshapedarray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ rdims(out::Tuple{}, inds::NTuple{M,Any}) where {M} = ()
rdims(out::Tuple{Any}, inds::Tuple{}) = out # N == 1, M == 0
rdims(out::NTuple{N,Any}, inds::Tuple{}) where {N} = out # N > 1, M == 0
rdims(out::Tuple{Any}, inds::Tuple{Any}) = inds # N == 1, M == 1
rdims(out::Tuple{Any}, inds::NTuple{M,Any}) where {M} = (OneTo(rdims_trailing(inds...)),) # N == 1, M > 1
rdims(out::Tuple{Any}, inds::NTuple{M,Any}) where {M} = (oneto(rdims_trailing(inds...)),) # N == 1, M > 1
rdims(out::NTuple{N,Any}, inds::NTuple{N,Any}) where {N} = inds # N > 1, M == N
rdims(out::NTuple{N,Any}, inds::NTuple{M,Any}) where {N,M} = (first(inds), rdims(tail(out), tail(inds))...) # N > 1, M > 1, M != N

Expand Down Expand Up @@ -207,7 +207,7 @@ size(A::ReshapedArray) = A.dims
similar(A::ReshapedArray, eltype::Type, dims::Dims) = similar(parent(A), eltype, dims)
IndexStyle(::Type{<:ReshapedArrayLF}) = IndexLinear()
parent(A::ReshapedArray) = A.parent
parentindices(A::ReshapedArray) = map(OneTo, size(parent(A)))
parentindices(A::ReshapedArray) = map(oneto, size(parent(A)))
reinterpret(::Type{T}, A::ReshapedArray, dims::Dims) where {T} = reinterpret(T, parent(A), dims)
elsize(::Type{<:ReshapedArray{<:Any,<:Any,P}}) where {P} = elsize(P)

Expand Down
6 changes: 3 additions & 3 deletions base/subarray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ viewindexing(I::Tuple{Vararg{Any}}) = IndexCartesian()
viewindexing(I::Tuple{AbstractArray, Vararg{Any}}) = IndexCartesian()

# Simple utilities
size(V::SubArray) = (@_inline_meta; map(n->Int(unsafe_length(n)), axes(V)))
size(V::SubArray) = (@_inline_meta; map(unsafe_length, axes(V)))

similar(V::SubArray, T::Type, dims::Dims) = similar(V.parent, T, dims)

Expand Down Expand Up @@ -90,7 +90,7 @@ julia> parentindices(V)
(1, Base.Slice(Base.OneTo(2)))
```
"""
parentindices(a::AbstractArray) = map(OneTo, size(a))
parentindices(a::AbstractArray) = map(oneto, size(a))

## Aliasing detection
dataids(A::SubArray) = (dataids(A.parent)..., _splatmap(dataids, A.indices)...)
Expand All @@ -107,7 +107,7 @@ function unaliascopy(V::SubArray{T,N,A,I,LD}) where {T,N,A<:Array,I<:Tuple{Varar
end
# Transform indices to be "dense"
_trimmedindex(i::Real) = oftype(i, 1)
_trimmedindex(i::AbstractUnitRange) = oftype(i, OneTo(length(i)))
_trimmedindex(i::AbstractUnitRange) = oftype(i, oneto(length(i)))
_trimmedindex(i::AbstractArray) = oftype(i, reshape(eachindex(IndexLinear(), i), axes(i)))

## SubArray creation
Expand Down
Loading