X-Git-Url: http://git.nguyen.vg/gitweb/?a=blobdiff_plain;f=ata.ml;h=f2b9e7298ebc1723e0849100e7d743a5e01e61f0;hb=bfedbb29aa139abed0a311fd2ab2d00f15e1ed9e;hp=8c3fa185eb2012b2c2582bcdd4cd8c24a10e2b54;hpb=7b6e25ac7c3b4e06c8386c1090bb69ae97a47143;p=SXSI%2Fxpathcomp.git diff --git a/ata.ml b/ata.ml index 8c3fa18..f2b9e72 100644 --- a/ata.ml +++ b/ata.ml @@ -889,7 +889,7 @@ END end - module TransCacheOld = + module TransCache = struct external get : 'a array -> int ->'a = "%array_unsafe_get" external set : 'a array -> int -> 'a -> unit = "%array_unsafe_set" @@ -908,7 +908,7 @@ END let add (h : t) tag slist (data : fun_tree) = let tab = get h (Uid.to_int slist.SList.Node.id) in let tab = if tab == dummy_cell then - let x = Array.create 10000 dummy in + let x = Array.create 100000 dummy in (set h (Uid.to_int slist.SList.Node.id) x;x) else tab in @@ -916,7 +916,7 @@ END end - let td_trans = TransCache.create 10000 (* should be number of tags *number of states^2 + let td_trans = TransCache.create 100000 (* should be number of tags *number of states^2 in the document *) let empty_size n = @@ -929,7 +929,7 @@ END let hash t = Uid.to_int t.Formlistlist.Node.id end) - module Fold2ResOld = struct + module Fold2Res = struct external get : 'a array -> int ->'a = "%array_unsafe_get" external set : 'a array -> int -> 'a -> unit = "%array_unsafe_set" external field1 : 'a -> 'b = "%field1" @@ -939,8 +939,8 @@ END let v = Obj.repr ((),2,()) in Obj.magic v - let create n = Array.create n dummy + let create n = Array.create n dummy let find h tag fl s1 s2 = let af = get h tag in if af == dummy then raise Not_found @@ -949,17 +949,20 @@ END if as1 == dummy then raise Not_found else let as2 = get as1 (Uid.to_int s1.SList.Node.id) in - if as2 == dummy then raise Not_found - else let v = get as2 (Uid.to_int s2.SList.Node.id) in - if field1 v == 2 then raise Not_found - else v + if as2 == dummy then raise Not_found + else + let v = get as2 (Uid.to_int s2.SList.Node.id) in + if field1 v == 2 then raise Not_found + else + v + let add h tag fl s1 s2 data = let af = let x = get h tag in if x == dummy then begin - let y = Array.make 10000 dummy in + let y = Array.make 100000 dummy in set h tag y;y end else x @@ -968,7 +971,7 @@ END let x = get af (Uid.to_int fl.Formlistlist.Node.id) in if x == dummy then begin - let y = Array.make 10000 dummy in + let y = Array.make 100000 dummy in set af (Uid.to_int fl.Formlistlist.Node.id) y;y end else x @@ -977,7 +980,7 @@ END let x = get as1 (Uid.to_int s1.SList.Node.id) in if x == dummy then begin - let y = Array.make 10000 dummy_val in + let y = Array.make 100000 dummy_val in set as1 (Uid.to_int s1.SList.Node.id) y;y end else x @@ -986,8 +989,10 @@ END end + + - module Fold2Res3 = struct + module Fold2Res2 = struct include Hashtbl.Make(struct type t = Tag.t*Formlistlist.t*SList.t*SList.t let equal (a,b,c,d) (x,y,z,t) = @@ -1003,7 +1008,7 @@ END find h (t,f,s1,s2) end - module Fold2Res = + module Fold2ResOld = struct type cell = { key : int; obj : Obj.t } @@ -1140,7 +1145,7 @@ END (*|`TAG(tag') -> let default = fun t _ -> eval_fold2_slist fl_list t (Tree.tag tree t) empty_res (loop_tag tag' (first t) llist t ) - in default (* + in let cf = SList.hd llist in if (slot_size == 1) && StateSet.is_singleton cf then @@ -1150,7 +1155,7 @@ END then RS.mk_quick_tag_loop default llist 1 tree tag' else default - else default *) *) + else default *) | _ -> (fun t _ -> eval_fold2_slist fl_list t (Tree.tag tree t) empty_res (loop (first t) llist t ))