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
ed1ca7bd
Commit
ed1ca7bd
authored
Mar 24, 2015
by
Chris Toshok
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
keep track of min_nonheap_root as well
parent
f69d1a99
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
1 deletion
+5
-1
src/gc/collector.cpp
src/gc/collector.cpp
+5
-1
No files found.
src/gc/collector.cpp
View file @
ed1ca7bd
...
@@ -150,6 +150,7 @@ static std::unordered_set<void*> nonheap_roots;
...
@@ -150,6 +150,7 @@ static std::unordered_set<void*> nonheap_roots;
// typically all have lower addresses than the heap roots, so this can serve as a cheap
// typically all have lower addresses than the heap roots, so this can serve as a cheap
// way to verify it's not a nonheap root (the full check requires a hashtable lookup).
// way to verify it's not a nonheap root (the full check requires a hashtable lookup).
static
void
*
max_nonheap_root
=
0
;
static
void
*
max_nonheap_root
=
0
;
static
void
*
min_nonheap_root
=
(
void
*
)
~
0
;
void
registerNonheapRootObject
(
void
*
obj
)
{
void
registerNonheapRootObject
(
void
*
obj
)
{
// I suppose that things could work fine even if this were true, but why would it happen?
// I suppose that things could work fine even if this were true, but why would it happen?
assert
(
global_heap
.
getAllocationFromInteriorPointer
(
obj
)
==
NULL
);
assert
(
global_heap
.
getAllocationFromInteriorPointer
(
obj
)
==
NULL
);
...
@@ -158,10 +159,13 @@ void registerNonheapRootObject(void* obj) {
...
@@ -158,10 +159,13 @@ void registerNonheapRootObject(void* obj) {
nonheap_roots
.
insert
(
obj
);
nonheap_roots
.
insert
(
obj
);
max_nonheap_root
=
std
::
max
(
obj
,
max_nonheap_root
);
max_nonheap_root
=
std
::
max
(
obj
,
max_nonheap_root
);
min_nonheap_root
=
std
::
min
(
obj
,
min_nonheap_root
);
}
}
bool
isNonheapRoot
(
void
*
p
)
{
bool
isNonheapRoot
(
void
*
p
)
{
return
p
<=
max_nonheap_root
&&
nonheap_roots
.
count
(
p
)
!=
0
;
if
(
p
>
max_nonheap_root
||
p
<
min_nonheap_root
)
return
false
;
return
nonheap_roots
.
count
(
p
)
!=
0
;
}
}
bool
isValidGCObject
(
void
*
p
)
{
bool
isValidGCObject
(
void
*
p
)
{
...
...
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