Skip to content

Commit

Permalink
RTS: address warnings and enable -Werror
Browse files Browse the repository at this point in the history
  • Loading branch information
ckoparkar committed Dec 28, 2023
1 parent bb8ab01 commit a13f114
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 17 deletions.
2 changes: 1 addition & 1 deletion gibbon-rts/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

CC := gcc
AR := gcc-ar
CFLAGS := -Wall -Wextra -Wpedantic -Wshadow -std=gnu11 -flto
CFLAGS := -Wall -Wextra -Wpedantic -Wshadow -Werror -std=gnu11 -flto
RSC := cargo
RSFLAGS := -v
VERBOSITY := 1
Expand Down
28 changes: 15 additions & 13 deletions gibbon-rts/rts-c/gibbon_rts.c
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ GibSym gib_read_gensym_counter(void)
#ifdef _GIBBON_POINTER

#ifdef _GIBBON_BUMPALLOC_HEAP
#warning "Using bump allocator."
#pragma message "Using bump allocator."

static __thread char *gib_global_ptr_bumpalloc_heap_ptr = (char *) NULL;
static __thread char *gib_global_ptr_bumpalloc_heap_ptr_end = (char *) NULL;
Expand Down Expand Up @@ -706,7 +706,7 @@ double gib_sum_timing_array(GibVector *times)

#ifdef _GIBBON_BUMPALLOC_LISTS
// #define _GIBBON_DEBUG
#warning "Using bump allocator."
#pragma message "Using bump allocator."

static __thread char *gib_global_list_bumpalloc_heap_ptr = (char *) NULL;
static __thread char *gib_global_list_bumpalloc_heap_ptr_end = (char *) NULL;
Expand Down Expand Up @@ -1036,26 +1036,26 @@ void gib_print_gc_config(void) {
printf("C config\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n");

#if defined _GIBBON_GENGC && _GIBBON_GENGC == 0
#warning "Generational GC is disabled."
#pragma message "Generational GC is disabled."
printf("Generational GC is disabled.\n");
#else
#warning "Generational GC is enabled."
#pragma message "Generational GC is enabled."
printf("Generational GC is enabled.\n");
#endif

#if defined _GIBBON_EAGER_PROMOTION && _GIBBON_EAGER_PROMOTION == 0
#warning "Eager promotion is disabled."
#pragma message "Eager promotion is disabled."
printf("Eager promotion is disabled.\n");
#else
#warning "Eager promotion is enabled."
#pragma message "Eager promotion is enabled."
printf("Eager promotion is enabled.\n");
#endif

#if defined _GIBBON_SIMPLE_WRITE_BARRIER && _GIBBON_SIMPLE_WRITE_BARRIER == 0
#warning "Simple write barrier is disabled."
#pragma message "Simple write barrier is disabled."
printf("Simple write barrier is disabled.\n");
#else
#warning "Simple write barrier is enabled."
#pragma message "Simple write barrier is enabled."
printf("Simple write barrier is enabled.\n");
#endif

Expand Down Expand Up @@ -1339,7 +1339,7 @@ static void gib_storage_initialize(void)
gib_gc_stats_initialize(gib_global_gc_stats);

// Initialize nurseries.
int n;
uint64_t n;
gib_global_nurseries = (GibNursery *) gib_alloc(gib_global_num_threads *
sizeof(GibNursery));
for (n = 0; n < gib_global_num_threads; n++) {
Expand All @@ -1351,7 +1351,7 @@ static void gib_storage_initialize(void)
gib_oldgen_initialize(gib_global_oldgen);

// Initialize shadow stacks.
int ss;
uint64_t ss;
gib_global_read_shadowstacks =
(GibShadowstack *) gib_alloc(gib_global_num_threads *
sizeof(GibShadowstack));
Expand All @@ -1375,7 +1375,7 @@ static void gib_storage_free(void)
}

// Free nurseries.
int n;
uint64_t n;
for (n = 0; n < gib_global_num_threads; n++) {
gib_nursery_free(&(gib_global_nurseries[n]));
}
Expand All @@ -1386,7 +1386,7 @@ static void gib_storage_free(void)
gib_free(gib_global_oldgen);

// Free shadow-stacks.
int ss;
uint64_t ss;
for (ss = 0; ss < gib_global_num_threads; ss++) {
gib_shadowstack_free(&(gib_global_read_shadowstacks[ss]));
gib_shadowstack_free(&(gib_global_write_shadowstacks[ss]));
Expand Down Expand Up @@ -1599,6 +1599,7 @@ static void gib_gc_stats_free(GibGcStats *stats)
gib_free(stats);
}

#ifdef _GIBBON_GCSTATS
static void gib_gc_stats_print(GibGcStats *stats)
{
printf("\nGC statistics\n----------------------------------------\n");
Expand Down Expand Up @@ -1652,6 +1653,7 @@ static void gib_gc_stats_print(GibGcStats *stats)
printf("Skipover env inserts:\t\t %ld\n", stats->skipover_env_inserts);
printf("Root set size:\t\t\t %ld\n", stats->rootset_size);
}
#endif // ifdef _GIBBON_GCSTATS


/*
Expand Down Expand Up @@ -1929,7 +1931,7 @@ int gib_init(int argc, char **argv)
}
#endif

int got_numargs = argc; // How many numeric arguments have we got.
// int got_numargs = argc; // How many numeric arguments have we got.

int i;
for (i = 1; i < argc; ++i)
Expand Down
4 changes: 2 additions & 2 deletions gibbon-rts/rts-c/gibbon_rts.h
Original file line number Diff line number Diff line change
Expand Up @@ -1069,9 +1069,9 @@ INLINE_HEADER void gib_indirection_barrier(
{

#if defined _GIBBON_SIMPLE_WRITE_BARRIER && _GIBBON_SIMPLE_WRITE_BARRIER == 1
#warning "Simple write barrier is enabled."
#pragma message "Simple write barrier is enabled."
#else
#warning "Simple write barrier is disabled."
#pragma message "Simple write barrier is disabled."
{
// Optimization: don't create long chains of indirection pointers.
GibPackedTag pointed_to_tag = *(GibPackedTag *) to;
Expand Down
2 changes: 1 addition & 1 deletion gibbon-rts/rts-ng/src/gc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ pub fn cleanup(
(*((*oldgen).old_zct)).insert((*footer).reg_info);
}
}
for reg_info in (*((*oldgen).old_zct)).drain() {
for _reg_info in (*((*oldgen).old_zct)).drain() {
// free_region((*reg_info).first_chunk_footer, null_mut())?;
}
}
Expand Down
4 changes: 4 additions & 0 deletions gibbon-rts/rts-ng/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
//! Next generation runtime system for the Gibbon compiler.

// Erroring on every warning is OK for now, but can be refined in the future:
// https://rust-unofficial.github.io/patterns/anti_patterns/deny-warnings.html
#![deny(warnings)]

pub use ffi::c::*;
pub use ffi::rs::*;
pub use gc::ValueStats;
Expand Down

0 comments on commit a13f114

Please sign in to comment.