Skip to content

Commit

Permalink
Merge branch 'master' of github.com:JuliaLang/julia into jb/dictsyntax
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffBezanson committed Oct 3, 2014
2 parents fa67b6c + 8b708d9 commit cae93a9
Show file tree
Hide file tree
Showing 81 changed files with 1,434 additions and 1,034 deletions.
13 changes: 13 additions & 0 deletions Make.inc
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,19 @@ DEBUGFLAGS = -O0 -g -DJL_DEBUG_BUILD -fstack-protector-all
SHIPFLAGS = -O3 -g -falign-functions
endif

ifeq ($(USECCACHE), 1)
CC := ccache $(CC)
CXX := ccache $(CXX)
ifeq ($(USECLANG),1)
# ccache and Clang don't do well together
# http:https://petereisentraut.blogspot.be/2011/05/ccache-and-clang.html
CC += -Qunused-arguments -fcolor-diagnostics
CXX += -Qunused-arguments -fcolor-diagnostics
# http:https://petereisentraut.blogspot.be/2011/09/ccache-and-clang-part-2.html
export CCACHE_CPP2 := yes
endif
endif

ifeq ($(LLVM_VER),svn)
JCXXFLAGS += -std=c++11
endif
Expand Down
9 changes: 5 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,13 @@ endif
# use sys.ji if it exists, otherwise run two stages
$(build_private_libdir)/sys%ji: $(build_private_libdir)/sys%o

.PRECIOUS: $(build_private_libdir)/sys%o
.SECONDARY: $(build_private_libdir)/sys.o
.SECONDARY: $(build_private_libdir)/sys0.o

$(build_private_libdir)/sys%$(SHLIB_EXT): $(build_private_libdir)/sys%o
$(CXX) -shared -fPIC -L$(build_private_libdir) -L$(build_libdir) -L$(build_shlibdir) -o $@ $< \
$$([ $(OS) = Darwin ] && echo -Wl,-undefined,dynamic_lookup || echo -Wl,--unresolved-symbols,ignore-all ) \
$$([ $(OS) = WINNT ] && echo -ljulia -lssp)
$$([ $(OS) = Darwin ] && echo '' -Wl,-undefined,dynamic_lookup || echo '' -Wl,--unresolved-symbols,ignore-all ) \
$$([ $(OS) = WINNT ] && echo '' -ljulia -lssp)
$(DSYMUTIL) $@

$(build_private_libdir)/sys0.o:
Expand All @@ -129,7 +130,7 @@ $(build_private_libdir)/sys.o: VERSION $(BASE_SRCS) $(build_datarootdir)/julia/h
@$(QUIET_JULIA) cd base && \
$(call spawn,$(JULIA_EXECUTABLE)) --build $(call cygpath_w,$(build_private_libdir)/sys) \
-J$(call cygpath_w,$(build_private_libdir))/$$([ -e $(build_private_libdir)/sys.ji ] && echo sys.ji || echo sys0.ji) -f sysimg.jl \
|| (echo "*** This error is usually fixed by running 'make clean'. If the error persists, try 'make cleanall'. ***" && false)
|| { echo "*** This error is usually fixed by running 'make clean'. If the error persists, try 'make cleanall'. ***" && false; }

