Skip to content

Commit

Permalink
Fix signedness errors in the GC
Browse files Browse the repository at this point in the history
  • Loading branch information
niner committed Nov 28, 2019
1 parent 119a3f8 commit 4bdc763
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions src/gc/collect.c
Expand Up @@ -319,7 +319,7 @@ static void process_worklist(MVMThreadContext *tc, MVMGCWorklist *worklist, Work
new_addr = (MVMCollectable *)tc->nursery_alloc;
tc->nursery_alloc = (char *)tc->nursery_alloc + MVM_ALIGN_SIZE(item->size);
GCDEBUG_LOG(tc, MVM_GC_DEBUG_COLLECT, "Thread %d run %d : copying an object %p (reprid %d) of size %d to tospace %p\n",
item, (item->flags & (MVM_CF_TYPE_OBJECT | MVM_CF_STABLE | MVM_CF_FRAME)) ? -1 : REPR(item)->ID, item->size, new_addr);
item, (item->flags & (MVM_CF_TYPE_OBJECT | MVM_CF_STABLE | MVM_CF_FRAME)) ? -1 : (int)REPR(item)->ID, item->size, new_addr);

/* Copy the object to tospace and mark it as seen in the
* nursery (so the next time around it will move to the
Expand All @@ -331,7 +331,7 @@ static void process_worklist(MVMThreadContext *tc, MVMGCWorklist *worklist, Work
/* Store the forwarding pointer and update the original
* reference. */
if (MVM_GC_DEBUG_ENABLED(MVM_GC_DEBUG_COLLECT) && new_addr != item) {
GCDEBUG_LOG(tc, MVM_GC_DEBUG_COLLECT, "Thread %d run %d : updating handle %p from referent %p (reprid %d) to %p\n", item_ptr, item, (item->flags & (MVM_CF_TYPE_OBJECT | MVM_CF_STABLE | MVM_CF_FRAME)) ? -1 : REPR(item)->ID, new_addr);
GCDEBUG_LOG(tc, MVM_GC_DEBUG_COLLECT, "Thread %d run %d : updating handle %p from referent %p (reprid %d) to %p\n", item_ptr, item, (item->flags & (MVM_CF_TYPE_OBJECT | MVM_CF_STABLE | MVM_CF_FRAME)) ? -1 : (int)REPR(item)->ID, new_addr);
}
*item_ptr = new_addr;
item->sc_forward_u.forwarder = new_addr;
Expand Down Expand Up @@ -721,7 +721,7 @@ void MVM_gc_collect_free_gen2_unmarked(MVMThreadContext *executing_thread, MVMTh
!(col->flags & MVM_CF_SERIALZATION_INDEX_ALLOCATED) &&
#endif
col->sc_forward_u.sc.sc_idx == 0
&& col->sc_forward_u.sc.idx == MVM_DIRECT_SC_IDX_SENTINEL) {
&& col->sc_forward_u.sc.idx == (unsigned)MVM_DIRECT_SC_IDX_SENTINEL) {
/* We marked it dead last time, kill it. */
MVM_6model_stable_gc_free(tc, (MVMSTable *)col);
}
Expand Down
2 changes: 1 addition & 1 deletion src/gc/collect.h
Expand Up @@ -49,7 +49,7 @@ typedef enum {
struct MVMGCPassedWork {
MVMCollectable **items[MVM_GC_PASS_WORK_SIZE];
MVMGCPassedWork *next;
MVMint32 num_items;
MVMuint32 num_items;
};

/* Functions. */
Expand Down
2 changes: 1 addition & 1 deletion src/gc/gen2.c
Expand Up @@ -116,7 +116,7 @@ void * MVM_gc_gen2_allocate_zeroed(MVMGen2Allocator *al, MVMuint32 size) {

/* Frees all memory associated with the second generation. */
void MVM_gc_gen2_destroy(MVMInstance *i, MVMGen2Allocator *al) {
MVMint32 j, k;
MVMuint32 j, k;

/* Remove all pages. */
for (j = 0; j < MVM_GEN2_BINS; j++) {
Expand Down
4 changes: 2 additions & 2 deletions src/gc/orchestrate.c
Expand Up @@ -5,7 +5,7 @@
/* If we have the job of doing GC for a thread, we add it to our work
* list. */
static void add_work(MVMThreadContext *tc, MVMThreadContext *stolen) {
MVMint32 i;
MVMuint32 i;
for (i = 0; i < tc->gc_work_count; i++)
if (tc->gc_work[i].tc == stolen)
return;
Expand All @@ -27,7 +27,7 @@ static void add_work(MVMThreadContext *tc, MVMThreadContext *stolen) {
static MVMuint32 signal_one_thread(MVMThreadContext *tc, MVMThreadContext *to_signal) {
/* Loop here since we may not succeed first time (e.g. the status of the
* thread may change between the two ways we try to twiddle it). */
int had_suspend_request = 0;
unsigned int had_suspend_request = 0;
while (1) {
AO_t current = MVM_load(&to_signal->gc_status);
switch (current) {
Expand Down

0 comments on commit 4bdc763

Please sign in to comment.