mirror of
git://gcc.gnu.org/git/gcc.git
synced 2024-12-23 02:49:01 +08:00
30c3de1ffb
* BCC_MAKEFILE: Merge with GC 6.3alpha1 release. * ChangeLog: Likewise. * Makefile.am: Likewise. * Makefile.direct: Likewise. * Makefile.dj: Likewise. * allchblk.c: Likewise. * alloc.c: Likewise. * backgraph.c: Likewise. * configure.host: Likewise. * configure.in: Likewise. * dbg_mlc.c: Likewise. * dyn_load.c: Likewise. * finalize.c: Likewise. * gc_cpp.cc: Likewise. * gc_dlopen.c: Likewise. * gcj_mlc.c: Likewise. * if_mach.c: Likewise. * mach_dep.c: Likewise. * malloc.c: Likewise. * mallocx.c: Likewise. * mark.c: Likewise. * mark_rts.c: Likewise. * misc.c: Likewise. * os_dep.c: Likewise. * ptr_chck.c: Likewise. * reclaim.c: Likewise. * solaris_pthreads.c: Likewise. * solaris_threads.c: Likewise. * sparc_mach_dep.S: Likewise. * threadlibs.c: Likewise. * typd_mlc.c: Likewise. * version.h: Likewise. * win32_threads.c: Likewise. * Mac_files/MacOS_Test_config.h: Likewise. * Mac_files/MacOS_config.h: Likewise. * cord/cordbscs.c: Likewise. * cord/cordprnt.c: Likewise. * cord/de_win.c: Likewise. * doc/README: Likewise. * doc/README.MacOSX: Likewise. * doc/README.changes: Likewise. * doc/README.environment: Likewise. * doc/README.ews4800: Likewise. * doc/README.linux: Likewise. * doc/README.macros: Likewise. * doc/README.win32: Likewise. * doc/debugging.html: Likewise. * doc/gcdescr.html: Likewise. * doc/tree.html: Likewise. * include/Makefile.in: Likewise. * include/gc.h: Likewise. * include/gc_cpp.h: Likewise. * include/gc_local_alloc.h: Likewise. * include/gc_mark.h: Likewise. * include/gc_pthread_redirects.h: Likewise. * include/gc_typed.h: Likewise. * include/new_gc_alloc.h: Likewise. * include/private/dbg_mlc.h: Likewise. * include/private/gc_hdrs.h: Likewise. * include/private/gc_locks.h: Likewise. * include/private/gc_pmark.h: Likewise. * include/private/gc_priv.h: Likewise. * include/private/gcconfig.h: Likewise. * include/private/solaris_threads.h: Likewise. * include/private/specific.h: Likewise. * tests/test.c: Likewise. * tests/test_cpp.cc: Likewise. * configure: Rebuild. * Makefile.in: Rebuild. * mips_sgi_mach_dep.s: Add. * alpha_mach_dep.s: Remove. * irix_threads.c: Remove. * linux_threads.c: Remove. * mips_sgi_mach_dep.S: Remove. * missing: Remove. * powerpc_macosx_mach_dep.s: Remove. * doc/Makefile.am: Remove. * doc/Makefile.in: Remove. From-SVN: r69880
89 lines
3.0 KiB
C
89 lines
3.0 KiB
C
/*
|
|
* Copyright (c) 2000 by Hewlett-Packard Company. All rights reserved.
|
|
*
|
|
* THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
|
|
* OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
|
|
*
|
|
* Permission is hereby granted to use or copy this program
|
|
* for any purpose, provided the above notices are retained on all copies.
|
|
* Permission to modify the code and to distribute modified code is granted,
|
|
* provided the above notices are retained, and a notice that the code was
|
|
* modified is included with the above copyright notice.
|
|
*/
|
|
|
|
/*
|
|
* Interface for thread local allocation. Memory obtained
|
|
* this way can be used by all threads, as though it were obtained
|
|
* from an allocator like GC_malloc. The difference is that GC_local_malloc
|
|
* counts the number of allocations of a given size from the current thread,
|
|
* and uses GC_malloc_many to perform the allocations once a threashold
|
|
* is exceeded. Thus far less synchronization may be needed.
|
|
* Allocation of known large objects should not use this interface.
|
|
* This interface is designed primarily for fast allocation of small
|
|
* objects on multiprocessors, e.g. for a JVM running on an MP server.
|
|
*
|
|
* If this file is included with GC_GCJ_SUPPORT defined, GCJ-style
|
|
* bitmap allocation primitives will also be included.
|
|
*
|
|
* If this file is included with GC_REDIRECT_TO_LOCAL defined, then
|
|
* GC_MALLOC, GC_MALLOC_ATOMIC, and possibly GC_GCJ_MALLOC will
|
|
* be redefined to use the thread local allocatoor.
|
|
*
|
|
* The interface is available only if the collector is built with
|
|
* -DTHREAD_LOCAL_ALLOC, which is currently supported only on Linux.
|
|
*
|
|
* The debugging allocators use standard, not thread-local allocation.
|
|
*
|
|
* These routines normally require an explicit call to GC_init(), though
|
|
* that may be done from a constructor function.
|
|
*/
|
|
|
|
#ifndef GC_LOCAL_ALLOC_H
|
|
#define GC_LOCAL_ALLOC_H
|
|
|
|
#ifndef _GC_H
|
|
# include "gc.h"
|
|
#endif
|
|
|
|
#if defined(GC_GCJ_SUPPORT) && !defined(GC_GCJ_H)
|
|
# include "gc_gcj.h"
|
|
#endif
|
|
|
|
/* We assume ANSI C for this interface. */
|
|
|
|
GC_PTR GC_local_malloc(size_t bytes);
|
|
|
|
GC_PTR GC_local_malloc_atomic(size_t bytes);
|
|
|
|
#if defined(GC_GCJ_SUPPORT)
|
|
GC_PTR GC_local_gcj_malloc(size_t bytes,
|
|
void * ptr_to_struct_containing_descr);
|
|
#endif
|
|
|
|
# ifdef GC_DEBUG
|
|
# define GC_LOCAL_MALLOC(s) GC_debug_malloc(s,GC_EXTRAS)
|
|
# define GC_LOCAL_MALLOC_ATOMIC(s) GC_debug_malloc_atomic(s,GC_EXTRAS)
|
|
# ifdef GC_GCJ_SUPPORT
|
|
# define GC_LOCAL_GCJ_MALLOC(s,d) GC_debug_gcj_malloc(s,d,GC_EXTRAS)
|
|
# endif
|
|
# else
|
|
# define GC_LOCAL_MALLOC(s) GC_local_malloc(s)
|
|
# define GC_LOCAL_MALLOC_ATOMIC(s) GC_local_malloc_atomic(s)
|
|
# ifdef GC_GCJ_SUPPORT
|
|
# define GC_LOCAL_GCJ_MALLOC(s,d) GC_local_gcj_malloc(s,d)
|
|
# endif
|
|
# endif
|
|
|
|
# ifdef GC_REDIRECT_TO_LOCAL
|
|
# undef GC_MALLOC
|
|
# define GC_MALLOC(s) GC_LOCAL_MALLOC(s)
|
|
# undef GC_MALLOC_ATOMIC
|
|
# define GC_MALLOC_ATOMIC(s) GC_LOCAL_MALLOC_ATOMIC(s)
|
|
# ifdef GC_GCJ_SUPPORT
|
|
# undef GC_GCJ_MALLOC
|
|
# define GC_GCJ_MALLOC(s,d) GC_LOCAL_GCJ_MALLOC(s,d)
|
|
# endif
|
|
# endif
|
|
|
|
#endif /* GC_LOCAL_ALLOC_H */
|