harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Pavel Ozhdikhin" <pavel.ozhdik...@gmail.com>
Subject Re: [jitrino]question about instrument
Date Fri, 12 Oct 2007 10:37:36 GMT
On 10/11/07, Yunyun Hao <yunyun.hao@gmail.com> wrote:
>
> 2007/9/21, Pavel Ozhdikhin < pavel.ozhdikhin@gmail.com>:
> >
> > Estelle,
> >
> >
> >
> > Unless you inline HIR of the callee into the foo(), your changes in this
> > HIR
> > will be lost after compilation of foo() is complete. I see several ways
> to
> >
> > instrument callees:
> >
> >   1. Instrument all methods and then filter out those you don't need.
> >   The list of callees or a call graph may be obtained during the
> > compilation
> >   of foo(). This looks to me as the simplest way but the overhead may be
> > big.
>
>
>
>
> Hi, Pavel,
>
> I have the same problem with estelle's. and if I Instrument all methods,
> it will bring side effect to other methods.
>
>
> 2. Use CompilationInterface.compileMethod() routine to run a full
> >   compilation of a callee from a compilation session of foo(). You may
> >   organize pasing a parameter to designate that the compiled method must
> > be
> >   instrumented. This is quite a simple to do but compiling one method
> from
> >   another may be unsafe in case on complex type dependencies.
>
>
> When the pipeline compile foo(), callee's HIR is unavailable. If Use
> CompilationInterface.compileMethod() routine to run a full  compilation of
> a
> callee from a compilation session of foo(). How to get HIR of callee?


 The callees will be compiled the same way as other methods but "out of
turn". You should hold a static list of methods to be instrumented and check
it in every method compilation.

For example, your method foo() calls methods a() and b(). When compiling
foo() you add a() and b() to your static list and calls
compileMethod(...,<a>) and compileMethod(...,<b>). When they are being
compiled, your instrumentation pass sees that current compiled method is in
the list and injects an instrumentation code. After they are compiled,
compilation of foo() continues.

Whether the instrumented HIR will be overrided when the pipeline really
> compile callees?


Yes, this is the problem - in a recompilation mode you method might be
recompiled by the execution manager when it becomes hot enough. Use pure
'opt' mode to make sure your instrumented code retains. Or patch the
recompialtion engine to not recompile methods from your list.

3. Create a list of callees during the first run and then instrument
> >   the callees during the next run.


This is the safest variant.

Thanks,
Pavel

Thanks,
> >
> > Pavel
> >
> >
> >
> > On 9/21/07, Estelle Liu < lyy1105@gmail.com > wrote:
> >
> > > Pavel,
> > > My case is :The insertion of instrumentation code occurs in an optpass
> > > applied to a method(suppose foo), and TranslatorSession is used to
> > > translate
> > > the callees of foo. My question is whether the instrumentation code
> > > injected
> > > to callees of foo there is permanent. If not, how can I make that
> > modified
> > > HIR permanent?
> > >
> > > Thanks,
> > >
> > > 2007/9/19, Pavel Ozhdikhin < pavel.ozhdikhin@gmail.com>:
> > > >
> > > > Estelle,
> > > >
> > > > Could you please give more details - what information do you want to
> > > > obtain
> > > > from the JIT?
> > > > For example, the simplest case is when the methods in the call chain
> > are
> > > > inlined - you may adjust the inliner to insert the instrumentation
> > code.
> > > >
> > > > Thanks,
> > > > Pavel
> > > >
> > > >
> > > > On 9/16/07, Estelle Liu < lyy1105@gmail.com > wrote:
> > > > >
> > > > > Hi,everyone,
> > > > > I'd like to instrument in the HIR of a method chain with call
> > > relations.
> > > > > Is there any way to go?
> > > > >
> > > > > --
> > > > > Estelle
> > > > >
> > > >
> > >
> > >
> > >
> > > --
> > > Estelle
> > >
> >
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message