Re: [rvm-research] Call-Site Information

Michael Bond <[email protected]> Tue, 24 May 2016 22:10:26 -0400
Newsgroups gmane.comp.java.jikes.rvm.devel
Message-ID <[email protected]>
Hi Shoaib,

Yes, this is definitely possible. There are two different ways to do it:

(1) Insert instrumentation at compile time that "knows" the static 
allocation site. For example, during compile time, assign a unique 
integer for every allocation site, and generate instrumentation that 
writes that integer into the object header.

(2) Insert instrumentation at compile time that figures out the 
allocation site at run time. It can do this by looking at the frame 
pointer and compiled method ID as you say; it gets a little bit complex 
with optimized code and inlining.

My group's patch for calling context profiling 
(https://sourceforge.net/p/jikesrvm/research-archive/44/) has code 
related to both approaches.

One gotcha: There's an issue in Jikes RVM (<=3.1.3, at least) such that 
if the left-most word (by default, this'll be the MiscHeader word) has 
the least-significant bit as 1 instead of 0, Jikes RVM will crash (at 
least with certain GCs?). You can avoid this by making sure it's always 
0 or by putting the MiscHeader to the right of the TIB pointer; see our 
Octet patch for an example of the latter 
(https://sourceforge.net/p/jikesrvm/research-archive/43/).

Regarding your question about calling into Jikes RVM from MMTk: this is 
definitely possible, but it's required to go through a specific 
interface. See classes in org.mmtk.vm such as org.mmtk.vm.Barriers (an 
abstract method that has a Jikes RVM-specific implementation). You can 
add your own method to own of the these classes; the method can access 
Jikes RVM stuff but be called from MMTk.

Cheers,
Mike

On 05/24/2016 02:28 PM, Shoaib Akram wrote:
> Hi All,
>
> Hello from PerformanceLab @ Ghent University in Belgium. I want to ask 
> if there is support in JikesRVM to identify the call-site of an 
> allocation. Suppose I have the code below:
>
> 1  public IntersectionState() {
> 2       stack = new StackNode[MAX_STACK_SIZE * 2];
> 3      for (int i = 0; i < stack.length; i++)
> 4            stack[i] = new StackNode();
> 5        rstack = new float[53 * 256];
> 6    }
>
> Each time a new object is allocated (line no. 4 above), I want to 
> store the call-site information (line 4) in the header of the object. 
> Is it possible to get the unique identity of the method and index 
> within the method, where a new object is being allocated from?
>
> There are some routines in runtime/Magic.java that let you get the 
> current frame pointer or the id of the compiled method, but I am not 
> sure if they usable from within MMTk(?) Does anyone know an an easy 
> way to get the site information at allocation time?
>
> Thanks in advance!
>
> -- 
> *Shoaib Akram*
> *ELIS - Gent University*
> *Belgium*
>
>
> ------------------------------------------------------------------------------
> Mobile security can be enabling, not merely restricting. Employees who
> bring their own devices (BYOD) to work are irked by the imposition of MDM
> restrictions. Mobile Device Manager Plus allows you to control only the
> apps on BYO-devices by containerizing them, leaving personal data untouched!
> https://ad.doubleclick.net/ddm/clk/304595813;131938128;j
>
>
> _______________________________________________
> Jikesrvm-researchers mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/jikesrvm-researchers

------------------------------------------------------------------------------
Mobile security can be enabling, not merely restricting. Employees who
bring their own devices (BYOD) to work are irked by the imposition of MDM
restrictions. Mobile Device Manager Plus allows you to control only the
apps on BYO-devices by containerizing them, leaving personal data untouched!
https://ad.doubleclick.net/ddm/clk/304595813;131938128;j

_______________________________________________
Jikesrvm-researchers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jikesrvm-researchers