X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=src%2Fmm%2Fboehm-gc%2Finclude%2Fgc_gcj.h;h=78658785d8557aa127f885ac2b6a80f46ffa971a;hb=c9ee016a64e925938f84fcb85521f82febcc4f63;hp=699ddf5d48bd42429e56857dff5b103d9bf7c1cd;hpb=7659949229c634784f7d27aa8b679fdd4c8351ab;p=cacao.git diff --git a/src/mm/boehm-gc/include/gc_gcj.h b/src/mm/boehm-gc/include/gc_gcj.h index 699ddf5d4..78658785d 100644 --- a/src/mm/boehm-gc/include/gc_gcj.h +++ b/src/mm/boehm-gc/include/gc_gcj.h @@ -1,4 +1,4 @@ -/* +/* * Copyright 1988, 1989 Hans-J. Boehm, Alan J. Demers * Copyright (c) 1991-1995 by Xerox Corporation. All rights reserved. * Copyright 1996-1999 by Silicon Graphics. All rights reserved. @@ -14,8 +14,7 @@ * modified is included with the above copyright notice. */ -/* This file assumes the collector has been compiled with GC_GCJ_SUPPORT */ -/* and that an ANSI C compiler is available. */ +/* This file assumes the collector has been compiled with GC_GCJ_SUPPORT. */ /* * We allocate objects whose first word contains a pointer to a struct @@ -25,70 +24,86 @@ */ #ifndef GC_GCJ_H - #define GC_GCJ_H -#ifndef MARK_DESCR_OFFSET -# define MARK_DESCR_OFFSET sizeof(word) + /* Gcj keeps GC descriptor as second word of vtable. This */ + /* probably needs to be adjusted for other clients. */ + /* We currently assume that this offset is such that: */ + /* - all objects of this kind are large enough to have */ + /* a value at that offset, and */ + /* - it is not zero. */ + /* These assumptions allow objects on the free list to be */ + /* marked normally. */ + +#ifndef GC_H +# include "gc.h" #endif - /* Gcj keeps GC descriptor as second word of vtable. This */ - /* probably needs to be adjusted for other clients. */ - /* We currently assume that this offset is such that: */ - /* - all objects of this kind are large enough to have */ - /* a value at that offset, and */ - /* - it is not zero. */ - /* These assumptions allow objects on the free list to be */ - /* marked normally. */ -#ifndef _GC_H -# include "gc.h" +#ifdef __cplusplus + extern "C" { #endif -/* The following allocators signal an out of memory condition with */ -/* return GC_oom_fn(bytes); */ +/* The following allocators signal an out of memory condition with */ +/* return GC_oom_fn(bytes); */ -/* The following function must be called before the gcj allocators */ -/* can be invoked. */ -/* mp_index and mp are the index and mark_proc (see gc_mark.h) */ -/* respectively for the allocated objects. Mark_proc will be */ -/* used to build the descriptor for objects allocated through the */ -/* debugging interface. The mark_proc will be invoked on all such */ -/* objects with an "environment" value of 1. The client may choose */ +/* The following function must be called before the gcj allocators */ +/* can be invoked. */ +/* mp_index and mp are the index and mark_proc (see gc_mark.h) */ +/* respectively for the allocated objects. Mark_proc will be */ +/* used to build the descriptor for objects allocated through the */ +/* debugging interface. The mark_proc will be invoked on all such */ +/* objects with an "environment" value of 1. The client may choose */ /* to use the same mark_proc for some of its generated mark descriptors.*/ -/* In that case, it should use a different "environment" value to */ -/* detect the presence or absence of the debug header. */ -/* Mp is really of type mark_proc, as defined in gc_mark.h. We don't */ -/* want to include that here for namespace pollution reasons. */ -extern void GC_init_gcj_malloc(int mp_index, void * /* really mark_proc */mp); +/* In that case, it should use a different "environment" value to */ +/* detect the presence or absence of the debug header. */ +/* Mp is really of type mark_proc, as defined in gc_mark.h. We don't */ +/* want to include that here for namespace pollution reasons. */ +/* Passing in mp_index here instead of having GC_init_gcj_malloc() */ +/* internally call GC_new_proc() is quite ugly, but in typical usage */ +/* scenarios a compiler also has to know about mp_index, so */ +/* generating it dynamically is not acceptable. Mp_index will */ +/* typically be an integer < RESERVED_MARK_PROCS, so that it doesn't */ +/* collide with GC_new_proc allocated indices. If the application */ +/* needs no other reserved indices, zero */ +/* (GC_GCJ_RESERVED_MARK_PROC_INDEX in gc_mark.h) is an obvious choice. */ +GC_API void GC_CALL GC_init_gcj_malloc(int /* mp_index */, + void * /* really mark_proc */ /* mp */); -/* Allocate an object, clear it, and store the pointer to the */ -/* type structure (vtable in gcj). */ +/* Allocate an object, clear it, and store the pointer to the */ +/* type structure (vtable in gcj). */ /* This adds a byte at the end of the object if GC_malloc would.*/ -extern void * GC_gcj_malloc(size_t lb, void * ptr_to_struct_containing_descr); -/* The debug versions allocate such that the specified mark_proc */ -/* is always invoked. */ -extern void * GC_debug_gcj_malloc(size_t lb, - void * ptr_to_struct_containing_descr, - GC_EXTRA_PARAMS); +GC_API void * GC_CALL GC_gcj_malloc(size_t /* lb */, + void * /* ptr_to_struct_containing_descr */) + GC_ATTR_MALLOC GC_ATTR_ALLOC_SIZE(1); +/* The debug versions allocate such that the specified mark_proc */ +/* is always invoked. */ +GC_API void * GC_CALL GC_debug_gcj_malloc(size_t /* lb */, + void * /* ptr_to_struct_containing_descr */, + GC_EXTRA_PARAMS) + GC_ATTR_MALLOC GC_ATTR_ALLOC_SIZE(1); -/* Similar to GC_gcj_malloc, but assumes that a pointer to near the */ -/* beginning of the resulting object is always maintained. */ -extern void * GC_gcj_malloc_ignore_off_page(size_t lb, - void * ptr_to_struct_containing_descr); +/* Similar to GC_gcj_malloc, but assumes that a pointer to near the */ +/* beginning of the resulting object is always maintained. */ +GC_API void * GC_CALL GC_gcj_malloc_ignore_off_page(size_t /* lb */, + void * /* ptr_to_struct_containing_descr */) + GC_ATTR_MALLOC GC_ATTR_ALLOC_SIZE(1); -/* The kind numbers of normal and debug gcj objects. */ -/* Useful only for debug support, we hope. */ -extern int GC_gcj_kind; +/* The kind numbers of normal and debug gcj objects. */ +/* Useful only for debug support, we hope. */ +GC_API int GC_gcj_kind; -extern int GC_gcj_debug_kind; +GC_API int GC_gcj_debug_kind; -# ifdef GC_DEBUG -# define GC_GCJ_MALLOC(s,d) GC_debug_gcj_malloc(s,d,GC_EXTRAS) -# define GC_GCJ_MALLOC_IGNORE_OFF_PAGE(s,d) GC_debug_gcj_malloc(s,d,GC_EXTRAS) -# else -# define GC_GCJ_MALLOC(s,d) GC_gcj_malloc(s,d) -# define GC_GCJ_MALLOC_IGNORE_OFF_PAGE(s,d) \ - GC_gcj_malloc_ignore_off_page(s,d) -# endif +#ifdef GC_DEBUG +# define GC_GCJ_MALLOC(s,d) GC_debug_gcj_malloc(s,d,GC_EXTRAS) +# define GC_GCJ_MALLOC_IGNORE_OFF_PAGE(s,d) GC_debug_gcj_malloc(s,d,GC_EXTRAS) +#else +# define GC_GCJ_MALLOC(s,d) GC_gcj_malloc(s,d) +# define GC_GCJ_MALLOC_IGNORE_OFF_PAGE(s,d) GC_gcj_malloc_ignore_off_page(s,d) +#endif + +#ifdef __cplusplus + } /* end of extern "C" */ +#endif #endif /* GC_GCJ_H */