Skip to content

Commit abf8b1d

Browse files
authored
Merge branch 'master' into gb/sigquittasks
2 parents e9e8e56 + 7382b7a commit abf8b1d

File tree

104 files changed

+2064
-1302
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

104 files changed

+2064
-1302
lines changed

AGENTS.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,11 @@ If you made changes to the runtime (any files in `src/`), you will need to rebui
2727
julia. Run `make -j` to rebuild julia. This process may take up to 10 minutes
2828
depending on your changes.
2929

30-
After `make` run these static analysis checks:
31-
- `make -C src clang-sa-<filename>` (replace `<filename>` with the basename of the file you modified)
32-
- `make -C src clang-sagc-<filename>` which may require adding JL_GC_PUSH arguments, or JL_GC_PROMISE_ROOTED statements., or require fixing locks. Remember arguments are assumed rooted, so check the callers to make sure that is handled. If the value is being temporarily moved around in a struct or arraylist, `JL_GC_PROMISE_ROOTED(struct->field)` may be needed as a statement (it return void) immediately after reloading the struct before any use of struct. Put the promise as early in the code as is legal.
33-
- `make -C src clang-tidy-<filename>`
30+
After making changes, run static analysis checks:
31+
- First run `make -C src install-analysis-deps` to initialize dependencies (only needed once the first time).
32+
- Run `make -C src analyze-<filename> --output-sync -j8` (replace `<filename>` with the basename of any C or C++ file you modified, excluding headers).
33+
- Tests can also be rerun individually with `clang-sa-<filename>`, `clang-sagc-<filename>` or `clang-tidy-<filename>`.
34+
- If `clang-sagc-<filename>` fails, it may require adding `JL_GC_PUSH` statements, or `JL_GC_PROMISE_ROOTED` statements., or require fixing locks. Remember arguments are assumed rooted, so check the callers to make sure that is handled. If the value is being temporarily moved around in a struct or arraylist, `JL_GC_PROMISE_ROOTED(struct->field)` may be needed as a statement (it return void) immediately after reloading the struct before any use of struct. Put that promise as early in the code as is legal, near the definition not the use.
3435

3536
## Using Revise
3637

Compiler/src/Compiler.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ using Base: @_foldable_meta, @_gc_preserve_begin, @_gc_preserve_end, @nospeciali
5353
_array_for, _bits_findnext, _methods_by_ftype, _uniontypes, all, allocatedinline, any,
5454
argument_datatype, binding_kind, cconvert, copy_exprargs, datatype_arrayelem,
5555
datatype_fieldcount, datatype_fieldtypes, datatype_layoutsize, datatype_nfields,
56-
datatype_pointerfree, decode_effects_override, diff_names, fieldindex,
56+
datatype_pointerfree, decode_effects_override, diff_names, fieldindex, visit,
5757
generating_output, get_nospecializeinfer_sig, get_world_counter, has_free_typevars,
5858
hasgenerator, hasintersect, indexed_iterate, isType, is_file_tracked, is_function_def,
5959
is_meta_expr, is_meta_expr_head, is_nospecialized, is_nospecializeinfer, is_defined_const_binding,
@@ -187,6 +187,7 @@ include("typeinfer.jl")
187187
include("optimize.jl")
188188

189189
include("bootstrap.jl")
190+
include("precompile.jl")
190191
include("reflection_interface.jl")
191192
include("opaque_closure.jl")
192193

Compiler/src/abstractinterpretation.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1245,7 +1245,7 @@ function const_prop_methodinstance_heuristic(interp::AbstractInterpreter,
12451245
if isa(code, CodeInstance)
12461246
inferred = @atomic :monotonic code.inferred
12471247
# TODO propagate a specific `CallInfo` that conveys information about this call
1248-
if src_inlining_policy(interp, inferred, NoCallInfo(), IR_FLAG_NULL)
1248+
if src_inlining_policy(interp, mi, inferred, NoCallInfo(), IR_FLAG_NULL)
12491249
return true
12501250
end
12511251
end

Compiler/src/bootstrap.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77

88
function activate_codegen!()
99
ccall(:jl_set_typeinf_func, Cvoid, (Any,), typeinf_ext_toplevel)
10+
# Register the new unified compile and emit function
11+
ccall(:jl_set_compile_and_emit_func, Cvoid, (Any,), compile_and_emit_native)
1012
Core.eval(Compiler, quote
1113
let typeinf_world_age = Base.tls_world_age()
1214
@eval Core.OptimizedGenerics.CompilerPlugins.typeinf(::Nothing, mi::MethodInstance, source_mode::UInt8) =

Compiler/src/optimize.jl

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,17 @@ is_declared_noinline(@nospecialize src::MaybeCompressed) =
132132
#####################
133133

134134
# return whether this src should be inlined. If so, retrieve_ir_for_inlining must return an IRCode from it
135+
136+
function src_inlining_policy(interp::AbstractInterpreter, mi::MethodInstance,
137+
@nospecialize(src), @nospecialize(info::CallInfo), stmt_flag::UInt32)
138+
# If we have a generator, but we can't invoke it (because argument type information is lacking),
139+
# don't inline so we defer its invocation to runtime where we'll have precise type information.
140+
if isa(mi.def, Method) && hasgenerator(mi)
141+
may_invoke_generator(mi) || return false
142+
end
143+
return src_inlining_policy(interp, src, info, stmt_flag)
144+
end
145+
135146
function src_inlining_policy(interp::AbstractInterpreter,
136147
@nospecialize(src), @nospecialize(info::CallInfo), stmt_flag::UInt32)
137148
isa(src, OptimizationState) && (src = src.src)

0 commit comments

Comments
 (0)