Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
jiahao committed Jun 25, 2014
2 parents cc438f7 + 3e6a6c7 commit 860a684
Show file tree
Hide file tree
Showing 16 changed files with 435 additions and 216 deletions.
224 changes: 119 additions & 105 deletions NEWS.md

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions base/boot.jl
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,8 @@ export
#nan_dom_err, copysign_float, ctlz_int, ctpop_int, cttz_int,
#div_float, eq_float, eq_int, eqfsi64, eqfui64, flipsign_int, select_value,
#sqrt_llvm, powi_llvm,
#fpext64, fpiseq, fpislt, fpsiround, fpuiround, fptosi, fptoui,
#fptrunc32, le_float, lefsi64, lefui64, lesif64,
#fpext, fpiseq, fpislt, fpsiround, fpuiround, fptosi, fptoui,
#fptrunc, le_float, lefsi64, lefui64, lesif64,
#leuif64, lshr_int, lt_float, ltfsi64, ltfui64, ltsif64, ltuif64, mul_float,
#mul_int, ne_float, ne_int, neg_float, neg_int, not_int, or_int, rem_float,
#sdiv_int, shl_int, sitofp, sle_int, slt_int, smod_int,
Expand Down
8 changes: 4 additions & 4 deletions base/dict.jl
Original file line number Diff line number Diff line change
Expand Up @@ -288,11 +288,11 @@ end

empty!(t::ObjectIdDict) = (t.ht = cell(length(t.ht)); t)

start(t::ObjectIdDict) = 0
done(t::ObjectIdDict, i) = is(next(t,i),())
next(t::ObjectIdDict, i) = ccall(:jl_eqtable_next, Any, (Any, Uint32), t.ht, i)
_oidd_nextind(a, i) = int(ccall(:jl_eqtable_nextind, Csize_t, (Any, Csize_t), a, i))

isempty(t::ObjectIdDict) = is(next(t,0),())
start(t::ObjectIdDict) = _oidd_nextind(t.ht, 0)
done(t::ObjectIdDict, i) = (i == -1)
next(t::ObjectIdDict, i) = ((t.ht[i+1],t.ht[i+2]), _oidd_nextind(t.ht, i+2))

function length(d::ObjectIdDict)
n = 0
Expand Down
12 changes: 6 additions & 6 deletions base/float.jl
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,15 @@ convert(::Type{Float32}, x::Float64) = box(Float32,fptrunc(Float32,x))
convert(::Type{Float64}, x::Float16) = convert(Float64, convert(Float32,x))
convert(::Type{Float64}, x::Float32) = box(Float64,fpext(Float64,x))

convert(::Type{FloatingPoint}, x::Bool) = convert(Float32, x)
convert(::Type{FloatingPoint}, x::Char) = convert(Float32, x)
convert(::Type{FloatingPoint}, x::Int8) = convert(Float32, x)
convert(::Type{FloatingPoint}, x::Int16) = convert(Float32, x)
convert(::Type{FloatingPoint}, x::Bool) = convert(Float64, x)
convert(::Type{FloatingPoint}, x::Char) = convert(Float64, x)
convert(::Type{FloatingPoint}, x::Int8) = convert(Float64, x)
convert(::Type{FloatingPoint}, x::Int16) = convert(Float64, x)
convert(::Type{FloatingPoint}, x::Int32) = convert(Float64, x)
convert(::Type{FloatingPoint}, x::Int64) = convert(Float64, x) # LOSSY
convert(::Type{FloatingPoint}, x::Int128) = convert(Float64, x) # LOSSY
convert(::Type{FloatingPoint}, x::Uint8) = convert(Float32, x)
convert(::Type{FloatingPoint}, x::Uint16) = convert(Float32, x)
convert(::Type{FloatingPoint}, x::Uint8) = convert(Float64, x)
convert(::Type{FloatingPoint}, x::Uint16) = convert(Float64, x)
convert(::Type{FloatingPoint}, x::Uint32) = convert(Float64, x)
convert(::Type{FloatingPoint}, x::Uint64) = convert(Float64, x) # LOSSY
convert(::Type{FloatingPoint}, x::Uint128) = convert(Float64, x) # LOSSY
Expand Down
7 changes: 7 additions & 0 deletions base/inference.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1994,6 +1994,13 @@ function inlineable(f, e::Expr, atypes, sv, enclosing_ast)
return (e.args[3],())
end
end
if is(f, typeassert) && length(atypes)==2
# typeassert(x::S, T) => x, when S<:T
if isType(atypes[2]) && isleaftype(atypes[2]) &&
atypes[1] <: atypes[2].parameters[1]
return (e.args[2],())
end
end
if length(atypes)==2 && is(f,unbox) && isa(atypes[2],DataType) && !atypes[2].mutable && atypes[2].pointerfree
# remove redundant unbox
return (e.args[3],())
Expand Down
4 changes: 2 additions & 2 deletions base/multimedia.jl
Original file line number Diff line number Diff line change
Expand Up @@ -192,15 +192,15 @@ end

