boehm-gc.h: Call thread local allocation functions if THREAD_LOCAL_ALLOC is defined.

* include/boehm-gc.h: Call thread local allocation functions
	if THREAD_LOCAL_ALLOC is defined.

From-SVN: r46490
This commit is contained in:
Hans Boehm 2001-10-25 17:29:41 +00:00 committed by Hans Boehm
parent cdd90341d6
commit e16ffa0d61
2 changed files with 23 additions and 2 deletions

View File

@ -1,3 +1,8 @@
2001-10-25 Hans Boehm <Hans_Boehm@hp.com>
* include/boehm-gc.h: Call thread local allocation functions
if THREAD_LOCAL_ALLOC is defined.
2001-10-25 Bryce McKinlay <bryce@waitaki.otago.ac.nz> 2001-10-25 Bryce McKinlay <bryce@waitaki.otago.ac.nz>
* java/lang/natClassLoader.cc (_Jv_RegisterClassHookDefault): Use * java/lang/natClassLoader.cc (_Jv_RegisterClassHookDefault): Use

View File

@ -28,23 +28,39 @@ extern "C"
extern "C" void * GC_gcj_malloc(size_t, void *); extern "C" void * GC_gcj_malloc(size_t, void *);
extern "C" void * GC_malloc_atomic(size_t); extern "C" void * GC_malloc_atomic(size_t);
#ifdef THREAD_LOCAL_ALLOC
extern "C" void * GC_local_gcj_malloc(size_t, void *);
extern "C" void * GC_local_malloc_atomic(size_t);
#endif
inline void * inline void *
_Jv_AllocObj (jsize size, jclass klass) _Jv_AllocObj (jsize size, jclass klass)
{ {
// This should call GC_GCJ_MALLOC, but that would involve // This should call GC_GCJ_MALLOC, but that would involve
// including gc.h. // including gc.h.
#ifdef THREAD_LOCAL_ALLOC
return GC_local_gcj_malloc (size, klass->vtable);
#else
return GC_gcj_malloc (size, klass->vtable); return GC_gcj_malloc (size, klass->vtable);
#endif
} }
inline void * inline void *
_Jv_AllocPtrFreeObj (jsize size, jclass klass) _Jv_AllocPtrFreeObj (jsize size, jclass klass)
{ {
#ifdef JV_HASH_SYNCHRONIZATION #ifdef JV_HASH_SYNCHRONIZATION
void * obj = GC_malloc_atomic(size); # ifdef THREAD_LOCAL_ALLOC
void * obj = GC_local_malloc_atomic(size);
# else
void * obj = GC_malloc_atomic(size);
# endif
*((_Jv_VTable **) obj) = klass->vtable; *((_Jv_VTable **) obj) = klass->vtable;
#else #else
void * obj = GC_gcj_malloc(size, klass->vtable); # ifdef THREAD_LOCAL_ALLOC
void * obj = GC_local_gcj_malloc(size, klass->vtable);
# else
void * obj = GC_gcj_malloc(size, klass->vtable);
# endif
#endif #endif
return obj; return obj;
} }