*/
/* Boehm, July 31, 1995 5:02 pm PDT */
-#include "config.h"
+#include "private/gc_pmark.h" /* includes gc_priv.h */
#ifdef GC_GCJ_SUPPORT
* is to get better gcj performance.
*
* We assume:
- * 1) We have an ANSI conforming C compiler.
- * 2) Counting on explicit initialization of this interface is OK.
- * 3) FASTLOCK is not a significant win.
+ * 1) Counting on explicit initialization of this interface is OK;
+ * 2) FASTLOCK is not a significant win.
*/
-#include "private/gc_pmark.h"
#include "gc_gcj.h"
#include "private/dbg_mlc.h"
ptr_t * GC_gcjdebugobjfreelist;
/* Caller does not hold allocation lock. */
-void GC_init_gcj_malloc(int mp_index, void * /* really GC_mark_proc */mp)
+GC_API void GC_CALL GC_init_gcj_malloc(int mp_index,
+ void * /* really GC_mark_proc */mp)
{
- register int i;
GC_bool ignore_gcj_info;
DCL_LOCK_STATE;
GC_log_printf("Gcj-style type information is disabled!\n");
}
GC_ASSERT(GC_mark_procs[mp_index] == (GC_mark_proc)0); /* unused */
- GC_mark_procs[mp_index] = (GC_mark_proc)mp;
- if (mp_index >= GC_n_mark_procs) ABORT("GC_init_gcj_malloc: bad index");
+ GC_mark_procs[mp_index] = (GC_mark_proc)(word)mp;
+ if ((unsigned)mp_index >= GC_n_mark_procs)
+ ABORT("GC_init_gcj_malloc: bad index");
/* Set up object kind gcj-style indirect descriptor. */
GC_gcjobjfreelist = (ptr_t *)GC_new_free_list_inner();
if (ignore_gcj_info) {
} else {
GC_gcj_kind = GC_new_kind_inner(
(void **)GC_gcjobjfreelist,
- (((word)(-MARK_DESCR_OFFSET - GC_INDIR_PER_OBJ_BIAS))
+ (((word)(-(signed_word)MARK_DESCR_OFFSET
+ - GC_INDIR_PER_OBJ_BIAS))
| GC_DS_PER_OBJECT),
FALSE, TRUE);
}
/* We do this even where we could just call GC_INVOKE_FINALIZERS, */
/* since it's probably cheaper and certainly more uniform. */
/* FIXME - Consider doing the same elsewhere? */
-static void maybe_finalize()
+static void maybe_finalize(void)
{
- static int last_finalized_no = 0;
+ static word last_finalized_no = 0;
if (GC_gc_no == last_finalized_no) return;
if (!GC_is_initialized) return;
#ifdef THREAD_LOCAL_ALLOC
void * GC_core_gcj_malloc(size_t lb, void * ptr_to_struct_containing_descr)
#else
- void * GC_gcj_malloc(size_t lb, void * ptr_to_struct_containing_descr)
+ GC_API void * GC_CALL GC_gcj_malloc(size_t lb,
+ void * ptr_to_struct_containing_descr)
#endif
{
ptr_t op;
return((void *) op);
}
+void GC_start_debugging(void);
+
/* Similar to GC_gcj_malloc, but add debug info. This is allocated */
/* with GC_gcj_debug_kind. */
-void * GC_debug_gcj_malloc(size_t lb, void * ptr_to_struct_containing_descr,
- GC_EXTRA_PARAMS)
+GC_API void * GC_CALL GC_debug_gcj_malloc(size_t lb,
+ void * ptr_to_struct_containing_descr, GC_EXTRA_PARAMS)
{
void * result;
return (GC_store_debug_info(result, (word)lb, s, (word)i));
}
-void * GC_gcj_malloc_ignore_off_page(size_t lb,
+/* There is no THREAD_LOCAL_ALLOC for GC_gcj_malloc_ignore_off_page(). */
+GC_API void * GC_CALL GC_gcj_malloc_ignore_off_page(size_t lb,
void * ptr_to_struct_containing_descr)
{
ptr_t op;
if( (op = *opp) == 0 ) {
maybe_finalize();
op = (ptr_t)GENERAL_MALLOC_IOP(lb, GC_gcj_kind);
- lg = GC_size_map[lb]; /* May have been uninitialized. */
+ if (0 == op) {
+ UNLOCK();
+ return(GC_oom_fn(lb));
+ }
} else {
*opp = obj_link(op);
GC_bytes_allocd += GRANULES_TO_BYTES(lg);
}
- *(void **)op = ptr_to_struct_containing_descr;
- UNLOCK();
} else {
LOCK();
maybe_finalize();
op = (ptr_t)GENERAL_MALLOC_IOP(lb, GC_gcj_kind);
- if (0 != op) {
- *(void **)op = ptr_to_struct_containing_descr;
+ if (0 == op) {
+ UNLOCK();
+ return(GC_oom_fn(lb));
}
- UNLOCK();
}
+ *(void **)op = ptr_to_struct_containing_descr;
+ UNLOCK();
return((void *) op);
}
#else
-char GC_no_gcj_support;
+extern int GC_quiet;
+ /* ANSI C doesn't allow translation units to be empty. */
#endif /* GC_GCJ_SUPPORT */