1 // nogc.cc - Implement null garbage collector.
3 /* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2006, 2007
4 Free Software Foundation
6 This file is part of libgcj.
8 This software is copyrighted work licensed under the terms of the
9 Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
20 // Total amount of memory allocated.
21 static long total
= 0;
24 _Jv_BuildGCDescr(jclass
)
30 _Jv_AllocObj (jsize size
, jclass klass
)
33 void *obj
= calloc (size
, 1);
34 if (!obj
) _Jv_ThrowNoMemory();
35 *((_Jv_VTable
**) obj
) = klass
->vtable
;
40 _Jv_AllocPtrFreeObj (jsize size
, jclass klass
)
43 void *obj
= calloc (size
, 1);
44 if (!obj
) _Jv_ThrowNoMemory();
45 *((_Jv_VTable
**) obj
) = klass
->vtable
;
50 _Jv_AllocArray (jsize size
, jclass klass
)
53 void *obj
= calloc (size
, 1);
54 if (!obj
) _Jv_ThrowNoMemory();
55 *((_Jv_VTable
**) obj
) = klass
->vtable
;
60 _Jv_AllocBytes (jsize size
)
63 void *obj
= calloc (size
, 1);
64 if (!obj
) _Jv_ThrowNoMemory();
69 _Jv_AllocRawObj (jsize size
)
72 return calloc (size
, 1);
76 _Jv_ClosureListFinalizer ()
78 _Jv_ClosureList
**clpp
;
79 clpp
= (_Jv_ClosureList
**)_Jv_AllocBytes (sizeof (*clpp
));
84 _Jv_RegisterFinalizer (void *, _Jv_FinalizerFunc
*)
86 // FIXME: should actually register so that finalizers can be run on
91 _Jv_RunFinalizers (void)
96 _Jv_RunAllFinalizers (void)
98 // FIXME: should still run all finalizers.
102 _Jv_GCInitializeFinalizers (void (*) (void))
112 _Jv_GCTotalMemory (void)
118 _Jv_GCFreeMemory (void)
124 _Jv_GCSetInitialHeapSize (size_t)
129 _Jv_GCSetMaximumHeapSize (size_t)
149 _Jv_GCRegisterDisappearingLink (jobject
*)
154 _Jv_GCCanReclaimSoftReference (jobject
)
156 // For now, always reclaim soft references. FIXME.
160 #ifdef JV_HASH_SYNCHRONIZATION
162 _Jv_AllocTraceOne (jsize size
/* includes vtable slot */)
164 void *obj
= calloc(size
, 1);
165 if (!obj
) _Jv_ThrowNoMemory();
170 _Jv_AllocTraceTwo (jsize size
/* includes vtable slot */)
172 void *obj
= calloc(size
, 1);
173 if (!obj
) _Jv_ThrowNoMemory();
176 #endif /* JV_HASH_SYNCHRONIZATION */
179 _Jv_SuspendThread (_Jv_Thread_t
*thread
)
184 _Jv_ResumeThread (_Jv_Thread_t
*thread
)
189 _Jv_IsThreadSuspended (_Jv_Thread_t
*thread
)