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
Spot
Spot
Commits
5a862295
Commit
5a862295
authored
Nov 08, 2016
by
Alexandre Duret-Lutz
Browse files
[buddy] improve initialization of bddnode
* src/kernel.c, src/kernel.h: Here.
parent
278b41f4
Changes
2
Hide whitespace changes
Inline
Side-by-side
buddy/src/kernel.c
View file @
5a862295
...
...
@@ -195,16 +195,18 @@ int bdd_init(int initnodesize, int cs)
/* Load these globals into local variables to help the
optimizer. */
int
sz
=
bddnodesize
;
BddNode
*
b
=
bddnodes
;
BddNode
Init
*
b
=
(
BddNodeInit
*
)
bddnodes
;
for
(
n
=
0
;
n
<
sz
;
n
++
)
{
b
->
refcou
=
0
;
b
->
level
=
0
;
b
->
low
=
-
1
;
b
->
next
=
n
+
1
;
++
b
;
b
[
n
].
z
=
0
;
b
[
n
].
low
=
-
1
;
// Initializing HIGH is useless in BuDDy, but it helps the
// compiler vectorizing the code, and it helps the processor
// write-combining data to memory.
b
[
n
].
high
=
0
;
b
[
n
].
next
=
n
+
1
;
}
b
ddnodes
[
sz
-
1
].
next
=
0
;
b
[
sz
-
1
].
next
=
0
;
bddnodes
[
0
].
refcou
=
bddnodes
[
1
].
refcou
=
MAXREF
;
LOW
(
0
)
=
HIGH
(
0
)
=
0
;
...
...
@@ -1447,16 +1449,15 @@ int bdd_noderesize(int doRehash)
/* copy these global variables into local variables to help the
optimizer */
int
sz
=
bddnodesize
;
BddNode
*
b
=
bddnodes
+
oldsize
;
BddNode
Init
*
b
=
(
BddNodeInit
*
)(
bddnodes
+
oldsize
)
;
for
(
n
=
oldsize
;
n
<
sz
;
n
++
)
{
b
->
refcou
=
0
;
b
->
level
=
0
;
b
->
low
=
-
1
;
b
->
next
=
n
+
1
;
++
b
;
b
[
n
].
z
=
0
;
b
[
n
].
low
=
-
1
;
b
[
n
].
high
=
0
;
b
[
n
].
next
=
n
+
1
;
}
b
ddnodes
[
sz
-
1
].
next
=
bddfreepos
;
b
[
sz
-
1
].
next
=
bddfreepos
;
bddfreepos
=
oldsize
;
bddfreenum
+=
bddnodesize
-
oldsize
;
...
...
buddy/src/kernel.h
View file @
5a862295
...
...
@@ -99,6 +99,15 @@ typedef struct s_BddNode /* Node table entry */
int
next
;
}
BddNode
;
// This structure is used during initialization of the above
// structure, to help gcc vectorize the initializing loop.
typedef
struct
s_BddNodeInit
{
int
z
;
int
low
;
int
high
;
int
next
;
}
BddNodeInit
;
/*=== KERNEL VARIABLES =================================================*/
...
...
Alexandre Duret-Lutz
@adl
Mentioned in commit
38c4fc88
·
Nov 19, 2016
Mentioned in commit
38c4fc88
Mentioned in commit 38c4fc8812eab66368c63d1a02b0aa7fabe2810b
Toggle commit list
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