Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
* upstream/master: (83 commits)
  Fix bug in the iterator for SpDiagIterator, and some other cleanups. Fix JuliaLang#5004.
  add inbounds to broadcast. closes JuliaLang#5002
  Fix/improve matrix-vector At_mul_B! and Ac_mul_B!
  Use @inbounds for filt
  Add test for Woodbury solve!()
  Woodbury: solve -> solve! (fixes Grid.jl issue 9)
  Enabled codespeed for spelling performance test.
  handle any-length error messages in jl_errorf. fixes JuliaLang#4992
  fix LLVM issues with corrected stack alignment code for windows
  Pkg.add: remove now-unnecessary work-around for JuliaLang#4979
  use `==` by default in `in`. ref JuliaLang#4941
  fix a bug in the localize_vars syntax transformation. fixes JuliaLang#4979
  fix error line number when a function is left open. fixes JuliaLang#4984
  fix stack alignment bug on win32
  better syntax error for assignments in tuples. fixes JuliaLang#4982
  Fix issue 4986 -- SparseMatrixCSC reinterpret bug
  Update cjh in .mailmap
  hex2bytes, bytes2hex: better error messages; make bytes2hex([]) work.
  Added perf test for julia port of Peter Norvig's spelling corrector
  From 93274a3: Array -> AbstractArray
  ...

Conflicts:
	doc/stdlib/base.rst
  • Loading branch information
Michael Fox committed Dec 3, 2013
2 parents 754fb5e + c3565dc commit b830fa1
Show file tree
Hide file tree
Showing 68 changed files with 941 additions and 344 deletions.
6 changes: 6 additions & 0 deletions .mailmap
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ Stephan Boyer <boyers@mit.edu> <stephan@julialang.xvm.mit.edu>
Stephan Boyer <boyers@mit.edu> <stephan@ubuntu.(none)>
Stephan Boyer <boyers@mit.edu> <stephan@ubuntu.ubuntu-domain>

Jiahao Chen <jiahao@mit.edu> Jiahao Chen (陈家豪) <jiahao@mit.edu>

Giuseppe Zingales <giuseppe.pet.zingales@gmail.com> <giuseppe.pet.zingales@gmail.com>
Giuseppe Zingales <giuseppe.pet.zingales@gmail.com> <g3@ubuntu.ubuntu-domain>

Expand Down Expand Up @@ -91,6 +93,10 @@ Francois Pepin <fpepin@gmail.com> <fpepin@gmail.com>
Waldir Pimenta <waldir@email.com> <waldir@email.com>

Steven G. Johnson <stevenj@alum.mit.edu> <stevenj@mit.edu>
Steven G. Johnson <stevenj@alum.mit.edu> <stevenj@math.mit.edu>
Steven G. Johnson <stevenj@alum.mit.edu> <stevenj@fftw.org>
Steven G. Johnson <stevenj@alum.mit.edu> <stevenj.mit@gmail.com>
Steven G. Johnson <stevenj@alum.mit.edu> <stevenj@ab-initio.mit.edu>

Isaiah Norton <isaiah.norton@gmail.com> <isaiah.norton@gmail.com>
Isaiah Norton <isaiah.norton@gmail.com> <inorton@bwh.harvard.edu>
Expand Down
7 changes: 5 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ VERSDIR = v`cut -d. -f1-2 < VERSION`
all: default
default: release

