Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 301322
b: refs/heads/anj/transpose
c: 5287930
h: refs/heads/master
  • Loading branch information
vtjnash committed Oct 27, 2015
1 parent 47b4473 commit 8890288
Show file tree
Hide file tree
Showing 16 changed files with 183 additions and 48 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ refs/heads/kf/uvint32: eaeee720ed1d4109801549813c7bdbe5d16c75e4
"refs/heads/sjk/return_type": bea6a57566034aaf880b7f380e9e4e7cea9733a3
refs/heads/tan/sparse: 27e4b6914cdc5ef685cb832dd194348164caec10
refs/heads/kf/mmap: 64facb8fd791faf0a5f0768be2e2e2f320e1f2eb
refs/heads/anj/transpose: d61a09ad8ae6c5d3f9f2a9902f638f3eafdae938
refs/heads/anj/transpose: 5287930780545fba8a05a53970f5ddf49cd1e053
"refs/heads/jn/cond_module": 687ae19896c164292399bb73c19154bf68976ee5
refs/heads/teh/multiprocloading: eabdd0f2c48ad31007266c46fe3aad7f987c6d41
refs/heads/kf/replfixes: 1c345c7d9598b0ae5d4818ecdba1eb25a170bd77
Expand Down
3 changes: 3 additions & 0 deletions branches/anj/transpose/base/complex.jl
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ reim(z) = (real(z), imag(z))
real{T<:Real}(::Type{T}) = T
real{T<:Real}(::Type{Complex{T}}) = T

complex{T<:Real}(::Type{T}) = Complex{T}
complex{T<:Real}(::Type{Complex{T}}) = Complex{T}

