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
94b020e6
Commit
94b020e6
authored
Dec 16, 2014
by
Kevin Modzelewski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename ThreadState->ThreadGCState
parent
f1552217
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
9 deletions
+9
-9
src/core/threading.cpp
src/core/threading.cpp
+3
-3
src/core/threading.h
src/core/threading.h
+4
-4
src/gc/root_finder.cpp
src/gc/root_finder.cpp
+2
-2
No files found.
src/core/threading.cpp
View file @
94b020e6
...
...
@@ -117,7 +117,7 @@ void popGenerator() {
}
static
int
signals_waiting
(
0
);
static
std
::
vector
<
ThreadState
>
thread_states
;
static
std
::
vector
<
Thread
GC
State
>
thread_states
;
static
void
pushThreadState
(
pthread_t
tid
,
ucontext_t
*
context
)
{
#if STACK_GROWS_DOWN
...
...
@@ -128,10 +128,10 @@ static void pushThreadState(pthread_t tid, ucontext_t* context) {
void
*
stack_end
=
(
void
*
)(
context
->
uc_mcontext
.
gregs
[
REG_RSP
]
+
sizeof
(
void
*
));
#endif
assert
(
stack_start
<
stack_end
);
thread_states
.
push_back
(
ThreadState
(
tid
,
context
,
stack_start
,
stack_end
));
thread_states
.
push_back
(
Thread
GC
State
(
tid
,
context
,
stack_start
,
stack_end
));
}
std
::
vector
<
ThreadState
>
getAllThreadStates
()
{
std
::
vector
<
Thread
GC
State
>
getAllThreadStates
()
{
// TODO need to prevent new threads from starting,
// though I suppose that will have been taken care of
// by the caller of this function.
...
...
src/core/threading.h
View file @
94b020e6
...
...
@@ -36,7 +36,7 @@ intptr_t start_thread(void* (*start_func)(Box*, Box*, Box*), Box* arg1, Box* arg
void
registerMainThread
();
void
finishMainThread
();
struct
ThreadState
{
struct
Thread
GC
State
{
pthread_t
tid
;
// useful mostly for debugging
ucontext_t
*
ucontext
;
...
...
@@ -45,13 +45,13 @@ struct ThreadState {
// in a generator, but those generators will be tracked separately.
void
*
stack_start
,
*
stack_end
;
ThreadState
(
pthread_t
tid
,
ucontext_t
*
ucontext
,
void
*
stack_start
,
void
*
stack_end
)
Thread
GC
State
(
pthread_t
tid
,
ucontext_t
*
ucontext
,
void
*
stack_start
,
void
*
stack_end
)
:
tid
(
tid
),
ucontext
(
ucontext
),
stack_start
(
stack_start
),
stack_end
(
stack_end
)
{}
};
// Gets a ThreadState per thread, not including the thread calling this function.
// Gets a Thread
GC
State per thread, not including the thread calling this function.
// For this call to make sense, the threads all should be blocked;
// as a corollary, this thread is very much not thread safe.
std
::
vector
<
ThreadState
>
getAllThreadStates
();
std
::
vector
<
Thread
GC
State
>
getAllThreadStates
();
// Get the stack "bottom" (ie first pushed data. For stacks that grow down, this
// will be the highest address).
...
...
src/gc/root_finder.cpp
View file @
94b020e6
...
...
@@ -47,9 +47,9 @@ void collectRoots(void* start, void* end, TraceStack* stack) {
void
collectOtherThreadsStacks
(
TraceStack
*
stack
)
{
std
::
vector
<
threading
::
ThreadState
>
threads
=
threading
::
getAllThreadStates
();
std
::
vector
<
threading
::
Thread
GC
State
>
threads
=
threading
::
getAllThreadStates
();
for
(
threading
::
ThreadState
&
tstate
:
threads
)
{
for
(
threading
::
Thread
GC
State
&
tstate
:
threads
)
{
collectRoots
(
tstate
.
stack_start
,
tstate
.
stack_end
,
stack
);
collectRoots
(
tstate
.
ucontext
,
tstate
.
ucontext
+
1
,
stack
);
}
...
...
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