Ayee, missed a file.
[official-gcc.git] / libjava / nogc.cc
blobe81fbe18714cd7bb2d676c3ebfaccbaed0eb9655
1 // nogc.cc - Implement null garbage collector.
3 /* Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation
5 This file is part of libgcj.
7 This software is copyrighted work licensed under the terms of the
8 Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
9 details. */
11 #include <config.h>
13 #include <stdio.h>
14 #include <stdlib.h>
16 #include <gcj/cni.h>
17 #include <jvm.h>
19 // Total amount of memory allocated.
20 static long total = 0;
22 void *
23 _Jv_BuildGCDescr(jclass)
25 return 0;
28 void *
29 _Jv_AllocObj (jsize size, jclass klass)
31 total += size;
32 void *obj = calloc (size, 1);
33 if (!obj) _Jv_ThrowNoMemory();
34 *((_Jv_VTable **) obj) = klass->vtable;
35 return obj;
38 void *
39 _Jv_AllocPtrFreeObj (jsize size, jclass klass)
41 total += size;
42 void *obj = calloc (size, 1);
43 if (!obj) _Jv_ThrowNoMemory();
44 *((_Jv_VTable **) obj) = klass->vtable;
45 return obj;
48 void *
49 _Jv_AllocArray (jsize size, jclass klass)
51 total += size;
52 void *obj = calloc (size, 1);
53 if (!obj) _Jv_ThrowNoMemory();
54 *((_Jv_VTable **) obj) = klass->vtable;
55 return obj;
58 void *
59 _Jv_AllocBytes (jsize size)
61 total += size;
62 void *obj = calloc (size, 1);
63 if (!obj) _Jv_ThrowNoMemory();
64 return obj;
67 void *
68 _Jv_AllocRawObj (jsize size)
70 total += size;
71 return calloc (size, 1);
74 void
75 _Jv_RegisterFinalizer (void *, _Jv_FinalizerFunc *)
77 // FIXME: should actually register so that finalizers can be run on
78 // exit.
81 void
82 _Jv_RunFinalizers (void)
86 void
87 _Jv_RunAllFinalizers (void)
89 // FIXME: should still run all finalizers.
92 void
93 _Jv_GCInitializeFinalizers (void (*) (void))
97 void
98 _Jv_RunGC (void)
102 long
103 _Jv_GCTotalMemory (void)
105 return total;
108 long
109 _Jv_GCFreeMemory (void)
111 return 0;
114 void
115 _Jv_GCSetInitialHeapSize (size_t)
119 void
120 _Jv_GCSetMaximumHeapSize (size_t)
124 void
125 _Jv_DisableGC (void)
129 void
130 _Jv_EnableGC (void)
134 void
135 _Jv_InitGC (void)
139 void
140 _Jv_GCRegisterDisappearingLink (jobject *)
144 jboolean
145 _Jv_GCCanReclaimSoftReference (jobject)
147 // For now, always reclaim soft references. FIXME.
148 return true;
151 #ifdef JV_HASH_SYNCHRONIZATION
152 void *
153 _Jv_AllocTraceOne (jsize size /* includes vtable slot */)
155 void *obj = calloc(size, 1);
156 if (!obj) _Jv_ThrowNoMemory();
157 return result;
160 void *
161 _Jv_AllocTraceTwo (jsize size /* includes vtable slot */)
163 void *obj = calloc(size, 1);
164 if (!obj) _Jv_ThrowNoMemory();
165 return result;
167 #endif /* JV_HASH_SYNCHRONIZATION */