Skip to content

Commit

Permalink
make Type{Union{}} ismutationfree (#48417)
Browse files Browse the repository at this point in the history
  • Loading branch information
gbaraldi authored Jan 28, 2023
1 parent 8b9da8d commit f6f6b1c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/jltypes.c
Original file line number Diff line number Diff line change
Expand Up @@ -2204,6 +2204,7 @@ void jl_init_types(void) JL_GC_DISABLED
((jl_datatype_t*)jl_type_type)->cached_by_hash = 0;
jl_type_typename->wrapper = jl_new_struct(jl_unionall_type, tttvar, (jl_value_t*)jl_type_type);
jl_type_type = (jl_unionall_t*)jl_type_typename->wrapper;
((jl_datatype_t*)jl_type_type->body)->ismutationfree = 1;

jl_typeofbottom_type->super = jl_wrap_Type(jl_bottom_type);

Expand Down Expand Up @@ -2807,7 +2808,6 @@ void jl_init_types(void) JL_GC_DISABLED
jl_symbol_type->ismutationfree = jl_symbol_type->isidentityfree = 1;
jl_simplevector_type->ismutationfree = jl_simplevector_type->isidentityfree = 1;
jl_datatype_type->ismutationfree = 1;
((jl_datatype_t*)jl_type_type->body)->ismutationfree = 1;

// Technically not ismutationfree, but there's a separate system to deal
// with mutations for global state.
Expand Down
3 changes: 3 additions & 0 deletions test/compiler/effects.jl
Original file line number Diff line number Diff line change
Expand Up @@ -740,3 +740,6 @@ end |> !Core.Compiler.is_consistent
ImmutRef(x) = $(Expr(:new, :(ImmutRef{typeof(x)}), :x))
end
@test Core.Compiler.is_foldable(Base.infer_effects(ImmutRef, Tuple{Any}))

@test Base.ismutationfree(Type{Union{}})
@test Core.Compiler.is_total(Base.infer_effects(typejoin, ()))

4 comments on commit f6f6b1c

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Executing the daily package evaluation, I will reply here when finished:

@nanosoldier runtests(isdaily = true)

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your package evaluation job has completed - possible new issues were detected.
A full report can be found here.

@vtjnash
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nanosoldier runbenchmarks(ALL, isdaily = true)

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your benchmark job has completed - possible performance regressions were detected. A full report can be found here.

Please sign in to comment.