Skip to content

Commit

Permalink
Rename a flag for consistency.
Browse files Browse the repository at this point in the history
  • Loading branch information
jnthn committed Feb 6, 2014
1 parent e05bf62 commit 0f2077b
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion src/6model/6model.h
Expand Up @@ -102,7 +102,7 @@ typedef enum {
MVM_CF_IN_GEN2_ROOT_LIST = 32,

/* GC has found this object to be live. */
MVM_CF_SECOND_GEN_LIVE = 64,
MVM_CF_GEN2_LIVE = 64,
/* This object in fromspace is live with a valid forwarder. */
/* TODO - should be possible to use the same bit for these two flags. */
MVM_CF_FORWARDER_VALID = 128
Expand Down
8 changes: 4 additions & 4 deletions src/6model/sc.c
Expand Up @@ -257,28 +257,28 @@ MVMuint64 MVM_sc_get_object_count(MVMThreadContext *tc, MVMSerializationContext

/* Gets an object's SC. */
MVMSerializationContext * MVM_sc_get_obj_sc(MVMThreadContext *tc, MVMObject *obj) {
assert(!(obj->header.flags & MVM_CF_SECOND_GEN_LIVE));
assert(!(obj->header.flags & MVM_CF_GEN2_LIVE));
assert(!(obj->header.flags & MVM_CF_FORWARDER_VALID));
return obj->header.sc_forward_u.sc;
}

/* Gets an STables's SC. */
MVMSerializationContext * MVM_sc_get_stable_sc(MVMThreadContext *tc, MVMSTable *st) {
assert(!(st->header.flags & MVM_CF_SECOND_GEN_LIVE));
assert(!(st->header.flags & MVM_CF_GEN2_LIVE));
assert(!(st->header.flags & MVM_CF_FORWARDER_VALID));
return st->header.sc_forward_u.sc;
}

/* Sets an object's SC. */
void MVM_sc_set_obj_sc(MVMThreadContext *tc, MVMObject *obj, MVMSerializationContext *sc) {
assert(!(obj->header.flags & MVM_CF_SECOND_GEN_LIVE));
assert(!(obj->header.flags & MVM_CF_GEN2_LIVE));
assert(!(obj->header.flags & MVM_CF_FORWARDER_VALID));
MVM_ASSIGN_REF(tc, obj, obj->header.sc_forward_u.sc, sc);
}

/* Sets an STable's SC. */
void MVM_sc_set_stable_sc(MVMThreadContext *tc, MVMSTable *st, MVMSerializationContext *sc) {
assert(!(st->header.flags & MVM_CF_SECOND_GEN_LIVE));
assert(!(st->header.flags & MVM_CF_GEN2_LIVE));
assert(!(st->header.flags & MVM_CF_FORWARDER_VALID));
MVM_ASSIGN_REF(tc, st, st->header.sc_forward_u.sc, sc);
}
Expand Down
4 changes: 2 additions & 2 deletions src/6model/sc.h
Expand Up @@ -29,7 +29,7 @@ MVMSerializationContext * MVM_sc_get_sc(MVMThreadContext *tc, MVMCompUnit *cu, M
#define MVM_SC_WB_OBJ(tc, obj) \
do { \
MVMObject *check = (MVMObject *)obj; \
assert(!(obj->header.flags & MVM_CF_SECOND_GEN_LIVE)); \
assert(!(obj->header.flags & MVM_CF_GEN2_LIVE)); \
assert(!(obj->header.flags & MVM_CF_FORWARDER_VALID)); \
if (check->header.sc_forward_u.sc) \
MVM_sc_wb_hit_obj(tc, check); \
Expand All @@ -38,7 +38,7 @@ void MVM_sc_wb_hit_obj(MVMThreadContext *tc, MVMObject *obj);
#define MVM_SC_WB_ST(tc, st) \
do { \
MVMSTable *check = st; \
assert(!(st->header.flags & MVM_CF_SECOND_GEN_LIVE)); \
assert(!(st->header.flags & MVM_CF_GEN2_LIVE)); \
assert(!(st->header.flags & MVM_CF_FORWARDER_VALID)); \
if (check->header.sc_forward_u.sc) \
MVM_sc_wb_hit_st(tc, check); \
Expand Down
16 changes: 8 additions & 8 deletions src/gc/collect.c
Expand Up @@ -173,7 +173,7 @@ static void process_worklist(MVMThreadContext *tc, MVMGCWorklist *worklist, Work
if (item_gen2) {
if (gen == MVMGCGenerations_Nursery)
continue;
if (item->flags & MVM_CF_SECOND_GEN_LIVE) {
if (item->flags & MVM_CF_GEN2_LIVE) {
/* gen2 and marked as live. */
continue;
}
Expand Down Expand Up @@ -222,7 +222,7 @@ static void process_worklist(MVMThreadContext *tc, MVMGCWorklist *worklist, Work
if (MVM_GC_DEBUG_ENABLED(MVM_GC_DEBUG_COLLECT)) {
GCDEBUG_LOG(tc, MVM_GC_DEBUG_COLLECT, "Thread %d run %d : handle %p was already %p\n", item_ptr, new_addr);
}
item->flags |= MVM_CF_SECOND_GEN_LIVE;
item->flags |= MVM_CF_GEN2_LIVE;
assert(*item_ptr == new_addr);
} else {
/* Catch NULL stable (always sign of trouble) in debug mode. */
Expand Down Expand Up @@ -257,7 +257,7 @@ static void process_worklist(MVMThreadContext *tc, MVMGCWorklist *worklist, Work
/* If we're going to sweep the second generation, also need
* to mark it as live. */
if (gen == MVMGCGenerations_Both)
new_addr->flags |= MVM_CF_SECOND_GEN_LIVE;
new_addr->flags |= MVM_CF_GEN2_LIVE;
}
else {
/* No, so it will live in the nursery for another GC
Expand Down Expand Up @@ -561,7 +561,7 @@ void MVM_gc_collect_cleanup_gen2roots(MVMThreadContext *tc) {
MVMuint32 ins_pos = 0;
MVMuint32 i;
for (i = 0; i < num_roots; i++)
if (gen2roots[i]->flags & MVM_CF_SECOND_GEN_LIVE)
if (gen2roots[i]->flags & MVM_CF_GEN2_LIVE)
gen2roots[ins_pos++] = gen2roots[i];
tc->num_gen2roots = ins_pos;
}
Expand Down Expand Up @@ -618,9 +618,9 @@ void MVM_gc_collect_free_gen2_unmarked(MVMThreadContext *tc) {

/* Otherwise, it must be a collectable of some kind. Is it
* live? */
else if (col->flags & MVM_CF_SECOND_GEN_LIVE) {
else if (col->flags & MVM_CF_GEN2_LIVE) {
/* Yes; clear the mark. */
col->flags &= ~MVM_CF_SECOND_GEN_LIVE;
col->flags &= ~MVM_CF_GEN2_LIVE;
}
else {
GCDEBUG_LOG(tc, MVM_GC_DEBUG_COLLECT, "Thread %d run %d : collecting an object %p in the gen2\n", col);
Expand Down Expand Up @@ -676,9 +676,9 @@ void MVM_gc_collect_free_gen2_unmarked(MVMThreadContext *tc) {
for (i = 0; i < gen2->num_overflows; i++) {
if (gen2->overflows[i]) {
MVMCollectable *col = gen2->overflows[i];
if (col->flags & MVM_CF_SECOND_GEN_LIVE) {
if (col->flags & MVM_CF_GEN2_LIVE) {
/* A living over-sized object; just clear the mark. */
col->flags &= ~MVM_CF_SECOND_GEN_LIVE;
col->flags &= ~MVM_CF_GEN2_LIVE;
}
else {
/* Dead over-sized object. We know if it's this big it cannot
Expand Down
2 changes: 1 addition & 1 deletion src/gc/roots.c
Expand Up @@ -242,7 +242,7 @@ void MVM_gc_root_gen2_cleanup(MVMThreadContext *tc) {
MVMuint32 cur_survivor = 0;
MVMuint32 i;
for (i = 0; i < num_roots; i++)
if (gen2roots[i]->flags & MVM_CF_SECOND_GEN_LIVE) {
if (gen2roots[i]->flags & MVM_CF_GEN2_LIVE) {
assert(!(gen2roots[i]->flags & MVM_CF_FORWARDER_VALID));
gen2roots[cur_survivor++] = gen2roots[i];
}
Expand Down

0 comments on commit 0f2077b

Please sign in to comment.