diff options
Diffstat (limited to 'lib/util.ml')
| -rw-r--r-- | lib/util.ml | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/lib/util.ml b/lib/util.ml index cdd3519301..9f29d55bd0 100644 --- a/lib/util.ml +++ b/lib/util.ml @@ -1442,8 +1442,6 @@ let memon_eq eq n f = module Size = struct - open Obj - (*s Pointers already visited are stored in a hash-table, where comparisons are done using physical equality. *) @@ -1451,7 +1449,7 @@ module Size = struct struct type t = Obj.t let equal = (==) - let hash o = Hashtbl.hash (magic o : int) + let hash o = Hashtbl.hash (Obj.magic o : int) end) let node_table = (H.create 257 : unit H.t) @@ -1465,27 +1463,27 @@ module Size = struct (*s Objects are traversed recursively, as soon as their tags are less than [no_scan_tag]. [count] records the numbers of words already visited. *) - let size_of_double = size (repr 1.0) + let size_of_double = Obj.size (Obj.repr 1.0) let count = ref 0 let rec traverse t = if not (in_table t) then begin add_in_table t; - if is_block t then begin - let n = size t in - let tag = tag t in - if tag < no_scan_tag then begin + if Obj.is_block t then begin + let n = Obj.size t in + let tag = Obj.tag t in + if tag < Obj.no_scan_tag then begin count := !count + 1 + n; for i = 0 to n - 1 do - let f = field t i in - if is_block f then traverse f + let f = Obj.field t i in + if Obj.is_block f then traverse f done - end else if tag = string_tag then + end else if tag = Obj.string_tag then count := !count + 1 + n - else if tag = double_tag then + else if tag = Obj.double_tag then count := !count + size_of_double - else if tag = double_array_tag then + else if tag = Obj.double_array_tag then count := !count + 1 + size_of_double * n else incr count @@ -1498,7 +1496,7 @@ module Size = struct let size_w o = reset_table (); count := 0; - traverse (repr o); + traverse (Obj.repr o); !count let size_b o = (size_w o) * (Sys.word_size / 8) |
