Skip to content

Commit

Permalink
underscore-related renaming (#1539): function_loc->functionloc, compi…
Browse files Browse the repository at this point in the history
…le_hint->precompile

un-export enq_work
rename each_line in doc
rename usleep to systemsleep (not exported)
  • Loading branch information
JeffBezanson committed Mar 16, 2013
1 parent ebdbefe commit b3aab70
Show file tree
Hide file tree
Showing 7 changed files with 136 additions and 135 deletions.
2 changes: 1 addition & 1 deletion base/base.jl
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ end
macro thunk(ex); :(()->$(esc(ex))); end
macro L_str(s); s; end

function compile_hint(f, args::Tuple)
function precompile(f, args::Tuple)
if isgeneric(f)
ccall(:jl_compile_hint, Void, (Any, Any), f, args)
end
Expand Down
2 changes: 2 additions & 0 deletions base/deprecated.jl
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,8 @@ end
@deprecate check_utf8(x) (is_valid_utf8(x)?x:error())
@deprecate each_line eachline
@deprecate each_match eachmatch
@deprecate function_loc functionloc
@deprecate compile_hint precompile

# note removed macros: str, B_str, I_str, E_str, L_str, L_mstr, I_mstr, E_mstr

Expand Down
5 changes: 2 additions & 3 deletions base/exports.jl
Original file line number Diff line number Diff line change
Expand Up @@ -903,7 +903,7 @@ export
# help and reflection
ans,
apropos,
function_loc,
functionloc,
edit,
methods,
methodswith,
Expand All @@ -928,7 +928,7 @@ export
require,

# RTS internals
compile_hint, # TODO: rename to "precompile"?
precompile,
finalizer,
gc,
gc_disable,
Expand Down Expand Up @@ -1011,7 +1011,6 @@ export
fetch,
isready,
yield,
enq_work,
myid,
nprocs,
pmap,
Expand Down
4 changes: 2 additions & 2 deletions base/libc.jl
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
## time-related functions ##

# TODO: check for usleep errors?
@unix_only usleep(s::Real) = ccall(:usleep, Int32, (Uint32,), uint32(iround(s*1e6)))
@windows_only usleep(s::Real) = (ccall(:Sleep, stdcall, Void, (Uint32,), uint32(iround(s*1e3))); return int32(0))
@unix_only systemsleep(s::Real) = ccall(:usleep, Int32, (Uint32,), uint32(iround(s*1e6)))
@windows_only systemsleep(s::Real) = (ccall(:Sleep, stdcall, Void, (Uint32,), uint32(iround(s*1e3))); return int32(0))

strftime(t) = strftime("%c", t)
function strftime(fmt::ByteString, t)
Expand Down
244 changes: 122 additions & 122 deletions base/sysimg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -178,128 +178,128 @@ include("pkg.jl")
include = include_from_node1

# prime method cache with some things we know we'll need right after startup
compile_hint(pwd, ())
compile_hint(fdio, (Int32,))
compile_hint(ProcessGroup, (Int, Array{Any,1}, Array{Any,1}))
compile_hint(next, (Dict{Any,Any}, Int))
compile_hint(start, (Dict{Any,Any},))
compile_hint(perform_work, ())
compile_hint(isempty, (Array{Any,1},))
compile_hint(isempty, (Array{WorkItem,1},))
compile_hint(getindex, (Dict{Any,Any}, Int32))
compile_hint(event_loop, (Bool,))
compile_hint(_start, ())
compile_hint(process_options, (Array{Any,1},))
compile_hint(run_repl, ())
compile_hint(any, (Function, Array{Any,1}))
compile_hint(Dict{Any,Any}, (Int,))
compile_hint(Set, ())
compile_hint(setindex!, (Dict{Any,Any}, Bool, Cmd))
compile_hint(rehash, (Dict{Any,Any}, Int))
compile_hint(wait, (Int32,))
compile_hint(system_error, (Symbol, Bool))
compile_hint(SystemError, (ASCIIString,))
compile_hint(has, (EnvHash, ASCIIString))
compile_hint(parse_input_line, (ASCIIString,))
compile_hint(cmp, (Int32, Int32))
compile_hint(min, (Int32, Int32))
compile_hint(==, (ASCIIString, ASCIIString))
compile_hint(arg_gen, (ASCIIString,))
compile_hint(Random.librandom_init, ())
compile_hint(Random.srand, (ASCIIString, Int))
compile_hint(Random.srand, (Uint64,))
compile_hint(open, (ASCIIString, Bool, Bool, Bool, Bool))
compile_hint(done, (IntSet, Int64))
compile_hint(next, (IntSet, Int64))
compile_hint(ht_keyindex, (Dict{Any,Any}, Int32))
compile_hint(perform_work, (WorkItem,))
compile_hint(notify_done, (WorkItem,))
compile_hint(work_result, (WorkItem,))
compile_hint(unshift!, (Array{WorkItem,1}, WorkItem))
compile_hint(enq_work, (WorkItem,))
compile_hint(pop!, (Array{WorkItem,1},))
compile_hint(string, (Int,))
compile_hint(parse_int, (Type{Int}, ASCIIString, Int))
compile_hint(repeat, (ASCIIString, Int))
compile_hint(KeyError, (Int,))
compile_hint(show, (Float64,))
compile_hint(match, (Regex, ASCIIString))
compile_hint(length, (ASCIIString,))
compile_hint(alignment, (Float64,))
compile_hint(repl_callback, (Expr, Int))
compile_hint(istaskdone, (Task,))
compile_hint(int, (Uint64,))
compile_hint(copy, (Bool,))
compile_hint(bool, (Bool,))
compile_hint(bool, (RemoteRef,))
compile_hint(wait, (RemoteRef,))
compile_hint(hash, (RemoteRef,))
compile_hint(take, (RemoteRef,))
compile_hint(bitmix, (Int, Int))
compile_hint(bitmix, (Uint, Int))
compile_hint(bitmix, (Uint64, Int64))
compile_hint(hash, (Int,))
compile_hint(isequal, (Symbol, Symbol))
compile_hint(isequal, (Bool, Bool))
compile_hint(WaitFor, (Symbol, RemoteRef))
compile_hint(get, (EnvHash, ASCIIString, ASCIIString))
compile_hint(notify_empty, (WorkItem,))
compile_hint(rr2id, (RemoteRef,))
compile_hint(isequal, (RemoteRef, WeakRef))
compile_hint(isequal, (RemoteRef, RemoteRef))
compile_hint(_ieval, (Symbol,))
compile_hint(static_convert, (Nothing, Nothing))
compile_hint(setindex!, (Array{Any,1}, WeakRef, Int))
compile_hint(setindex!, (Dict{Any,Any}, WorkItem, (Int,Int)))
compile_hint(isequal, ((Int,Int),(Int,Int)))
compile_hint(isequal, (Int,Int))
compile_hint(RemoteRef, (Int, Int, Int))
compile_hint(eval_user_input, (Expr, Bool))
compile_hint(print, (Float64,))
compile_hint(a2t, (Array{Any,1},))
compile_hint(flush, (IOStream,))
compile_hint(getindex, (Type{ByteString}, ASCIIString, ASCIIString, ASCIIString, ASCIIString, ASCIIString, ASCIIString))
compile_hint(int, (Int,))
compile_hint(uint, (Uint,))
compile_hint(_atexit, ())
compile_hint(read, (IOStream, Array{Uint32,1}))
compile_hint(hex, (Char, Int))
compile_hint(abs, (Char,))
compile_hint(abstract_eval, (LambdaStaticData, ObjectIdDict, StaticVarInfo))
compile_hint(length, (Range1{Int},))
compile_hint(start, (Range1{Int},))
compile_hint(done, (Range1{Int},Int))
compile_hint(next, (Range1{Int},Int))
compile_hint(IOStream, (ASCIIString, Array{Uint8,1}))
compile_hint(mk_tupleref, (SymbolNode, Int))
compile_hint(abstract_interpret, (Bool, ObjectIdDict, StaticVarInfo))
compile_hint(eval_annotate, (LambdaStaticData, ObjectIdDict, StaticVarInfo, ObjectIdDict, Array{Any,1}))
compile_hint(occurs_more, (Bool, Function, Int))
compile_hint(isconstantfunc, (SymbolNode, StaticVarInfo))
compile_hint(CallStack, (Expr, Module, (Nothing,), EmptyCallStack))
compile_hint(convert, (Type{Module}, Module))
compile_hint(effect_free, (Expr,))
compile_hint(effect_free, (TopNode,))
compile_hint(abspath, (ASCIIString,))
compile_hint(isabspath, (ASCIIString,))
compile_hint(split, (ASCIIString,))
compile_hint(split, (ASCIIString, ASCIIString, Int, Bool))
compile_hint(split, (ASCIIString, Regex, Int, Bool))
compile_hint(print_joined, (IOStream, Array{String,1}, ASCIIString))
compile_hint(begins_with, (ASCIIString, ASCIIString))
compile_hint(resolve_globals, (Symbol, Module, Module, Vector{Any}, Vector{Any}))
compile_hint(resolve_globals, (SymbolNode, Module, Module, Vector{Any}, Vector{Any}))
compile_hint(BitArray, (Int,))
compile_hint(getindex, (BitArray{1}, Int,))
compile_hint(setindex!, (BitArray{1}, Bool, Int,))
compile_hint(fill!, (BitArray{1}, Bool))
compile_hint(nnz, (BitArray{1},))
compile_hint(get_chunks_id, (Int,))
compile_hint(occurs_more, (Uint8, Function, Int))
compile_hint(abstract_eval_arg, (Uint8, ObjectIdDict, StaticVarInfo))
compile_hint(occurs_outside_tupleref, (Function, Symbol, StaticVarInfo, Int))
compile_hint(search, (ASCIIString, Regex, Int))
compile_hint(setindex!, (Vector{Uint8}, Uint8, Int))
precompile(pwd, ())
precompile(fdio, (Int32,))
precompile(ProcessGroup, (Int, Array{Any,1}, Array{Any,1}))
precompile(next, (Dict{Any,Any}, Int))
precompile(start, (Dict{Any,Any},))
precompile(perform_work, ())
precompile(isempty, (Array{Any,1},))
precompile(isempty, (Array{WorkItem,1},))
precompile(getindex, (Dict{Any,Any}, Int32))
precompile(event_loop, (Bool,))
precompile(_start, ())
precompile(process_options, (Array{Any,1},))
precompile(run_repl, ())
precompile(any, (Function, Array{Any,1}))
precompile(Dict{Any,Any}, (Int,))
precompile(Set, ())
precompile(setindex!, (Dict{Any,Any}, Bool, Cmd))
precompile(rehash, (Dict{Any,Any}, Int))
precompile(wait, (Int32,))
precompile(system_error, (Symbol, Bool))
precompile(SystemError, (ASCIIString,))
precompile(has, (EnvHash, ASCIIString))
precompile(parse_input_line, (ASCIIString,))
precompile(cmp, (Int32, Int32))
precompile(min, (Int32, Int32))
precompile(==, (ASCIIString, ASCIIString))
precompile(arg_gen, (ASCIIString,))
precompile(Random.librandom_init, ())
precompile(Random.srand, (ASCIIString, Int))
precompile(Random.srand, (Uint64,))
precompile(open, (ASCIIString, Bool, Bool, Bool, Bool))
precompile(done, (IntSet, Int64))
precompile(next, (IntSet, Int64))
precompile(ht_keyindex, (Dict{Any,Any}, Int32))
precompile(perform_work, (WorkItem,))
precompile(notify_done, (WorkItem,))
precompile(work_result, (WorkItem,))
precompile(unshift!, (Array{WorkItem,1}, WorkItem))
precompile(enq_work, (WorkItem,))
precompile(pop!, (Array{WorkItem,1},))
precompile(string, (Int,))
precompile(parse_int, (Type{Int}, ASCIIString, Int))
precompile(repeat, (ASCIIString, Int))
precompile(KeyError, (Int,))
precompile(show, (Float64,))
precompile(match, (Regex, ASCIIString))
precompile(length, (ASCIIString,))
precompile(alignment, (Float64,))
precompile(repl_callback, (Expr, Int))
precompile(istaskdone, (Task,))
precompile(int, (Uint64,))
precompile(copy, (Bool,))
precompile(bool, (Bool,))
precompile(bool, (RemoteRef,))
precompile(wait, (RemoteRef,))
precompile(hash, (RemoteRef,))
precompile(take, (RemoteRef,))
precompile(bitmix, (Int, Int))
precompile(bitmix, (Uint, Int))
precompile(bitmix, (Uint64, Int64))
precompile(hash, (Int,))
precompile(isequal, (Symbol, Symbol))
precompile(isequal, (Bool, Bool))
precompile(WaitFor, (Symbol, RemoteRef))
precompile(get, (EnvHash, ASCIIString, ASCIIString))
precompile(notify_empty, (WorkItem,))
precompile(rr2id, (RemoteRef,))
precompile(isequal, (RemoteRef, WeakRef))
precompile(isequal, (RemoteRef, RemoteRef))
precompile(_ieval, (Symbol,))
precompile(static_convert, (Nothing, Nothing))
precompile(setindex!, (Array{Any,1}, WeakRef, Int))
precompile(setindex!, (Dict{Any,Any}, WorkItem, (Int,Int)))
precompile(isequal, ((Int,Int),(Int,Int)))
precompile(isequal, (Int,Int))
precompile(RemoteRef, (Int, Int, Int))
precompile(eval_user_input, (Expr, Bool))
precompile(print, (Float64,))
precompile(a2t, (Array{Any,1},))
precompile(flush, (IOStream,))
precompile(getindex, (Type{ByteString}, ASCIIString, ASCIIString, ASCIIString, ASCIIString, ASCIIString, ASCIIString))
precompile(int, (Int,))
precompile(uint, (Uint,))
precompile(_atexit, ())
precompile(read, (IOStream, Array{Uint32,1}))
precompile(hex, (Char, Int))
precompile(abs, (Char,))
precompile(abstract_eval, (LambdaStaticData, ObjectIdDict, StaticVarInfo))
precompile(length, (Range1{Int},))
precompile(start, (Range1{Int},))
precompile(done, (Range1{Int},Int))
precompile(next, (Range1{Int},Int))
precompile(IOStream, (ASCIIString, Array{Uint8,1}))
precompile(mk_tupleref, (SymbolNode, Int))
precompile(abstract_interpret, (Bool, ObjectIdDict, StaticVarInfo))
precompile(eval_annotate, (LambdaStaticData, ObjectIdDict, StaticVarInfo, ObjectIdDict, Array{Any,1}))
precompile(occurs_more, (Bool, Function, Int))
precompile(isconstantfunc, (SymbolNode, StaticVarInfo))
precompile(CallStack, (Expr, Module, (Nothing,), EmptyCallStack))
precompile(convert, (Type{Module}, Module))
precompile(effect_free, (Expr,))
precompile(effect_free, (TopNode,))
precompile(abspath, (ASCIIString,))
precompile(isabspath, (ASCIIString,))
precompile(split, (ASCIIString,))
precompile(split, (ASCIIString, ASCIIString, Int, Bool))
precompile(split, (ASCIIString, Regex, Int, Bool))
precompile(print_joined, (IOStream, Array{String,1}, ASCIIString))
precompile(begins_with, (ASCIIString, ASCIIString))
precompile(resolve_globals, (Symbol, Module, Module, Vector{Any}, Vector{Any}))
precompile(resolve_globals, (SymbolNode, Module, Module, Vector{Any}, Vector{Any}))
precompile(BitArray, (Int,))
precompile(getindex, (BitArray{1}, Int,))
precompile(setindex!, (BitArray{1}, Bool, Int,))
precompile(fill!, (BitArray{1}, Bool))
precompile(nnz, (BitArray{1},))
precompile(get_chunks_id, (Int,))
precompile(occurs_more, (Uint8, Function, Int))
precompile(abstract_eval_arg, (Uint8, ObjectIdDict, StaticVarInfo))
precompile(occurs_outside_tupleref, (Function, Symbol, StaticVarInfo, Int))
precompile(search, (ASCIIString, Regex, Int))
precompile(setindex!, (Vector{Uint8}, Uint8, Int))

# invoke type inference, running the existing inference code on the new
# inference code to cache an optimized version of it.
Expand Down
12 changes: 6 additions & 6 deletions base/util.jl
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ peakflops() = peakflops(2000)

# source files, editing, function reflection

function function_loc(f::Function, types)
function functionloc(f::Function, types)
for m = methods(f, types)
if isa(m[3],LambdaStaticData)
lsd = m[3]::LambdaStaticData
Expand All @@ -83,7 +83,7 @@ function function_loc(f::Function, types)
end
error("could not find function definition")
end
function_loc(f::Function) = function_loc(f, (Any...))
functionloc(f::Function) = functionloc(f, (Any...))

function whicht(f, types)
for m = methods(f, types)
Expand Down Expand Up @@ -177,10 +177,10 @@ function less(file::String, line::Integer)
end
less(file::String) = less(file, 1)

edit(f::Function) = edit(function_loc(f)...)
edit(f::Function, t) = edit(function_loc(f,t)...)
less(f::Function) = less(function_loc(f)...)
less(f::Function, t) = less(function_loc(f,t)...)
edit(f::Function) = edit(functionloc(f)...)
edit(f::Function, t) = edit(functionloc(f,t)...)
less(f::Function) = less(functionloc(f)...)
less(f::Function, t) = less(functionloc(f,t)...)

disassemble(f::Function, types::Tuple) =
print(ccall(:jl_dump_function, Any, (Any,Any), f, types)::ByteString)
Expand Down
2 changes: 1 addition & 1 deletion doc/stdlib/base.rst
Original file line number Diff line number Diff line change
Expand Up @@ -935,7 +935,7 @@ Text I/O

Read all lines as an array.

.. function:: each_line(stream)
.. function:: eachline(stream)

Create an iterable object that will yield each line from a stream.

Expand Down

0 comments on commit b3aab70

Please sign in to comment.