Re: [rvm-research] Quesiton on passing the object operand of getfield instruction to an instrumented function call inserted after the getfield in opt

Michael Bond <[email protected]> Mon, 14 Dec 2015 16:32:59 -0500
Newsgroups gmane.comp.java.jikes.rvm.devel
Message-ID <[email protected]>
Hi Chunbai,

I think the issue may be that your instrumentation is encountering an IR 
instruction like this:

r = r.f;

That is, the result and the ref are the same symbolic register. Although 
the opt compiler's generated IR mostly generates "SSA-ish" code, it 
still sometimes generates instructions like r = r.f.

Perhaps the easiest way to deal with this case is to introduce a new 
symbolic register:

newTempRegister = r.f;
/* insert your instrumentation here */
r = newTempRegister;

Cheers,
Mike

On 12/14/2015 08:44 AM, Chunbai YANG wrote:
> Hi,
>
> I want to perform instrumentation to insert a function call after a 
> "getfield" instruction in opt compiler. The inserted function call 
> (e.g., void postBarrier(Object obj)) needs the object, which the 
> "getfield" instruction is performed on, as its parameter.
>
> I extract the operand by
>
>     Operand ref = GetField.getRef(/inst/) 
>
> where /inst/ is the getfield instruction of type 
> org.jikesrvm.compiler.opt.ir.Instruction. Then I pass the ref.copy() 
> as operand to create the function call instruction inserted after 
> /inst/. However, during runtime, my inserted function call encounter 
> null pointer exception on the object parameter. On the other hand, if 
> I insert the function call before the getfield instruction /inst/, 
> then there's no null pointer exception.
>
> Since a getfield instruction should not modify the object whose field 
> it accesses to, what I can guess is that the value of the Operand 
> /ref/ has been changed after the getfield instruction. The concrete 
> class of the Operand returned by GetField.getRef(inst) is 
> RegisterOperand. So is the problem due to the change of the value in 
> the symbolic register represented by this RegisterOperand? If so, how 
> can I pass the object parameter to my function call inserted after the 
> getfield instruction?
>
> Thanks,
> Chunbai Yang
>
>
>
> ------------------------------------------------------------------------------
>
>
> _______________________________________________
> Jikesrvm-researchers mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/jikesrvm-researchers

------------------------------------------------------------------------------

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