Skip to content

Commit 8681db4

Browse files
committed
CHB: remove recording of return values and side effects
1 parent 5da9830 commit 8681db4

File tree

4 files changed

+4
-72
lines changed

4 files changed

+4
-72
lines changed

CodeHawk/CHB/bchlib/bCHFloc.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -406,12 +406,12 @@ object (self)
406406
(* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ *
407407
* return values *
408408
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ *)
409-
409+
(*
410410
method record_return_value =
411411
let eax = self#env#mk_cpu_register_variable Eax in
412412
let returnExpr = self#rewrite_variable_to_external eax in
413413
self#f#record_return_value self#cia returnExpr
414-
414+
*)
415415

416416
(* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ *
417417
* call targets *

CodeHawk/CHB/bchlib/bCHFunctionInfo.ml

Lines changed: 1 addition & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ open BCHConstantDefinitions
5959
open BCHCppClass
6060
open BCHCStruct
6161
open BCHDoubleword
62-
open BCHExternalPredicate
6362
open BCHFtsParameter
6463
open BCHFunctionInterface
6564
open BCHFunctionData
@@ -1561,8 +1560,7 @@ object (self)
15611560

15621561
val instrbytes = H.create 5
15631562
val jump_targets = H.create 5 (* to be saved *)
1564-
val return_values = H.create 3
1565-
val sideeffects = H.create 3 (* iaddr -> sideeffect-ix *)
1563+
15661564
val mutable nonreturning = false
15671565
val mutable user_summary = None (* to be deprecated *)
15681566
val mutable appsummary =
@@ -1819,47 +1817,6 @@ object (self)
18191817
LBLOCK l ; NL ;
18201818
STR (string_repeat "~" 80) ; NL]
18211819

1822-
(* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ *
1823-
* record return values *
1824-
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ *)
1825-
1826-
method record_return_value (iaddr:ctxt_iaddress_t) (x:xpr_t) =
1827-
H.replace return_values iaddr x
1828-
1829-
method get_return_values = H.fold (fun _ x a -> x :: a) return_values []
1830-
1831-
method return_values_to_pretty =
1832-
let p = ref [] in
1833-
let _ = H.iter (fun iaddr x ->
1834-
let pp = LBLOCK [ STR iaddr ; STR ": " ; pr_expr x ; NL ] in
1835-
p := pp :: !p ) return_values in
1836-
LBLOCK [ STR "Return values: (" ; INT (H.length return_values) ; STR ")" ; NL ;
1837-
INDENT (3, LBLOCK !p) ; NL ]
1838-
1839-
(* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ *
1840-
* record side effects *
1841-
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ *)
1842-
1843-
method record_sideeffect (iaddr: ctxt_iaddress_t) (s: xxpredicate_t) =
1844-
let index = id#index_xxpredicate s in
1845-
if H.mem sideeffects iaddr then
1846-
let prev_ix = H.find sideeffects iaddr in
1847-
if index = prev_ix then
1848-
()
1849-
else
1850-
begin
1851-
H.replace sideeffects iaddr index;
1852-
sideeffects_changed <- true
1853-
end
1854-
else
1855-
begin
1856-
H.add sideeffects iaddr index;
1857-
sideeffects_changed <- true;
1858-
chlog#add
1859-
"sideeffects changed"
1860-
(LBLOCK [self#a#toPretty; STR ": "; xxpredicate_to_pretty s])
1861-
end
1862-
18631820
method set_nonreturning =
18641821
if nonreturning then () else
18651822
let fa = self#get_address in

CodeHawk/CHB/bchlib/bCHLibTypes.mli

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -5274,13 +5274,6 @@ object
52745274
(** Declares that this function is non-returning.*)
52755275
method set_nonreturning: unit
52765276

5277-
(** [finfo#record_return_value iaddr xpr] records that the function
5278-
returns value [xpr] at return instruction [iaddr].*)
5279-
method record_return_value: ctxt_iaddress_t -> xpr_t -> unit
5280-
5281-
(** Returns the function return values recorded for this function.*)
5282-
method get_return_values: xpr_t list
5283-
52845277

52855278
(* method set_dynlib_stub: call_target_t -> unit *)
52865279

@@ -5393,18 +5386,6 @@ object
53935386
method set_unknown_java_native_method_signature: unit
53945387

53955388

5396-
(** {2 Side effects}*)
5397-
5398-
(** [finfo#record_sideeffect iaddr se] records side effect [se] (i.e.,
5399-
an effect that is observable outside of the function, such as writing
5400-
through a pointer provided as argument) at instruction address [iaddr].
5401-
5402-
This method is currently called only when an assignment is performed
5403-
with a left-hand-side that is an external memory reference.
5404-
*)
5405-
method record_sideeffect: ctxt_iaddress_t -> xxpredicate_t -> unit
5406-
5407-
54085389
(** {1 Condition codes}
54095390
The function info keeps track of test expressions and the variables used
54105391
therein for conditional jump instructions. These methods are used mainly
@@ -5577,7 +5558,7 @@ object
55775558
method summary_to_pretty: pretty_t
55785559
method saved_registers_to_pretty: pretty_t
55795560
method base_pointers_to_pretty: pretty_t
5580-
method return_values_to_pretty: pretty_t
5561+
(* method return_values_to_pretty: pretty_t *)
55815562

55825563
end
55835564

@@ -5892,10 +5873,6 @@ class type floc_int =
58925873

58935874
(** {1 Function summary}*)
58945875

5895-
(* evaluates the value of eax at this location and reports it to the function
5896-
info *)
5897-
method record_return_value: unit
5898-
58995876
method evaluate_summary_address_term: bterm_t -> variable_t option
59005877

59015878
method evaluate_summary_term: bterm_t -> variable_t -> xpr_t

CodeHawk/CHB/bchlibx86/bCHTranslateToCHIF.ml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2000,8 +2000,6 @@ let translate_instruction
20002000

20012001
(* different control flow *)
20022002
| RepzRet | Ret _ | BndRet _ ->
2003-
let floc = get_floc loc in
2004-
let _ = floc#record_return_value in
20052003
let transaction =
20062004
package_transaction finfo block_label (commands @ [invariantOperation]) in
20072005
let nodes = [(block_label, [transaction])] in

0 commit comments

Comments
 (0)