diff options
author | bryce <bryce@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-09-10 01:21:08 +0000 |
---|---|---|
committer | bryce <bryce@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-09-10 01:21:08 +0000 |
commit | a9460e1f0bc702445e3c5c7ec0814422e3690359 (patch) | |
tree | c9cba2a639bc7b4c52507deb032b19f60bb24057 /libjava | |
parent | e1a0572dd809ae3defa258fd154e6d52d6058c57 (diff) | |
download | gcc-a9460e1f0bc702445e3c5c7ec0814422e3690359.tar.gz |
* 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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@45497 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava')
-rw-r--r-- | libjava/ChangeLog | 7 | ||||
-rw-r--r-- | libjava/boehm.cc | 8 | ||||
-rw-r--r-- | libjava/exception.cc | 5 | ||||
-rw-r--r-- | libjava/include/jvm.h | 3 | ||||
-rw-r--r-- | libjava/nogc.cc | 7 |
5 files changed, 26 insertions, 4 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog index 6d872b2731c..8e158adfc77 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,3 +1,10 @@ +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 diff --git a/libjava/boehm.cc b/libjava/boehm.cc index 7982eda0951..27e332b259e 100644 --- a/libjava/boehm.cc +++ b/libjava/boehm.cc @@ -375,6 +375,14 @@ _Jv_AllocArray (jsize size, jclass klass) 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) { diff --git a/libjava/exception.cc b/libjava/exception.cc index 752236102af..a8e6ece6e28 100644 --- a/libjava/exception.cc +++ b/libjava/exception.cc @@ -20,8 +20,6 @@ details. */ #include "unwind.h" -#include <gc.h> - struct alignment_test_struct { @@ -73,9 +71,8 @@ get_exception_header_from_ue (_Unwind_Exception *exc) 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 (); diff --git a/libjava/include/jvm.h b/libjava/include/jvm.h index 3f9071c347f..936d4c690c6 100644 --- a/libjava/include/jvm.h +++ b/libjava/include/jvm.h @@ -114,6 +114,9 @@ void *_Jv_AllocPtrFreeObj (jsize size, jclass cl) __attribute__((__malloc__)); 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 diff --git a/libjava/nogc.cc b/libjava/nogc.cc index 7cdd5827724..65cc8c30e22 100644 --- a/libjava/nogc.cc +++ b/libjava/nogc.cc @@ -66,6 +66,13 @@ _Jv_AllocBytes (jsize size) return obj; } +void * +_Jv_AllocRawObj (jsize size) +{ + total += size; + return calloc (size, 1); +} + void _Jv_RegisterFinalizer (void *, _Jv_FinalizerFunc *) { |