Skip to content

Commit da1daba

Browse files
authored
ZJIT: Refine effects for CheckInterrupts to InterruptFlag|Control (ruby#16240)
CheckInterrupts only reads ec->interrupt_flag and conditionally side-exits — it doesn't touch PatchPoint invariants or the allocator. Add an InterruptFlag leaf under Memory in the abstract heap DAG and narrow CheckInterrupts from Any to read(InterruptFlag)|write(Control). This lets remove_redundant_patch_points see through CheckInterrupts, eliminating duplicate PatchPoints that were previously separated by an interrupt check.
1 parent c5d85d5 commit da1daba

File tree

4 files changed

+14
-15
lines changed

4 files changed

+14
-15
lines changed

zjit/src/hir.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1241,7 +1241,7 @@ impl Insn {
12411241
Insn::SideExit { .. } => effects::Any,
12421242
Insn::IncrCounter(_) => Effect::read_write(abstract_heaps::Empty, abstract_heaps::Other),
12431243
Insn::IncrCounterPtr { .. } => Effect::read_write(abstract_heaps::Empty, abstract_heaps::Other),
1244-
Insn::CheckInterrupts { .. } => effects::Any,
1244+
Insn::CheckInterrupts { .. } => Effect::read_write(abstract_heaps::InterruptFlag, abstract_heaps::Control),
12451245
Insn::InvokeProc { .. } => effects::Any,
12461246
Insn::RefineType { .. } => effects::Empty,
12471247
Insn::HasType { .. } => effects::Empty,

zjit/src/hir/opt_tests.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -623,9 +623,6 @@ mod hir_opt_tests {
623623
v60:TrueClass = Const Value(true)
624624
IncrCounter inline_cfunc_optimized_send_count
625625
CheckInterrupts
626-
v23:Fixnum[2] = Const Value(2)
627-
v25:Fixnum[2] = Const Value(2)
628-
PatchPoint MethodRedefined(Integer@0x1000, <=@0x1008, cme:0x1010)
629626
v62:TrueClass = Const Value(true)
630627
IncrCounter inline_cfunc_optimized_send_count
631628
CheckInterrupts
@@ -697,9 +694,6 @@ mod hir_opt_tests {
697694
v60:TrueClass = Const Value(true)
698695
IncrCounter inline_cfunc_optimized_send_count
699696
CheckInterrupts
700-
v23:Fixnum[2] = Const Value(2)
701-
v25:Fixnum[2] = Const Value(2)
702-
PatchPoint MethodRedefined(Integer@0x1000, >=@0x1008, cme:0x1010)
703697
v62:TrueClass = Const Value(true)
704698
IncrCounter inline_cfunc_optimized_send_count
705699
CheckInterrupts

zjit/src/hir_effect/gen_hir_effect.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ def to_graphviz effect, f
4949
control = any.subeffect 'Control'
5050
memory = any.subeffect 'Memory'
5151
patch_point = any.subeffect 'PatchPoint'
52+
interrupt_flag = memory.subeffect 'InterruptFlag'
5253
other = memory.subeffect 'Other'
5354
frame = memory.subeffect 'Frame'
5455
pc = frame.subeffect 'PC'

zjit/src/hir_effect/hir_effect.inc.rs

Lines changed: 12 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)