jakarta-bcel-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Todd Wright <twri...@bbn.com>
Subject Re: Modification of java.lang.Object
Date Tue, 18 May 2004 14:28:45 GMT
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 

Offline I modify all class constructors to register the newly created instance 
in a table, using WeakReferences to allow GC:
For and overview and snapshots, see:
I implemented a table that's quite similar to your design:

It was discussed on the "advanced-java" mailing list:

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 
  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":

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...


> -- 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

View raw message