From 17a7aa0116737ffcd8225673cd8e058cbdc0c037 Mon Sep 17 00:00:00 2001 From: Danya Berezun Date: Mon, 4 Sep 2023 21:44:26 +0200 Subject: [PATCH] fix warnings --- byterun/Makefile | 8 +++++--- runtime/Makefile | 2 +- runtime/gc.c | 4 ++-- runtime/gc.h | 9 ++++----- runtime/runtime.c | 4 ++-- 5 files changed, 14 insertions(+), 13 deletions(-) diff --git a/byterun/Makefile b/byterun/Makefile index 45fc9c562..c6304ed16 100644 --- a/byterun/Makefile +++ b/byterun/Makefile @@ -1,8 +1,10 @@ +FLAGS=-no-pie -m32 -g2 -fstack-protector-all + all: byterun.o - $(CC) -m32 -g -o byterun byterun.o ../runtime/runtime.a + $(CC) $(FLAGS) -o byterun byterun.o ../runtime/runtime.a byterun.o: byterun.c - $(CC) -g -fstack-protector-all -m32 -c byterun.c + $(CC) $(FLAGS) -g -c byterun.c clean: - $(RM) *.a *.o *~ + $(RM) *.a *.o *~ byterun diff --git a/runtime/Makefile b/runtime/Makefile index 2c9b7632c..68148f7e9 100644 --- a/runtime/Makefile +++ b/runtime/Makefile @@ -1,5 +1,5 @@ CC=gcc -FLAGS=-m32 -g2 -fstack-protector-all -DLAMA_ENV +FLAGS=-no-pie -m32 -g2 -fstack-protector-all -DLAMA_ENV all: gc_runtime.o gc.o runtime.o ar rc runtime.a gc_runtime.o runtime.o gc.o diff --git a/runtime/gc.c b/runtime/gc.c index b3f11fcab..a47343945 100644 --- a/runtime/gc.c +++ b/runtime/gc.c @@ -460,11 +460,11 @@ void physically_relocate (memory_chunk *old_heap) { #endif } -bool is_valid_heap_pointer (const size_t *p) { +inline bool is_valid_heap_pointer (const size_t *p) { return !UNBOXED(p) && (size_t)heap.begin <= (size_t)p && (size_t)p <= (size_t)heap.current; } -bool is_valid_pointer (const size_t *p) { return !UNBOXED(p); } +static inline bool is_valid_pointer (const size_t *p) { return !UNBOXED(p); } static inline void queue_enqueue (heap_iterator *tail_iter, void *obj) { void *tail = tail_iter->current; diff --git a/runtime/gc.h b/runtime/gc.h index 8c16a5537..0655e0f69 100644 --- a/runtime/gc.h +++ b/runtime/gc.h @@ -65,8 +65,7 @@ void *gc_alloc_on_existing_heap(size_t); void mark (void *obj); void mark_phase (void); // written in ASM, scans stack for pointers to the heap and starts marking process -extern void - __gc_root_scan_stack (void); +extern void __gc_root_scan_stack (void); // marks each pointer from extra roots void scan_extra_roots (void); #ifdef LAMA_ENV @@ -93,9 +92,9 @@ extern void __pre_gc (void); extern void __post_gc (void); // invoked from ASM -extern void gc_test_and_mark_root (size_t **root); -inline bool is_valid_heap_pointer (const size_t *); -inline bool is_valid_pointer (const size_t *); +extern void gc_test_and_mark_root (size_t **root); +bool is_valid_heap_pointer (const size_t *); +static inline bool is_valid_pointer (const size_t *); void clear_extra_roots (void); diff --git a/runtime/runtime.c b/runtime/runtime.c index bc849cb46..ae4f81cc5 100644 --- a/runtime/runtime.c +++ b/runtime/runtime.c @@ -820,7 +820,7 @@ extern void *Bclosure (int bn, void *entry, ...) { for (i = 0; i < n; i++, argss++) { push_extra_root((void **)argss); } r = (data *)alloc_closure(n + 1); - push_extra_root(&r); + push_extra_root((void **)&r); ((void **)r->contents)[0] = entry; va_start(args, entry); @@ -834,7 +834,7 @@ extern void *Bclosure (int bn, void *entry, ...) { POST_GC(); - pop_extra_root(&r); + pop_extra_root((void **)&r); argss--; for (i = 0; i < n; i++, argss--) { pop_extra_root((void **)argss); } return r->contents;