Use better defaults for top-down cache size.
[SXSI/xpathcomp.git] / src / l2JIT.ml
index 90105d8..d01d480 100644 (file)
@@ -13,12 +13,12 @@ type jump =
   | NEXT_ELEMENT of StateSet.t
   | TAGGED_DESCENDANT of StateSet.t * Tag.t
   | TAGGED_FOLLOWING of StateSet.t * Tag.t
-  | SELECT_DESCENDANT of StateSet.t * Ptset.Int.t * Tree.unordered_set
-  | SELECT_FOLLOWING of StateSet.t * Ptset.Int.t * Tree.unordered_set
+  | SELECT_DESCENDANT of StateSet.t * Ptset.Int.t * Tree.tag_list
+  | SELECT_FOLLOWING of StateSet.t * Ptset.Int.t * Tree.tag_list
   | TAGGED_CHILD of StateSet.t * Tag.t
-  | TAGGED_FOLLOWING_SIBLING of StateSet.t * Tag.t
-  | SELECT_CHILD of StateSet.t * Ptset.Int.t * Tree.unordered_set
-  | SELECT_FOLLOWING_SIBLING of StateSet.t * Ptset.Int.t * Tree.unordered_set
+  | TAGGED_SIBLING of StateSet.t * Tag.t
+  | SELECT_CHILD of StateSet.t * Ptset.Int.t * Tree.tag_list
+  | SELECT_SIBLING of StateSet.t * Ptset.Int.t * Tree.tag_list
   | TAGGED_SUBTREE of StateSet.t * Tag.t
   | ELEMENT_SUBTREE of StateSet.t
 
@@ -31,12 +31,12 @@ let _first_element s = FIRST_ELEMENT s
 let _next_element s = NEXT_ELEMENT s
 let _tagged_descendant s t = TAGGED_DESCENDANT(s,t)
 let _tagged_following s t = TAGGED_FOLLOWING(s,t)
-let _select_descendant s t = SELECT_DESCENDANT(s,t, Tree.unordered_set_of_set t)
-let _select_following s t = SELECT_FOLLOWING(s,t, Tree.unordered_set_of_set t)
+let _select_descendant s t = SELECT_DESCENDANT(s,t, Tree.tag_list_of_set t)
+let _select_following s t = SELECT_FOLLOWING(s,t, Tree.tag_list_of_set t)
 let _tagged_child s t = TAGGED_CHILD(s,t)
-let _tagged_following_sibling s t = TAGGED_FOLLOWING_SIBLING(s,t)
-let _select_child s t = SELECT_CHILD(s,t, Tree.unordered_set_of_set t)
-let _select_following_sibling s t = SELECT_FOLLOWING_SIBLING(s,t, Tree.unordered_set_of_set t)
+let _tagged_following_sibling s t = TAGGED_SIBLING(s,t)
+let _select_child s t = SELECT_CHILD(s,t, Tree.tag_list_of_set t)
+let _select_following_sibling s t = SELECT_SIBLING(s,t, Tree.tag_list_of_set t)
 let _tagged_subtree s t = TAGGED_SUBTREE (s, t)
 let _element_subtree s = ELEMENT_SUBTREE s
 
@@ -67,13 +67,13 @@ let print_jump fmt j =
 
   | TAGGED_CHILD (_, tag) -> fprintf fmt "tagged_child(%s)" (Tag.to_string tag)
 
-  | TAGGED_FOLLOWING_SIBLING (_, tag) ->
+  | TAGGED_SIBLING (_, tag) ->
     fprintf fmt "tagged_following_sibling(%s)" (Tag.to_string tag)
 
   | SELECT_CHILD (_, tags, _) -> fprintf fmt "select_child(%a)"
     TagSet.print (TagSet.inj_positive tags)
 
-  | SELECT_FOLLOWING_SIBLING (_, tags, _) -> fprintf fmt "select_following_sibling(%a)"
+  | SELECT_SIBLING (_, tags, _) -> fprintf fmt "select_following_sibling(%a)"
     TagSet.print (TagSet.inj_positive tags)
 
   | TAGGED_SUBTREE (_, tag) -> fprintf fmt "tagged_subtree(%s)" (Tag.to_string tag)
@@ -116,7 +116,7 @@ let print_opcode fmt o = match o with
   end
   end c
 *)
-let create () = Cache.Lvl2.create 4096 dummy
+let create () = Cache.Lvl2.create 512 dummy
 (*
   let stats fmt c =
   let d = Cache.Lvl2.to_array c in
@@ -196,11 +196,12 @@ let compute_jump auto tree tag states dir =
     let jkind = Ata.top_down_approx auto states tree in
     let jump = translate_jump tree tag jkind dir states in
     LOG(__ "level2-jit" 2
-       "Computed jumps for %s %a %s: %a\n%!"
-         (Tag.to_string tag)
-         StateSet.print states
-         (if dir == DIR_LEFT then "left" else "right")
-         print_jump jump
+          "Computed jumps for %s %a %s, from %a : %a%!"
+          (Tag.to_string tag)
+          StateSet.print states
+          (if dir == DIR_LEFT then "left" else "right")
+          Ata.print_kind jkind
+          print_jump jump
     );
     jump