summaryrefslogtreecommitdiff
path: root/thread_local_alloc.c
diff options
context:
space:
mode:
authorhboehm <hboehm>2008-07-26 00:51:33 +0000
committerIvan Maidanski <ivmai@mail.ru>2011-07-26 21:06:43 +0400
commit68b9f2740e77bfae2b94392140608d952114b199 (patch)
tree492d095c29a2cfc5cbbc4a49b41fa1f5b06bc6ff /thread_local_alloc.c
parent1867d249698c81214418b2cf9752a987abb7b4f2 (diff)
downloadbdwgc-68b9f2740e77bfae2b94392140608d952114b199.tar.gz
2008-07-25 Hans Boehm <Hans.Boehm@hp.com> (Really mostly Ivan Maidanski)
Ivan's description of the patch follows. Note that a few pieces like the GC_malloc(0) patch, were not applied since an alternate had been previously applied. A few differed stylistically from the rest of the code (mostly casts to void * instead of target type), or were classified as too minor to bother. Note that all of Ivan's static declarations which did not correct outright naming bugs (as a few did), where replaced by STATIC, which is ignored by default. - minor bug fixing (for FreeBSD, for THREAD_LOCAL_ALLOC and for GC_malloc(0)); - addition of missing getter/setter functions for public variables (may be useful if compiled as Win32 DLL); - addition of missing GC_API for some exported functions; - addition of missing "static" declarator for internal functions and variables (where possible); - replacement of all remaining K&R-style definitions with ANSI C ones (__STDC__ macro is not used anymore); - addition of some Win32 macro definitions (that may be missing in the standard headers supplied with a compiler) for GWW_VDB mode; - elimination of most compiler warnings (except for "uninitialized data" warning); - several typos correction; - missing parenthesis addition in macros in some header files of "libatomic_ops" module. My highlights based on reading the patch: * allchblk.c: Remove GC_freehblk_ptr decl. Make free_list_index_of() static. * include/gc.h: Use __int64 on win64, define GC_oom_func, GC_finalizer_notifier_proc, GC_finalizer_notifier_proc, add getter and setters: GC_get_gc_no, GC_get_parallel, GC_set_oom_fn, GC_set_finalize_on_demand, GC_set_java_finalization, GC_set_dont_expand, GC_set_no_dls, GC_set_max_retries, GC_set_dont_precollect, GC_set_finalizer_notifier. Always define GC_win32_free_heap. gc_config_macros.h: Define _REENTRANT after processing GC_THREADS. * include/gc_cpp.h: Improve GC_PLACEMENT_DELETE test, handling of operator new[] for old Windows compilers. * include/gc_inline.h (GC_MALLOC_FAST_GRANS): Add parentheses around arguments. * dbg_mlc.c, malloc.c, misc.c: Add many GC_API specs. * mark.c (GC_mark_and_push_stack): Fix source argument for blacklist printing. * misc.c: Fix log file naming based on environment variable for Windows. Make GC_set_warn_proc and GC_set_free_space_divisor just return current value with 0 argument. Add DONT_USER_USER32_DLL. Add various getters and setters as in gc.h. * os_dep.c: Remove no longer used GC_disable/enable_signals implementations. (GC_get_stack_base): Add pthread_attr_destroy call. No longer set GC_old_bus_handler in DARWIN workaround. * pthread_support.c: GC_register_my_thread must also call GC_init_thread_local.
Diffstat (limited to 'thread_local_alloc.c')
-rw-r--r--thread_local_alloc.c20
1 files changed, 8 insertions, 12 deletions
diff --git a/thread_local_alloc.c b/thread_local_alloc.c
index d18cd88b..8372c1e6 100644
--- a/thread_local_alloc.c
+++ b/thread_local_alloc.c
@@ -131,10 +131,10 @@ void GC_destroy_thread_local(GC_tlfs p)
#endif
#if defined(GC_ASSERTIONS) && defined(GC_WIN32_THREADS)
- extern char * GC_lookup_thread(int id);
+ void * /*GC_thread*/ GC_lookup_thread_inner(unsigned /*DWORD*/ thread_id);
#endif
-void * GC_malloc(size_t bytes)
+GC_API void * GC_malloc(size_t bytes)
{
size_t granules = ROUNDED_UP_GRANULES(bytes);
void *tsd;
@@ -181,7 +181,7 @@ void * GC_malloc(size_t bytes)
return result;
}
-void * GC_malloc_atomic(size_t bytes)
+GC_API void * GC_malloc_atomic(size_t bytes)
{
size_t granules = ROUNDED_UP_GRANULES(bytes);
void *tsd;
@@ -206,8 +206,8 @@ void * GC_malloc_atomic(size_t bytes)
# endif
GC_ASSERT(GC_is_initialized);
tiny_fl = ((GC_tlfs)tsd) -> ptrfree_freelists;
- GC_FAST_MALLOC_GRANS(result, granules, tiny_fl, DIRECT_GRANULES,
- PTRFREE, GC_core_malloc_atomic(bytes), 0/* no init */);
+ GC_FAST_MALLOC_GRANS(result, granules, tiny_fl, DIRECT_GRANULES, PTRFREE,
+ GC_core_malloc_atomic(bytes), (void)0 /* no init */);
return result;
}
@@ -241,8 +241,8 @@ extern int GC_gcj_kind;
/* incremental GC should be enabled before we fork a second thread. */
/* Unlike the other thread local allocation calls, we assume that the */
/* collector has been explicitly initialized. */
-void * GC_gcj_malloc(size_t bytes,
- void * ptr_to_struct_containing_descr)
+GC_API void * GC_gcj_malloc(size_t bytes,
+ void * ptr_to_struct_containing_descr)
{
if (GC_EXPECT(GC_incremental, 0)) {
return GC_core_gcj_malloc(bytes, ptr_to_struct_containing_descr);
@@ -325,9 +325,5 @@ void GC_mark_thread_local_fls_for(GC_tlfs p)
}
#endif /* GC_ASSERTIONS */
-# else /* !THREAD_LOCAL_ALLOC */
-
-# define GC_destroy_thread_local(t)
-
-# endif /* !THREAD_LOCAL_ALLOC */
+# endif /* THREAD_LOCAL_ALLOC */