这个是对 julia devdoc Julia 运行时的初始化 的补充笔记。
较为详细的给出了文档中涉及到的函数调用点、被调用函数源代码所在的位置。
(主要是整理了一堆链接,不保存一下浪费了
关联 PR
代码基于 julia 1.6.3,以 cygwin+mingw64+x86_64 环境的调试版编译产物为例
main()
到下一节的调用链:mainCRTStartup
→ jl_load_repl
→ repl_entrypoint
→ julia_init
mainCRTStartup
@ cli/loader_exe.c:26
jl_load_repl
@ cli/loader_lib.c:183
repl_entrypoint
@ src/jlapi.c:668
julia_init()
到下一节的调用链:julia_init
→ return
→ true_main
julia_init
@ src/task.c:309 →
_julia_init
@ src/init.c:631
true_main()
到下一节的调用链:true_main
→ jl_apply
→ Base._start
true_main
@ src/jlapi.c:549
Base._start
Base._start
@ base/client.jl:477
Core.eval
到下一节的调用链:Core.eval
→ return to repl_entrypoint
→ jl_atexit_hook
Core.eval
@ base/boot.jl:360
Full stack dumps
Stack frame |
Source file |
next call (GDB output) |
Notes |
jl_uv_write |
jl_uv.c:463 |
cli/trampolines/ trampolines_x86_64.S |
called though [ccall ] |
julia_uv_write_async_21396 |
stream.jl:1017 |
stream.jl:1024 |
Base.uv_write_async(s::LibuvStream, p::Ptr{UInt8}, n::UInt) |
julia_uv_write_35687 |
stream.jl:980 |
stream.jl:981 |
Base.uv_write(s::LibuvStream, p::Ptr{UInt8}, n::UInt) |
julia_unsafe_write_20103 |
stream.jl:1046 |
stream.jl:1064 |
Base.unsafe_write(s::LibuvStream, p::Ptr{UInt8}, n::UInt) |
write |
strings/io.jl:185 |
strings/io.jl:185 |
Base.write(io::IO, s::Union{String,SubString{String}}) |
print |
strings/io.jl:187 |
strings/io.jl:187 |
Base.print(io::IO, s::Union{String,SubString{String}}) |
japi1_print_42299 |
strings/io.jl:42 |
strings/io.jl:46 |
Base.print(io::IO, xs...) |
jl_fptr_args |
gf.c:2001 |
cli/trampolines/ trampolines_x86_64.S |
|
_jl_invoke |
gf.c:2210 |
gf.c:2218 |
|
jl_apply_generic |
gf.c:2412 |
cli/trampolines/ trampolines_x86_64.S |
print(::Base.TTY, ::String, ::Char) |
jl_apply |
julia.h:1701 |
julia.h:1703 |
|
do_apply |
builtins.c:512 |
builtins.c:670 |
|
jl_f__apply_iterate |
builtins.c:675 |
cli/trampolines/ trampolines_x86_64.S |
JL_CALLABLE(jl_f__apply_iterate) |
japi1_println_27966 |
strings/io.jl:73 |
strings/io.jl:73 |
Base.println(io::IO, xs...) |
jl_fptr_args |
gf.c:2001 |
cli/trampolines/ trampolines_x86_64.S |
|
_jl_invoke |
gf.c:2210 |
gf.c:2218 |
|
jl_apply_generic |
gf.c:2412 |
cli/trampolines/ trampolines_x86_64.S |
println(::Base.TTY, ::String) |
japi1_println_27976 |
coreio.jl:4 |
coreio.jl:4 |
Base.println(xs...) |
jl_fptr_args |
gf.c:2001 |
cli/trampolines/ trampolines_x86_64.S |
|
_jl_invoke |
gf.c:2210 |
gf.c:2218 |
|
jl_apply_generic |
gf.c:2412 |
cli/trampolines/ trampolines_x86_64.S |
println(::String) |
jl_apply |
julia.h:1701 |
julia.h:1703 |
|
do_call |
interpreter.c:107 |
interpreter.c:115 |
|
eval_value |
interpreter.c:159 |
interpreter.c:204 |
|
eval_stmt_value |
interpreter.c:153 |
interpreter.c:155 |
|
eval_body |
interpreter.c:391 |
interpreter.c:558 |
|
jl_interpret_toplevel_thunk |
interpreter.c:655 |
interpreter.c:670 |
|
jl_toplevel_eval_flex |
toplevel.c:825 |
toplevel.c:877 |
|
jl_toplevel_eval_flex |
toplevel.c:616 |
toplevel.c:825 |
|
jl_toplevel_eval |
toplevel.c:884 |
cli/trampolines/ trampolines_x86_64.S |
|
jl_toplevel_eval_in |
toplevel.c:917 |
cli/trampolines/ trampolines_x86_64.S |
|
Core.eval |
boot.jl:360 |
boot.jl:360 |
Base.eval(m::Module, @nospecialize(e)) |
julia_exec_options_19488 |
client.jl:204 |
client.jl:261 |
Base.exec_options(opts) |
julia__start_46180 |
client.jl:477 |
client.jl:485 |
Base._start() |
jfptr.start_46181 |
0x2a6b11fa5 |
|
|
_jl_invoke |
gf.c:2210 |
gf.c:2218 |
|
jl_apply_generic |
gf.c:2412 |
cli/trampolines/ trampolines_x86_64.S |
_start() |
jl_apply |
julia.h:1701 |
julia.h:1703 |
|
true_main |
jlapi.c:549 |
jlapi.c:560 |
|
repl_entrypoint |
jlapi.c:668 |
jlapi.c:702 |
|
jl_load_repl |
cli/loader_lib.c:183 |
cli/loader_lib.c:214 |
|
mainCRTStartup |
cli/loader_exe.c:26 |
cli/loader_exe.c:51 |
|
jl_atexit_hook()
到下一节的调用链:jl_atexit_hook
→ jl_write_compiler_output
jl_atexit_hook
@ src/init.c:203
jl_write_compiler_output()
if exitcode == 0
&& jl_generating_output()
then call:
jl_write_compiler_output
@ src/precompile.c:25