summaryrefslogtreecommitdiff
path: root/dyn_load.c
diff options
context:
space:
mode:
authorivmai <ivmai>2009-10-22 17:00:59 +0200
committerIvan Maidanski <ivmai@mail.ru>2011-07-26 19:06:51 +0200
commitc06769bfb05036d0ab57114d3b4568d8f743ad49 (patch)
treea0715b580d2c0bd3b565c6fa42109e2671bc6f0c /dyn_load.c
parentbad4c7acb6060861cd4be55968c1f58b2026a747 (diff)
2009-10-22 Ivan Maidanski <ivmai@mail.ru>
* alloc.c (GC_collection_in_progress): Move the prototype to gc_priv.h. * gc_dlopen.c (GC_collection_in_progress): Ditto. * pthread_support.c (GC_collection_in_progress): Ditto. * misc.c (GC_init_parallel): Ditto. * pthread_support.c (GC_init_parallel): Ditto. * win32_threads.c (GC_init_parallel): Ditto. * darwin_stop_world.c (GC_thr_init): Ditto. * misc.c (GC_thr_init): Ditto. * pthread_stop_world.c (GC_thr_init): Ditto. * pthread_support.c (GC_thr_init): Ditto. * blacklst.c (GC_clear_bl, GC_copy_bl, GC_number_stack_black_listed): Make STATIC. * dbg_mlc.c (GC_print_obj, GC_make_closure, GC_debug_invoke_finalizer): Ditto. * malloc.c (GC_alloc_large_and_clear): Ditto. * mark.c (GC_push_selected, GC_push_marked1, GC_push_marked2, GC_push_marked4, GC_push_marked, GC_push_next_marked, GC_push_next_marked_dirty, GC_push_next_marked_uncollectable): Ditto. * misc.c (GC_clear_stack_inner): Ditto. * os_dep.c (GC_repeat_read, GC_default_push_other_roots): Ditto. * darwin_stop_world.c (FindTopOfStack): Make static; define only if not DARWIN_DONT_PARSE_STACK. * dbg_mlc.c (GC_debug_free_inner): Define only if DBG_HDRS_ALL. * dyn_load.c (GC_repeat_read): Remove unused prototype. * include/private/gc_pmark.h (GC_find_start): Ditto. * misc.c (GC_read, GC_register_finalizer_no_order): Ditto. * dyn_load.c (GC_segment_is_thread_stack): Add prototype (only if THREADS). * dyn_load.c (GC_register_main_static_data): Define only if DYNAMIC_LOADING. * finalize.c (GC_enqueue_all_finalizers): Remove unnecessary tail "return" statement. * gc_dlopen.c (GC_SOLARIS_THREADS): Don't recognize (since implies GC_PTHREADS). * include/gc.h: Fix a typo. * include/gc_inline.h (GC_ASSERT): Define (if not defined) since the header is public. * include/gc_inline.h (GC_generic_malloc_many): New public function declaration. * mallocx.c (GC_generic_malloc_many): Make public. * include/private/gc_priv.h (GC_INNER): Use visibility attribute (if available). * include/private/gc_priv.h (GC_EXTERN): Define using GC_INNER. * include/private/gc_priv.h: Include atomic_ops.h if THREADS and MPROTECT_VDB. * os_dep.c: Don't include atomic_ops.h * win32_threads.c: Ditto. * include/private/gc_priv.h (GC_push_selected, GC_push_regs, GC_push_marked, GC_number_stack_black_listed, GC_alloc_large_and_clear, GC_reclaim_or_delete_all, GC_generic_malloc_many, GC_make_closure, GC_debug_invoke_finalizer, GC_print_obj, GC_page_was_ever_dirty): Remove the prototype. * mark.c (GC_page_was_ever_dirty): Add prototype (only if PROC_VDB). * include/private/gc_priv.h (GC_push_next_marked_dirty, GC_push_next_marked, GC_push_next_marked_uncollectable): Move the prototype to mark.c. * include/private/gc_priv.h (GC_is_static_root): Declare only if not THREADS. * include/private/gc_priv.h (GC_free_inner): Declare only if THREADS. * include/private/gc_priv.h (GC_debug_free_inner): Declare only if THREADS and DBG_HDRS_ALL. * include/private/gc_priv.h (GC_markers): Declare GC_markers only if PARALLEL_MARK. * include/private/gc_priv.h (GC_register_main_static_data): Move the prototype to misc.c. * mach_dep.c (GC_push_regs): Make STATIC; define only along with HAVE_PUSH_REGS definition. * mach_dep.c (GC_clear_stack_inner): Replace K&R-style function definition with the ANSI C one. * mark.c (GC_started_thread_while_stopped): Declared only if not GNU C. * win32_threads.c (GC_started_thread_while_stopped): Don't define if GNU C. * mark.c (GC_mark_from): Avoid unbalanced brackets in #if-#else-#endif blocks. * mark_rts.c (GC_is_static_root): Define only if not THREADS. * os_dep.c (GC_get_stack_base): Make public (for OpenBSD). * os_dep.c (GC_page_was_ever_dirty): Comment out the function except for PROC_VDB. * tests/test.c (main): Don't reference GC_print_obj, GC_make_closure, GC_debug_invoke_finalizer, GC_page_was_ever_dirty, GC_is_fresh (in GC_noop). * thread_local_alloc.c: Don't include "gc_inline.h". * win32_threads.c (GC_write_fault_handler): Declare only if MPROTECT_VDB.
Diffstat (limited to 'dyn_load.c')
-rw-r--r--dyn_load.c90
1 files changed, 44 insertions, 46 deletions
diff --git a/dyn_load.c b/dyn_load.c
index 73f9ac6..89edcaf 100644
--- a/dyn_load.c
+++ b/dyn_load.c
@@ -130,7 +130,7 @@ GC_FirstDLOpenedLinkMap(void)
struct r_debug *r;
static struct link_map * cachedResult = 0;
static ElfW(Dyn) *dynStructureAddr = 0;
- /* BTL: added to avoid Solaris 5.3 ld.so _DYNAMIC bug */
+ /* BTL: added to avoid Solaris 5.3 ld.so _DYNAMIC bug */
# ifdef SUNOS53_SHARED_LIB
/* BTL: Avoid the Solaris 5.3 bug that _DYNAMIC isn't being set */
@@ -230,15 +230,10 @@ void GC_register_dynamic_libraries(void)
#define MAPS_BUF_SIZE (32*1024)
-ssize_t GC_repeat_read(int fd, char *buf, size_t count);
- /* Repeatedly read until buffer is filled, or EOF is encountered */
- /* Defined in os_dep.c. */
-
char *GC_parse_map_entry(char *buf_ptr, ptr_t *start, ptr_t *end,
- char **prot, unsigned int *maj_dev,
- char **mapping_name);
-char *GC_get_maps(void);
- /* From os_dep.c */
+ char **prot, unsigned int *maj_dev,
+ char **mapping_name);
+char *GC_get_maps(void); /* from os_dep.c */
/* Sort an array of HeapSects by start address. */
/* Unfortunately at least some versions of */
@@ -270,6 +265,10 @@ static void sort_heap_sects(struct HeapSect *base, size_t number_of_elements)
}
}
+#ifdef THREADS
+ GC_bool GC_segment_is_thread_stack(ptr_t lo, ptr_t hi);
+#endif
+
STATIC word GC_register_map_entries(char *maps)
{
char *prot;
@@ -288,7 +287,8 @@ STATIC word GC_register_map_entries(char *maps)
+ GC_our_memory[GC_n_memory-1].hs_bytes;
for (;;) {
- buf_ptr = GC_parse_map_entry(buf_ptr, &start, &end, &prot, &maj_dev, 0);
+ buf_ptr = GC_parse_map_entry(buf_ptr, &start, &end, &prot,
+ &maj_dev, 0);
if (buf_ptr == NULL) return 1;
if (prot[1] == 'w') {
/* This is a writable mapping. Add it to */
@@ -329,7 +329,7 @@ STATIC word GC_register_map_entries(char *maps)
GC_add_roots_inner((char *)start, (char *)end, TRUE);
continue;
}
- /* Add sections that dont belong to us. */
+ /* Add sections that don't belong to us. */
i = 0;
while (GC_our_memory[i].hs_start + GC_our_memory[i].hs_bytes
< start)
@@ -606,7 +606,6 @@ GC_FirstDLOpenedLinkMap(void)
return cachedResult;
}
-
void GC_register_dynamic_libraries(void)
{
struct link_map *lm;
@@ -665,7 +664,6 @@ void * GC_roots_present(ptr_t);
/* The type is a lie, since the real type doesn't make sense here, */
/* and we only test for NULL. */
-
/* We use /proc to track down all parts of the address space that are */
/* mapped by the process, and throw out regions we know we shouldn't */
/* worry about. This may also work under other SVR4 variants. */
@@ -703,8 +701,8 @@ void GC_register_dynamic_libraries(void)
if (needed_sz >= current_sz) {
current_sz = needed_sz * 2 + 1;
/* Expansion, plus room for 0 record */
- addr_map = (prmap_t *)GC_scratch_alloc((word)
- (current_sz * sizeof(prmap_t)));
+ addr_map = (prmap_t *)GC_scratch_alloc(
+ (word)current_sz * sizeof(prmap_t));
}
if (ioctl(fd, PIOCMAP, addr_map) < 0) {
GC_err_printf("fd = %d, errno = %d, needed_sz = %d, addr_map = %p\n",
@@ -772,8 +770,8 @@ void GC_register_dynamic_libraries(void)
GC_add_roots_inner(start, limit, TRUE);
irrelevant: ;
}
- /* Dont keep cached descriptor, for now. Some kernels don't like us */
- /* to keep a /proc file descriptor around during kill -9. */
+ /* Don't keep cached descriptor, for now. Some kernels don't like us */
+ /* to keep a /proc file descriptor around during kill -9. */
if (close(fd) < 0) ABORT("Couldnt close /proc file");
fd = -1;
}
@@ -826,17 +824,19 @@ void GC_register_dynamic_libraries(void)
}
# endif
-GC_bool GC_register_main_static_data(void)
-{
-# ifdef MSWINCE
- /* Do we need to separately register the main static data segment? */
- return FALSE;
-# else
- return GC_no_win32_dlls;
-# endif
-}
+#ifdef DYNAMIC_LOADING
+ GC_bool GC_register_main_static_data(void)
+ {
+# ifdef MSWINCE
+ /* Do we need to separately register the main static data segment? */
+ return FALSE;
+# else
+ return GC_no_win32_dlls;
+# endif
+ }
+#endif /* DYNAMIC_LOADING */
-# define HAVE_REGISTER_MAIN_STATIC_DATA
+#define HAVE_REGISTER_MAIN_STATIC_DATA
# ifdef DEBUG_VIRTUALQUERY
void GC_dump_meminfo(MEMORY_BASIC_INFORMATION *buf)
@@ -1090,11 +1090,11 @@ void GC_register_dynamic_libraries(void)
#endif /* HPUX */
#ifdef AIX
-#pragma alloca
-#include <sys/ldr.h>
-#include <sys/errno.h>
-void GC_register_dynamic_libraries(void)
-{
+# pragma alloca
+# include <sys/ldr.h>
+# include <sys/errno.h>
+ void GC_register_dynamic_libraries(void)
+ {
int len;
char *ldibuf;
int ldibuflen;
@@ -1119,7 +1119,7 @@ void GC_register_dynamic_libraries(void)
TRUE);
ldi = len ? (struct ld_info *)((char *)ldi + len) : 0;
}
-}
+ }
#endif /* AIX */
#ifdef DARWIN
@@ -1281,12 +1281,12 @@ GC_bool GC_register_main_static_data(void)
#ifdef PCR
-# include "il/PCR_IL.h"
-# include "th/PCR_ThCtl.h"
-# include "mm/PCR_MM.h"
+# include "il/PCR_IL.h"
+# include "th/PCR_ThCtl.h"
+# include "mm/PCR_MM.h"
-void GC_register_dynamic_libraries(void)
-{
+ void GC_register_dynamic_libraries(void)
+ {
/* Add new static data areas of dynamically loaded modules. */
{
PCR_IL_LoadedFile * p = PCR_IL_GetLastLoadedFile();
@@ -1313,7 +1313,7 @@ void GC_register_dynamic_libraries(void)
}
}
}
-}
+ }
#else /* !PCR */
@@ -1324,13 +1324,11 @@ void GC_register_dynamic_libraries(void) {}
#endif /* !DYNAMIC_LOADING */
#ifndef HAVE_REGISTER_MAIN_STATIC_DATA
-
-/* Do we need to separately register the main static data segment? */
-GC_bool GC_register_main_static_data(void)
-{
- return TRUE;
-}
-
+ /* Do we need to separately register the main static data segment? */
+ GC_bool GC_register_main_static_data(void)
+ {
+ return TRUE;
+ }
#endif /* HAVE_REGISTER_MAIN_STATIC_DATA */
/* Register a routine to filter dynamic library registration. */