Skip to content

Commit 5da9830

Browse files
committed
CHB: remove types from functioninfo
1 parent 0a3320a commit 5da9830

File tree

5 files changed

+13
-79
lines changed

5 files changed

+13
-79
lines changed

CodeHawk/CHB/bchlib/bCHFloc.ml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1427,6 +1427,7 @@ object (self)
14271427
if self#is_composite_symbolic_value rhsx then
14281428
let sv = self#env#mk_symbolic_value rhsx in
14291429
begin
1430+
(*
14301431
(match vtype with
14311432
| TUnknown _ -> ()
14321433
| _ ->
@@ -1440,7 +1441,7 @@ object (self)
14401441
STR ": ";
14411442
STR (btype_to_string vtype)]);
14421443
self#f#set_btype sv vtype
1443-
end);
1444+
end); *)
14441445
XVar sv
14451446
end
14461447
else

CodeHawk/CHB/bchlib/bCHFunctionInfo.ml

Lines changed: 5 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,6 @@ module H = Hashtbl
8181
module LF = CHOnlineCodeSet.LanguageFactory
8282
module TR = CHTraceResult
8383

84-
let bcd = BCHBCDictionary.bcdictionary
85-
8684
let x2p = xpr_formatter#pr_expr
8785
let p2s = CHPrettyUtil.pretty_to_string
8886

@@ -651,7 +649,9 @@ object (self)
651649
end
652650

