Skip to content

SharedArray not type stable #17101

Closed
Closed
@mauro3

Description

@mauro3

SharedArray constructor is not type stable. On 0.5:

julia> @code_warntype SharedArray(Int, 1)
Variables:
  #self#::Type{SharedArray}
  T::Type{Int64}
  I::Tuple{Int64}

Body:
  begin  # sharedarray.jl, line 114:
      return $(Expr(:invoke, #SharedArray#457(::Array{Any,1}, ::Type{T}, ::Type{T}, ::Int64, ::Vararg{Int64,N}), :(Base.#SharedArray#457), :((Core.ccall)(:jl_alloc_array_1d,(Core.apply_type)(Core.Array,Any,1)::Type{Array{Any,1}},(Core.svec)(Core.Any,Core.Int)::SimpleVector,Array{Any,1},0,0,0)::Array{Any,1}), :(#self#), :(T), :((Core.getfield)(I,1)::Int64)))
  end::Union{SharedArray{T,N},Void}

On 0.4, the inferred type is Any. I'm pretty sure Any was also inferred for 0.5 until recently, maybe #17095 changed this?
(I could have sworn I filed this two days ago, but apparently not...)

Metadata

Metadata

Assignees

No one assigned

    Labels

    parallelismParallel or distributed computation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions