You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/src/devdocs/eval.md
+14-14Lines changed: 14 additions & 14 deletions
Original file line number
Diff line number
Diff line change
@@ -25,7 +25,7 @@ The 10,000 foot view of the whole process is as follows:
25
25
1. The user starts `julia`.
26
26
2. The C function `main()` from `ui/repl.c` gets called. This function processes the command line
27
27
arguments, filling in the `jl_options` struct and setting the variable `ARGS`. It then initializes
28
-
Julia (by calling [`julia_init` in task.c](https://github.com/JuliaLang/julia/blob/master/src/task.c),
28
+
Julia (by calling [`julia_init` in `task.c`](https://github.com/JuliaLang/julia/blob/master/src/task.c),
29
29
which may load a previously compiled [sysimg](@ref dev-sysimg)). Finally, it passes off control to Julia
30
30
by calling [`Base._start()`](https://github.com/JuliaLang/julia/blob/master/base/client.jl).
31
31
3. When `_start()` takes over control, the subsequent sequence of commands depends on the command
@@ -45,7 +45,7 @@ The 10,000 foot view of the whole process is as follows:
45
45
the AST to make it simpler to execute.
46
46
10.`jl_toplevel_eval_flex()` then uses some simple heuristics to decide whether to JIT compiler the
47
47
AST or to interpret it directly.
48
-
11. The bulk of the work to interpret code is handled by [`eval` in interpreter.c](https://github.com/JuliaLang/julia/blob/master/src/interpreter.c).
48
+
11. The bulk of the work to interpret code is handled by [`eval` in `interpreter.c`](https://github.com/JuliaLang/julia/blob/master/src/interpreter.c).
49
49
12. If instead, the code is compiled, the bulk of the work is handled by `codegen.cpp`. Whenever a
50
50
Julia function is called for the first time with a given set of argument types, [type inference](@ref dev-type-inference)
51
51
will be run on that function. This information is used by the [codegen](@ref dev-codegen) step to generate
@@ -62,12 +62,12 @@ The 10,000 foot view of the whole process is as follows:
62
62
The Julia parser is a small lisp program written in femtolisp, the source-code for which is distributed
63
63
inside Julia in [src/flisp](https://github.com/JuliaLang/julia/tree/master/src/flisp).
64
64
65
-
The interface functions for this are primarily defined in [jlfrontend.scm](https://github.com/JuliaLang/julia/blob/master/src/jlfrontend.scm).
66
-
The code in [ast.c](https://github.com/JuliaLang/julia/blob/master/src/ast.c) handles this handoff
65
+
The interface functions for this are primarily defined in [`jlfrontend.scm`](https://github.com/JuliaLang/julia/blob/master/src/jlfrontend.scm).
66
+
The code in [`ast.c`](https://github.com/JuliaLang/julia/blob/master/src/ast.c) handles this handoff
67
67
on the Julia side.
68
68
69
-
The other relevant files at this stage are [julia-parser.scm](https://github.com/JuliaLang/julia/blob/master/src/julia-parser.scm),
70
-
which handles tokenizing Julia code and turning it into an AST, and [julia-syntax.scm](https://github.com/JuliaLang/julia/blob/master/src/julia-syntax.scm),
69
+
The other relevant files at this stage are [`julia-parser.scm`](https://github.com/JuliaLang/julia/blob/master/src/julia-parser.scm),
70
+
which handles tokenizing Julia code and turning it into an AST, and [`julia-syntax.scm`](https://github.com/JuliaLang/julia/blob/master/src/julia-syntax.scm),
71
71
which handles transforming complex AST representations into simpler, "lowered" AST representations
72
72
which are more suitable for analysis and execution.
73
73
@@ -83,7 +83,7 @@ although it can also be invoked directly by a call to [`macroexpand()`](@ref)/`j
83
83
84
84
## [Type Inference](@id dev-type-inference)
85
85
86
-
Type inference is implemented in Julia by [typeinf() in inference.jl](https://github.com/JuliaLang/julia/blob/master/base/inference.jl).
86
+
Type inference is implemented in Julia by [`typeinf()` in `inference.jl`](https://github.com/JuliaLang/julia/blob/master/base/inference.jl).
87
87
Type inference is the process of examining a Julia function and determining bounds for the types
88
88
of each of its variables, as well as bounds on the type of the return value from the function.
89
89
This enables many future optimizations, such as unboxing of known immutable values, and compile-time
@@ -135,26 +135,26 @@ Type inference may also include other steps such as constant propagation and inl
135
135
136
136
Codegen is the process of turning a Julia AST into native machine code.
137
137
138
-
The JIT environment is initialized by an early call to [`jl_init_codegen` in codegen.cpp](https://github.com/JuliaLang/julia/blob/master/src/codegen.cpp).
138
+
The JIT environment is initialized by an early call to [`jl_init_codegen` in `codegen.cpp`](https://github.com/JuliaLang/julia/blob/master/src/codegen.cpp).
139
139
140
140
On demand, a Julia method is converted into a native function by the function `emit_function(jl_method_instance_t*)`.
141
141
(note, when using the MCJIT (in LLVM v3.4+), each function must be JIT into a new module.) This
142
142
function recursively calls `emit_expr()` until the entire function has been emitted.
143
143
144
144
Much of the remaining bulk of this file is devoted to various manual optimizations of specific
145
145
code patterns. For example, `emit_known_call()` knows how to inline many of the primitive functions
146
-
(defined in [builtins.c](https://github.com/JuliaLang/julia/blob/master/src/builtins.c)) for various
146
+
(defined in [`builtins.c`](https://github.com/JuliaLang/julia/blob/master/src/builtins.c)) for various
147
147
combinations of argument types.
148
148
149
149
Other parts of codegen are handled by various helper files:
0 commit comments