From 89cce4cc0bf0bebc76eda55323641ff7af20ecd2 Mon Sep 17 00:00:00 2001 From: Shuhei Kadowaki <40514306+aviatesk@users.noreply.github.com> Date: Fri, 14 Jun 2024 13:29:55 +0900 Subject: [PATCH] inference: update `VALID_EXPR_HEADS` (#54789) 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. --- base/compiler/validation.jl | 4 ++-- test/compiler/ssair.jl | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/base/compiler/validation.jl b/base/compiler/validation.jl index 267b23bda8c0b..06649198fefb7 100644 --- a/base/compiler/validation.jl +++ b/base/compiler/validation.jl @@ -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, @@ -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 @@ -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 diff --git a/test/compiler/ssair.jl b/test/compiler/ssair.jl index 4e789da7815c9..06258f52cb69c 100644 --- a/test/compiler/ssair.jl +++ b/test/compiler/ssair.jl @@ -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)),