function redisplay(x)
for i = length(displays):-1:1
applicable(redisplay, displays[i], x) &&
xdisplayable(displays[i], x) &&
@try_display return redisplay(displays[i], x)
end
throw(MethodError(redisplay, (x,)))
end

function redisplay(m::Union(MIME,String), x)
for i = length(displays):-1:1
applicable(redisplay, displays[i], m, x) &&
xdisplayable(displays[i], m, x) &&
@try_display return redisplay(displays[i], m, x)
end
throw(MethodError(redisplay, (m, x)))
Expand Down
13 changes: 7 additions & 6 deletions base/reduce.jl
Original file line number Diff line number Diff line change
Expand Up @@ -136,12 +136,13 @@ mapreduce_impl(f, op, A::AbstractArray, ifirst::Int, ilast::Int) =

# handling empty arrays
mr_empty(f, op, T) = error("Reducing over an empty array is not allowed.")
mr_empty(::IdFun, op::AddFun, T) = r_promote(op, zero(T))
mr_empty(::AbsFun, op::AddFun, T) = r_promote(op, abs(zero(T)))
mr_empty(::Abs2Fun, op::AddFun, T) = r_promote(op, abs2(zero(T)))
mr_empty(::IdFun, op::MulFun, T) = r_promote(op, one(T))
mr_empty(::AbsFun, op::MaxFun, T) = abs(zero(T))
mr_empty(::Abs2Fun, op::MaxFun, T) = abs2(zero(T))
# use zero(T)::T to improve type information when zero(T) is not defined
mr_empty(::IdFun, op::AddFun, T) = r_promote(op, zero(T)::T)
mr_empty(::AbsFun, op::AddFun, T) = r_promote(op, abs(zero(T)::T))
mr_empty(::Abs2Fun, op::AddFun, T) = r_promote(op, abs2(zero(T)::T))
mr_empty(::IdFun, op::MulFun, T) = r_promote(op, one(T)::T)
mr_empty(::AbsFun, op::MaxFun, T) = abs(zero(T)::T)
mr_empty(::Abs2Fun, op::MaxFun, T) = abs2(zero(T)::T)
mr_empty(f, op::AndFun, T) = true
mr_empty(f, op::OrFun, T) = false

Expand Down
16 changes: 16 additions & 0 deletions doc/NEWS-update.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Script to automatically insert Markdown footnotes for all [#xxxx] issue
# cross-references in the NEWS file.

NEWS = get(ARGS, 1, "NEWS.md")

s = readall(NEWS)

s = s[1:match(r"\[#[0-9]+\]:", s).offset-1];

footnote(n) = "[#$n]: https://github.com/JuliaLang/julia/issues/$n"
N = map(m -> parseint(m.captures[1]), eachmatch(r"\[#([0-9]+)\]", s))
foots = join(map(footnote, sort!(unique(N))), "\n")

open(NEWS, "w") do f
println(f, s, foots)
end
Loading

0 comments on commit 860a684

Please sign in to comment.