Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Move lowlevel Fiber marking to the Thread level

  • Loading branch information...
commit ae50198bf57d3861a398377ac0b44bd0a6567d58 1 parent 028cb3d
@evanphx evanphx authored
View
26 vm/builtin/fiber.cpp
@@ -40,9 +40,6 @@ namespace rubinius {
// Lazily allocate a root fiber.
if(fib->nil_p()) {
fib = state->new_object<Fiber>(G(fiber));
- if(fib->zone() != YoungObjectZone) {
- state->memory()->remember_object(fib);
- }
fib->prev_ = nil<Fiber>();
fib->root_ = true;
fib->status_ = Fiber::eRunning;
@@ -114,9 +111,6 @@ namespace rubinius {
}
Fiber* fib = state->new_object<Fiber>(as<Class>(self));
- if(fib->zone() != YoungObjectZone) {
- state->memory()->remember_object(fib);
- }
fib->starter(state, callable);
fib->prev(state, nil<Fiber>());
fib->root_ = false;
@@ -301,26 +295,6 @@ namespace rubinius {
void Fiber::Info::mark(Object* obj, ObjectMark& mark) {
auto_mark(obj, mark);
-
- mark.remember_object(obj);
-
- Fiber* fib = (Fiber*)obj;
-
- FiberData* data = fib->data_;
-
- if(!data) return;
-
- if(data->dead_p()) return;
-
- AddressDisplacement dis(data->data_offset(),
- data->data_lower_bound(),
- data->data_upper_bound());
-
- if(CallFrame* cf = data->call_frame()) {
- mark.gc->walk_call_frame(cf, &dis);
- }
-
- mark.gc->scan(data->variable_root_buffers(), false, &dis);
}
}
View
22 vm/fiber_stack.cpp
@@ -6,6 +6,8 @@
#include "bug.hpp"
+#include "gc/gc.hpp"
+
#include <stdlib.h>
namespace rubinius {
@@ -66,6 +68,26 @@ namespace rubinius {
}
}
+ void FiberStacks::gc_scan(GarbageCollector* gc) {
+ for(Datas::iterator i = datas_.begin();
+ i != datas_.end();
+ ++i)
+ {
+ FiberData* data = *i;
+ if(data->dead_p()) continue;
+
+ AddressDisplacement dis(data->data_offset(),
+ data->data_lower_bound(),
+ data->data_upper_bound());
+
+ if(CallFrame* cf = data->call_frame()) {
+ gc->walk_call_frame(cf, &dis);
+ }
+
+ gc->scan(data->variable_root_buffers(), false, &dis);
+ }
+ }
+
FiberData* FiberStacks::new_data() {
FiberData* data = new FiberData(thread_);
datas_.push_back(data);
View
3  vm/fiber_stack.hpp
@@ -3,6 +3,7 @@
namespace rubinius {
class FiberData;
+ class GarbageCollector;
class FiberStack {
void* address_;
@@ -88,6 +89,8 @@ namespace rubinius {
FiberData* new_data();
void* trampoline();
+
+ void gc_scan(GarbageCollector* gc);
};
}
View
8 vm/gc/gc.cpp
@@ -247,13 +247,7 @@ namespace rubinius {
scan(thr->root_buffers(), young_only);
if(VM* vm = thr->as_vm()) {
- if(CallFrame* cf = vm->saved_call_frame()) {
- walk_call_frame(cf);
- }
-
- State ls(vm);
-
- vm->shared.tool_broker()->at_gc(&ls);
+ vm->gc_scan(this);
}
std::list<ObjectHeader*>& los = thr->locked_objects();
View
12 vm/vm.cpp
@@ -436,6 +436,18 @@ namespace rubinius {
return current_fiber->variable_root_buffers();
}
+ void VM::gc_scan(GarbageCollector* gc) {
+ if(CallFrame* cf = saved_call_frame()) {
+ gc->walk_call_frame(cf);
+ }
+
+ State ls(this);
+
+ shared.tool_broker()->at_gc(&ls);
+
+ fiber_stacks_.gc_scan(gc);
+ }
+
GCIndependent::GCIndependent(NativeMethodEnvironment* env)
: state_(env->state())
{
View
3  vm/vm.hpp
@@ -63,6 +63,7 @@ namespace rubinius {
class SymbolTable;
class SharedState;
class Fiber;
+ class GarbageCollector;
enum MethodMissingReason {
eNone, ePrivate, eProtected, eSuper, eVCall, eNormal
@@ -395,6 +396,8 @@ namespace rubinius {
void register_raise(STATE, Exception* exc);
+ void gc_scan(GarbageCollector* gc);
+
// For thread-local roots
static std::list<Roots*>* roots;
};
Please sign in to comment.
Something went wrong with that request. Please try again.