Re: [rvm-research] Adding Runtime Extension
Matthew Ma <[email protected]>
| Newsgroups | gmane.comp.java.jikes.rvm.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi Elliot,
Thanks for the reply.
Could you be a little specific on what you mean by “With Jikes RVM you CAN add header fields”?
With the help and suggestion from Rifat, I now can add a Word in MiscHeader (changed header size, misc offset..).
The difficulty I have is how to process annotations annotated on method, and retrieve it to write into any object created in that method.
1 @create(“Group1”) //user annotated
2 public void foo(){
3 ast = new Tree(); //“Group1” is written into misc header field of newly created object
4 bst = new Tree(); //same as above
5 cst = new Object(); //same as above
6 }
I read tutorial on asm adding a field in class. From your advice, does it mean I can directly write annotation content into misc header field without creating a field in an class?
Please correct me if I am misunderstanding.
Sincerely,
Matthew
On Jun 30, 2014, at 11:59 AM, Eliot Moss <[email protected]> wrote:
> 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
> _______________________________________________
> Jikesrvm-researchers mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/jikesrvm-researchers
------------------------------------------------------------------------------
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