Skip to content

Commit

Permalink
Merge branch 'master' into kf/failbreakpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
Keno authored Mar 17, 2022
2 parents 110e0ee + b9b2a3c commit f9cfff8
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 3 deletions.
6 changes: 3 additions & 3 deletions base/compiler/tfuncs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1811,11 +1811,11 @@ function builtin_effects(f::Builtin, argtypes::Vector{Any}, rt)
nothrow = isvarargtype(argtypes[end]) ? false :
builtin_nothrow(f, argtypes[2:end], rt)
end
effect_free = f === isdefined
effect_free = true
elseif f === getglobal && length(argtypes) >= 3
nothrow = effect_free = getglobal_nothrow(argtypes[2:end])
nothrow = getglobal_nothrow(argtypes[2:end])
ipo_consistent = nothrow && isconst((argtypes[2]::Const).val, (argtypes[3]::Const).val)
#effect_free = nothrow && isbindingresolved((argtypes[2]::Const).val, (argtypes[3]::Const).val)
effect_free = true
else
ipo_consistent = contains_is(_CONSISTENT_BUILTINS, f)
effect_free = contains_is(_EFFECT_FREE_BUILTINS, f) || contains_is(_PURE_BUILTINS, f)
Expand Down
19 changes: 19 additions & 0 deletions base/strings/lazy.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,15 @@ of functions).
This type is designed to be cheap to construct at runtime, trying to offload
as much work as possible to either the macro or later printing operations.
# Examples
```jldoctest
julia> n = 5; str = LazyString("n is ", n)
"n is 5"
```
See also [`lazy"str"`](@ref).
!!! compat "Julia 1.8"
`LazyString` requires Julia 1.8 or later.
"""
Expand All @@ -26,6 +35,16 @@ Create a [`LazyString`](@ref) using regular string interpolation syntax.
Note that interpolations are *evaluated* at LazyString construction time,
but *printing* is delayed until the first access to the string.
# Examples
```
julia> n = 5; str = lazy"n is \$n"
"n is 5"
julia> typeof(str)
LazyString
```
!!! compat "Julia 1.8"
`lazy"str"` requires Julia 1.8 or later.
"""
Expand Down
3 changes: 3 additions & 0 deletions test/compiler/irpasses.jl
Original file line number Diff line number Diff line change
Expand Up @@ -831,3 +831,6 @@ let ci = code_typed(foo_cfg_empty, Tuple{Bool}, optimize=true)[1][1]
@test length(ir.cfg.blocks) <= 2
@test isa(ir.stmts[length(ir.stmts)][:inst], ReturnNode)
end

@test Core.Compiler.builtin_effects(getfield, Any[Complex{Int}, Symbol], Any).effect_free.state == 0x01
@test Core.Compiler.builtin_effects(getglobal, Any[Module, Symbol], Any).effect_free.state == 0x01

0 comments on commit f9cfff8

Please sign in to comment.