Re: [rvm-research] Adding Runtime Extension

Eliot Moss <[email protected]>
Newsgroups gmane.comp.java.jikes.rvm.devel
Message-ID <[email protected]>
On 6/29/2014 11:29 PM, Matthew Ma wrote:
> Hi,
> If I want to add a field to any class (in user code), where in the RVM compiler should I start instrumenting the byte code.
> Is there any existing examples that I can take a look at?
> I am using asm tool and java assist.

You can't add fields to arrays, and probably not to some
built-in objects.

With Jikes RVM you CAN add header fields -- this would be
more toward the GC oriented code, but in the JVM code
related to headers and header layout.

However, as I have tried to tell you before, a JVMTI agent
allows you to associate an arbitrary 64-bit value with any
object.  You could (for example) instrument bytecode to add,
after the constructor invocation on a new object, a call to
a C/C++ routine in your agent saying "please associate this
information with this object".  In fact, the C/C++ code could
do it any way it wants, if you use the 64-bit field to assign
unique ids to objects, and then use the unique ids as keys
into tables managed with the C/C++ code.

My point is that maintaining information via a map keyed on
the object is as good as storing information IN the object.

Regards -- EM

------------------------------------------------------------------------------
Open source business process management suite built on Java and Eclipse
Turn processes into business applications with Bonita BPM Community Edition
Quickly connect people, data, and systems into organized workflows
Winner of BOSSIE, CODIE, OW2 and Gartner awards
http://p.sf.net/sfu/Bonitasoft
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.