Skip to content

Commit 0da5143

Browse files
committed
Add devdocs
1 parent 87dd8d7 commit 0da5143

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

doc/src/devdocs/diagnostics.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Diagnostics used by the package ecosystem
2+
3+
This page documents "hooks" embedded in Julia that are primarily used by
4+
external tools. Many of these tools are designed to perform analyses that are
5+
too complicated to be made part of Julia proper.
6+
7+
## SnoopCompile
8+
9+
SnoopCompile "snoops" on Julia's compiler to extract information for analysis
10+
about invalidations and type-inference. There are a few internals it uses for
11+
different purposes:
12+
13+
- recording invalidations: `Base.StaticData.debug_method_invalidation` and
14+
`ccall(:jl_debug_method_invalidation, ...)`: these record different modes of
15+
invalidation. Users of SnoopCompile will transiently turn these on when, e.g.,
16+
loading packages. Each produces a standard log format; messing with the log
17+
format might require a complementary pull request to SnoopCompile.
18+
SnoopCompile will process these logs and generate trees of invalidated
19+
CodeInstances that are attributable to specific changes in the method tables
20+
or bindings.
21+
- observing inference: `ccall(:jl_set_newly_inferred, ...)` and
22+
`ccall(:jl_set_inference_entrance_backtraces, ...)`: these are used to
23+
understand how inference gets triggered. The main purpose is to allow
24+
performance diagnostics to understand sources of TTFX. The second of these
25+
`ccall`s records a backtrace on every entrance to type-inference, so that
26+
SnoopCompile can determine the caller of a dynamically-dispatched call. This
27+
is needed to attribute "cause" for new type inference.

0 commit comments

Comments
 (0)