Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
SWIFTsim
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SWIFT
SWIFTsim
Commits
6979ad47
Commit
6979ad47
authored
8 years ago
by
Pedro Gonnet
Browse files
Options
Downloads
Patches
Plain Diff
don't mess-up the list by clearing linked cells.
parent
981be8bc
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!291
Space recycle
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/space.c
+20
-11
20 additions, 11 deletions
src/space.c
with
20 additions
and
11 deletions
src/space.c
+
20
−
11
View file @
6979ad47
...
...
@@ -434,9 +434,8 @@ void space_regrid(struct space *s, int verbose) {
// message( "rebuilding upper-level cells took %.3f %s." ,
// clocks_from_ticks(double)(getticks() - tic), clocks_getunit());
}
/* re-build upper-level cells? */
else
{
/* Otherwise, just clean up the cells. */
}
/* re-build upper-level cells? */
else
{
/* Otherwise, just clean up the cells. */
/* Free the old cells, if they were allocated. */
threadpool_map
(
&
s
->
e
->
threadpool
,
space_rebuild_recycle_mapper
,
...
...
@@ -1623,16 +1622,13 @@ void space_split_mapper(void *map_data, int num_cells, void *extra_data) {
}
/**
* @brief Return a used cell to the buffer o
d
unused sub-cells.
* @brief Return a used cell to the buffer o
f
unused sub-cells.
*
* @param s The #space.
* @param c The #cell.
*/
void
space_recycle
(
struct
space
*
s
,
struct
cell
*
c
)
{
/* Lock the space. */
lock_lock
(
&
s
->
lock
);
/* Clear the cell. */
if
(
lock_destroy
(
&
c
->
lock
)
!=
0
)
error
(
"Failed to destroy spinlock."
);
...
...
@@ -1642,6 +1638,9 @@ void space_recycle(struct space *s, struct cell *c) {
/* Clear the cell data. */
bzero
(
c
,
sizeof
(
struct
cell
));
/* Lock the space. */
lock_lock
(
&
s
->
lock
);
/* Hook this cell into the buffer. */
c
->
next
=
s
->
cells_sub
;
s
->
cells_sub
=
c
;
...
...
@@ -1651,6 +1650,16 @@ void space_recycle(struct space *s, struct cell *c) {
lock_unlock_blind
(
&
s
->
lock
);
}
/**
* @brief Return a list of used cells to the buffer of unused sub-cells.
*
* @param s The #space.
* @param list_begin Pointer to the first #cell in the linked list of
* cells joined by their @c next pointers.
* @param list_begin Pointer to the last #cell in the linked list of
* cells joined by their @c next pointers. It is assumed that this
* cell's @c next pointer is @c NULL.
*/
void
space_recycle_list
(
struct
space
*
s
,
struct
cell
*
list_begin
,
struct
cell
*
list_end
)
{
...
...
@@ -1662,10 +1671,10 @@ void space_recycle_list(struct space *s, struct cell *list_begin,
if
(
lock_destroy
(
&
c
->
lock
)
!=
0
)
error
(
"Failed to destroy spinlock."
);
/* Clear this cell's sort arrays. */
if
(
c
->
sort
!=
NULL
)
free
(
c
->
sort
);
/* Clear the cell data. */
bzero
(
c
,
sizeof
(
struct
cell
));
if
(
c
->
sort
!=
NULL
)
{
free
(
c
->
sort
);
c
->
sort
=
NULL
;
}
/* Count this cell. */
count
+=
1
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment