Skip to content

Commit

Permalink
Merge branch 'master' of github.com:JuliaLang/julia into tilda_project
Browse files Browse the repository at this point in the history
  • Loading branch information
Moelf committed May 13, 2019
2 parents fa6a6ad + 178d703 commit 771c76b
Show file tree
Hide file tree
Showing 726 changed files with 1,564 additions and 1,387 deletions.
46 changes: 22 additions & 24 deletions .appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
environment:
# USEMSVC: "1"
global:
CCACHE_DIR: C:\ccache
CYG_MIRROR: http://cygwin.mirror.constant.com
CYG_CACHE: '%CYG_ROOT%\var\cache\setup'
CYG_BASH: '%CYG_ROOT%\bin\bash'

matrix:
- ARCH: "i686"
- MINGW_ARCH: "i686"
CYG_ROOT: C:\cygwin
CYG_SETUP: setup-x86.exe
JULIA_TEST_MAXRSS_MB: 500
- ARCH: "x86_64"

- MINGW_ARCH: "x86_64"
CYG_ROOT: C:\cygwin64
CYG_SETUP: setup-x86_64.exe
JULIA_TEST_MAXRSS_MB: 450

# Only build on master and PR's for now, not personal branches
Expand All @@ -30,35 +40,23 @@ notifications:
on_build_failure: false
on_build_status_changed: false

clone_depth: 50
cache:
- '%CYG_CACHE%'
- '%CCACHE_DIR%'

init:
# Carriage returns are bad
- git config --global core.autocrlf input

cache:
# Cache large downloads to avoid network unreliability
- C:\cygdownloads
- llvm-3.9.1-i686-w64-mingw32-juliadeps-r07.7z
- llvm-3.9.1-x86_64-w64-mingw32-juliadeps-r07.7z
- C:\ccache
install:
- '%CYG_ROOT%\%CYG_SETUP% -gnq -R "%CYG_ROOT%" -s "%CYG_MIRROR%" -l "%CYG_CACHE%" -P make,python2,libiconv,curl,time,p7zip,ccache,mingw64-%MINGW_ARCH%-gcc-g++,mingw64-%MINGW_ARCH%-gcc-fortran > NULL 2>&1'
- '%CYG_ROOT%\bin\cygcheck -dc cygwin'

