Commit 1c37e833 authored by POTTIER Francois's avatar POTTIER Francois

New compact encoding of the table of items in [lr0_items2].

According to the tiny test, the two encodings are equivalent.
parent 25b1f37d
......@@ -931,6 +931,18 @@ let lr0_items () =
physically shared. Or perhaps we could use some form of packed
array? *)
let lr0_items2 () =
assert Settings.inspection;
let items : int array array =
Array.init Lr0.n (fun node ->
Array.map Item.marshal (Array.of_list (Item.Set.elements (Lr0.items node)))
)
in
define_and_measure (
"lr0_items2",
linearize_and_marshal1 items
)
(* ------------------------------------------------------------------------ *)
(* Let's put everything together. *)
......@@ -1039,6 +1051,7 @@ let program =
rhs() ::
lr0_core() ::
lr0_items() ::
lr0_items2() ::
[]
) ::
[]
......
......@@ -153,5 +153,7 @@ module type INSPECTION_TABLES = sig
val lr0_items: int list array
val lr0_items2: PackedIntArray.t * PackedIntArray.t
end
......@@ -197,8 +197,23 @@ module MakeInspection (T : TableFormat.INSPECTION_TABLES) = struct
let export t =
(t lsr 7, t mod 128)
let items2 s =
let core = PackedIntArray.get T.lr0_core s in
(* TEMPORARY share code with [rhs] above *)
let (data, entry) = T.lr0_items2 in
let items : int list =
LinearizedArray.read_row_via
(PackedIntArray.get data)
(PackedIntArray.get entry)
core
in
List.map export items
let items s =
let core = PackedIntArray.get T.lr0_core s in
List.map export T.lr0_items.(core)
let answer1 = List.map export T.lr0_items.(core) in
let answer2 = items2 s in
assert (answer1 = answer2);
answer1
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment