OSDN Git Service

* include/java-interp.h (_Jv_Frame::depth):
authorkseitz <kseitz@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 8 Feb 2007 01:55:29 +0000 (01:55 +0000)
committerkseitz <kseitz@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 8 Feb 2007 01:55:29 +0000 (01:55 +0000)
        New function.
        * jvmti.cc (_Jv_JVMTI_GetFrameCount): Use _Jv_Frame::depth.

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

libjava/ChangeLog
libjava/include/java-interp.h
libjava/jvmti.cc

index 3ced148..d99393b 100644 (file)
@@ -1,3 +1,9 @@
+2007-02-07  Keith Seitz  <keiths@redhat.com>
+
+       * include/java-interp.h (_Jv_Frame::depth):
+       New function.
+       * jvmti.cc (_Jv_JVMTI_GetFrameCount): Use _Jv_Frame::depth.
+
 2007-02-07  Kyle Galloway  <kgallowa@redhat.com>
 
     * jvmti.cc (CHECK_FOR_NATIVE_METHOD): New macro.
index 1370ef1..ce2fac2 100644 (file)
@@ -1,6 +1,6 @@
 // java-interp.h - Header file for the bytecode interpreter.  -*- c++ -*-
 
-/* Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006  Free Software Foundation
+/* Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007  Free Software Foundation
 
    This file is part of libgcj.
 
@@ -357,6 +357,16 @@ public:
   {
     thread->frame = (gnu::gcj::RawData *) next;
   }
+
+  int depth ()
+  {
+    int depth = 0;
+    struct _Jv_Frame *f;
+    for (f = this; f != NULL; f = f->next)
+      ++depth;
+
+    return depth;
+  }
 };
 
 // An interpreted frame in the call stack
index ba4ee81..815bee5 100644 (file)
@@ -271,14 +271,7 @@ _Jv_JVMTI_GetFrameCount (MAYBE_UNUSED jvmtiEnv *env, jthread thread,
   THREAD_CHECK_IS_ALIVE (thr);
    
   _Jv_Frame *frame = reinterpret_cast<_Jv_Frame *> (thr->frame);
-  (*frame_count) = 0;
-  
-  while (frame != NULL)
-    {
-      (*frame_count)++;
-      frame = frame->next;
-    }
-  
+  (*frame_count) = frame->depth ();
   return JVMTI_ERROR_NONE;
 }