source: vendor/gcc/current/libjava/include/boehm-gc.h

Last change on this file was 2, checked in by bird, 22 years ago

Initial revision

  • Property cvs2svn:cvs-rev set to 1.1
  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 1.7 KB
Line 
1// -*- c++ -*-
2// boehm-gc.h - Defines for Boehm collector.
3
4/* Copyright (C) 1998, 1999 Free Software Foundation
5
6 This file is part of libgcj.
7
8This software is copyrighted work licensed under the terms of the
9Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
10details. */
11
12#ifndef __JV_BOEHM_GC__
13#define __JV_BOEHM_GC__
14
15#define JV_MARKOBJ_DECL void *_Jv_MarkObj (void *, void *, void *, void *)
16#define JV_MARKARRAY_DECL void *_Jv_MarkArray (void *, void *, void *, void *)
17
18extern "C"
19{
20 JV_MARKOBJ_DECL;
21 JV_MARKARRAY_DECL;
22};
23
24// Enough stuff to inline _Jv_AllocObj. Ugly.
25#include <gcj/javaprims.h>
26#include <java/lang/Class.h>
27#include <string.h>
28
29extern "C" void * GC_gcj_malloc(size_t, void *);
30extern "C" void * GC_malloc_atomic(size_t);
31#ifdef THREAD_LOCAL_ALLOC
32extern "C" void * GC_local_gcj_malloc(size_t, void *);
33extern "C" void * GC_local_malloc_atomic(size_t);
34#endif
35
36inline void *
37_Jv_AllocObj (jsize size, jclass klass)
38{
39 // This should call GC_GCJ_MALLOC, but that would involve
40 // including gc.h.
41#ifdef THREAD_LOCAL_ALLOC
42 return GC_local_gcj_malloc (size, klass->vtable);
43#else
44 return GC_gcj_malloc (size, klass->vtable);
45#endif
46}
47
48inline void *
49_Jv_AllocPtrFreeObj (jsize size, jclass klass)
50{
51#ifdef JV_HASH_SYNCHRONIZATION
52# ifdef THREAD_LOCAL_ALLOC
53 void * obj = GC_local_malloc_atomic(size);
54# else
55 void * obj = GC_malloc_atomic(size);
56# endif
57 *((_Jv_VTable **) obj) = klass->vtable;
58#else
59# ifdef THREAD_LOCAL_ALLOC
60 void * obj = GC_local_gcj_malloc(size, klass->vtable);
61# else
62 void * obj = GC_gcj_malloc(size, klass->vtable);
63# endif
64#endif
65 return obj;
66}
67
68// _Jv_AllocBytes (jsize size) should go here, too. But clients don't
69// usually include this header.
70
71#endif /* __JV_BOEHM_GC__ */
Note: See TracBrowser for help on using the repository browser.