* include/jvm.h (_Jv_AllocRawObj): New prototype.
* boehm.cc (_Jv_AllocRawObj): Implement.
* nogc.cc (_Jv_AllocRawObj): Likewise.
* exception.cc (_Jv_Throw): Use _Jv_AllocRawObj, not GC_malloc.
From-SVN: r45497
+2001-09-10 Bryce McKinlay <bryce@waitaki.otago.ac.nz>
+
+ * include/jvm.h (_Jv_AllocRawObj): New prototype.
+ * boehm.cc (_Jv_AllocRawObj): Implement.
+ * nogc.cc (_Jv_AllocRawObj): Likewise.
+ * exception.cc (_Jv_Throw): Use _Jv_AllocRawObj, not GC_malloc.
+
2001-09-06 Anthony Green <green@redhat.com>
* java/util/ResourceBundle.java (tryLocalBundle): Eliminate
return obj;
}
+/* Allocate space for a new non-Java object, which does not have the usual
+ Java object header but may contain pointers to other GC'ed objects. */
+void *
+_Jv_AllocRawObj (jsize size)
+{
+ return (void *) GC_MALLOC (size);
+}
+
static void
call_finalizer (GC_PTR obj, GC_PTR client_data)
{
#include "unwind.h"
-#include <gc.h>
-
\f
struct alignment_test_struct
{
extern "C" void
_Jv_Throw (jthrowable value)
{
- /* FIXME: Use the proper API to the collector. */
java_exception_header *xh
- = static_cast<java_exception_header *>(GC_malloc (sizeof (*xh)));
+ = static_cast<java_exception_header *>(_Jv_AllocRawObj (sizeof (*xh)));
if (value == NULL)
value = new java::lang::NullPointerException ();
void *_Jv_AllocArray (jsize size, jclass cl) __attribute__((__malloc__));
/* Allocate space that is known to be pointer-free. */
void *_Jv_AllocBytes (jsize size) __attribute__((__malloc__));
+/* Allocate space for a new non-Java object, which does not have the usual
+ Java object header but may contain pointers to other GC'ed objects. */
+void *_Jv_AllocRawObj (jsize size) __attribute__((__malloc__));
/* Explicitly throw an out-of-memory exception. */
void _Jv_ThrowNoMemory() __attribute__((__noreturn__));
/* Allocate an object with a single pointer. The first word is reserved
return obj;
}
+void *
+_Jv_AllocRawObj (jsize size)
+{
+ total += size;
+ return calloc (size, 1);
+}
+
void
_Jv_RegisterFinalizer (void *, _Jv_FinalizerFunc *)
{