Skip to content

Commit

Permalink
remove now unnecessary effects annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
aviatesk committed Jun 15, 2023
1 parent ac77a59 commit 538a511
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 18 deletions.
2 changes: 1 addition & 1 deletion base/math.jl
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ end
Base.@assume_effects :terminates_locally @inline function exthorner(x, p::Tuple)
hi, lo = p[end], zero(x)
for i in length(p)-1:-1:1
pi = getfield(p, i) # needed to prove consistency
pi = @inbounds p[i]
prod, err = two_mul(hi,x)
hi = pi+prod
lo = fma(lo, x, prod - (hi - pi) + err)
Expand Down
5 changes: 2 additions & 3 deletions base/special/exp.jl
Original file line number Diff line number Diff line change
Expand Up @@ -174,10 +174,9 @@ const J_TABLE = (0x0000000000000000, 0xaac00b1afa5abcbe, 0x9b60163da9fb3335, 0xa
0xa66f0f9c1cb64129, 0x93af252b376bba97, 0xacdf3ac948dd7273, 0x99df50765b6e4540, 0x9faf6632798844f8,
0xa12f7bfdad9cbe13, 0xaeef91d802243c88, 0x874fa7c1819e90d8, 0xacdfbdba3692d513, 0x62efd3c22b8f71f1, 0x74afe9d96b2a23d9)

# :nothrow needed since the compiler can't prove `ind` is inbounds.
Base.@assume_effects :nothrow function table_unpack(ind::Int32)
function table_unpack(ind::Int32)
ind = ind & 255 + 1 # 255 == length(J_TABLE) - 1
j = getfield(J_TABLE, ind) # use getfield so the compiler can prove consistent
j = @inbounds J_TABLE[ind]
jU = reinterpret(Float64, JU_CONST | (j&JU_MASK))
jL = reinterpret(Float64, JL_CONST | (j>>8))
return jU, jL
Expand Down
13 changes: 3 additions & 10 deletions base/special/log.jl
Original file line number Diff line number Diff line change
Expand Up @@ -155,10 +155,7 @@ logbU(::Type{Float64},::Val{10}) = 0.4342944819032518
logbL(::Type{Float64},::Val{10}) = 1.098319650216765e-17

# Procedure 1
# XXX we want to mark :consistent-cy here so that this function can be concrete-folded,
# because the effect analysis currently can't prove it in the presence of `@inbounds` or
# `:boundscheck`, but still the access to `t_log_Float64` is really safe here
Base.@assume_effects :consistent @inline function log_proc1(y::Float64,mf::Float64,F::Float64,f::Float64,base=Val(:ℯ))
@inline function log_proc1(y::Float64,mf::Float64,F::Float64,f::Float64,base=Val(:ℯ))
jp = unsafe_trunc(Int,128.0*F)-127

## Steps 1 and 2
Expand Down Expand Up @@ -216,10 +213,7 @@ end
end

# Procedure 1
# XXX we want to mark :consistent-cy here so that this function can be concrete-folded,
# because the effect analysis currently can't prove it in the presence of `@inbounds` or
# `:boundscheck`, but still the access to `t_log_Float32` is really safe here
Base.@assume_effects :consistent @inline function log_proc1(y::Float32,mf::Float32,F::Float32,f::Float32,base=Val(:ℯ))
@inline function log_proc1(y::Float32,mf::Float32,F::Float32,f::Float32,base=Val(:ℯ))
jp = unsafe_trunc(Int,128.0f0*F)-127

## Steps 1 and 2
Expand Down Expand Up @@ -571,8 +565,7 @@ function _log_ext(xu)
z = reinterpret(Float64, xu - (tmp & 0xfff0000000000000))
k = Float64(tmp >> 52)
# log(x) = k*Ln2 + log(c) + log1p(z/c-1).
# getfield instead of getindex to satisfy effect analysis not knowing whether this is inbounds
t, logctail = getfield(t_log_table_compact, Int(i+1))
t, logctail = @inbounds t_log_table_compact[Int(i+1)]
invc, logc = log_tab_unpack(t)
# Note: invc is j/N or j/N/2 where j is an integer in [N,2N) and
# |z/c - 1| < 1/N, so r = z/c - 1 is exactly representable.
Expand Down
5 changes: 1 addition & 4 deletions base/special/rem_pio2.jl
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,7 @@ function fromfraction(f::Int128)
return (z1,z2)
end

# XXX we want to mark :consistent-cy here so that this function can be concrete-folded,
# because the effect analysis currently can't prove it in the presence of `@inbounds` or
# `:boundscheck`, but still the accesses to `INV_2PI` are really safe here
Base.@assume_effects :consistent function paynehanek(x::Float64)
function paynehanek(x::Float64)
# 1. Convert to form
#
# x = X * 2^k,
Expand Down

0 comments on commit 538a511

Please sign in to comment.