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
8a510e30
Commit
8a510e30
authored
Sep 04, 2015
by
Rudi Chen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ifdef out some moving GC code for now.
parent
9fade195
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
0 deletions
+12
-0
src/gc/collector.cpp
src/gc/collector.cpp
+10
-0
src/gc/collector.h
src/gc/collector.h
+2
-0
No files found.
src/gc/collector.cpp
View file @
8a510e30
...
...
@@ -235,6 +235,7 @@ public:
}
};
#if MOVING_GC
class
ReferenceMapWorklist
:
public
Worklist
{
ReferenceMap
*
refmap
;
...
...
@@ -287,6 +288,7 @@ public:
void
pin
(
GCAllocation
*
al
)
{
refmap
->
pinned
.
emplace
(
al
);
}
};
#endif
void
registerPermanentRoot
(
void
*
obj
,
bool
allow_duplicates
)
{
assert
(
global_heap
.
getAllocationFromInteriorPointer
(
obj
));
...
...
@@ -485,6 +487,7 @@ void GCVisitor::visitPotentialRange(void** start, void** end) {
}
}
#if MOVING_GC
void
GCVisitorPinning
::
_visit
(
void
**
ptr_address
)
{
void
*
p
=
*
ptr_address
;
if
((
uintptr_t
)
p
<
SMALL_ARENA_START
||
(
uintptr_t
)
p
>=
HUGE_ARENA_START
+
ARENA_SIZE
)
{
...
...
@@ -510,6 +513,7 @@ void GCVisitorReplacing::_visit(void** ptr_address) {
*
ptr_address
=
new_value
;
}
}
#endif
static
void
visitRoots
(
GCVisitor
&
visitor
)
{
GC_TRACE_LOG
(
"Looking at the stack
\n
"
);
...
...
@@ -784,6 +788,7 @@ static void sweepPhase(std::vector<Box*>& weakly_referenced) {
}
static
void
mapReferencesPhase
(
ReferenceMap
&
refmap
)
{
#if MOVING_GC
ReferenceMapWorklist
worklist
(
&
refmap
,
roots
);
GCVisitorPinning
visitor
(
&
worklist
);
...
...
@@ -794,8 +799,10 @@ static void mapReferencesPhase(ReferenceMap& refmap) {
}
graphTraversalMarking
(
worklist
,
visitor
);
#endif
}
#if MOVING_GC
#define MOVE_LOG 1
static
FILE
*
move_log
;
...
...
@@ -844,6 +851,7 @@ static void move(ReferenceMap& refmap, GCAllocation* old_al, size_t size) {
// TODO: This probably should not happen.
}
}
#endif
// Move objects around memory randomly. The purpose is to test whether the rest
// of the program is able to support a moving collector (e.g. if all pointers are
...
...
@@ -856,6 +864,7 @@ static void move(ReferenceMap& refmap, GCAllocation* old_al, size_t size) {
// 2) Reallocate all non-pinned object. Update the value for every pointer locations
// from the map built in (1)
static
void
testMoving
()
{
#if MOVING_GC
global_heap
.
prepareForCollection
();
ReferenceMap
refmap
;
...
...
@@ -867,6 +876,7 @@ static void testMoving() {
global_heap
.
forEachSmallArenaReference
([
&
refmap
](
GCAllocation
*
al
,
size_t
size
)
{
move
(
refmap
,
al
,
size
);
});
global_heap
.
cleanupAfterCollection
();
#endif
}
bool
gcIsEnabled
()
{
...
...
src/gc/collector.h
View file @
8a510e30
...
...
@@ -91,6 +91,7 @@ class ReferenceMapWorklist;
#define MOVING_OVERRIDE
#endif
#if MOVING_GC
// Bulds the reference map, and also determine which objects cannot be moved.
class
GCVisitorPinning
:
public
GCVisitorNoRedundancy
{
private:
...
...
@@ -134,6 +135,7 @@ public:
// Track movement (reallocation) of objects.
std
::
unordered_map
<
GCAllocation
*
,
GCAllocation
*>
moves
;
};
#endif
}
}
...
...
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