OSDN Git Service

2004-08-23 Bryce McKinlay <mckinlay@redhat.com>
authorbryce <bryce@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 23 Aug 2004 21:31:53 +0000 (21:31 +0000)
committerbryce <bryce@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 23 Aug 2004 21:31:53 +0000 (21:31 +0000)
* prims.cc (JVMPI_NOTIFY_ALLOC): New macro. Call jvmpi_notify_alloc
only if jvmpi is enabled.
(jvmpi_notify_alloc): Don't check if jvmpi is enabled here.
(_Jv_AllocObjectNoFinalizer): Use JVMPI_NOTIFY_ALLOC.
(_Jv_AllocString): Likewise.
(_Jv_AllocPtrFreeObject): Likewise.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@86441 138bc75d-0d04-0410-961f-82ee72b054a4

libjava/ChangeLog
libjava/prims.cc

index bf219e9..7e0c068 100644 (file)
@@ -1,4 +1,14 @@
+2004-08-23  Bryce McKinlay  <mckinlay@redhat.com>
+
+       * prims.cc (JVMPI_NOTIFY_ALLOC): New macro. Call jvmpi_notify_alloc
+       only if jvmpi is enabled.
+       (jvmpi_notify_alloc): Don't check if jvmpi is enabled here.
+       (_Jv_AllocObjectNoFinalizer): Use JVMPI_NOTIFY_ALLOC.
+       (_Jv_AllocString): Likewise.
+       (_Jv_AllocPtrFreeObject): Likewise.     
+
 2004-08-23  Hans Boehm  <Hans.Boehm@hp.com>
 2004-08-23  Hans Boehm  <Hans.Boehm@hp.com>
+
        * defineclass.cc: Include <stdio.h>.
        * java/lang/natClassLoader.cc: Include <stdio.h>.
 
        * defineclass.cc: Include <stdio.h>.
        * java/lang/natClassLoader.cc: Include <stdio.h>.
 
index 7f3276e..285363f 100644 (file)
@@ -364,37 +364,37 @@ void _Jv_ThrowNoMemory()
 }
 
 #ifdef ENABLE_JVMPI
 }
 
 #ifdef ENABLE_JVMPI
+# define JVMPI_NOTIFY_ALLOC(klass,size,obj) \
+    if (__builtin_expect (_Jv_JVMPI_Notify_OBJECT_ALLOC != 0, false)) \
+      jvmpi_notify_alloc(klass,size,obj);
 static void
 jvmpi_notify_alloc(jclass klass, jint size, jobject obj)
 {
   // Service JVMPI allocation request.
 static void
 jvmpi_notify_alloc(jclass klass, jint size, jobject obj)
 {
   // Service JVMPI allocation request.
-  if (__builtin_expect (_Jv_JVMPI_Notify_OBJECT_ALLOC != 0, false))
-    {
-      JVMPI_Event event;
-
-      event.event_type = JVMPI_EVENT_OBJECT_ALLOC;
-      event.env_id = NULL;
-      event.u.obj_alloc.arena_id = 0;
-      event.u.obj_alloc.class_id = (jobjectID) klass;
-      event.u.obj_alloc.is_array = 0;
-      event.u.obj_alloc.size = size;
-      event.u.obj_alloc.obj_id = (jobjectID) obj;
-
-      // FIXME:  This doesn't look right for the Boehm GC.  A GC may
-      // already be in progress.  _Jv_DisableGC () doesn't wait for it.
-      // More importantly, I don't see the need for disabling GC, since we
-      // blatantly have a pointer to obj on our stack, ensuring that the
-      // object can't be collected.  Even for a nonconservative collector,
-      // it appears to me that this must be true, since we are about to
-      // return obj. Isn't this whole approach way too intrusive for
-      // a useful profiling interface?                 - HB
-      _Jv_DisableGC ();
-      (*_Jv_JVMPI_Notify_OBJECT_ALLOC) (&event);
-      _Jv_EnableGC ();
-    }
+  JVMPI_Event event;
+
+  event.event_type = JVMPI_EVENT_OBJECT_ALLOC;
+  event.env_id = NULL;
+  event.u.obj_alloc.arena_id = 0;
+  event.u.obj_alloc.class_id = (jobjectID) klass;
+  event.u.obj_alloc.is_array = 0;
+  event.u.obj_alloc.size = size;
+  event.u.obj_alloc.obj_id = (jobjectID) obj;
+
+  // FIXME:  This doesn't look right for the Boehm GC.  A GC may
+  // already be in progress.  _Jv_DisableGC () doesn't wait for it.
+  // More importantly, I don't see the need for disabling GC, since we
+  // blatantly have a pointer to obj on our stack, ensuring that the
+  // object can't be collected.  Even for a nonconservative collector,
+  // it appears to me that this must be true, since we are about to
+  // return obj. Isn't this whole approach way too intrusive for
+  // a useful profiling interface?                     - HB
+  _Jv_DisableGC ();
+  (*_Jv_JVMPI_Notify_OBJECT_ALLOC) (&event);
+  _Jv_EnableGC ();
 }
 #else /* !ENABLE_JVMPI */
 }
 #else /* !ENABLE_JVMPI */
