* [RFA] "Rewrite" GetFrameCount
@ 2007-02-08 0:56 Keith Seitz
2007-02-08 1:01 ` Tom Tromey
0 siblings, 1 reply; 3+ messages in thread
From: Keith Seitz @ 2007-02-08 0:56 UTC (permalink / raw)
To: Java Patch List
[-- Attachment #1: Type: text/plain, Size: 792 bytes --]
Hi,
The attach patch adds the new function _Jv_Frame::depth(), which returns
the depth of the stack at this frame. It's a little hoaky, but it should
be sufficient, since we end up getting the top of the stack from the
thread anyway. No need to add more storage to save this info off.
It also contains changes to _Jv_JVMTI_GetFrame to use this function.
This patch should effectively be a nop in functionality, except that I
can now call _Jv_Frame::depth without having to call a JVMTI function,
which I'm going to need when I submit patches related to single stepping.
Ok?
Keith
ChangeLog
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.
[-- Attachment #2: frame-depth.patch --]
[-- Type: text/x-patch, Size: 1244 bytes --]
Index: include/java-interp.h
===================================================================
--- include/java-interp.h (revision 121607)
+++ include/java-interp.h (working copy)
@@ -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.
@@ -352,6 +352,16 @@
{
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: jvmti.cc
===================================================================
--- jvmti.cc (revision 121616)
+++ jvmti.cc (working copy)
@@ -259,14 +259,7 @@
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;
}
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [RFA] "Rewrite" GetFrameCount
2007-02-08 0:56 [RFA] "Rewrite" GetFrameCount Keith Seitz
@ 2007-02-08 1:01 ` Tom Tromey
2007-02-08 1:55 ` Keith Seitz
0 siblings, 1 reply; 3+ messages in thread
From: Tom Tromey @ 2007-02-08 1:01 UTC (permalink / raw)
To: Keith Seitz; +Cc: Java Patch List
>>>>> "Keith" == Keith Seitz <keiths@redhat.com> writes:
Keith> It also contains changes to _Jv_JVMTI_GetFrame to use this
Keith> function. This patch should effectively be a nop in functionality,
Keith> except that I can now call _Jv_Frame::depth without having to call a
Keith> JVMTI function, which I'm going to need when I submit patches related
Keith> to single stepping.
Keith> Ok?
Looks good to me, thanks.
I think one of Kyle's recent patches had some code to compute the
stack depth, but it did something special if the frame was not found.
I didn't look to see if this is a candidate for reuse.
Tom
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [RFA] "Rewrite" GetFrameCount
2007-02-08 1:01 ` Tom Tromey
@ 2007-02-08 1:55 ` Keith Seitz
0 siblings, 0 replies; 3+ messages in thread
From: Keith Seitz @ 2007-02-08 1:55 UTC (permalink / raw)
To: tromey; +Cc: Java Patch List
Tom Tromey wrote:
> Looks good to me, thanks.
Committed. Thanks.
> I think one of Kyle's recent patches had some code to compute the
> stack depth, but it did something special if the frame was not found.
> I didn't look to see if this is a candidate for reuse.
I think that was GetStackTrace, which differentiates between native
frames and interpreted frames. It already uses GetFrameCount. It could
use _Jv_Frame::depth, too, if we so wanted to change it. I've left it as
is. Something symmetrical about JVMTI code calling JVMTI code to do
tasks. If you want me to change it, just say the word.
Keith
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2007-02-08 1:55 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-08 0:56 [RFA] "Rewrite" GetFrameCount Keith Seitz
2007-02-08 1:01 ` Tom Tromey
2007-02-08 1:55 ` Keith Seitz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).