run-julia-debug run-julia-release: run-julia-%:
$(MAKE) $(QUIET_MAKE) run-julia JULIA_EXECUTABLE="$(JULIA_EXECUTABLE_$*)"
Expand Down
32 changes: 31 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,30 @@ New language features
* Unicode version 7 is now supported for identifiers etcetera ([#7917]).

* Type parameters now permit any arbitrary `isbits` type, not just
`Int` and `Bool` ([#6081]).
`Int` and `Bool` ([#6081]).

* Keyword argument names can be computed, using syntax such as `f(; (name, val))` ([#7704]).

* (TODO pending final syntax) staged functions ([#7311]).

Language changes
----------------

* `None` is deprecated; use `Union()` instead ([#8423]).

* `Nothing` (the type of `nothing`) is renamed to `Void` ([#8423]).

Library improvements
--------------------

* `convert` now checks for overflow when truncating integers or converting between
signed and unsigned ([#5413]).

* Arithmetic is type-preserving for more types; e.g. `(x::Int8) + (y::Int8)` now
yields an `Int8` ([#3759]).

* Reductions (e.g. `reduce`, `sum`) widen small types (integers smaller than `Int`, and `Float16`).

* New `Dates` module for calendar dates and other time-interval calculations ([#7654]).

* Added generic Cholesky factorization, and the Cholesky factorization is now parametrized on the matrix type ([#7236]).
Expand All @@ -34,6 +53,11 @@ Library improvements
to provide uniform cross-platform behavior and up-to-date, locale-independent support
for Unicode standards ([#5939]).

* New `Nullable` type for missing data ([#8152]).

* New `ordschur` and `ordschur!` functions for sorting a schur factorization by the eigenvalues.

* `deepcopy` recurses through immutable types and makes copies of their mutable fields ([#8560]).

Julia v0.3.0 Release Notes
==========================
Expand Down Expand Up @@ -961,3 +985,9 @@ Too numerous to mention.
[#7992]: https://github.com/JuliaLang/julia/issues/7992
[#8011]: https://github.com/JuliaLang/julia/issues/8011
[#8089]: https://github.com/JuliaLang/julia/issues/8089
[#7704]: https://github.com/JuliaLang/julia/issues/7704
[#5413]: https://github.com/JuliaLang/julia/issues/5413
[#3759]: https://github.com/JuliaLang/julia/issues/3759
[#7311]: https://github.com/JuliaLang/julia/issues/7311
[#8423]: https://github.com/JuliaLang/julia/issues/8423
[#8152]: https://github.com/JuliaLang/julia/pull/8152
4 changes: 2 additions & 2 deletions base/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ all: pcre_h.jl errno_h.jl build_h.jl.phony fenv_constants.jl file_constants.jl u

pcre_h.jl:
ifeq ($(USE_SYSTEM_PCRE), 1)
@$(call PRINT_PERL, $(CPP) -dM $(shell $(PCRE_CONFIG) --prefix)/include/pcre.h | perl -nle '/^\s*#define\s+PCRE_(\w*)\s*\(?($(PCRE_CONST))\)?\s*$$/ and print "const $$1 = uint32($$2)"' | sort > $@)
@$(call PRINT_PERL, $(CPP) -dM $(shell $(PCRE_CONFIG) --prefix)/include/pcre.h | perl -nle '/^\s*#define\s+PCRE_(\w*)\s*\(?($(PCRE_CONST))\)?\s*$$/ and print "const $$1 = int32($$2)"' | sort > $@)
else
@$(call PRINT_PERL, $(CPP) -dM $(build_includedir)/pcre.h | perl -nle '/^\s*#define\s+PCRE_(\w*)\s*\(?($(PCRE_CONST))\)?\s*$$/ and print "const $$1 = uint32($$2)"' | sort > $@)
@$(call PRINT_PERL, $(CPP) -dM $(build_includedir)/pcre.h | perl -nle '/^\s*#define\s+PCRE_(\w*)\s*\(?($(PCRE_CONST))\)?\s*$$/ and print "const $$1 = int32($$2)"' | sort > $@)
endif

errno_h.jl:
Expand Down
6 changes: 3 additions & 3 deletions base/abstractarray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -505,10 +505,10 @@ promote_eltype() = Bottom
promote_eltype(v1, vs...) = promote_type(eltype(v1), promote_eltype(vs...))

#TODO: ERROR CHECK
cat(catdim::Integer) = Array(Bottom, 0)
cat(catdim::Integer) = Array(Any, 0)

vcat() = Array(Bottom, 0)
hcat() = Array(Bottom, 0)
vcat() = Array(Any, 0)
hcat() = Array(Any, 0)

## cat: special cases
hcat{T}(X::T...) = T[ X[j] for i=1, j=1:length(X) ]
Expand Down
15 changes: 0 additions & 15 deletions base/array.jl
Original file line number Diff line number Diff line change
Expand Up @@ -446,13 +446,7 @@ end

## Dequeue functionality ##

const _grow_none_errmsg =
"[] cannot grow. Instead, initialize the array with \"T[]\", where T is the desired element type."

function push!{T}(a::Array{T,1}, item)
if is(T,Bottom)
error(_grow_none_errmsg)
end
# convert first so we don't grow the array if the assignment won't work
item = convert(T, item)
ccall(:jl_array_grow_end, Void, (Any, Uint), a, 1)
Expand All @@ -467,19 +461,13 @@ function push!(a::Array{Any,1}, item::ANY)
end

function append!{T}(a::Array{T,1}, items::AbstractVector)
if is(T,Bottom)
error(_grow_none_errmsg)
end
n = length(items)
ccall(:jl_array_grow_end, Void, (Any, Uint), a, n)
copy!(a, length(a)-n+1, items, 1, n)
return a
end

function prepend!{T}(a::Array{T,1}, items::AbstractVector)
if is(T,Bottom)
error(_grow_none_errmsg)
end
n = length(items)
ccall(:jl_array_grow_beg, Void, (Any, Uint), a, n)
if a === items
Expand Down Expand Up @@ -518,9 +506,6 @@ function pop!(a::Vector)
end

function unshift!{T}(a::Array{T,1}, item)
if is(T,Bottom)
error(_grow_none_errmsg)
end
item = convert(T, item)
ccall(:jl_array_grow_beg, Void, (Any, Uint), a, 1)
a[1] = item
Expand Down
6 changes: 0 additions & 6 deletions base/base.jl
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
# important core definitions

using Core: Intrinsics, arraylen, arrayref, arrayset, arraysize,
tuplelen, tupleref, convert_default, kwcall,
typeassert, apply_type

import Core.Array # to add methods

const NonTupleType = Union(DataType,UnionType,TypeConstructor)
Expand Down
2 changes: 1 addition & 1 deletion base/boot.jl
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ export
#ccall, cglobal, llvmcall, abs_float, add_float, add_int, and_int, ashr_int,
#box, bswap_int, checked_fptosi, checked_fptoui, checked_sadd,
#checked_smul, checked_ssub, checked_uadd, checked_umul, checked_usub,
#checked_trunc_sint, checked_trunc_uint,
#checked_trunc_sint, checked_trunc_uint, check_top_bit,
#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,
Expand Down
12 changes: 8 additions & 4 deletions base/char.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,16 @@ char(x::FloatingPoint) = char(iround(x))

integer(x::Char) = int(x)

convert(::Type{Char}, x::Float16) = char(convert(Uint32, x))
convert(::Type{Char}, x::Float32) = char(convert(Uint32, x))
convert(::Type{Char}, x::Float64) = char(convert(Uint32, x))

## char promotions ##

promote_rule(::Type{Char}, ::Type{Int8}) = Int32
promote_rule(::Type{Char}, ::Type{Uint8}) = Int32
promote_rule(::Type{Char}, ::Type{Uint8}) = Uint32
promote_rule(::Type{Char}, ::Type{Int16}) = Int32
promote_rule(::Type{Char}, ::Type{Uint16}) = Int32
promote_rule(::Type{Char}, ::Type{Uint16}) = Uint32
promote_rule(::Type{Char}, ::Type{Int32}) = Int32
promote_rule(::Type{Char}, ::Type{Uint32}) = Uint32
promote_rule(::Type{Char}, ::Type{Int64}) = Int64
Expand All @@ -23,10 +27,10 @@ promote_rule(::Type{Char}, ::Type{Uint128}) = Uint128
+(x::Char , y::Char ) = int(x)+int(y)

# ordinal operations
+(x::Char , y::Integer) = char(int(x)+int(y))
+(x::Char , y::Integer) = reinterpret(Char, int32(x)+int32(y))
+(x::Integer, y::Char ) = y+x
-(x::Char , y::Char ) = int(x)-int(y)
-(x::Char , y::Integer) = char(int(x)-int(y))
-(x::Char , y::Integer) = reinterpret(Char, int32(x)-int32(y))

# bitwise operations
(~)(x::Char) = char(~uint32(x))
Expand Down
10 changes: 9 additions & 1 deletion base/client.jl
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,15 @@ function init_bind_addr(args::Vector{UTF8String})
# --worker, -n and --machinefile options are affected by it
btoidx = findfirst(args, "--bind-to")
if btoidx > 0
bind_addr = parseip(args[btoidx+1])
bind_to = split(args[btoidx+1], ":")
bind_addr = parseip(bind_to[1])
if length(bind_to) > 1
bind_port = parseint(bind_to[2])
else
bind_port = 0
end
else
bind_port = 0
try
bind_addr = getipaddr()
catch
Expand All @@ -188,6 +195,7 @@ function init_bind_addr(args::Vector{UTF8String})
end
global LPROC
LPROC.bind_addr = bind_addr
LPROC.bind_port = uint16(bind_port)
end


Expand Down
2 changes: 1 addition & 1 deletion base/datafmt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ function dlm_parse{T,D}(dbuff::T, eol::D, dlm::D, qchar::D, cchar::D, ign_adj_dl
all_ascii = (D <: Uint8) || (isascii(eol) && isascii(dlm) && (!allow_quote || isascii(qchar)) && (!allow_comments || isascii(cchar)))
(T <: UTF8String) && all_ascii && (return dlm_parse(dbuff.data, uint8(eol), uint8(dlm), uint8(qchar), uint8(cchar), ign_adj_dlm, allow_quote, allow_comments, skipstart, skipblanks, dh))
ncols = nrows = col = 0
is_default_dlm = (dlm == convert(D, invalid_dlm))
is_default_dlm = (dlm == itrunc(D, invalid_dlm))
error_str = ""
# 0: begin field, 1: quoted field, 2: unquoted field, 3: second quote (could either be end of field or escape character), 4: comment, 5: skipstart
state = (skipstart > 0) ? 5 : 0
Expand Down
2 changes: 1 addition & 1 deletion base/dates/types.jl
Original file line number Diff line number Diff line change
Expand Up @@ -160,4 +160,4 @@ Base.promote_rule(::Type{Date},x::Type{DateTime}) = DateTime
Base.isless(x::Date,y::Date) = isless(value(x),value(y))
Base.isless(x::DateTime,y::DateTime) = isless(value(x),value(y))
Base.isless(x::TimeType,y::TimeType) = isless(promote(x,y)...)
==(x::TimeType,y::TimeType) = ===(promote(x,y)...)
==(x::TimeType,y::TimeType) = ===(promote(x,y)...)
23 changes: 13 additions & 10 deletions base/deepcopy.jl
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,23 @@ function deepcopy_internal(x, stackdict::ObjectIdDict)
end

function _deepcopy_t(x, T::DataType, stackdict::ObjectIdDict)
if T.names===() || !T.mutable
return x
end
ret = ccall(:jl_new_struct_uninit, Any, (Any,), T)
stackdict[x] = ret
for i in 1:length(T.names)
if isdefined(x,i)
ret.(i) = deepcopy_internal(x.(i), stackdict)
isbits(T) | isempty(T.names) && return x
if T.mutable
y = ccall(:jl_new_struct_uninit, Any, (Any,), T)
stackdict[x] = y
for i in 1:length(T.names)
if isdefined(x,i)
y.(i) = deepcopy_internal(x.(i), stackdict)
end
end
else
fields = Any[deepcopy_internal(x.(i), stackdict) for i in 1:length(T.names)]
y = ccall(:jl_new_structv, Any, (Any, Ptr{Void}, Uint32),
T, pointer(fields), length(fields))
end
return ret
return y::T
end


function deepcopy_internal(x::Array, stackdict::ObjectIdDict)
if haskey(stackdict, x)
return stackdict[x]
Expand Down
4 changes: 2 additions & 2 deletions base/dict.jl
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ end

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

_oidd_nextind(a, i) = int(ccall(:jl_eqtable_nextind, Csize_t, (Any, Csize_t), a, i))
_oidd_nextind(a, i) = reinterpret(Int,ccall(:jl_eqtable_nextind, Csize_t, (Any, Csize_t), a, i))

start(t::ObjectIdDict) = _oidd_nextind(t.ht, 0)
done(t::ObjectIdDict, i) = (i == -1)
Expand Down Expand Up @@ -394,7 +394,7 @@ function deserialize{K,V}(s, T::Type{Dict{K,V}})
return t
end

hashindex(key, sz) = (int(hash(key)) & (sz-1)) + 1
hashindex(key, sz) = (reinterpret(Int,hash(key)) & (sz-1)) + 1

isslotempty(h::Dict, i::Int) = h.slots[i] == 0x0
isslotfilled(h::Dict, i::Int) = h.slots[i] == 0x1
Expand Down
2 changes: 2 additions & 0 deletions base/exports.jl
Original file line number Diff line number Diff line change
Expand Up @@ -667,6 +667,8 @@ export
lyap,
norm,
null,
ordschur!,
ordschur,
peakflops,
pinv,
qr,
Expand Down
2 changes: 1 addition & 1 deletion base/file.jl
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ end
seed::Uint32 = rand(Uint32)
dir = tempdir()
while true
if uint16(seed) == 0
if (seed & typemax(Uint16)) == 0
seed += 1
end
filename = tempname(dir, seed)
Expand Down
10 changes: 5 additions & 5 deletions base/float.jl
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
## conversions to floating-point ##

convert(::Type{Float32}, x::Int128) = float32(uint128(abs(x)))*(1-2(x<0))
convert(::Type{Float32}, x::Uint128) = float32(uint64(x)) + ldexp(float32(uint64(x>>>64)),64)
convert(::Type{Float32}, x::Int128) = float32(reinterpret(Uint128,abs(x)))*(1-2(x<0))
convert(::Type{Float32}, x::Uint128) = float32(uint64(x&0xffffffffffffffff)) + ldexp(float32(uint64(x>>>64)),64)
promote_rule(::Type{Float32}, ::Type{Int128} ) = Float32
promote_rule(::Type{Float32}, ::Type{Uint128}) = Float32

convert(::Type{Float64}, x::Int128) = float64(uint128(abs(x)))*(1-2(x<0))
convert(::Type{Float64}, x::Uint128) = float64(uint64(x)) + ldexp(float64(uint64(x>>>64)),64)
convert(::Type{Float64}, x::Int128) = float64(reinterpret(Uint128,abs(x)))*(1-2(x<0))
convert(::Type{Float64}, x::Uint128) = float64(uint64(x&0xffffffffffffffff)) + ldexp(float64(uint64(x>>>64)),64)
promote_rule(::Type{Float64}, ::Type{Int128} ) = Float64
promote_rule(::Type{Float64}, ::Type{Uint128}) = Float64

convert(::Type{Float16}, x::Union(Signed,Unsigned)) = convert(Float16, convert(Float32,x))
convert(::Type{Float16}, x::Integer) = convert(Float16, convert(Float32,x))
for t in (Bool,Char,Int8,Int16,Int32,Int64,Uint8,Uint16,Uint32,Uint64)
@eval promote_rule(::Type{Float16}, ::Type{$t}) = Float32
end
Expand Down
Loading

0 comments on commit cae93a9

Please sign in to comment.