Skip to content

Commit

Permalink
Merge branch 'master' into opsuffix
Browse files Browse the repository at this point in the history
  • Loading branch information
ararslan committed May 31, 2017
2 parents b407114 + 8f8c154 commit 77269fe
Show file tree
Hide file tree
Showing 146 changed files with 2,015 additions and 1,207 deletions.
5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ $(build_private_libdir)/%.$(SHLIB_EXT): $(build_private_libdir)/%.o

CORE_SRCS := $(addprefix $(JULIAHOME)/, \
base/boot.jl base/coreimg.jl \
base/docs/core.jl \
base/abstractarray.jl \
base/array.jl \
base/bool.jl \
Expand Down Expand Up @@ -590,7 +591,7 @@ ifneq (,$(filter $(ARCH), i386 i486 i586 i686))
cd $(JULIAHOME)/dist-extras && \
$(JLDOWNLOAD) http://downloads.sourceforge.net/sevenzip/7z920.exe && \
7z x -y 7z920.exe 7z.exe 7z.dll && \
../contrib/windows/winrpm.sh http://download.opensuse.org/repositories/windows:/mingw:/win32/openSUSE_42.2 \
../contrib/windows/winrpm.sh http://download.opensuse.org/repositories/windows:/mingw:/win32/openSUSE_Leap_42.2 \
"mingw32-libgfortran3 mingw32-libquadmath0 mingw32-libstdc++6 mingw32-libgcc_s_sjlj1 mingw32-libssp0 mingw32-libwinpthread1 mingw32-libexpat1 mingw32-zlib1" && \
cp usr/i686-w64-mingw32/sys-root/mingw/bin/*.dll .
else ifeq ($(ARCH),x86_64)
Expand All @@ -599,7 +600,7 @@ else ifeq ($(ARCH),x86_64)
7z x -y 7z920-x64.msi _7z.exe _7z.dll && \
mv _7z.dll 7z.dll && \
mv _7z.exe 7z.exe && \
../contrib/windows/winrpm.sh http://download.opensuse.org/repositories/windows:/mingw:/win64/openSUSE_42.2 \
../contrib/windows/winrpm.sh http://download.opensuse.org/repositories/windows:/mingw:/win64/openSUSE_Leap_42.2 \
"mingw64-libgfortran3 mingw64-libquadmath0 mingw64-libstdc++6 mingw64-libgcc_s_seh1 mingw64-libssp0 mingw64-libwinpthread1 mingw64-libexpat1 mingw64-zlib1" && \
cp usr/x86_64-w64-mingw32/sys-root/mingw/bin/*.dll .
else
Expand Down
13 changes: 13 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,16 @@ This section lists changes that do not have deprecation warnings.
* `@__DIR__` returns the current working directory rather than `nothing` when not run
from a file ([#21759]).

* `@__FILE__` and `@__DIR__` return information relative to the file that it was parsed from,
rather than from the task-local `SOURCE_PATH` global when it was expanded.

* All macros receive an extra argument `__source__::LineNumberNode` which describes the
parser location in the source file for the `@` of the macro call.
It can be accessed as a normal argument variable in the body of the macro.
This is implemented by inserting an extra leading argument into the
`Expr(:macrocall, :@name, LineNumberNode(...), args...)`
surface syntax. ([#21746])

* Passing the same keyword argument multiple times is now a syntax error ([#16937]).

* `getsockname` on a `TCPSocket` now returns the locally bound address and port
Expand All @@ -48,6 +58,9 @@ Library improvements
method can be opened in an editor by entering the corresponding number in the REPL
and pressing `^Q` ([#22007]).

* `getpeername` on a `TCPSocket` returns the address and port of the remote
endpoint of the TCP connection ([#21825]).

Compiler/Runtime improvements
-----------------------------

Expand Down
24 changes: 22 additions & 2 deletions README.windows.md
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,12 @@ versions of the MinGW-w64 compilers available through Cygwin's package manager.
either 32 or 64 bit Julia from either 32 or 64 bit Cygwin. 64 bit Cygwin
has a slightly smaller but often more up-to-date selection of packages.

Advanced: you may skip steps 2-4 by running:

setup-x86_64.exe -s <url> -q -P cmake,gcc-g++,git,make,patch,curl,m4,python,p7zip,mingw64-i686-gcc-g++,mingw64-i686-gcc-fortran,mingw64-x86_64-gcc-g++,mingw64-x86_64-gcc-fortran
:: replace <url> with a site from https://cygwin.com/mirrors.html
:: or run setup manually first and select a mirror

2. Select installation location and download mirror.

3. At the '*Select Packages'* step, select the following:
Expand All @@ -207,7 +213,7 @@ versions of the MinGW-w64 compilers available through Cygwin's package manager.

1. Get the Julia sources
```sh
git clone --recursive https://github.com/JuliaLang/julia.git
git clone https://github.com/JuliaLang/julia.git
cd julia
```
Tip: If you get an `error: cannot fork() for fetch-pack: Resource
Expand All @@ -219,14 +225,28 @@ versions of the MinGW-w64 compilers available through Cygwin's package manager.
```sh
echo 'XC_HOST = i686-w64-mingw32' > Make.user # for 32 bit Julia
# or
echo 'XC_HOST = x86_64-w64-mingw32' > Make.user #for 64 bit Julia
echo 'XC_HOST = x86_64-w64-mingw32' > Make.user # for 64 bit Julia
```

3. Start the build
```sh
make -j 4 # Adjust the number of cores (4) to match your build environment.
```


> Protip: build both!
> ```sh
> make O=julia-win32 configure
> make O=julia-win64 configure
> echo 'XC_HOST = i686-w64-mingw32' > julia-win32/Make.user
> echo 'XC_HOST = x86_64-w64-mingw32' > julia-win64/Make.user
> echo 'ifeq ($(BUILDROOT),$(JULIAHOME))
> $(error "in-tree build disabled")
> endif' >> Make.user
> make -C julia-win32 # build for Windows x86 in julia-win32 folder
> make -C julia-win64 # build for Windows x86-64 in julia-win64 folder
> ```

7. Run Julia using the Julia executables directly
```sh
usr/bin/julia.exe
Expand Down
5 changes: 3 additions & 2 deletions base/Enums.jl
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,9 @@ julia> f(apple)
"I'm a Fruit with value: 1"
```
`BaseType`, which defaults to `Int32`, must be a primitive subtype of Integer. Member values can be converted between
the enum type and `BaseType`. `read` and `write` perform these conversions automatically.
`BaseType`, which defaults to [`Int32`](@ref), must be a primitive subtype of `Integer`.
Member values can be converted between the enum type and `BaseType`. `read` and `write`
perform these conversions automatically.
"""
macro enum(T,syms...)
if isempty(syms)
Expand Down
2 changes: 1 addition & 1 deletion base/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ else
endif
@echo "const libfftw_name = \"$(LIBFFTWNAME)\"" >> $@
@echo "const libfftwf_name = \"$(LIBFFTWFNAME)\"" >> $@
@echo "const libllvm_version = \"$$($(LLVM_CONFIG_HOST) --version)\"" >> $@
@echo "const libllvm_version_string = \"$$($(LLVM_CONFIG_HOST) --version)\"" >> $@
@echo "const VERSION_STRING = \"$(JULIA_VERSION)\"" >> $@
@echo "const TAGGED_RELEASE_BANNER = \"$(TAGGED_RELEASE_BANNER)\"" >> $@
@echo "const SYSCONFDIR = \"$(sysconfdir_rel)\"" >> $@
Expand Down
1 change: 1 addition & 0 deletions base/REPL.jl
Original file line number Diff line number Diff line change
Expand Up @@ -633,6 +633,7 @@ function respond(f, repl, main; pass_empty = false)
line = String(take!(buf))
if !isempty(line) || pass_empty
reset(repl)
local val, bt
try
# note: value wrapped carefully here to ensure it doesn't get passed through expand
response = eval(Main, Expr(:body, Expr(:return, Expr(:call, QuoteNode(f), QuoteNode(line)))))
Expand Down
2 changes: 1 addition & 1 deletion base/REPLCompletions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ function get_type_call(expr::Expr)
found ? push!(args, typ) : push!(args, Any)
end
# use _methods_by_ftype as the function is supplied as a type
world = typemax(UInt)
world = ccall(:jl_get_world_counter, UInt, ())
mt = Base._methods_by_ftype(Tuple{ft, args...}, -1, world)
length(mt) == 1 || return (Any, false)
m = first(mt)
Expand Down
2 changes: 1 addition & 1 deletion base/abstractarray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,7 @@ julia> similar(trues(10,10), 2)
false
```
Since `BitArray`s can only store elements of type `Bool`, however, if you request a
Since `BitArray`s can only store elements of type [`Bool`](@ref), however, if you request a
different element type it will create a regular `Array` instead:
```julia-repl
Expand Down
8 changes: 4 additions & 4 deletions base/array.jl
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ end
eye([T::Type=Float64,] m::Integer, n::Integer)
`m`-by-`n` identity matrix.
The default element type is `Float64`.
The default element type is [`Float64`](@ref).
"""
function eye(::Type{T}, m::Integer, n::Integer) where T
a = zeros(T,m,n)
Expand All @@ -287,7 +287,7 @@ eye(::Type{T}, n::Integer) where {T} = eye(T, n, n)
eye([T::Type=Float64,] n::Integer)
`n`-by-`n` identity matrix.
The default element type is `Float64`.
The default element type is [`Float64`](@ref).
"""
eye(n::Integer) = eye(Float64, n)

Expand Down Expand Up @@ -860,8 +860,8 @@ julia> deleteat!([6, 5, 4, 3, 2, 1], [true, false, true, false, true, false])
julia> deleteat!([6, 5, 4, 3, 2, 1], (2, 2))
ERROR: ArgumentError: indices must be unique and sorted
Stacktrace:
[1] _deleteat!(::Array{Int64,1}, ::Tuple{Int64,Int64}) at ./array.jl:873
[2] deleteat!(::Array{Int64,1}, ::Tuple{Int64,Int64}) at ./array.jl:860
[1] _deleteat!(::Array{Int64,1}, ::Tuple{Int64,Int64}) at ./array.jl:880
[2] deleteat!(::Array{Int64,1}, ::Tuple{Int64,Int64}) at ./array.jl:867
```
"""
deleteat!(a::Vector, inds) = _deleteat!(a, inds)
Expand Down
6 changes: 3 additions & 3 deletions base/atomics.jl
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export
# Disable 128-bit types on 32-bit Intel sytems due to LLVM problems;
# see <https://github.com/JuliaLang/julia/issues/14818> (fixed on LLVM 3.9)
# 128-bit atomics do not exist on AArch32.
if (VersionNumber(Base.libllvm_version) < v"3.9-" && ARCH === :i686) ||
if (Base.libllvm_version < v"3.9-" && ARCH === :i686) ||
startswith(string(ARCH), "arm")
const inttypes = (Int8, Int16, Int32, Int64,
UInt8, UInt16, UInt32, UInt64)
Expand Down Expand Up @@ -330,8 +330,8 @@ alignment(::Type{T}) where {T} = ccall(:jl_alignment, Cint, (Csize_t,), sizeof(T
for typ in atomictypes
lt = llvmtypes[typ]
ilt = llvmtypes[inttype(typ)]
rt = VersionNumber(Base.libllvm_version) >= v"3.6" ? "$lt, $lt*" : "$lt*"
irt = VersionNumber(Base.libllvm_version) >= v"3.6" ? "$ilt, $ilt*" : "$ilt*"
rt = Base.libllvm_version >= v"3.6" ? "$lt, $lt*" : "$lt*"
irt = Base.libllvm_version >= v"3.6" ? "$ilt, $ilt*" : "$ilt*"
if VersionNumber(Base.libllvm_version) >= v"3.8"
@eval getindex(x::Atomic{$typ}) =
llvmcall($"""
Expand Down
8 changes: 5 additions & 3 deletions base/boot.jl
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@

#struct LineNumberNode
# line::Int
# file::Any # nominally Union{Symbol,Void}
#end

#struct LabelNode
Expand Down Expand Up @@ -281,7 +282,8 @@ _new(:GotoNode, :Int)
_new(:NewvarNode, :SlotNumber)
_new(:QuoteNode, :ANY)
_new(:SSAValue, :Int)
eval(:((::Type{LineNumberNode})(l::Int) = $(Expr(:new, :LineNumberNode, :l))))
eval(:((::Type{LineNumberNode})(l::Int) = $(Expr(:new, :LineNumberNode, :l, nothing))))
eval(:((::Type{LineNumberNode})(l::Int, f::ANY) = $(Expr(:new, :LineNumberNode, :l, :f))))
eval(:((::Type{GlobalRef})(m::Module, s::Symbol) = $(Expr(:new, :GlobalRef, :m, :s))))
eval(:((::Type{SlotNumber})(n::Int) = $(Expr(:new, :SlotNumber, :n))))
eval(:((::Type{TypedSlot})(n::Int, t::ANY) = $(Expr(:new, :TypedSlot, :n, :t))))
Expand Down Expand Up @@ -335,15 +337,15 @@ end

# docsystem basics
macro doc(x...)
atdoc(x...)
atdoc(__source__, x...)
end
macro __doc__(x)
Expr(:escape, Expr(:block, Expr(:meta, :doc), x))
end
macro doc_str(s)
Expr(:escape, s)
end
atdoc = (str, expr) -> Expr(:escape, expr)
atdoc = (source, str, expr) -> Expr(:escape, expr)
atdoc!(λ) = global atdoc = λ


Expand Down
2 changes: 1 addition & 1 deletion base/c.jl
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Culong
"""
Cwchar_t
Equivalent to the native `wchar_t` c-type (`Int32`).
Equivalent to the native `wchar_t` c-type ([`Int32`](@ref)).
"""
Cwchar_t

Expand Down
34 changes: 11 additions & 23 deletions base/combinatorics.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,17 @@

# Factorials

const _fact_table64 =
Int64[1,2,6,24,120,720,5040,40320,362880,3628800,39916800,479001600,6227020800,
87178291200,1307674368000,20922789888000,355687428096000,6402373705728000,
121645100408832000,2432902008176640000]

const _fact_table128 =
UInt128[0x00000000000000000000000000000001, 0x00000000000000000000000000000002,
0x00000000000000000000000000000006, 0x00000000000000000000000000000018,
0x00000000000000000000000000000078, 0x000000000000000000000000000002d0,
0x000000000000000000000000000013b0, 0x00000000000000000000000000009d80,
0x00000000000000000000000000058980, 0x00000000000000000000000000375f00,
0x00000000000000000000000002611500, 0x0000000000000000000000001c8cfc00,
0x0000000000000000000000017328cc00, 0x0000000000000000000000144c3b2800,
0x00000000000000000000013077775800, 0x00000000000000000000130777758000,
0x00000000000000000001437eeecd8000, 0x00000000000000000016beecca730000,
0x000000000000000001b02b9306890000, 0x000000000000000021c3677c82b40000,
0x0000000000000002c5077d36b8c40000, 0x000000000000003ceea4c2b3e0d80000,
0x000000000000057970cd7e2933680000, 0x00000000000083629343d3dcd1c00000,
0x00000000000cd4a0619fb0907bc00000, 0x00000000014d9849ea37eeac91800000,
0x00000000232f0fcbb3e62c3358800000, 0x00000003d925ba47ad2cd59dae000000,
0x0000006f99461a1e9e1432dcb6000000, 0x00000d13f6370f96865df5dd54000000,
0x0001956ad0aae33a4560c5cd2c000000, 0x0032ad5a155c6748ac18b9a580000000,
0x0688589cc0e9505e2f2fee5580000000, 0xde1bc4d19efcac82445da75b00000000]
const _fact_table64 = Vector{Int64}(20)
_fact_table64[1] = 1
for n in 2:20
_fact_table64[n] = _fact_table64[n-1] * n
end

const _fact_table128 = Vector{UInt128}(34)
_fact_table128[1] = 1
for n in 2:34
_fact_table128[n] = _fact_table128[n-1] * n
end

function factorial_lookup(n::Integer, table, lim)
n < 0 && throw(DomainError())
Expand Down
14 changes: 12 additions & 2 deletions base/complex.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# This file is a part of Julia. License is MIT: https://julialang.org/license

"""
Complex{T<:Real} <: Number
Complex number type with real and imaginary part of type `T`.
`Complex32`, `Complex64` and `Complex128` are aliases for
`Complex{Float16}`, `Complex{Float32}` and `Complex{Float64}` respectively.
"""
struct Complex{T<:Real} <: Number
re::T
im::T
Expand Down Expand Up @@ -603,19 +611,21 @@ function ^(z::Complex{T}, p::Complex{T})::Complex{T} where T<:AbstractFloat
end
end

function exp2(z::Complex{T}) where T
function exp2(z::Complex{T}) where T<:AbstractFloat
er = exp2(real(z))
theta = imag(z) * log(convert(T, 2))
s, c = sincos(theta)
Complex(er * c, er * s)
end
exp2(z::Complex) = exp2(float(z))

function exp10(z::Complex{T}) where T
function exp10(z::Complex{T}) where T<:AbstractFloat
er = exp10(real(z))
theta = imag(z) * log(convert(T, 10))
s, c = sincos(theta)
Complex(er * c, er * s)
end
exp10(z::Complex) = exp10(float(z))

function ^(z::T, p::T) where T<:Complex
if isinteger(p)
Expand Down
Loading

0 comments on commit 77269fe

Please sign in to comment.