summaryrefslogtreecommitdiff
path: root/typd_mlc.c
diff options
context:
space:
mode:
authorhboehm <hboehm>2008-07-26 02:51:33 +0200
committerIvan Maidanski <ivmai@mail.ru>2011-07-26 19:06:43 +0200
commit68b9f2740e77bfae2b94392140608d952114b199 (patch)
tree492d095c29a2cfc5cbbc4a49b41fa1f5b06bc6ff /typd_mlc.c
parent1867d249698c81214418b2cf9752a987abb7b4f2 (diff)
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 'typd_mlc.c')
-rw-r--r--typd_mlc.c59
1 files changed, 30 insertions, 29 deletions
diff --git a/typd_mlc.c b/typd_mlc.c
index ae529d3..fb8d8e8 100644
--- a/typd_mlc.c
+++ b/typd_mlc.c
@@ -106,7 +106,7 @@ static void GC_push_typed_structures_proc (void)
/* starting index. */
/* Returns -1 on failure. */
/* Caller does not hold allocation lock. */
-signed_word GC_add_ext_descriptor(GC_bitmap bm, word nbits)
+STATIC signed_word GC_add_ext_descriptor(GC_bitmap bm, word nbits)
{
size_t nwords = divWORDSZ(nbits + WORDSZ-1);
signed_word result;
@@ -167,7 +167,7 @@ GC_descr GC_bm_table[WORDSZ/2];
/* The result is known to be short enough to fit into a bitmap */
/* descriptor. */
/* Descriptor is a GC_DS_LENGTH or GC_DS_BITMAP descriptor. */
-GC_descr GC_double_descr(GC_descr descriptor, word nwords)
+STATIC GC_descr GC_double_descr(GC_descr descriptor, word nwords)
{
if ((descriptor & GC_DS_TAGS) == GC_DS_LENGTH) {
descriptor = GC_bm_table[BYTES_TO_WORDS((word)descriptor)];
@@ -176,7 +176,9 @@ GC_descr GC_double_descr(GC_descr descriptor, word nwords)
return(descriptor);
}
-complex_descriptor * GC_make_sequence_descriptor();
+STATIC complex_descriptor *
+GC_make_sequence_descriptor(complex_descriptor *first,
+ complex_descriptor *second);
/* Build a descriptor for an array with nelements elements, */
/* each of which can be described by a simple descriptor. */
@@ -197,10 +199,10 @@ complex_descriptor * GC_make_sequence_descriptor();
# define LEAF 1
# define SIMPLE 0
# define NO_MEM (-1)
-int GC_make_array_descriptor(size_t nelements, size_t size, GC_descr descriptor,
- GC_descr *simple_d,
- complex_descriptor **complex_d,
- struct LeafDescriptor * leaf)
+STATIC int GC_make_array_descriptor(size_t nelements, size_t size,
+ GC_descr descriptor, GC_descr *simple_d,
+ complex_descriptor **complex_d,
+ struct LeafDescriptor * leaf)
{
# define OPT_THRESHOLD 50
/* For larger arrays, we try to combine descriptors of adjacent */
@@ -293,8 +295,9 @@ int GC_make_array_descriptor(size_t nelements, size_t size, GC_descr descriptor,
}
}
-complex_descriptor * GC_make_sequence_descriptor(complex_descriptor *first,
- complex_descriptor *second)
+STATIC complex_descriptor *
+GC_make_sequence_descriptor(complex_descriptor *first,
+ complex_descriptor *second)
{
struct SequenceDescriptor * result =
(struct SequenceDescriptor *)
@@ -331,20 +334,18 @@ ptr_t * GC_eobjfreelist;
ptr_t * GC_arobjfreelist;
-mse * GC_typed_mark_proc(word * addr, mse * mark_stack_ptr,
- mse * mark_stack_limit, word env);
+STATIC mse * GC_typed_mark_proc(word * addr, mse * mark_stack_ptr,
+ mse * mark_stack_limit, word env);
-mse * GC_array_mark_proc(word * addr, mse * mark_stack_ptr,
- mse * mark_stack_limit, word env);
+STATIC mse * GC_array_mark_proc(word * addr, mse * mark_stack_ptr,
+ mse * mark_stack_limit, word env);
/* Caller does not hold allocation lock. */
-void GC_init_explicit_typing(void)
+STATIC void GC_init_explicit_typing(void)
{
register int i;
DCL_LOCK_STATE;
-
- /* Ignore gcc "no effect" warning. */
GC_STATIC_ASSERT(sizeof(struct LeafDescriptor) % sizeof(word) == 0);
LOCK();
if (GC_explicit_typing_initialized) {
@@ -375,8 +376,8 @@ void GC_init_explicit_typing(void)
UNLOCK();
}
-mse * GC_typed_mark_proc(word * addr, mse * mark_stack_ptr,
- mse * mark_stack_limit, word env)
+STATIC mse * GC_typed_mark_proc(word * addr, mse * mark_stack_ptr,
+ mse * mark_stack_limit, word env)
{
word bm = GC_ext_descriptors[env].ed_bitmap;
word * current_p = addr;
@@ -392,7 +393,7 @@ mse * GC_typed_mark_proc(word * addr, mse * mark_stack_ptr,
FIXUP_POINTER(current);
if ((ptr_t)current >= least_ha && (ptr_t)current <= greatest_ha) {
PUSH_CONTENTS((ptr_t)current, mark_stack_ptr,
- mark_stack_limit, current_p, exit1);
+ mark_stack_limit, (ptr_t)current_p, exit1);
}
}
}
@@ -415,7 +416,7 @@ mse * GC_typed_mark_proc(word * addr, mse * mark_stack_ptr,
/* Return the size of the object described by d. It would be faster to */
/* store this directly, or to compute it as part of */
/* GC_push_complex_descriptor, but hopefully it doesn't matter. */
-word GC_descr_obj_size(complex_descriptor *d)
+STATIC word GC_descr_obj_size(complex_descriptor *d)
{
switch(d -> TAG) {
case LEAF_TAG:
@@ -434,8 +435,8 @@ word GC_descr_obj_size(complex_descriptor *d)
/* Push descriptors for the object at addr with complex descriptor d */
/* onto the mark stack. Return 0 if the mark stack overflowed. */
-mse * GC_push_complex_descriptor(word *addr, complex_descriptor *d,
- mse *msp, mse *msl)
+STATIC mse * GC_push_complex_descriptor(word *addr, complex_descriptor *d,
+ mse *msp, mse *msl)
{
register ptr_t current = (ptr_t) addr;
register word nelements;
@@ -490,8 +491,8 @@ mse * GC_push_complex_descriptor(word *addr, complex_descriptor *d,
}
/*ARGSUSED*/
-mse * GC_array_mark_proc(word * addr, mse * mark_stack_ptr,
- mse * mark_stack_limit, word env)
+STATIC mse * GC_array_mark_proc(word * addr, mse * mark_stack_ptr,
+ mse * mark_stack_limit, word env)
{
hdr * hhdr = HDR(addr);
size_t sz = hhdr -> hb_sz;
@@ -528,7 +529,7 @@ mse * GC_array_mark_proc(word * addr, mse * mark_stack_ptr,
return new_mark_stack_ptr;
}
-GC_descr GC_make_descriptor(GC_bitmap bm, size_t len)
+GC_API GC_descr GC_make_descriptor(GC_bitmap bm, size_t len)
{
signed_word last_set_bit = len - 1;
GC_descr result;
@@ -575,7 +576,7 @@ GC_descr GC_make_descriptor(GC_bitmap bm, size_t len)
}
}
-ptr_t GC_clear_stack();
+void * GC_clear_stack(void *);
#define GENERAL_MALLOC(lb,k) \
(void *)GC_clear_stack(GC_generic_malloc((word)lb, k))
@@ -583,7 +584,7 @@ ptr_t GC_clear_stack();
#define GENERAL_MALLOC_IOP(lb,k) \
(void *)GC_clear_stack(GC_generic_malloc_ignore_off_page(lb, k))
-void * GC_malloc_explicitly_typed(size_t lb, GC_descr d)
+GC_API void * GC_malloc_explicitly_typed(size_t lb, GC_descr d)
{
ptr_t op;
ptr_t * opp;
@@ -616,7 +617,7 @@ void * GC_malloc_explicitly_typed(size_t lb, GC_descr d)
return((void *) op);
}
-void * GC_malloc_explicitly_typed_ignore_off_page(size_t lb, GC_descr d)
+GC_API void * GC_malloc_explicitly_typed_ignore_off_page(size_t lb, GC_descr d)
{
ptr_t op;
ptr_t * opp;
@@ -648,7 +649,7 @@ DCL_LOCK_STATE;
return((void *) op);
}
-void * GC_calloc_explicitly_typed(size_t n, size_t lb, GC_descr d)
+GC_API void * GC_calloc_explicitly_typed(size_t n, size_t lb, GC_descr d)
{
ptr_t op;
ptr_t * opp;