DIRS = $(BUILD)/bin $(BUILD)/etc/julia $(BUILD)/lib $(BUILD)/share/julia $(BUILD)/share/julia/man/man1
DIRS = $(BUILD)/bin $(BUILD)/etc/julia $(BUILD)/lib $(BUILD)/libexec $(BUILD)/share/julia $(BUILD)/share/julia/man/man1
ifneq ($(JL_LIBDIR),bin)
ifneq ($(JL_LIBDIR),lib)
DIRS += $(BUILD)/$(JL_LIBDIR)
Expand Down Expand Up @@ -162,7 +162,9 @@ install:
@for subdir in "bin" "libexec" $(JL_LIBDIR) $(JL_PRIVATE_LIBDIR) "share/julia" "share/man/man1" "include/julia" "share/julia/site/"$(VERSDIR) "etc/julia" ; do \
mkdir -p $(PREFIX)/$$subdir ; \
done
cp -a $(BUILD)/bin $(PREFIX)
cp -a $(BUILD)/bin/julia* $(PREFIX)/bin/
-cp -a $(BUILD)/bin/*.dll $(BUILD)/bin/*.bat $(PREFIX)/bin/
cp -a $(BUILD)/libexec $(PREFIX)
ifneq ($(OS),WINNT)
cd $(PREFIX)/bin && ln -sf julia-$(DEFAULT_REPL) julia
endif
Expand All @@ -175,6 +177,7 @@ endif
ifeq ($(USE_SYSTEM_LIBUV),0)
ifeq ($(OS),WINNT)
cp -a $(BUILD)/lib/libuv.a $(PREFIX)/$(JL_PRIVATE_LIBDIR)
cp -a $(BUILD)/include/tree.h $(PREFIX)/include/julia
else
cp -a $(BUILD)/$(JL_LIBDIR)/libuv.a $(PREFIX)/$(JL_PRIVATE_LIBDIR)
endif
Expand Down
8 changes: 8 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,14 @@ Library improvements
* New Pkg.submit(pkg[,commit]) function to automatically submit
a Github pull request to the package author.

* Triple-quoted regex strings, `r"""..."""` ([#4934]).

* New string type, `UTF16String` ([#4930]).

* `CharString` is renamed to `UTF32String` ([#4943]).

* Faster sparse `kron` ([#4958]).

Deprecated or removed
---------------------

Expand Down
2 changes: 1 addition & 1 deletion base/broadcast.jl
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ function code_map!_inner(fname::Symbol, dest, extra_args::Vector,
@gensym k
code_inner(fname, {dest, extra_args...}, :($k=1),
(els...)->quote
$dest[$k] = $(innermost(:($dest[$k]), els...))
@inbounds $dest[$k] = $(innermost(:($dest[$k]), els...))
$k += 1
end)
end
Expand Down
2 changes: 1 addition & 1 deletion base/char.jl
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,4 @@ sizeof(::Type{Char}) = 4
## printing & showing characters ##

print(io::IO, c::Char) = (write(io,c); nothing)
show(io::IO, c::Char) = (print(io,'\''); print_escaped(io,CharString(c),"'"); print(io,'\''))
show(io::IO, c::Char) = (print(io,'\''); print_escaped(io,UTF32String(c),"'"); print(io,'\''))
4 changes: 3 additions & 1 deletion base/client.jl
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ function process_options(args::Array{Any,1})
color_set = true
global have_color = true
elseif args[i][8] == '='
val = args[i][9:]
val = args[i][9:end]
if in(val, ("no","0","false"))
color_set = true
global have_color = false
Expand Down Expand Up @@ -371,6 +371,8 @@ function _start()
fdwatcher_reinit()
# Initialize RNG
Random.librandom_init()
# Ensure PCRE is compatible with the compiled reg-exes
PCRE.check_pcre()
# Check that BLAS is correctly built
check_blas()
LinAlg.init()
Expand Down
14 changes: 7 additions & 7 deletions base/combinatorics.jl
Original file line number Diff line number Diff line change
Expand Up @@ -445,10 +445,10 @@ function nextprod(a::Vector{Int}, x)
error("unsafe for x bigger than typemax(Int)")
end
k = length(a)
v = ones(Int, k) # current value of each counter
mx = int(nextpow(a, x)) # maximum value of each counter
v[1] = mx[1] # start at first case that is >= x
p::morebits(Int) = mx[1] # initial value of product in this case
v = ones(Int, k) # current value of each counter
mx = [nextpow(ai,x) for ai in a] # maximum value of each counter
v[1] = mx[1] # start at first case that is >= x
p::morebits(Int) = mx[1] # initial value of product in this case
best = p
icarry = 1

Expand Down Expand Up @@ -486,9 +486,9 @@ function prevprod(a::Vector{Int}, x)
error("unsafe for x bigger than typemax(Int)")
end
k = length(a)
v = ones(Int, k) # current value of each counter
mx = int(nextpow(a, x)) # allow each counter to exceed p (sentinel)
first = int(prevpow(a[1], x)) # start at best case in first factor
v = ones(Int, k) # current value of each counter
mx = [nextpow(ai,x) for ai in a] # allow each counter to exceed p (sentinel)
first = int(prevpow(a[1], x)) # start at best case in first factor
v[1] = first
p::morebits(Int) = first
best = p
Expand Down
2 changes: 1 addition & 1 deletion base/darray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ function reshape{T,S<:Array}(A::DArray{T,1,S}, d::Dims)

B = Array(T,sz)
nr = size(B,1)
sztail = size(B)[2:]
sztail = size(B)[2:end]

for i=1:div(length(B),nr)
i2 = ind2sub(sztail, i)
Expand Down
2 changes: 1 addition & 1 deletion base/datafmt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ end
writedlm{T}(io::IO, a::AbstractArray{T,0}, dlm::Char) = writedlm(io, reshape(a,1), dlm)

function writedlm(io::IO, a::AbstractArray, dlm::Char)
tail = size(a)[3:]
tail = size(a)[3:end]
function print_slice(idxs...)
writedlm(io, sub(a, 1:size(a,1), 1:size(a,2), idxs...), dlm)
if idxs != tail
Expand Down
3 changes: 3 additions & 0 deletions base/deprecated.jl
Original file line number Diff line number Diff line change
Expand Up @@ -356,5 +356,8 @@ export mmread
export Stat
const Stat = StatStruct

export CharString
const CharString = UTF32String

# 0.3 discontinued functions

4 changes: 2 additions & 2 deletions base/dict.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ haskey(d::Associative, k) = in(k,keys(d))

function in(p::(Any,Any), a::Associative)
v = get(a,p[1],secret_table_token)
!is(v, secret_table_token) && isequal(v, p[2])
!is(v, secret_table_token) && (v == p[2])
end

function show{K,V}(io::IO, t::Associative{K,V})
Expand Down Expand Up @@ -316,7 +316,7 @@ Dict{K,V}(ks::(K...), vs::(V...)) = Dict{K ,V }(ks, vs)
Dict{K }(ks::(K...), vs::Tuple ) = Dict{K ,Any}(ks, vs)
Dict{V }(ks::Tuple , vs::(V...)) = Dict{Any,V }(ks, vs)

Dict{K,V}(kv::Array{(K,V)}) = Dict{K,V}(kv)
Dict{K,V}(kv::AbstractArray{(K,V)}) = Dict{K,V}(kv)

similar{K,V}(d::Dict{K,V}) = (K=>V)[]

Expand Down
24 changes: 14 additions & 10 deletions base/dsp.jl
Original file line number Diff line number Diff line change
Expand Up @@ -47,20 +47,24 @@ function filt{T<:Number}(b::Union(AbstractVector{T}, T),a::Union(AbstractVector{
a = newa
end

for i=1:xs
y[i] = si[1] + b[1]*x[i]
for j=1:(silen-1)
si[j] = si[j+1] + b[j+1]*x[i] - a[j+1]*y[i]
@inbounds begin
for i=1:xs
y[i] = si[1] + b[1]*x[i]
for j=1:(silen-1)
si[j] = si[j+1] + b[j+1]*x[i] - a[j+1]*y[i]
end
si[silen] = b[silen+1]*x[i] - a[silen+1]*y[i]
end
si[silen] = b[silen+1]*x[i] - a[silen+1]*y[i]
end
else
for i=1:xs
y[i] = si[1] + b[1]*x[i]
for j=1:(silen-1)
si[j] = si[j+1] + b[j+1]*x[i]
@inbounds begin
for i=1:xs
y[i] = si[1] + b[1]*x[i]
for j=1:(silen-1)
si[j] = si[j+1] + b[j+1]*x[i]
end
si[silen] = b[silen+1]*x[i]
end
si[silen] = b[silen+1]*x[i]
end
end
return y
Expand Down
3 changes: 2 additions & 1 deletion base/exports.jl
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ export
BitMatrix,
BitVector,
BunchKaufman,
CharString,
Cholesky,
CholeskyPivoted,
Cmd,
Expand Down Expand Up @@ -105,6 +104,7 @@ export
Triangular,
Tridiagonal,
UTF16String,
UTF32String,
VecOrMat,
Vector,
VersionNumber,
Expand Down Expand Up @@ -819,6 +819,7 @@ export
uppercase,
utf8,
utf16,
utf32,
warn,
xdump,

Expand Down
2 changes: 1 addition & 1 deletion base/expr.jl
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ function find_vars(e, lst)
else
push!(lst, e)
end
elseif isa(e,Expr)
elseif isa(e,Expr) && e.head !== :quote && e.head !== :top
for x in e.args
find_vars(x,lst)
end
Expand Down
27 changes: 11 additions & 16 deletions base/gmp.jl
Original file line number Diff line number Diff line change
Expand Up @@ -34,22 +34,17 @@ function gmp_init()
end

BigInt(x::BigInt) = x
BigInt(s::String) = parseint(BigInt,s)

function mpz_set_str(x::String, b::Integer)
function Base.parseint_nocheck(::Type{BigInt}, s::String, base::Int)
s = bytestring(s)
sgn, base, i = Base.parseint_preamble(true,s,base)
z = BigInt()
err = ccall((:__gmpz_set_str, :libgmp), Int32, (Ptr{BigInt}, Ptr{Uint8}, Int32), &z, bytestring(x), b)
if err != 0; error("string is not a valid integer"); end
return z
end

# note: 0 is a special base value that uses leading characters (0x, 0b, 0)
BigInt(x::String) = mpz_set_str(x, 0)

function parseint(::Type{BigInt}, s::String, base::Integer=10)
if !(2 <= base <= 62)
error("invalid base: $b. Base b must satisfy: 2 <= b =< 62.")
end
mpz_set_str(s, base)
err = ccall((:__gmpz_set_str, :libgmp),
Int32, (Ptr{BigInt}, Ptr{Uint8}, Int32),
&z, convert(Ptr{Uint8},SubString(s,i)), base)
err == 0 || error("invalid big integer: $(repr(s))")
return sgn < 0 ? -z : z
end

function BigInt(x::Union(Clong,Int32))
Expand Down Expand Up @@ -133,8 +128,8 @@ if sizeof(Int32) == sizeof(Clong)
end
if sizeof(Int64) == sizeof(Clong)
function convert(::Type{Uint128}, x::BigInt)
uint128(uint(ax>>>64))<<64 +
uint128(uint(ax & typemax(Uint64)))
uint128(uint(x>>>64))<<64 +
uint128(uint(x & typemax(Uint64)))
end
end
convert(::Type{Int128}, x::BigInt) = copysign(int128(uint128(abs(x))),x)
Expand Down
14 changes: 7 additions & 7 deletions base/inference.jl
Original file line number Diff line number Diff line change
Expand Up @@ -660,7 +660,7 @@ function abstract_call(f, fargs, argtypes, vtypes, sv::StaticVarInfo, e)
af = isconstantfunc(fargs[1], sv)
end
if !is(af,false)
aargtypes = argtypes[2:]
aargtypes = argtypes[2:end]
if all(x->isa(x,Tuple), aargtypes) &&
!any(isvatuple, aargtypes[1:(length(aargtypes)-1)])
e.head = :call1
Expand Down Expand Up @@ -704,7 +704,7 @@ function abstract_call(f, fargs, argtypes, vtypes, sv::StaticVarInfo, e)
sig = argtypes[2]
if isa(sig,Tuple) && all(isType, sig)
sig = map(t->t.parameters[1], sig)
return invoke_tfunc(af, sig, argtypes[3:])
return invoke_tfunc(af, sig, argtypes[3:end])
end
end
end
Expand Down Expand Up @@ -751,7 +751,7 @@ function abstract_eval_arg(a::ANY, vtypes::ANY, sv::StaticVarInfo)
end

function abstract_eval_call(e, vtypes, sv::StaticVarInfo)
fargs = e.args[2:]
fargs = e.args[2:end]
argtypes = tuple([abstract_eval_arg(a, vtypes, sv) for a in fargs]...)
if any(x->is(x,None), argtypes)
return None
Expand Down Expand Up @@ -1204,7 +1204,7 @@ function typeinf(linfo::LambdaStaticData,atypes::Tuple,sparams::Tuple, def, cop)
end
s[1][args[la]] = Tuple
else
s[1][args[la]] = limit_tuple_depth(atypes[la:])
s[1][args[la]] = limit_tuple_depth(atypes[la:end])
end
la -= 1
else
Expand Down Expand Up @@ -1483,7 +1483,7 @@ function eval_annotate(e::ANY, vtypes::ANY, sv::StaticVarInfo, decls, clo)
end
if (head === :call || head === :call1) && isa(e.args[1],LambdaStaticData)
called = e.args[1]
fargs = e.args[2:]
fargs = e.args[2:end]
argtypes = tuple([abstract_eval_arg(a, vtypes, sv) for a in fargs]...)
# recur inside inner functions once we have all types
tr,ty = typeinf(called, argtypes, called.sparams, called, false)
Expand Down Expand Up @@ -1725,7 +1725,7 @@ function inlineable(f, e::Expr, sv, enclosing_ast)
if !(isa(f,Function) || isstructtype(f) || isa(f,IntrinsicFunction))
return NF
end
argexprs = e.args[2:]
argexprs = e.args[2:end]
atypes = tuple(map(exprtype, argexprs)...)
if length(atypes) > MAX_TUPLETYPE_LEN
atypes = limit_tuple_type(atypes)
Expand Down Expand Up @@ -2039,7 +2039,7 @@ function inlining_pass(e::Expr, sv, ast)
t = exprtype(aarg)
if isa(aarg,Expr) && is_known_call(aarg, tuple, sv)
# apply(f,tuple(x,y,...)) => f(x,y,...)
newargs[i-2] = aarg.args[2:]
newargs[i-2] = aarg.args[2:end]
elseif isa(t,Tuple) && !isvatuple(t) && effect_free(aarg,sv)
# apply(f,t::(x,y)) => f(t[1],t[2])
newargs[i-2] = { mk_tupleref(aarg,j) for j=1:length(t) }
Expand Down
2 changes: 1 addition & 1 deletion base/io.jl
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ function write{T,N,A<:Array}(s::IOStream, a::SubArray{T,N,A})
return write(s, pointer(a, 1), colsz)
else
cartesianmap((idxs...)->write(s, pointer(a, idxs), colsz),
tuple(1, size(a)[2:]...))
tuple(1, size(a)[2:end]...))
return colsz*trailingsize(a,2)
end
end
Expand Down
Loading

0 comments on commit b830fa1

Please sign in to comment.