Commit 94b020e6 authored by Kevin Modzelewski's avatar Kevin Modzelewski

Rename ThreadState->ThreadGCState

parent f1552217
...@@ -117,7 +117,7 @@ void popGenerator() { ...@@ -117,7 +117,7 @@ void popGenerator() {
} }
static int signals_waiting(0); static int signals_waiting(0);
static std::vector<ThreadState> thread_states; static std::vector<ThreadGCState> thread_states;
static void pushThreadState(pthread_t tid, ucontext_t* context) { static void pushThreadState(pthread_t tid, ucontext_t* context) {
#if STACK_GROWS_DOWN #if STACK_GROWS_DOWN
...@@ -128,10 +128,10 @@ static void pushThreadState(pthread_t tid, ucontext_t* context) { ...@@ -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*)); void* stack_end = (void*)(context->uc_mcontext.gregs[REG_RSP] + sizeof(void*));
#endif #endif
assert(stack_start < stack_end); assert(stack_start < stack_end);
thread_states.push_back(ThreadState(tid, context, stack_start, stack_end)); thread_states.push_back(ThreadGCState(tid, context, stack_start, stack_end));
} }
std::vector<ThreadState> getAllThreadStates() { std::vector<ThreadGCState> getAllThreadStates() {
// TODO need to prevent new threads from starting, // TODO need to prevent new threads from starting,
// though I suppose that will have been taken care of // though I suppose that will have been taken care of
// by the caller of this function. // by the caller of this function.
......
...@@ -36,7 +36,7 @@ intptr_t start_thread(void* (*start_func)(Box*, Box*, Box*), Box* arg1, Box* arg ...@@ -36,7 +36,7 @@ intptr_t start_thread(void* (*start_func)(Box*, Box*, Box*), Box* arg1, Box* arg
void registerMainThread(); void registerMainThread();
void finishMainThread(); void finishMainThread();
struct ThreadState { struct ThreadGCState {
pthread_t tid; // useful mostly for debugging pthread_t tid; // useful mostly for debugging
ucontext_t* ucontext; ucontext_t* ucontext;
...@@ -45,13 +45,13 @@ struct ThreadState { ...@@ -45,13 +45,13 @@ struct ThreadState {
// in a generator, but those generators will be tracked separately. // in a generator, but those generators will be tracked separately.
void* stack_start, *stack_end; void* stack_start, *stack_end;
ThreadState(pthread_t tid, ucontext_t* ucontext, void* stack_start, void* stack_end) ThreadGCState(pthread_t tid, ucontext_t* ucontext, void* stack_start, void* stack_end)
: tid(tid), ucontext(ucontext), stack_start(stack_start), stack_end(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 ThreadGCState per thread, not including the thread calling this function.
// For this call to make sense, the threads all should be blocked; // For this call to make sense, the threads all should be blocked;
// as a corollary, this thread is very much not thread safe. // as a corollary, this thread is very much not thread safe.
std::vector<ThreadState> getAllThreadStates(); std::vector<ThreadGCState> getAllThreadStates();
// Get the stack "bottom" (ie first pushed data. For stacks that grow down, this // Get the stack "bottom" (ie first pushed data. For stacks that grow down, this
// will be the highest address). // will be the highest address).
......
...@@ -47,9 +47,9 @@ void collectRoots(void* start, void* end, TraceStack* stack) { ...@@ -47,9 +47,9 @@ void collectRoots(void* start, void* end, TraceStack* stack) {
void collectOtherThreadsStacks(TraceStack* stack) { void collectOtherThreadsStacks(TraceStack* stack) {
std::vector<threading::ThreadState> threads = threading::getAllThreadStates(); std::vector<threading::ThreadGCState> threads = threading::getAllThreadStates();
for (threading::ThreadState& tstate : threads) { for (threading::ThreadGCState& tstate : threads) {
collectRoots(tstate.stack_start, tstate.stack_end, stack); collectRoots(tstate.stack_start, tstate.stack_end, stack);
collectRoots(tstate.ucontext, tstate.ucontext + 1, stack); collectRoots(tstate.ucontext, tstate.ucontext + 1, stack);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment