nogc.cc & darwin

Andreas Tobler toa@pop.agri.ch
Thu Jan 24 13:05:00 GMT 2002


Hi all,

during my adventure on bringing libjava to work on darwin I struggle
over a few items where I'd like to get your opinions.

First, Bryce already helped me (thanks, needed a day off and a few cups
of coffee), in nogc.cc I fail to compile here _Jv_AllocPtrFreeObj since 
ptr_t is not defined. (and a few more places, see below)

Second, two functions are not defined in nogc.cc, they are used in java/lang/ref/natReference.cc.

_Jv_GCCanReclaimSoftReference (jobject) and
_Jv_GCRegisterDisappearingLink (jobject *objp)

I implemented them as 'null' functions, copied from boehm.cc. Is this
correct? 
This should not be a patch, more a RFC. I couldn't test now. If the way
is ok I'll deliver a patch.

Third, I have an undefined symbol where I struggle as well. When linking
I miss the symbol _sqrtf. My search led to the point that this
symbol/function is in libstdc++.a but this one isn't on the linking libs
list. Well, I didn't say --disabled-shared because I assumed that this
is default on darwin.
Do I have explicitly say disable-shared?

And last, how about patches, I see different formats diff -rcs or diff
-u, which one is preferred? I prefer -u since it uses less space, but
I'm open to do as expected.

And finally the diff, as said, this one should not be applied since I
couldn't test so far and I'd like to hear your opinion.

Thanks in advance!

Andreas

---
--- nogc.cc.orig        Thu Jan 24 19:07:27 2002
+++ nogc.cc     Thu Jan 24 19:28:35 2002
@@ -39,7 +39,7 @@
 _Jv_AllocPtrFreeObj (jsize size, jclass klass)
 {
   total += size;
-  ptr_t obj = malloc (size, 1);
+  void *obj = malloc (size);
   if (!obj) _Jv_ThrowNoMemory();
   *((_Jv_VTable **) obj) = klass->vtable;
   return obj;
@@ -59,7 +59,7 @@
 _Jv_AllocBytes (jsize size)
 {
   total += size;
-  ptr_t obj = calloc (size, 1);
+  void *obj = calloc (size, 1);
   if (!obj) _Jv_ThrowNoMemory();
   return obj;
 }
@@ -136,11 +136,23 @@
 {
 }

+void
+_Jv_GCRegisterDisappearingLink (jobject *objp)
+{
+}
+
+jboolean
+_Jv_GCCanReclaimSoftReference (jobject)
+{
+  // For now, always reclaim soft references.  FIXME.
+  return true;
+}
+
 #ifdef JV_HASH_SYNCHRONIZATION
 void *
 _Jv_AllocTraceOne (jsize size /* includes vtable slot */)
 {
-  ptr_t obj = calloc(size, 1);
+  void *obj = calloc(size, 1);
   if (!obj) _Jv_ThrowNoMemory();
   return result;
 }
 }
@@ -148,7 +160,7 @@
 void *
 _Jv_AllocTraceTwo (jsize size /* includes vtable slot */)
 {
-  ptr_t obj = calloc(size, 1);
+  void *obj = calloc(size, 1);
   if (!obj) _Jv_ThrowNoMemory();
   return result;
 }



More information about the Java mailing list