Skip to content

Commit c84f9d9

Browse files
committed
CHB: convert init location into function parameter typing constraint variable
1 parent 9e7fc82 commit c84f9d9

File tree

5 files changed

+30
-13
lines changed

5 files changed

+30
-13
lines changed

CodeHawk/CHB/bchlib/bCHFunctionInterface.ml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1133,7 +1133,13 @@ let record_function_interface_type_constraints
11331133
let fretvar = add_return_capability ftypevar in
11341134
begin
11351135
(match mk_btype_constraint fretvar returntype with
1136-
| Some tyc -> store#add_constraint tyc
1136+
| Some tyc ->
1137+
let _ =
1138+
log_diagnostics_result
1139+
~tag:("function-interface type constraint")
1140+
__FILE__ __LINE__
1141+
[faddr ^ ": " ^ (type_constraint_to_string tyc)] in
1142+
store#add_constraint tyc
11371143
| _ -> ());
11381144
(match fargs with
11391145
| None ->

CodeHawk/CHB/bchlib/bCHTypeConstraintGraph.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ object (self: 'a)
5656
Update for constraint of type (v, c) or (c, w), v in V, c in C:
5757
5858
tvars'(w) = tvars(w) u {c}, tvreps' = tvreps if w = tvreps(v)
59-
tvars'(w) = tvars(w), tvreps' = tvresp otherwise
59+
tvars'(w) = tvars(w), tvreps' = tvreps otherwise
6060
6161
Update for constraint of type (v1, v2), v1, v2 in V:
6262

CodeHawk/CHB/bchlib/bCHTypeConstraintStore.ml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,6 @@ object (self)
437437
method resolve_reglhs_type
438438
(reg: register_t) (faddr: string) (iaddr: string): btype_t option =
439439
let evaluation = self#evaluate_reglhs_type reg faddr iaddr in
440-
let logresults = iaddr = "0xffffffff" in
441440
let log_evaluation () =
442441
log_diagnostics_result
443442
~tag:("reglhs resolution not successfull for " ^ faddr)
@@ -463,9 +462,17 @@ object (self)
463462
List.iter (fun (vars, consts) ->
464463
let jointy = type_constant_join consts in
465464
let _ =
466-
if logresults then
467-
log_result __FILE__ __LINE__
468-
["jointy: " ^ (type_constant_to_string jointy)] in
465+
log_diagnostics_result
466+
~tag:("result of type_constant_join for " ^ faddr)
467+
__FILE__ __LINE__
468+
[iaddr
469+
^ ": jointy: "
470+
^ (type_constant_to_string jointy)
471+
^ " from "
472+
^ (p2s (pretty_print_list
473+
consts
474+
(fun c -> STR (type_constant_to_string c))
475+
"[" ", " "]"))] in
469476
List.iter (fun v ->
470477
let optty =
471478
match jointy with

CodeHawk/CHB/bchlib/bCHTypeConstraintUtil.ml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -277,11 +277,6 @@ let mk_global_variable_typevar (gaddr: string): type_variable_t =
277277
mk_type_basevar (GlobalVariableType gaddr)
278278

279279

280-
let mk_reglhs_typevar (reg: register_t) (faddr: string) (iaddr: string)
281-
: type_variable_t =
282-
mk_type_basevar (RegisterLhsType (reg, faddr, iaddr))
283-
284-
285280
let mk_localstack_lhs_typevar (off: int) (faddr: string) (iaddr: string)
286281
: type_variable_t =
287282
mk_type_basevar (LocalStackLhsType (off, faddr, iaddr))
@@ -356,6 +351,15 @@ let add_stack_address_capability (offset: int) (tv: type_variable_t)
356351
add_capability [FLocStackAddress offset] tv
357352

358353

354+
let mk_reglhs_typevar (reg: register_t) (faddr: string) (iaddr: string)
355+
: type_variable_t =
356+
if iaddr = "init" then
357+
let ftypevar = mk_function_typevar faddr in
358+
add_freg_param_capability reg ftypevar
359+
else
360+
mk_type_basevar (RegisterLhsType (reg, faddr, iaddr))
361+
362+
359363
let mk_cty_term (c: type_constant_t): type_term_t = TyConstant c
360364

361365

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_20250702"
99-
~date:"2025-07-02"
98+
~version:"0.6.0_20250713"
99+
~date:"2025-07-13"
100100
~licensee: None
101101
~maxfilesize: None
102102
()

0 commit comments

Comments
 (0)