Commit 66a1a6f
committed
ZJIT: Add HIR Comment insn
Useful for adding comments to HIR/LIR/disasm that are not specific to an instruction.
Possibly most useful for temporarily printing more information
while debugging by keeping the statements interleaved with the HIR.
With a local change like this
diff --git a/zjit/src/hir.rs b/zjit/src/hir.rs
index bff384f..de5b41caa1 100644
--- a/zjit/src/hir.rs
+++ b/zjit/src/hir.rs
@@ -2491,6 +2491,8 @@ fn type_specialize(&mut self) {
cme = unsafe { rb_aliased_callable_method_entry(cme) };
def_type = unsafe { get_cme_def_type(cme) };
}
+ eprintln!("WTH");
+ hir_comment!(self, block, "HOWDY def_type {:?}", def_type);
if def_type == VM_METHOD_TYPE_ISEQ {
// TODO(max): Allow non-iseq; cache cme
// Only specialize positional-positional calls
The print statement (1) shows up early (anywhere)
whereas the HIR comment (2) is interleaved with the rest of
the HIR so you can easily correlate debug info to the compilation of
whatever function you are observing:
1. WTH
Optimized HIR:
fn test@test.rb:2:
bb0():
EntryPoint interpreter
v1:BasicObject = LoadSelf
Jump bb2(v1)
bb1(v4:BasicObject):
EntryPoint JIT(0)
Jump bb2(v4)
bb2(v6:BasicObject):
v11:Fixnum[1] = Const Value(1)
2. # HOWDY def_type 0
PatchPoint MethodRedefined(Object@0x10184ed10, foo@0x9c01, cme:0x101967060)
The comments show up in HIR, LIR, and disasm:
bb2(v6:BasicObject):
v11:Fixnum[1] = Const Value(1)
# HOWDY def_type 0
PatchPoint MethodRedefined(Object@0x1220fed10, foo@0x9c01, cme:0x123717060)
--
PatchPoint Exit(PatchPoint(NoTracePoint))
# Insn: v11 Const Value(1)
# Insn: v18 # HOWDY def_type 0
# Insn: v19 PatchPoint MethodRedefined(Object@0x103aaed00, foo@0x9c01, cme:0x103bc7080)
PatchPoint Exit(PatchPoint(MethodRedefined(Object@0x103aaed00, foo@0x9c01, cme:0x103bc7080)))
--
0x1230bc0f0: nop
# Insn: v11 Const Value(1)
# Insn: v18 # HOWDY def_type 0
# Insn: v19 PatchPoint MethodRedefined(Object@0x103c6ed20, foo@0x9c01, cme:0x103d87070)
0x1230bc0f4: nop1 parent f261909 commit 66a1a6f
3 files changed
Lines changed: 60 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
594 | 594 | | |
595 | 595 | | |
596 | 596 | | |
| 597 | + | |
597 | 598 | | |
598 | 599 | | |
599 | 600 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
27 | 47 | | |
28 | 48 | | |
29 | 49 | | |
| |||
829 | 849 | | |
830 | 850 | | |
831 | 851 | | |
| 852 | + | |
| 853 | + | |
| 854 | + | |
832 | 855 | | |
833 | 856 | | |
834 | 857 | | |
| |||
1192 | 1215 | | |
1193 | 1216 | | |
1194 | 1217 | | |
1195 | | - | |
| 1218 | + | |
| 1219 | + | |
1196 | 1220 | | |
1197 | 1221 | | |
1198 | 1222 | | |
| |||
1501 | 1525 | | |
1502 | 1526 | | |
1503 | 1527 | | |
1504 | | - | |
| 1528 | + | |
| 1529 | + | |
1505 | 1530 | | |
1506 | 1531 | | |
1507 | 1532 | | |
| |||
1561 | 1586 | | |
1562 | 1587 | | |
1563 | 1588 | | |
| 1589 | + | |
1564 | 1590 | | |
1565 | 1591 | | |
1566 | 1592 | | |
| |||
1745 | 1771 | | |
1746 | 1772 | | |
1747 | 1773 | | |
| 1774 | + | |
| 1775 | + | |
| 1776 | + | |
| 1777 | + | |
| 1778 | + | |
| 1779 | + | |
1748 | 1780 | | |
1749 | 1781 | | |
1750 | 1782 | | |
| |||
1813 | 1845 | | |
1814 | 1846 | | |
1815 | 1847 | | |
| 1848 | + | |
1816 | 1849 | | |
1817 | 1850 | | |
1818 | 1851 | | |
| |||
2695 | 2728 | | |
2696 | 2729 | | |
2697 | 2730 | | |
| 2731 | + | |
| 2732 | + | |
| 2733 | + | |
| 2734 | + | |
2698 | 2735 | | |
2699 | 2736 | | |
2700 | 2737 | | |
| |||
2887 | 2924 | | |
2888 | 2925 | | |
2889 | 2926 | | |
| 2927 | + | |
2890 | 2928 | | |
2891 | 2929 | | |
2892 | 2930 | | |
| |||
5952 | 5990 | | |
5953 | 5991 | | |
5954 | 5992 | | |
| 5993 | + | |
5955 | 5994 | | |
5956 | 5995 | | |
5957 | 5996 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2413 | 2413 | | |
2414 | 2414 | | |
2415 | 2415 | | |
| 2416 | + | |
| 2417 | + | |
| 2418 | + | |
| 2419 | + | |
| 2420 | + | |
| 2421 | + | |
| 2422 | + | |
| 2423 | + | |
| 2424 | + | |
| 2425 | + | |
| 2426 | + | |
| 2427 | + | |
| 2428 | + | |
| 2429 | + | |
| 2430 | + | |
| 2431 | + | |
| 2432 | + | |
| 2433 | + | |
2416 | 2434 | | |
2417 | 2435 | | |
2418 | 2436 | | |
| |||
0 commit comments