isreal(x::Real) = true
isreal(z::Complex) = imag(z) == 0
isimag(z::Number) = real(z) == 0
Expand Down
8 changes: 8 additions & 0 deletions branches/anj/transpose/base/inference.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2721,6 +2721,14 @@ function inlineable(f::ANY, e::Expr, atype::ANY, sv::StaticVarInfo, enclosing_as
expr = lastexpr.args[1]
end

if length(stmts) == 1
# remove line number when inlining a single expression. see issue #13725
s = stmts[1]
if isa(s,Expr)&&is(s.head,:line) || isa(s,LineNumberNode)
pop!(stmts)
end
end

if isa(expr,Expr)
old_t = e.typ
if old_t <: expr.typ
Expand Down
40 changes: 23 additions & 17 deletions branches/anj/transpose/base/loading.jl
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,9 @@ end

# returns an array of modules loaded, or nothing if failed
function _require_from_serialized(node::Int, mod::Symbol, path_to_try::ByteString, toplevel_load::Bool)
if JLOptions().use_compilecache == 0
return nothing
end
restored = nothing
if toplevel_load && myid() == 1 && nprocs() > 1
recompile_stale(mod, path_to_try)
Expand Down Expand Up @@ -177,6 +180,9 @@ function _require_from_serialized(node::Int, mod::Symbol, path_to_try::ByteStrin
end

function _require_from_serialized(node::Int, mod::Symbol, toplevel_load::Bool)
if JLOptions().use_compilecache == 0
return nothing
end
if node == myid()
paths = find_all_in_cache_path(mod)
else
Expand Down Expand Up @@ -234,8 +240,10 @@ precompilableerror(ex, c) = false
# to be prevent it from being precompiled (false). __precompile__(true) is
# ignored except within "require" call.
function __precompile__(isprecompilable::Bool=true)
if myid() == 1 && isprecompilable != (0 != ccall(:jl_generating_output, Cint, ())) &&
!(isprecompilable && toplevel_load::Bool)
if (myid() == 1 &&
JLOptions().use_compilecache != 0 &&
isprecompilable != (0 != ccall(:jl_generating_output, Cint, ())) &&
!(isprecompilable && toplevel_load::Bool))
throw(PrecompilableError(isprecompilable))
end
end
Expand All @@ -246,19 +254,21 @@ function require_modname(name::AbstractString)
# While we could also strip off the absolute path, the user may be
# deliberately directing to a different file than what got
# cached. So this takes a conservative approach.
if endswith(name, ".jl")
tmp = name[1:end-3]
for prefix in LOAD_CACHE_PATH
path = joinpath(prefix, tmp*".ji")
if isfile(path)
return tmp
if Bool(JLOptions().use_compilecache)
if endswith(name, ".jl")
tmp = name[1:end-3]
for prefix in LOAD_CACHE_PATH
path = joinpath(prefix, tmp*".ji")
if isfile(path)
return tmp
end
end
end
end
name
return name
end

doc"""
"""
reload(name::AbstractString)
Force reloading of a package, even if it has been loaded before. This is intended for use
Expand Down Expand Up @@ -305,7 +315,6 @@ function require(mod::Symbol)
end
return
end

name = string(mod)
path = find_in_node_path(name, nothing, 1)
if path === nothing
Expand Down Expand Up @@ -347,9 +356,8 @@ include_string(txt::ByteString, fname::ByteString) =
ccall(:jl_load_file_string, Any, (Ptr{UInt8},Csize_t,Ptr{UInt8},Csize_t),
txt, sizeof(txt), fname, sizeof(fname))

include_string(txt::AbstractString, fname::AbstractString) = include_string(bytestring(txt), bytestring(fname))

include_string(txt::AbstractString) = include_string(txt, "string")
include_string(txt::AbstractString, fname::AbstractString="string") =
include_string(bytestring(txt), bytestring(fname))

function source_path(default::Union{AbstractString,Void}="")
t = current_task()
Expand Down Expand Up @@ -436,9 +444,7 @@ function create_expr_cache(input::AbstractString, output::AbstractString)
serialize(io, :(Base._track_dependencies[1] = true))
serialize(io, :(Base.include($(abspath(input)))))
if source !== nothing
serialize(io, quote
delete!(task_local_storage(), :SOURCE_PATH)
end)
serialize(io, :(delete!(task_local_storage(), :SOURCE_PATH)))
end
close(io)
wait(pobj)
Expand Down
15 changes: 15 additions & 0 deletions branches/anj/transpose/base/options.jl
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ immutable JLOptions
worker::Int8
handle_signals::Int8
use_precompiled::Int8
use_compilecache::Int8
bindto::Ptr{UInt8}
outputbc::Ptr{UInt8}
outputo::Ptr{UInt8}
Expand All @@ -36,3 +37,17 @@ immutable JLOptions
end

JLOptions() = unsafe_load(cglobal(:jl_options, JLOptions))

function show(io::IO, opt::JLOptions)
println(io, "JLOptions(")
fields = fieldnames(opt)
nfields = length(fields)
for (i,f) in enumerate(fieldnames(opt))
v = getfield(opt,f)
if isa(v, Ptr{UInt8})
v = v != C_NULL ? bytestring(v) : ""
end
println(io, " ", f, " = ", repr(v), i < nfields ? "," : "")
end
print(io,")")
end
1 change: 1 addition & 0 deletions branches/anj/transpose/base/pkg/entry.jl
Original file line number Diff line number Diff line change
Expand Up @@ -543,6 +543,7 @@ function build!(pkgs::Vector, errs::Dict, seen::Set=Set())
end
"""
io, pobj = open(detach(`$(Base.julia_cmd())
--compilecache=$(Bool(Base.JLOptions().use_compilecache) ? "yes" : "no")
--history-file=no
--color=$(Base.have_color ? "yes" : "no")
--eval $code`), "w", STDOUT)
Expand Down
2 changes: 1 addition & 1 deletion branches/anj/transpose/deps/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -645,7 +645,7 @@ ifeq ($(BUILD_LLDB),1)
(cd $(LLVM_SRC_DIR)/tools/lldb && \
git pull --ff-only)
ifneq ($(LLVM_GIT_VER_LLDB),)
(cd $(LLVM_SRC_DIR)/tools/LLDB && \
(cd $(LLVM_SRC_DIR)/tools/lldb && \
git checkout $(LLVM_GIT_VER_LLDB))
endif # LLVM_GIT_VER_CLANG
endif # BUILD_LLDB
Expand Down
77 changes: 48 additions & 29 deletions branches/anj/transpose/doc/man/julia.1
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ If a Julia source file is given as a \fIprogram\fP (optionally followed by

.\" This section was taken nearly verbatim from the output of `julia --help`
.SH "COMMAND-LINE OPTIONS"
.TP 25

.TP
-v, --version
Expand All @@ -65,13 +64,25 @@ Display version information
Print help message

.TP
-q, --quiet
Quiet startup without banner
-J, --sysimage <file>
Start up with the given system image file

.TP
-precompiled={yes|no}
Use precompiled code from system image if available

.TP
-H, --home <dir>
Set location of julia executable

.TP
--startup-file={yes|no}
Load ~/.juliarc.jl

.TP
--handle-signals={yes|no}
Enable or disable Julia's default signal handlers

.TP
-e, --eval <expr>
Evaluate <expr>
Expand All @@ -88,14 +99,6 @@ Evaluate <expr>, but don't disable interactive mode
-L, --load <file>
Load <file> immediately on all processors

.TP
-J, --sysimage <file>
Start up with the given system image file

.TP
-C, --cpu-target <target>
Limit usage of cpu features up to <target>

.TP
-p, --procs <n>
Run n local processes
Expand All @@ -108,6 +111,10 @@ Run processes on hosts listed in <file>
-i
Force isinteractive() to be true

.TP
-q, --quiet
Quiet startup without banner

.TP
--color={yes|no}
Enable or disable color text
Expand All @@ -117,45 +124,57 @@ Enable or disable color text
Load or save history

.TP
--startup-file={yes|no}
Load ~/.juliarc.jl

.TP
--compile={yes|no|all}
--compile={yes|no|all}
Enable or disable compiler, or request exhaustive compilation

.TP
--code-coverage={none|user|all}, --code-coverage
Count executions of source lines (omitting setting is equivalent to 'user')

.TP
--track-allocation={none|user|all}, --track-allocation
Count bytes allocated by each source line
-C, --cpu-target <target>
Limit usage of cpu features up to <target>

.TP
-O, --optimize
Run time-intensive code optimizations

.TP
--inline={yes|no}
Control whether inlining is permitted (overrides functions declared as @inline)

.TP
--check-bounds={yes|no}
Emit bounds checks always or never (ignoring declarations)

.TP
--dump-bitcode={yes|no}
Dump bitcode for the system image (used with --build)
--math-mode={ieee|user}
Always use IEEE semantics for math (ignoring declarations),
or adhere to declarations in source code

.TP
--depwarn={yes|no|error}
Enable or disable syntax and method deprecation warnings ('error' turns warnings into errors)

.TP
--inline={yes|no}
Control whether inlining is permitted (overrides functions declared as @inline)
--output-o name
Generate an object file (including system image data)

.TP
--math-mode={ieee|user}
Always use IEEE semantics for math (ignoring declarations),
or adhere to declarations in source code
--output-ji name
Generate a system image data file (.ji)

.TP
--output-bc name
Generate LLVM bitcode (.bc)

.TP
--output-incremental=no
Generate an incremental output file (rather than complete)

.TP
--code-coverage={none|user|all}, --code-coverage
Count executions of source lines (omitting setting is equivalent to 'user')

.TP
--track-allocation={none|user|all}, --track-allocation
Count bytes allocated by each source line

.SH FILES
.I ~/.juliarc.jl
Expand Down
1 change: 1 addition & 0 deletions branches/anj/transpose/doc/manual/getting-started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ those available for the ``perl`` and ``ruby`` programs::

-J, --sysimage <file> Start up with the given system image file
--precompiled={yes|no} Use precompiled code from system image if available
--compilecache={yes|no} Enable/disable incremental precompilation of modules\n"
-H, --home <dir> Set location of julia executable
--startup-file={yes|no} Load ~/.juliarc.jl
-f, --no-startup Don't load ~/.juliarc (deprecated, use --startup-file=no)
Expand Down
6 changes: 6 additions & 0 deletions branches/anj/transpose/doc/manual/modules.rst
Original file line number Diff line number Diff line change
Expand Up @@ -419,3 +419,9 @@ A few other points to be aware of:

4. WeakRef objects and finalizers are not currently handled properly by the serializer
(this will be fixed in an upcoming release).

It is sometimes helpful during module development to turn off incremental precompilation.
The command line flag ``--compilecache={yes|no}`` enables you to toggle module precompilation on and off.
When Julia is started with ``--compilecache=no`` the serialized modules in the compile cache are ignored when loading modules and module dependencies.
``Base.compilecache()`` can still be called manually and it will respect ``__precompile__()`` directives for the module.
The state of this command line flag is passed to ``Pkg.build()`` to disable automatic precompilation triggering when installing, updating, and explicitly building packages.
1 change: 1 addition & 0 deletions branches/anj/transpose/src/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ jl_options_t jl_options = { 0, // quiet
#else
JL_OPTIONS_USE_PRECOMPILED_YES,
#endif
JL_OPTIONS_USE_COMPILECACHE_YES,
NULL, // bindto
NULL, // outputbc
NULL, // outputo
Expand Down
4 changes: 4 additions & 0 deletions branches/anj/transpose/src/julia.h
Original file line number Diff line number Diff line change
Expand Up @@ -1572,6 +1572,7 @@ typedef struct {
int8_t worker;
int8_t handle_signals;
int8_t use_precompiled;
int8_t use_compilecache;
const char *bindto;
const char *outputbc;
const char *outputo;
Expand Down Expand Up @@ -1621,6 +1622,9 @@ DLLEXPORT int jl_generating_output(void);
#define JL_OPTIONS_USE_PRECOMPILED_YES 1
#define JL_OPTIONS_USE_PRECOMPILED_NO 0

#define JL_OPTIONS_USE_COMPILECACHE_YES 1
#define JL_OPTIONS_USE_COMPILECACHE_NO 0

// Version information
#include <julia_version.h>

Expand Down
6 changes: 6 additions & 0 deletions branches/anj/transpose/test/cmdlineargs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -232,4 +232,10 @@ let exename = `$(joinpath(JULIA_HOME, Base.julia_exename())) --precompiled=yes`
@test readchomp(pipeline(ignorestatus(`$exename -f -p`),stderr=`cat`)) == "ERROR: option `-p/--procs` is missing an argument"
@test readchomp(pipeline(ignorestatus(`$exename -f --inline`),stderr=`cat`)) == "ERROR: option `--inline` is missing an argument"
@test readchomp(pipeline(ignorestatus(`$exename -f -e "@show ARGS" -now -- julia RUN.jl`),stderr=`cat`)) == "ERROR: unknown option `-n`"

# --compilecache={yes|no}
@test readchomp(`$exename -E "Bool(Base.JLOptions().use_compilecache)"`) == "true"
@test readchomp(`$exename --compilecache=yes -E "Bool(Base.JLOptions().use_compilecache)"`) == "true"
@test readchomp(`$exename --compilecache=no -E "Bool(Base.JLOptions().use_compilecache)"`) == "false"
@test !success(`$exename --compilecache=foo -e "exit(0)"`)
end
Loading

0 comments on commit 8890288

Please sign in to comment.