Skip to content

Commit 99ae5b5

Browse files
committed
CHB: allow for register spill/restore in trampoline
1 parent b0d4e47 commit 99ae5b5

File tree

2 files changed

+21
-5
lines changed

2 files changed

+21
-5
lines changed

CodeHawk/CHB/bchlib/bCHFunctionStackframe.ml

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,9 @@ object (self)
153153
offset >= self#offset && offset < self#offset + size
154154

155155
method frame2object_offset_value (xpr: xpr_t): xpr_t traceresult =
156-
let (t, _coffset) = BCHXprUtil.smallest_wrapped_constant_term xpr in
157-
let xoff = simplify_xpr (XOp (XMinus, [xpr; num_constant_expr t])) in
158-
Ok xoff
156+
let xoff =
157+
simplify_xpr (XOp (XMinus, [xpr; int_constant_expr self#offset])) in
158+
Ok xoff
159159

160160
method frame_offset_memory_offset
161161
?(tgtsize=None)
@@ -584,10 +584,26 @@ object (self)
584584
()
585585
else
586586
let restore = RegisterRestore (offset, reg) in
587+
let mk_stackslot () =
588+
let ssrec = {
589+
sslot_name = (register_to_string reg) ^ "_spill";
590+
sslot_offset = offset;
591+
sslot_btype = t_unknown;
592+
sslot_spill = Some reg;
593+
sslot_size = Some 4;
594+
sslot_loopcounter = false;
595+
sslot_desc = Some "register restore"
596+
} in
597+
new stackslot_t ssrec in
587598
begin
588599
(if H.mem stackslots offset then
589600
if (H.find stackslots offset)#is_spill then
590601
()
602+
else
603+
let sslot = H.find stackslots offset in
604+
if sslot#is_compatible_with_spill then
605+
let sslot = mk_stackslot () in
606+
H.replace stackslots offset sslot
591607
else
592608
let sslot = H.find stackslots offset in
593609
raise

CodeHawk/CHB/bchlib/bCHVersion.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,8 @@ end
9595

9696

9797
let version = new version_info_t
98-
~version:"0.6.0_20260105"
99-
~date:"2026-01-05"
98+
~version:"0.6.0_20260106"
99+
~date:"2026-01-06"
100100
~licensee: None
101101
~maxfilesize: None
102102
()

0 commit comments

Comments
 (0)