-# define jvmpi_notify_alloc(klass,size,obj) /* do nothing */
+# define JVMPI_NOTIFY_ALLOC(klass,size,obj) /* do nothing */
 #endif
 
 // Allocate a new object of class KLASS.
 #endif
 
 // Allocate a new object of class KLASS.
@@ -407,7 +407,7 @@ _Jv_AllocObjectNoInitNoFinalizer (jclass klass)
 {
   jint size = klass->size ();
   jobject obj = (jobject) _Jv_AllocObj (size, klass);
 {
   jint size = klass->size ();
   jobject obj = (jobject) _Jv_AllocObj (size, klass);
-  jvmpi_notify_alloc (klass, size, obj);
+  JVMPI_NOTIFY_ALLOC (klass, size, obj);
   return obj;
 }
 
   return obj;
 }
 
@@ -418,7 +418,7 @@ _Jv_AllocObjectNoFinalizer (jclass klass)
   _Jv_InitClass (klass);
   jint size = klass->size ();
   jobject obj = (jobject) _Jv_AllocObj (size, klass);
   _Jv_InitClass (klass);
   jint size = klass->size ();
   jobject obj = (jobject) _Jv_AllocObj (size, klass);
-  jvmpi_notify_alloc (klass, size, obj);
+  JVMPI_NOTIFY_ALLOC (klass, size, obj);
   return obj;
 }
 
   return obj;
 }
 
@@ -462,27 +462,8 @@ _Jv_AllocString(jsize len)
   obj->boffset = sizeof(java::lang::String);
   obj->count = len;
   obj->cachedHashCode = 0;
   obj->boffset = sizeof(java::lang::String);
   obj->count = len;
   obj->cachedHashCode = 0;
-  
-#ifdef ENABLE_JVMPI
-  // Service JVMPI request.
 
 
-  if (__builtin_expect (_Jv_JVMPI_Notify_OBJECT_ALLOC != 0, false))
-    {
-      JVMPI_Event event;
-
-      event.event_type = JVMPI_EVENT_OBJECT_ALLOC;
-      event.env_id = NULL;
-      event.u.obj_alloc.arena_id = 0;
-      event.u.obj_alloc.class_id = (jobjectID) &String::class$;
-      event.u.obj_alloc.is_array = 0;
-      event.u.obj_alloc.size = sz;
-      event.u.obj_alloc.obj_id = (jobjectID) obj;
-
-      _Jv_DisableGC ();
-      (*_Jv_JVMPI_Notify_OBJECT_ALLOC) (&event);
-      _Jv_EnableGC ();
-    }
-#endif  
+  JVMPI_NOTIFY_ALLOC (&String::class$, sz, obj);
   
   return obj;
 }
   
   return obj;
 }
@@ -499,26 +480,7 @@ _Jv_AllocPtrFreeObject (jclass klass)
 
   jobject obj = (jobject) _Jv_AllocPtrFreeObj (size, klass);
 
 
   jobject obj = (jobject) _Jv_AllocPtrFreeObj (size, klass);
 
-#ifdef ENABLE_JVMPI
-  // Service JVMPI request.
-
-  if (__builtin_expect (_Jv_JVMPI_Notify_OBJECT_ALLOC != 0, false))
-    {
-      JVMPI_Event event;
-
-      event.event_type = JVMPI_EVENT_OBJECT_ALLOC;
-      event.env_id = NULL;
-      event.u.obj_alloc.arena_id = 0;
-      event.u.obj_alloc.class_id = (jobjectID) klass;
-      event.u.obj_alloc.is_array = 0;
-      event.u.obj_alloc.size = size;
-      event.u.obj_alloc.obj_id = (jobjectID) obj;
-
-      _Jv_DisableGC ();
-      (*_Jv_JVMPI_Notify_OBJECT_ALLOC) (&event);
-      _Jv_EnableGC ();
-    }
-#endif
+  JVMPI_NOTIFY_ALLOC (klass, size, obj);
 
   return obj;
 }
 
   return obj;
 }