summaryrefslogtreecommitdiff
path: root/typd_mlc.c
diff options
context:
space:
mode:
authorhboehm <hboehm>2009-06-13 00:00:06 +0000
committerIvan Maidanski <ivmai@mail.ru>2011-07-26 21:06:45 +0400
commit4faed82e614d119f649a5e1dcfac2174f06d59a8 (patch)
treeeb0580dc2d507b1cf5b79f3f1ec757bee0556390 /typd_mlc.c
parentf9c7d77d0cff9d52082a422052cab1480fda858d (diff)
downloadbdwgc-4faed82e614d119f649a5e1dcfac2174f06d59a8.tar.gz
2009-06-12 Hans Boehm <Hans.Boehm@hp.com> (Really mostly Ivan Maidanski)
diff98_cvs(resembling diff3, diff27, diff59, diff61, diff66, diff73 partly) * dbg_mlc.c (GC_print_smashed_obj): Convert a group of printf() calls into a single one (for output atomicity). * typd_mlc.c (GC_calloc_explicitly_typed): Don't declare and use GC_finalization_failures variable; check the result of GC_general_register_disappearing_link() (for lack of memory) instead. * finalize.c (GC_finalization_failures): Remove unused global variable. * finalize.c (GC_general_register_disappearing_link, GC_general_register_disappearing_link): Don't update the value of GC_finalization_failures (since unused). * include/private/gc_pmark.h (PUSH_ONE_CHECKED_STACK, GC_PUSH_ONE_STACK, GC_PUSH_ONE_HEAP): The first parameter is of word type now (as FIXUP_POINTER requires numeric argument). * finalize.c (GC_ignore_self_finalize_mark_proc): GC_PUSH_ONE_HEAP requires the first parameter of word type. * mark.c (PUSH_GRANULE): Ditto. * mark.c (GC_push_one, GC_push_all_eager): Ditto (for GC_PUSH_ONE_STACK). * finalize.c (GC_finalize_all): Call GC_invoke_finalizers() or GC_finalizer_notifier directly, instead of GC_INVOKE_FINALIZERS() to prevent infinite looping. * include/javaxfc.h: Clarify GC_finalize_all comment. * gcj_mlc.c: Include gc_pmark.h before "ifdef GC_GCJ_SUPPORT" (not after) for configuration information. * gcj_mlc.c (GC_gcj_malloc_ignore_off_page): Add comment. * gcj_mlc.c (GC_gcj_malloc_ignore_off_page): Check "op" local variable for NULL before dereferencing it, return GC_oom_fn() in this case. * typd_mlc.c (GC_malloc_explicitly_typed, GC_malloc_explicitly_typed_ignore_off_page): Transform the code to suppress compiler warning (for uninitialized "lg" variable).
Diffstat (limited to 'typd_mlc.c')
-rw-r--r--typd_mlc.c24
1 files changed, 11 insertions, 13 deletions
diff --git a/typd_mlc.c b/typd_mlc.c
index 2c790984..ded8b2d0 100644
--- a/typd_mlc.c
+++ b/typd_mlc.c
@@ -609,13 +609,14 @@ GC_API void * GC_CALL GC_malloc_explicitly_typed(size_t lb, GC_descr d)
GC_bytes_allocd += GRANULES_TO_BYTES(lg);
UNLOCK();
}
+ ((word *)op)[GRANULES_TO_WORDS(lg) - 1] = d;
} else {
op = (ptr_t)GENERAL_MALLOC((word)lb, GC_explicit_kind);
- if (op != NULL)
+ if (op != NULL) {
lg = BYTES_TO_GRANULES(GC_size(op));
+ ((word *)op)[GRANULES_TO_WORDS(lg) - 1] = d;
+ }
}
- if (op != NULL)
- ((word *)op)[GRANULES_TO_WORDS(lg) - 1] = d;
return((void *) op);
}
@@ -635,6 +636,7 @@ DCL_LOCK_STATE;
if( (op = *opp) == 0 ) {
UNLOCK();
op = (ptr_t)GENERAL_MALLOC_IOP(lb, GC_explicit_kind);
+ if (0 == op) return 0;
lg = GC_size_map[lb]; /* May have been uninitialized. */
} else {
*opp = obj_link(op);
@@ -642,13 +644,14 @@ DCL_LOCK_STATE;
GC_bytes_allocd += GRANULES_TO_BYTES(lg);
UNLOCK();
}
+ ((word *)op)[GRANULES_TO_WORDS(lg) - 1] = d;
} else {
op = (ptr_t)GENERAL_MALLOC_IOP(lb, GC_explicit_kind);
- if (op != NULL)
+ if (op != NULL) {
lg = BYTES_TO_WORDS(GC_size(op));
+ ((word *)op)[GRANULES_TO_WORDS(lg) - 1] = d;
+ }
}
- if (op != NULL)
- ((word *)op)[GRANULES_TO_WORDS(lg) - 1] = d;
return((void *) op);
}
@@ -712,18 +715,13 @@ DCL_LOCK_STATE;
lp -> ld_descriptor = leaf.ld_descriptor;
((volatile word *)op)[GRANULES_TO_WORDS(lg) - 1] = (word)lp;
} else {
- extern unsigned GC_finalization_failures;
- unsigned ff = GC_finalization_failures;
size_t lw = GRANULES_TO_WORDS(lg);
((word *)op)[lw - 1] = (word)complex_descr;
/* Make sure the descriptor is cleared once there is any danger */
/* it may have been collected. */
- (void)
- GC_general_register_disappearing_link((void * *)
- ((word *)op+lw-1),
- (void *) op);
- if (ff != GC_finalization_failures) {
+ if (GC_general_register_disappearing_link((void * *)((word *)op+lw-1),
+ op) == 2) {
/* Couldn't register it due to lack of memory. Punt. */
/* This will probably fail too, but gives the recovery code */
/* a chance. */