Skip to content

Commit

Permalink
inference: update VALID_EXPR_HEADS (#54789)
Browse files Browse the repository at this point in the history
The `:enter` expression was replaced with `EnterNode` before, so we
don't need to handle it anymore. Also it's better to add `:public` to
`VALID_EXPR_HEADS` although we don't usually optimize a top-level thunk
containing `:public` expressions.
  • Loading branch information
aviatesk authored Jun 14, 2024
1 parent 54091ea commit 89cce4c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions base/compiler/validation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ const VALID_EXPR_HEADS = IdDict{Symbol,UnitRange{Int}}(
:new => 1:typemax(Int),
:splatnew => 2:2,
:the_exception => 0:0,
:enter => 1:2,
:leave => 1:typemax(Int),
:pop_exception => 1:1,
:inbounds => 1:1,
Expand All @@ -38,6 +37,7 @@ const VALID_EXPR_HEADS = IdDict{Symbol,UnitRange{Int}}(
:import => 1:typemax(Int),
:using => 1:typemax(Int),
:export => 1:typemax(Int),
:public => 1:typemax(Int),
)

# @enum isn't defined yet, otherwise I'd use it for this
Expand Down Expand Up @@ -147,7 +147,7 @@ function validate_code!(errors::Vector{InvalidCodeError}, c::CodeInfo, is_top_le
elseif head === :call || head === :invoke || x.head === :invoke_modify ||
head === :gc_preserve_end || head === :meta ||
head === :inbounds || head === :foreigncall || head === :cfunction ||
head === :const || head === :enter || head === :leave || head === :pop_exception ||
head === :const || head === :leave || head === :pop_exception ||
head === :method || head === :global || head === :static_parameter ||
head === :new || head === :splatnew || head === :thunk || head === :loopinfo ||
head === :throw_undef_if_not || head === :code_coverage_effect || head === :inline || head === :noinline
Expand Down
2 changes: 1 addition & 1 deletion test/compiler/ssair.jl
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ let

# this isn't valid code, we just care about looking at a variety of IR nodes
body = Any[
Expr(:enter, 11),
EnterNode(11),
Expr(:call, :+, SSAValue(3), 1),
Expr(:throw_undef_if_not, :expected, false),
Expr(:leave, Core.SSAValue(1)),
Expand Down

0 comments on commit 89cce4c

Please sign in to comment.