Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
POTTIER Francois
menhir
Commits
1c37e833
Commit
1c37e833
authored
Jan 08, 2015
by
POTTIER Francois
Browse files
New compact encoding of the table of items in [lr0_items2].
According to the tiny test, the two encodings are equivalent.
parent
25b1f37d
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/tableBackend.ml
View file @
1c37e833
...
@@ -931,6 +931,18 @@ let lr0_items () =
...
@@ -931,6 +931,18 @@ let lr0_items () =
physically shared. Or perhaps we could use some form of packed
physically shared. Or perhaps we could use some form of packed
array? *)
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. *)
(* Let's put everything together. *)
...
@@ -1039,6 +1051,7 @@ let program =
...
@@ -1039,6 +1051,7 @@ let program =
rhs
()
::
rhs
()
::
lr0_core
()
::
lr0_core
()
::
lr0_items
()
::
lr0_items
()
::
lr0_items2
()
::
[]
[]
)
::
)
::
[]
[]
...
...
src/tableFormat.ml
View file @
1c37e833
...
@@ -153,5 +153,7 @@ module type INSPECTION_TABLES = sig
...
@@ -153,5 +153,7 @@ module type INSPECTION_TABLES = sig
val
lr0_items
:
int
list
array
val
lr0_items
:
int
list
array
val
lr0_items2
:
PackedIntArray
.
t
*
PackedIntArray
.
t
end
end
src/tableInterpreter.ml
View file @
1c37e833
...
@@ -197,8 +197,23 @@ module MakeInspection (T : TableFormat.INSPECTION_TABLES) = struct
...
@@ -197,8 +197,23 @@ module MakeInspection (T : TableFormat.INSPECTION_TABLES) = struct
let
export
t
=
let
export
t
=
(
t
lsr
7
,
t
mod
128
)
(
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
items
s
=
let
core
=
PackedIntArray
.
get
T
.
lr0_core
s
in
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
end
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment