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

Chunbai YANG <[email protected]> Mon, 14 Dec 2015 21:44:26 +0800
Newsgroups gmane.comp.java.jikes.rvm.devel
Message-ID <CABpGBxaxFN98tRfhVGv+dAzbLRV3xGAeHt2goxTm8J=ZX9TJng@mail.gmail.com>
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