Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
Pyston
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
Pyston
Commits
2558ff26
Commit
2558ff26
authored
Nov 07, 2014
by
Kevin Modzelewski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Try to not repeatedly scan through the 'free' bitfield
Seems to help by a couple percent.
parent
72aca8d6
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
7 deletions
+12
-7
src/gc/heap.cpp
src/gc/heap.cpp
+7
-3
src/gc/heap.h
src/gc/heap.h
+5
-1
src/runtime/types.cpp
src/runtime/types.cpp
+0
-3
No files found.
src/gc/heap.cpp
View file @
2558ff26
...
...
@@ -198,16 +198,20 @@ Heap::ThreadBlockCache::~ThreadBlockCache() {
}
static
GCAllocation
*
allocFromBlock
(
Block
*
b
)
{
int
i
=
0
;
uint64_t
mask
=
0
;
for
(;
i
<
BITFIELD_ELTS
;
i
++
)
{
mask
=
b
->
isfree
[
i
];
int
elts_scanned
=
0
;
for
(;
b
->
next_to_check
<
BITFIELD_ELTS
;
b
->
next_to_check
++
)
{
elts_scanned
++
;
mask
=
b
->
isfree
[
b
->
next_to_check
];
if
(
mask
!=
0L
)
{
break
;
}
}
int
i
=
b
->
next_to_check
;
if
(
i
==
BITFIELD_ELTS
)
{
b
->
next_to_check
=
0
;
return
NULL
;
}
...
...
src/gc/heap.h
View file @
2558ff26
...
...
@@ -69,7 +69,7 @@ static_assert(ATOMS_PER_BLOCK % 64 == 0, "");
#define BITFIELD_SIZE (ATOMS_PER_BLOCK / 8)
#define BITFIELD_ELTS (BITFIELD_SIZE / 8)
#define BLOCK_HEADER_SIZE (BITFIELD_SIZE +
2 * sizeof(void*) + sizeof(uint64_t
))
#define BLOCK_HEADER_SIZE (BITFIELD_SIZE +
4 * sizeof(void*
))
#define BLOCK_HEADER_ATOMS ((BLOCK_HEADER_SIZE + ATOM_SIZE - 1) / ATOM_SIZE)
struct
Atoms
{
...
...
@@ -82,6 +82,8 @@ struct Block {
Block
*
next
,
**
prev
;
uint64_t
size
;
uint64_t
isfree
[
BITFIELD_ELTS
];
int
next_to_check
;
void
*
_header_end
[
0
];
};
Atoms
atoms
[
ATOMS_PER_BLOCK
];
};
...
...
@@ -95,6 +97,8 @@ struct Block {
static
Block
*
forPointer
(
void
*
ptr
)
{
return
(
Block
*
)((
uintptr_t
)
ptr
&
~
(
BLOCK_SIZE
-
1
));
}
};
static_assert
(
sizeof
(
Block
)
==
BLOCK_SIZE
,
"bad size"
);
static_assert
(
offsetof
(
Block
,
_header_end
)
>=
BLOCK_HEADER_SIZE
,
"bad header size"
);
static_assert
(
offsetof
(
Block
,
_header_end
)
<=
BLOCK_HEADER_SIZE
,
"bad header size"
);
constexpr
const
size_t
sizes
[]
=
{
16
,
32
,
48
,
64
,
80
,
96
,
112
,
128
,
160
,
192
,
224
,
256
,
...
...
src/runtime/types.cpp
View file @
2558ff26
...
...
@@ -252,9 +252,6 @@ extern "C" void listGCHandler(GCVisitor* v, Box* b) {
v
->
visit
(
l
->
elts
);
if
(
size
)
v
->
visitRange
((
void
**
)
&
l
->
elts
->
elts
[
0
],
(
void
**
)
&
l
->
elts
->
elts
[
size
]);
static
StatCounter
sc
(
"gc_listelts_visited"
);
sc
.
log
(
size
);
}
extern
"C"
void
setGCHandler
(
GCVisitor
*
v
,
Box
*
b
)
{
...
...
Write
Preview
Markdown
is supported
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