Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fix bug introduced in commit 667d462 (introduction of FLAG_HAS_GC_MEM…

…BERS)
  • Loading branch information...
commit 009a748da615691feb751320c72594322bf74689 1 parent de3a1cc
@kazuho authored
Showing with 7 additions and 5 deletions.
  1. +5 −4 picogc.cpp
  2. +2 −1  picogc.h
View
9 picogc.cpp
@@ -66,7 +66,9 @@ void gc::trigger_gc()
emitter_->gc_start(this);
// move the new object list to the old object list
- *old_objs_end_ = reinterpret_cast<intptr_t>(new_objs_);
+ assert((*old_objs_end_ & ~FLAG_MASK) == 0);
+ *old_objs_end_ = reinterpret_cast<intptr_t>(new_objs_)
+ | (*old_objs_end_ & FLAG_HAS_GC_MEMBERS);
new_objs_ = NULL;
// setup local
for (std::vector<gc_object*>::iterator i = stack_.begin(); i != stack_.end();
@@ -93,8 +95,7 @@ void gc::_mark()
gc_object* o = pending_.back();
pending_.pop_back();
// request deferred marking of the properties
- if ((o->next_ & FLAG_HAS_GC_MEMBERS) != 0)
- o->gc_mark(this);
+ o->gc_mark(this);
}
emitter_->mark_end(this);
@@ -118,7 +119,7 @@ void gc::_sweep()
}
obj = reinterpret_cast<gc_object*>(next & ~FLAG_MASK);
}
- *ref = (intptr_t) NULL;
+ *ref &= FLAG_HAS_GC_MEMBERS;
old_objs_end_ = ref;
emitter_->sweep_end(this);
View
3  picogc.h
@@ -250,7 +250,8 @@ namespace picogc {
// mark
obj->next_ |= FLAG_MARKED;
// push to the mark stack
- pending_.push_back(obj);
+ if ((obj->next_ & FLAG_HAS_GC_MEMBERS) != 0)
+ pending_.push_back(obj);
}
template <typename T> void gc::mark(member<T>& _obj)
Please sign in to comment.
Something went wrong with that request. Please try again.