* c-decl.c (store_parm_decls): When comparing types in an
[official-gcc.git] / libjava / nogc.cc
blob7cdd58277246769407adc41df2894b7e0d3a8328
1 // nogc.cc - Implement null garbage collector.
3 /* Copyright (C) 1998, 1999, 2000, 2001 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 #ifdef INTERPRETER
23 void *
24 _Jv_BuildGCDescr(jclass klass)
26 return 0;
28 #endif
30 void *
31 _Jv_AllocObj (jsize size, jclass klass)
33 total += size;
34 void *obj = calloc (size, 1);
35 if (!obj) _Jv_ThrowNoMemory();
36 *((_Jv_VTable **) obj) = klass->vtable;
37 return obj;
40 void *
41 _Jv_AllocPtrFreeObj (jsize size, jclass klass)
43 total += size;
44 ptr_t obj = malloc (size, 1);
45 if (!obj) _Jv_ThrowNoMemory();
46 *((_Jv_VTable **) obj) = klass->vtable;
47 return obj;
50 void *
51 _Jv_AllocArray (jsize size, jclass klass)
53 total += size;
54 void *obj = calloc (size, 1);
55 if (!obj) _Jv_ThrowNoMemory();
56 *((_Jv_VTable **) obj) = klass->vtable;
57 return obj;
60 void *
61 _Jv_AllocBytes (jsize size)
63 total += size;
64 ptr_t obj = calloc (size, 1);
65 if (!obj) _Jv_ThrowNoMemory();
66 return obj;
69 void
70 _Jv_RegisterFinalizer (void *, _Jv_FinalizerFunc *)
72 // FIXME: should actually register so that finalizers can be run on
73 // exit.
76 void
77 _Jv_RunFinalizers (void)
81 void
82 _Jv_RunAllFinalizers (void)
84 // FIXME: should still run all finalizers.
87 void
88 _Jv_RunGC (void)
92 long
93 _Jv_GCTotalMemory (void)
95 return total;
98 long
99 _Jv_GCFreeMemory (void)
101 return 0;
104 void
105 _Jv_GCSetInitialHeapSize (size_t size)
109 void
110 _Jv_GCSetMaximumHeapSize (size_t size)
114 void
115 _Jv_DisableGC (void)
119 void
120 _Jv_EnableGC (void)
124 void
125 _Jv_InitGC (void)
129 #ifdef JV_HASH_SYNCHRONIZATION
130 void *
131 _Jv_AllocTraceOne (jsize size /* includes vtable slot */)
133 ptr_t obj = calloc(size, 1);
134 if (!obj) _Jv_ThrowNoMemory();
135 return result;
137 #endif /* JV_HASH_SYNCHRONIZATION */