653651
method get_symbolic_num_variable(v: variable_t): variable_t traceresult =
654-
self#get_variable v#getName#getSeqNumber
652+
tprop
653+
(self#get_variable v#getName#getSeqNumber)
654+
(__FILE__ ^ ":" ^ (string_of_int __LINE__))
655655

656656
method private has_chifvar index = H.mem chifvars index
657657

@@ -868,7 +868,7 @@ object (self)
868868
end
869869
else
870870
tmap
871-
~msg:"finfo.mk_global_variable"
871+
~msg:(__FILE__ ^ ":" ^ (string_of_int __LINE__) ^ ": memref:global")
872872
(fun offset ->
873873
let gvar =
874874
self#mk_variable
@@ -1551,7 +1551,7 @@ object (self)
15511551
val test_expressions = H.create 3 (* test-expressions *)
15521552
val test_variables = H.create 3 (* test-variables *)
15531553

1554-
val cvariable_types = H.create 3 (* types of constant-value variables *)
1554+
(* val cvariable_types = H.create 3 *) (* types of constant-value variables *)
15551555

15561556
(* ------------------------------------------------------------------------- *)
15571557

@@ -1605,48 +1605,6 @@ object (self)
16051605
STR " in function ";
16061606
faddr#toPretty]))
16071607

1608-
method set_btype (v: variable_t) (ty: btype_t) =
1609-
let vix = v#getName#getSeqNumber in
1610-
let bix = bcd#index_typ ty in
1611-
let entry: int list =
1612-
if H.mem cvariable_types vix then
1613-
H.find cvariable_types vix
1614-
else
1615-
[] in
1616-
if List.mem bix entry then
1617-
()
1618-
else
1619-
H.replace cvariable_types vix (bix :: entry)
1620-
1621-
method has_btype (v: variable_t): bool =
1622-
let vix = v#getName#getSeqNumber in
1623-
H.mem cvariable_types vix
1624-
1625-
method get_btype (v: variable_t): btype_t =
1626-
let vix = v#getName#getSeqNumber in
1627-
if H.mem cvariable_types vix then
1628-
let btypes = List.map bcd#get_typ (H.find cvariable_types vix) in
1629-
btype_join btypes
1630-
else
1631-
TUnknown []
1632-
1633-
method get_btypes (v: variable_t): btype_t list =
1634-
let vix = v#getName#getSeqNumber in
1635-
if H.mem cvariable_types vix then
1636-
List.map bcd#get_typ (H.find cvariable_types vix)
1637-
else
1638-
[]
1639-
1640-
method get_btype_table: (int * int * int list) list =
1641-
let result = ref [] in
1642-
let _ =
1643-
H.iter (fun vix bixs ->
1644-
let btypes = List.map bcd#get_typ bixs in
1645-
let jbtype = btype_join btypes in
1646-
let entry = (vix, bcd#index_typ jbtype, bixs) in
1647-
result := entry :: !result) cvariable_types in
1648-
!result
1649-
16501608
method sideeffects_changed = sideeffects_changed
16511609

16521610
method call_targets_were_set = call_targets_set

CodeHawk/CHB/bchlib/bCHGlobalMemoryMap.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,7 @@ object (self)
458458
?(btype = t_unknown)
459459
?(initialvalue = None)
460460
?(size = None)
461-
(address: doubleword_int): global_location_int TR.traceresult =
461+
(address: doubleword_int): global_location_int traceresult =
462462
if H.mem locations address#index then
463463
begin
464464
ch_error_log#add

CodeHawk/CHB/bchlib/bCHLibTypes.mli

Lines changed: 4 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -4491,9 +4491,12 @@ class type function_environment_int =
44914491

44924492
(** {2 Register variables} *)
44934493

4494-
(** {3 x86} *)
4494+
(** {3 Generic} *)
44954495

44964496
method mk_register_variable: register_t -> variable_t
4497+
4498+
(** {3 x86} *)
4499+
44974500
method mk_cpu_register_variable: cpureg_t -> variable_t
44984501
method mk_fpu_register_variable: int -> variable_t
44994502
method mk_mmx_register_variable: int -> variable_t
@@ -5355,34 +5358,6 @@ object
53555358
method restore_register: xpr_t -> ctxt_iaddress_t -> register_t -> unit
53565359

53575360

5358-
(** {2 Auxvar types}
5359-
5360-
The types set and retrieved are inferred variable types for constant-value
5361-
variables. Inferences are based on their appearance in certain instructions
5362-
or operations performed on them. Throughout the analysis different aspects
5363-
may be revealed, and a list of these is maintained.*)
5364-
5365-
(** [finfo#set_btype v ty] records type [ty] for variable [v].*)
5366-
method set_btype: variable_t -> btype_t -> unit
5367-
5368-
(** [finfo#has_btype v] returns true if at least one type has been recorded for
5369-
variable [v].*)
5370-
method has_btype: variable_t -> bool
5371-
5372-
(** [finfo#get_btype v] returns the join of all types that have been recorded
5373-
for variable [v]. If no types were recorded [t_unknown] is returned.*)
5374-
method get_btype: variable_t -> btype_t
5375-
5376-
(** [finfo#get_btypes v] returns all types that have been recorded for
5377-
variable [v]. If no types were recorded the empty list is returned.*)
5378-
method get_btypes: variable_t -> btype_t list
5379-
5380-
(** Returns a list of indexed variable type records, where each entry
5381-
represents (index of variable, index of joined type, indices of all
5382-
types).*)
5383-
method get_btype_table: (int * int * int list) list
5384-
5385-
53865361
(** {1 Function summaries}
53875362
Information registered to create a function summary for the application
53885363
function represented by this function_info (possibly including global

CodeHawk/CHB/bchlib/bCHVariable.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -692,7 +692,7 @@ object (self)
692692
method make_runtime_constant (name:string) =
693693
self#mk_variable (AuxiliaryVariable (RuntimeConstant name))
694694

695-
method get_initial_memory_value_variable (v: variable_t) =
695+
method get_initial_memory_value_variable (v: variable_t): variable_t traceresult =
696696
tbind
697697
~msg:(__FILE__ ^ ":" ^ (string_of_int __LINE__) ^ ": " ^ (p2s v#toPretty))
698698
(fun av -> av#get_initial_memory_value_variable)

0 commit comments

Comments
 (0)