Commit 6f143ea
authored
invert linetable representation (#52415)
Previously, our linetables (similar to LLVM) represented line
information as a linked list from callee via inlined_at up to the
original information. This requires many copies of this information to
be created. Instead we can take advantage of the necessary existence of
the line table from the child to flip this chain of information and
instead make each statement be a table describing (for each IR
instruction):
`(current line number, (index into edges, index into edges statements))`
plus a table of all edges, plus a table with the original line numbers
from the parser, plus the file name. This is all packed into the struct
struct DebugInfo
def::Union{Method,MethodInstance,Symbol}
linetable::Union{Nothing,DebugInfo}
edges::SimpleVector{DebugInfo}
codelocs::String
end
Which is described in doc/src/devdocs/ast.md for what each field means
and look at stacktraces.jl or compiler/ssair/show.jl to look at how to
decode and interpret this information.
For the sysimage, this saves several megabytes (about 113 MB -> 110 MB)
and about 5% of the stdlib pkgimages (294 MB -> 279 MB).
It also now happens to have the full type information for the inlined
functions. Now if you create an `IRShow.DILineInfoPrinter` with
`showtypes=true`, it can print that information when printing IR.
```
julia> @eval Base.IRShow DILineInfoPrinter(debuginfo, def) = DILineInfoPrinter(debuginfo, def, true)
DILineInfoPrinter (generic function with 2 methods)
julia> (@code_typed 1 + 1.0)[1]
CodeInfo(
@ promotion.jl:425 within `+`
┌ invoke MethodInstance for promote(::Int64, ::Float64)
│ @ promotion.jl:396 within `promote`
│┌ invoke MethodInstance for Base._promote(::Int64, ::Float64)
││ @ promotion.jl:373 within `_promote`
││┌ invoke MethodInstance for convert(::Type{Float64}, ::Int64)
│││ @ number.jl:7 within `convert`
│││┌ invoke MethodInstance for Float64(::Int64)
││││ @ float.jl:221 within `Float64`
1 ─││││ %1 = Base.sitofp(Float64, x)::Float64
│ └└└└
│ ┌ invoke MethodInstance for +(::Float64, ::Float64)
│ │ @ float.jl:460 within `+`
│ │ %2 = Base.add_float(%1, y)::Float64
│ └
└── return %2
)
```1 parent 8413b97 commit 6f143ea
File tree
57 files changed
+1488
-899
lines changed- base
- compiler
- ssair
- doc/src
- base
- devdocs
- src
- clangsa
- stdlib
- InteractiveUtils/test
- REPL/test
- Serialization/src
- test
- compiler
- testhelpers
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
57 files changed
+1488
-899
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
67 | | - | |
| 67 | + | |
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
| |||
125 | 125 | | |
126 | 126 | | |
127 | 127 | | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
134 | 135 | | |
135 | 136 | | |
136 | 137 | | |
| |||
296 | 297 | | |
297 | 298 | | |
298 | 299 | | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
299 | 303 | | |
300 | 304 | | |
301 | 305 | | |
| |||
466 | 470 | | |
467 | 471 | | |
468 | 472 | | |
469 | | - | |
470 | | - | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
471 | 477 | | |
472 | 478 | | |
473 | 479 | | |
| |||
482 | 488 | | |
483 | 489 | | |
484 | 490 | | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
485 | 501 | | |
486 | 502 | | |
487 | 503 | | |
488 | 504 | | |
489 | | - | |
| 505 | + | |
490 | 506 | | |
491 | | - | |
| 507 | + | |
492 | 508 | | |
493 | | - | |
494 | | - | |
| 509 | + | |
495 | 510 | | |
496 | 511 | | |
497 | 512 | | |
| |||
629 | 644 | | |
630 | 645 | | |
631 | 646 | | |
632 | | - | |
| 647 | + | |
633 | 648 | | |
634 | 649 | | |
635 | 650 | | |
636 | 651 | | |
637 | | - | |
| 652 | + | |
638 | 653 | | |
639 | 654 | | |
640 | 655 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
323 | 323 | | |
324 | 324 | | |
325 | 325 | | |
326 | | - | |
| 326 | + | |
327 | 327 | | |
328 | 328 | | |
329 | 329 | | |
| |||
474 | 474 | | |
475 | 475 | | |
476 | 476 | | |
477 | | - | |
| 477 | + | |
478 | 478 | | |
479 | 479 | | |
480 | 480 | | |
481 | | - | |
482 | | - | |
483 | | - | |
484 | | - | |
485 | | - | |
486 | | - | |
487 | | - | |
488 | | - | |
489 | | - | |
490 | | - | |
491 | | - | |
492 | | - | |
493 | | - | |
494 | | - | |
495 | | - | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
496 | 492 | | |
497 | 493 | | |
498 | 494 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
990 | 990 | | |
991 | 991 | | |
992 | 992 | | |
993 | | - | |
| 993 | + | |
994 | 994 | | |
995 | 995 | | |
996 | 996 | | |
997 | 997 | | |
998 | 998 | | |
999 | 999 | | |
1000 | | - | |
1001 | | - | |
1002 | | - | |
1003 | | - | |
| 1000 | + | |
| 1001 | + | |
| 1002 | + | |
| 1003 | + | |
| 1004 | + | |
| 1005 | + | |
| 1006 | + | |
| 1007 | + | |
| 1008 | + | |
| 1009 | + | |
| 1010 | + | |
| 1011 | + | |
| 1012 | + | |
| 1013 | + | |
| 1014 | + | |
| 1015 | + | |
| 1016 | + | |
| 1017 | + | |
| 1018 | + | |
| 1019 | + | |
| 1020 | + | |
| 1021 | + | |
| 1022 | + | |
| 1023 | + | |
| 1024 | + | |
| 1025 | + | |
| 1026 | + | |
| 1027 | + | |
| 1028 | + | |
| 1029 | + | |
| 1030 | + | |
| 1031 | + | |
| 1032 | + | |
| 1033 | + | |
| 1034 | + | |
| 1035 | + | |
| 1036 | + | |
| 1037 | + | |
| 1038 | + | |
| 1039 | + | |
| 1040 | + | |
| 1041 | + | |
| 1042 | + | |
| 1043 | + | |
| 1044 | + | |
| 1045 | + | |
| 1046 | + | |
| 1047 | + | |
| 1048 | + | |
| 1049 | + | |
| 1050 | + | |
| 1051 | + | |
| 1052 | + | |
| 1053 | + | |
| 1054 | + | |
| 1055 | + | |
1004 | 1056 | | |
| 1057 | + | |
1005 | 1058 | | |
| 1059 | + | |
1006 | 1060 | | |
1007 | 1061 | | |
1008 | | - | |
| 1062 | + | |
| 1063 | + | |
| 1064 | + | |
| 1065 | + | |
1009 | 1066 | | |
1010 | 1067 | | |
1011 | 1068 | | |
| |||
1021 | 1078 | | |
1022 | 1079 | | |
1023 | 1080 | | |
1024 | | - | |
| 1081 | + | |
1025 | 1082 | | |
1026 | 1083 | | |
1027 | 1084 | | |
1028 | | - | |
| 1085 | + | |
1029 | 1086 | | |
1030 | 1087 | | |
1031 | 1088 | | |
| |||
1052 | 1109 | | |
1053 | 1110 | | |
1054 | 1111 | | |
1055 | | - | |
1056 | | - | |
1057 | 1112 | | |
1058 | 1113 | | |
1059 | 1114 | | |
1060 | 1115 | | |
1061 | 1116 | | |
1062 | | - | |
| 1117 | + | |
1063 | 1118 | | |
1064 | | - | |
1065 | | - | |
| 1119 | + | |
1066 | 1120 | | |
1067 | 1121 | | |
1068 | | - | |
| 1122 | + | |
1069 | 1123 | | |
1070 | 1124 | | |
1071 | 1125 | | |
| |||
1084 | 1138 | | |
1085 | 1139 | | |
1086 | 1140 | | |
1087 | | - | |
| 1141 | + | |
1088 | 1142 | | |
1089 | 1143 | | |
1090 | 1144 | | |
| |||
1106 | 1160 | | |
1107 | 1161 | | |
1108 | 1162 | | |
1109 | | - | |
| 1163 | + | |
1110 | 1164 | | |
1111 | 1165 | | |
1112 | 1166 | | |
| |||
1121 | 1175 | | |
1122 | 1176 | | |
1123 | 1177 | | |
1124 | | - | |
| 1178 | + | |
1125 | 1179 | | |
1126 | 1180 | | |
1127 | 1181 | | |
| |||
1158 | 1212 | | |
1159 | 1213 | | |
1160 | 1214 | | |
1161 | | - | |
| 1215 | + | |
1162 | 1216 | | |
1163 | 1217 | | |
1164 | 1218 | | |
1165 | 1219 | | |
1166 | 1220 | | |
1167 | 1221 | | |
1168 | | - | |
| 1222 | + | |
1169 | 1223 | | |
1170 | 1224 | | |
1171 | 1225 | | |
| |||
0 commit comments