Return-Path: Delivered-To: apmail-jakarta-bcel-user-archive@www.apache.org Received: (qmail 89953 invoked from network); 18 May 2004 14:30:15 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 18 May 2004 14:30:15 -0000 Received: (qmail 13481 invoked by uid 500); 18 May 2004 14:30:29 -0000 Delivered-To: apmail-jakarta-bcel-user-archive@jakarta.apache.org Received: (qmail 13376 invoked by uid 500); 18 May 2004 14:30:28 -0000 Mailing-List: contact bcel-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "BCEL Users List" Reply-To: "BCEL Users List" Delivered-To: mailing list bcel-user@jakarta.apache.org Received: (qmail 13340 invoked by uid 98); 18 May 2004 14:30:28 -0000 Received: from twright@bbn.com by hermes.apache.org by uid 82 with qmail-scanner-1.20 (clamuko: 0.70. Clear:RC:0(128.33.0.62):. Processed in 0.084104 secs); 18 May 2004 14:30:28 -0000 X-Qmail-Scanner-Mail-From: twright@bbn.com via hermes.apache.org X-Qmail-Scanner: 1.20 (Clear:RC:0(128.33.0.62):. Processed in 0.084104 secs) Received: from unknown (HELO aragorn.bbn.com) (128.33.0.62) by hermes.apache.org with SMTP; 18 May 2004 14:30:27 -0000 Received: from po2.bbn.com (po2.bbn.com [128.33.0.56]) by aragorn.bbn.com (8.12.7/8.12.7) with ESMTP id i4IEU27W006066; Tue, 18 May 2004 10:30:02 -0400 (EDT) Received: from twright (Twright.dsl.bbn.com [128.89.72.71]) by po2.bbn.com (8.10.2+Sun/8.10.2) with ESMTP id i4IEU2623081; Tue, 18 May 2004 10:30:02 -0400 (EDT) From: Todd Wright Organization: BBN To: "BCEL Users List" , Daniel Schregenberger Subject: Re: Modification of java.lang.Object Date: Tue, 18 May 2004 10:28:45 -0400 User-Agent: KMail/1.5 References: <1084305680.7572.29.camel@localhost> <20040513125651.GA17632@arbat.com> <1084471941.7556.16.camel@localhost> In-Reply-To: <1084471941.7556.16.camel@localhost> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200405181028.45512.twright@bbn.com> X-Scanned-By: MIMEDefang 2.28 (www . roaringpenguin . com / mimedefang) X-Spam-Rating: hermes.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N On Thursday 13 May 2004 15:02, Daniel Schregenberger wrote: > On Don, 2004-05-13 at 14:56, Erik Corry wrote: > > On Thu, May 13, 2004 at 08:40:31AM -0400, David Hovemeyer wrote: > > > On Thu, May 13, 2004 at 12:54:41AM +0200, Daniel Schregenberger wrote: > > > > > There might also be some ways to solve your problem... > > > > > > > > Yeah, it looks as if I have to think of one :) > > > > > > You might want to consider using Jikes RVM instead of Sun's JVM: > > > > What I'm doing is to put all the objects in a hash table. That means > > you can associate whatever info you want with them. You have to > > make sure that you use System.identityhashcode and the == operator, > > you have to use weak references (unless you don't mind no garbage > > collection occurring) and you have to be careful that your own > > objects (eg the WeakReferences themselves) don't get put into the > > system. > > > > Apart from that it's quite simple. :-) > > I was thinking about this approach too. There's a high probability that > I will try it this way now. > Thanks for pointing out the difficult parts! I wrote something like this using BCEL without VM changes. It's all open source: Offline I modify all class constructors to register the newly created instance in a table, using WeakReferences to allow GC: http://profiler.cougaar.org/#design For and overview and snapshots, see: http://profiler.cougaar.org/ I implemented a table that's quite similar to your design: http://cougaar.org/cgi-bin/viewcvs.cgi/profiler_impl/src/org/cougaar/profiler/InstancesTable.java?rev=HEAD&cvsroot=profiler&content-type=text/vnd.viewcvs-markup It was discussed on the "advanced-java" mailing list: http://discuss.develop.com/archives/wa.exe?A2=ind0312&L=ADVANCED-JAVA&T=0&I=-3&P=1321 Since the above discussion I've fixed several limitations, such as String and Thread tracking. Some "java.lang" classes are still out of reach due to the VM: Class Object String$CaseInsensitiveComparator java.lang.ThreadGroup java.lang.Throwable java.lang.ref.Reference java.lang.ref.SoftReference java.lang.ref.WeakReference # since I use WeakReferences in my table! The Sun JVM ignores any modifications to Class, and Object is likely the same, since it's partially built into the VM. Also, there was a minor hurdle with BCEL 5.1 and "java.math.BigInteger": http://issues.apache.org/bugzilla/show_bug.cgi?id=18323 A more significant limitation is array tracking, since arrays lack a constructor. I've started a workaround to modify "newarray" clients, but some of the largest arrays are inside the JVM (e.g. classfile bytecodes, jars, string constants, etc). I'd be happy to discuss the details and usage... Todd > > -- Daniel > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: bcel-user-unsubscribe@jakarta.apache.org > For additional commands, e-mail: bcel-user-help@jakarta.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: bcel-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: bcel-user-help@jakarta.apache.org