From: Andrew Haley <aph@redhat.com>
To: Keith Seitz <keiths@redhat.com>,
Java Patch List <java-patches@gcc.gnu.org>
Subject: Re: [RFC/JVMTI] GetMethodDeclaringClass
Date: Tue, 17 Oct 2006 19:05:00 -0000 [thread overview]
Message-ID: <17717.8425.50456.767598@zebedee.pink> (raw)
In-Reply-To: <17717.7538.291407.210562@zebedee.pink>
Andrew Haley writes:
> Keith Seitz writes:
> >
> > Okay, well, I hate to be indecisive, but I've spent a lot of time being
> > really wishy-washy on this, so I'm leaving it up to the collective
> > wisdom of the maintainers and other developers. :-)
> >
> > JVMTI has a function called GetMethodDeclaringClass which is a real
> > pain. Unlike JDWP and JNI, JVMTI does *not* pass class IDs and method
> > IDs together. JVMTI simply passes around the jmethodID. As a result, we
> > have the evil known as GetMethodDeclaringClass, which is going to be
> > required for JDWP (and probably any other real-world JVMTI agent).
> >
> > So somehow we must maintain a mapping of jmethodIDs to their
> > corresponding classes. I've played around with this quite a bit
> > recently, and I've come to two solutions for this problem, both with
> > pros and cons. [I have hacked both these solutions together; rough
> > patches on request.]
> >
> > It is up to you, gentle reader, to pick one of these solutions or offer
> > another up for review. [I should mention a small aside: both JDWP and
> > JVMTI also have a function to get all the classes in the VM for which
> > this could also be used.]
> >
> > 1) the simple method
> > ClassLoaders already contain a list of all the classes they've loaded.
> > So by adding some code to java.lang.ClassLoader, we can keep track of
> > all the ClassLoaders in the system. We can then do several things to
> > search through those loaded classes: loop through the classes (dog
> > slow), sort the loaded classes and then search (I'm guessing not
> > feasible for a large number of classes), etc.
> >
> > 2) maintain yet another list of loaded classes
> > Yes, I hate to say it, but this is on the table. If it isn't bad enough
> > that java.lang.ClassLoader and the stacktracing code maintain lists of
> > loaded classes, I'm proposing adding one more, which builds on the
> > stacktracing code's _Jv_{Pop,Push}Class. I've implemented this with a
> > TreeSet and a custom Comparator. [It maintains a list of classes, not
> > jmethodIDs!]
> >
> > 3) ???
> >
> > Any comments or other ideas?
>
> What is a jmethodID? How is it created?\
Ah, sorry. I thought you meant something internal to JVMTI, but I
guess you mean libgcj's jmethodID.
AFAICS we just need to make sure that all methods for interpreted
classes are pushed with _Jv_PushClass. Then to get your class,
class = ncodeMap->get (jmethodID->ncode);
Andrew.
next prev parent reply other threads:[~2006-10-17 19:05 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-10-17 18:09 Keith Seitz
2006-10-17 18:14 ` Andrew Haley
2006-10-17 19:05 ` Andrew Haley [this message]
2006-10-17 18:42 ` Keith Seitz
2006-10-17 18:53 ` Andrew Haley
2006-10-18 23:04 ` Keith Seitz
2006-10-19 8:22 ` Andrew Haley
2006-10-23 20:50 ` Keith Seitz
2006-10-24 6:36 ` Andrew Haley
2006-10-27 0:06 ` Keith Seitz
2006-10-27 10:17 ` Andrew Haley
2006-10-28 2:16 ` Keith Seitz
2006-10-17 18:23 ` Per Bothner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=17717.8425.50456.767598@zebedee.pink \
--to=aph@redhat.com \
--cc=java-patches@gcc.gnu.org \
--cc=keiths@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).