build_script:
# If there's a newer build queued for the same PR, cancel this one
- ps: if ($env:APPVEYOR_PULL_REQUEST_NUMBER -and $env:APPVEYOR_BUILD_NUMBER -ne ((Invoke-RestMethod `
https://ci.appveyor.com/api/projects/$env:APPVEYOR_ACCOUNT_NAME/$env:APPVEYOR_PROJECT_SLUG/history?recordsNumber=50).builds | `
Where-Object pullRequestId -eq $env:APPVEYOR_PULL_REQUEST_NUMBER)[0].buildNumber) { `
throw "There are newer queued builds for this pull request, failing early." }
# Remove C:\MinGW\bin from the path, the version of MinGW installed on
# AppVeyor is not compatible with the cross-compiled Julia Windows binaries
- set PATH=%PATH:C:\MinGW\bin;=%
# Remove git's msys2 from path, since it conflicts with cygwin1.dll
- set PATH=%PATH:C:\Program Files\Git\usr\bin;=%
- ps: contrib/windows/install-cygwin.ps1
# - '"%VS120COMNTOOLS%\..\..\VC\vcvarsall.bat" x86_amd64'
- C:\cygwin-%ARCH%\bin\sh.exe --login /cygdrive/c/projects/julia/contrib/windows/appveyor_build.sh
- 'echo Building Julia'
- '%CYG_BASH% -lc "cd $APPVEYOR_BUILD_FOLDER && ./contrib/windows/appveyor_build.sh"'

test_script:
- 'echo Testing Julia'
- usr\bin\julia -e "Base.require(Main, :InteractiveUtils).versioninfo()"
- usr\bin\julia --sysimage-native-code=no -e "true"
- cd julia-* && .\bin\julia.exe --check-bounds=yes share\julia\test\runtests.jl all &&
Expand Down
11 changes: 5 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -462,10 +462,10 @@ ifeq ($(OS), WINNT)
cd $(BUILDROOT)/julia-$(JULIA_COMMIT) && find * | sed -e 's/\//\\/g' -e 's/$$/\r/g' > etc/uninstall.log

# build nsis package
cd $(BUILDROOT) && $(call spawn,$(JULIAHOME)/dist-extras/nsis/makensis.exe) -NOCD -DVersion=$(JULIA_VERSION) -DArch=$(ARCH) -DCommit=$(JULIA_COMMIT) -DMUI_ICON="$(call cygpath_w,$(JULIAHOME)/contrib/windows/julia.ico)" $(call cygpath_w,$(JULIAHOME)/contrib/windows/build-installer.nsi) | iconv -f latin1
cd $(BUILDROOT) && $(call spawn,$(JULIAHOME)/dist-extras/nsis/makensis.exe) -NOCD -DVersion=$(JULIA_VERSION) -DArch=$(ARCH) -DCommit=$(JULIA_COMMIT) -DJULIAHOME="$(call cygpath_w,$(JULIAHOME))" $(call cygpath_w,$(JULIAHOME)/contrib/windows/build-installer.nsi) | iconv -f latin1

# compress nsis installer and combine with 7zip self-extracting header
cd $(BUILDROOT) && $(JULIAHOME)/dist-extras/7z a -mx9 "julia-install-$(JULIA_COMMIT)-$(ARCH).7z" julia-installer.exe
cd $(BUILDROOT) && $(JULIAHOME)/dist-extras/7z a -mx=9 "julia-install-$(JULIA_COMMIT)-$(ARCH).7z" julia-installer.exe
cd $(BUILDROOT) && cat $(JULIAHOME)/contrib/windows/7zS.sfx $(JULIAHOME)/contrib/windows/7zSFX-config.txt "julia-install-$(JULIA_COMMIT)-$(ARCH).7z" > "$(JULIA_BINARYDIST_FILENAME).exe"
chmod a+x "$(BUILDROOT)/$(JULIA_BINARYDIST_FILENAME).exe"
-rm -f $(BUILDROOT)/julia-install-$(JULIA_COMMIT)-$(ARCH).7z
Expand Down Expand Up @@ -611,12 +611,11 @@ else
$(error no win-extras target for ARCH=$(ARCH))
endif
cd $(JULIAHOME)/dist-extras && \
$(JLDOWNLOAD) http://downloads.sourceforge.net/sevenzip/7z1900-extra.7z && \
$(JLDOWNLOAD) https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/unsis/nsis-2.46.5-Unicode-setup.exe && \
$(JLCHECKSUM) nsis-2.46.5-Unicode-setup.exe && \
$(JLDOWNLOAD) https://sourceforge.net/projects/nsis/files/NSIS%203/3.04/nsis-3.04-setup.exe && \
$(JLCHECKSUM) nsis-3.04-setup.exe && \
chmod a+x 7z.exe && \
chmod a+x 7z.dll && \
$(call spawn,./7z.exe) x -y -onsis nsis-2.46.5-Unicode-setup.exe && \
$(call spawn,./7z.exe) x -y -onsis nsis-3.04-setup.exe && \
chmod a+x ./nsis/makensis.exe

# various statistics about the build that may interest the user
Expand Down
4 changes: 2 additions & 2 deletions base/compiler/abstractinterpretation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ function abstract_call_method(method::Method, @nospecialize(sig), sparams::Simpl
# we have a self-cycle in the call-graph, but not in the inference graph (typically):
# break this edge now (before we record it) by returning early
# (non-typically, this means that we lose the ability to detect a guaranteed StackOverflow in some cases)
return Any, false, nothing
return Any, true, nothing
end
topmost = nothing
edgecycle = true
Expand Down Expand Up @@ -339,7 +339,7 @@ function abstract_call_method(method::Method, @nospecialize(sig), sparams::Simpl
# since it's very unlikely that we'll try to inline this,
# or want make an invoke edge to its calling convention return type.
# (non-typically, this means that we lose the ability to detect a guaranteed StackOverflow in some cases)
return Any, false, nothing
return Any, true, nothing
end
poison_callstack(sv, topmost::InferenceState, true)
sig = newsig
Expand Down
29 changes: 15 additions & 14 deletions base/compiler/tfuncs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ function nfields_tfunc(@nospecialize(x))
x = widenconst(x)
if isa(x, DataType) && !x.abstract && !(x.name === Tuple.name && isvatuple(x))
if !(x.name === _NAMEDTUPLE_NAME && !isconcretetype(x))
return Const(length(x.types))
return Const(isdefined(x, :types) ? length(x.types) : length(x.name.names))
end
end
return Int
Expand Down Expand Up @@ -592,7 +592,7 @@ function fieldcount_noerror(@nospecialize t)
if abstr
return nothing
end
return length(t.types)
return isdefined(t, :types) ? length(t.types) : length(t.name.names)
end


Expand Down Expand Up @@ -748,7 +748,8 @@ function getfield_tfunc(@nospecialize(s00), @nospecialize(name))
# TODO: better approximate inference
return Any
end
if isempty(s.types)
ftypes = datatype_fieldtypes(s)
if isempty(ftypes)
return Bottom
end
if isa(name, Conditional)
Expand All @@ -758,27 +759,27 @@ function getfield_tfunc(@nospecialize(s00), @nospecialize(name))
if !(Int <: name || Symbol <: name)
return Bottom
end
if length(s.types) == 1
return rewrap_unionall(unwrapva(s.types[1]), s00)
if length(ftypes) == 1
return rewrap_unionall(unwrapva(ftypes[1]), s00)
end
# union together types of all fields
t = Bottom
for _ft in s.types
for _ft in ftypes
t = tmerge(t, rewrap_unionall(unwrapva(_ft), s00))
t === Any && break
end
return t
end
fld = name.val
if isa(fld,Symbol)
if isa(fld, Symbol)
fld = fieldindex(s, fld, false)
end
if !isa(fld,Int)
if !isa(fld, Int)
return Bottom
end
nf = length(s.types)
if s <: Tuple && fld >= nf && isvarargtype(s.types[nf])
return rewrap_unionall(unwrapva(s.types[nf]), s00)
nf = length(ftypes)
if s <: Tuple && fld >= nf && isvarargtype(ftypes[nf])
return rewrap_unionall(unwrapva(ftypes[nf]), s00)
end
if fld < 1 || fld > nf
return Bottom
Expand All @@ -794,7 +795,7 @@ function getfield_tfunc(@nospecialize(s00), @nospecialize(name))
t = const_datatype_getfield_tfunc(sp, fld)
t !== nothing && return t
end
R = s.types[fld]
R = ftypes[fld]
if isempty(s.parameters)
return R
end
Expand Down Expand Up @@ -847,7 +848,7 @@ function _fieldtype_nothrow(@nospecialize(s), exact::Bool, name::Const)
fld = fieldindex(u, fld, false)
end
isa(fld, Int) || return false
ftypes = u.types
ftypes = datatype_fieldtypes(u)
nf = length(ftypes)
(fld >= 1 && fld <= nf) || return false
if u.name === Tuple.name && fld >= nf && isvarargtype(ftypes[nf])
Expand Down Expand Up @@ -897,7 +898,7 @@ function _fieldtype_tfunc(@nospecialize(s), exact::Bool, @nospecialize(name))
# TODO: better approximate inference
return Type
end
ftypes = u.types
ftypes = datatype_fieldtypes(u)
if isempty(ftypes)
return Bottom
end
Expand Down
11 changes: 9 additions & 2 deletions base/errorshow.jl
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,18 @@ function showerror(io::IO, ex, bt; backtrace=true)
end

function showerror(io::IO, ex::LoadError, bt; backtrace=true)
print(io, "Error while loading expression starting at ", ex.file, ":", ex.line)
print(io, "LoadError: ")
showerror(io, ex.error, bt, backtrace=backtrace)
print(io, "\nin expression starting at $(ex.file):$(ex.line)")
end
showerror(io::IO, ex::LoadError) = showerror(io, ex, [])

showerror(io::IO, ex::InitError) = print(io, "InitError during initialization of module ", ex.mod)
function showerror(io::IO, ex::InitError, bt; backtrace=true)
print(io, "InitError: ")
showerror(io, ex.error, bt, backtrace=backtrace)
print(io, "\nduring initialization of module ", ex.mod)
end
showerror(io::IO, ex::InitError) = showerror(io, ex, [])

function showerror(io::IO, ex::DomainError)
if isa(ex.val, AbstractArray)
Expand Down
18 changes: 10 additions & 8 deletions base/filesystem.jl
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ mutable struct File <: AbstractFile
File(fd::OS_HANDLE) = new(true, fd)
end
if OS_HANDLE !== RawFD
File(fd::RawFD) = File(Libc._get_osfhandle(fd))
File(fd::RawFD) = File(Libc._get_osfhandle(fd)) # TODO: calling close would now destroy the wrong handle
end

rawhandle(file::File) = file.handle
Expand Down Expand Up @@ -94,12 +94,13 @@ function check_open(f::File)
end

function close(f::File)
check_open(f)
err = ccall(:jl_fs_close, Int32, (OS_HANDLE,), f.handle)
uv_error("close", err)
f.handle = INVALID_OS_HANDLE
f.open = false
return nothing
if isopen(f)
f.open = false
err = ccall(:jl_fs_close, Int32, (OS_HANDLE,), f.handle)
f.handle = INVALID_OS_HANDLE
uv_error("close", err)
end
nothing
end

# sendfile is the most efficient way to copy from a file descriptor
Expand Down Expand Up @@ -159,7 +160,7 @@ end

function read(f::File, ::Type{Char})
b0 = read(f, UInt8)
l = 8(4-leading_ones(b0))
l = 8 * (4 - leading_ones(b0))
c = UInt32(b0) << 24
if l < 24
s = 16
Expand All @@ -176,6 +177,7 @@ function read(f::File, ::Type{Char})
end
return reinterpret(Char, c)
end

read(f::File, ::Type{T}) where {T<:AbstractChar} = T(read(f, Char)) # fallback

function unsafe_read(f::File, p::Ptr{UInt8}, nel::UInt)
Expand Down
19 changes: 16 additions & 3 deletions base/intfuncs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,10 @@ function ndigits0zpb(x::Integer, b::Integer)
b == 8 && return (sizeof(x)<<3 - leading_zeros(x) + 2) ÷ 3
b == 16 && return sizeof(x)<<1 - leading_zeros(x)>>2
b == 10 && return bit_ndigits0z(x)
if ispow2(b)
dv, rm = divrem(sizeof(x)<<3 - leading_zeros(x), trailing_zeros(b))
return iszero(rm) ? dv : dv + 1
end
end

d = 0
Expand Down Expand Up @@ -755,9 +759,18 @@ function digits!(a::AbstractVector{T}, n::Integer; base::Integer = 10) where T<:
isempty(a) && return a

if base > 0
for i in eachindex(a)
n, d = divrem(n, base)
a[i] = d
if ispow2(base) && n >= 0 && n isa Base.BitInteger && base <= typemax(Int)
base = Int(base)
k = trailing_zeros(base)
c = base - 1
for i in eachindex(a)
a[i] = (n >> (k * (i - firstindex(a)))) & c
end
else
for i in eachindex(a)
n, d = divrem(n, base)
a[i] = d
end
end
else
# manually peel one loop iteration for type stability
Expand Down
15 changes: 10 additions & 5 deletions base/iostream.jl
Original file line number Diff line number Diff line change
Expand Up @@ -488,18 +488,22 @@ function readbytes!(s::IOStream, b::Array{UInt8}, nb=length(b); all::Bool=true)
end

function read(s::IOStream)
sz = 0
try # filesize is just a hint, so ignore if it fails
sz = filesize(s)
sz = try # filesize is just a hint, so ignore if `fstat` fails
filesize(s)
catch ex
ex isa IOError || rethrow()
Int64(0)
end
if sz > 0
pos = ccall(:ios_pos, Int64, (Ptr{Cvoid},), s.ios)
if pos > 0
sz -= pos
end
catch
end
b = StringVector(sz<=0 ? 1024 : sz)
b = StringVector(sz <= 0 ? 1024 : sz)
nr = readbytes_all!(s, b, typemax(Int))
resize!(b, nr)
return b
end

"""
Expand All @@ -518,6 +522,7 @@ function read(s::IOStream, nb::Integer; all::Bool=true)
b = Vector{UInt8}(undef, all && nb == typemax(Int) ? 1024 : nb)
nr = readbytes!(s, b, nb, all=all)
resize!(b, nr)
return b
end

## peek ##
Expand Down
Loading

0 comments on commit 771c76b

Please sign in to comment.