Re: [rvm-research] Call-Site Information

Shoaib Akram <[email protected]> Tue, 14 Jun 2016 16:27:33 +0200
Newsgroups gmane.comp.java.jikes.rvm.devel
Message-ID <CAB7d=91jvSjsnOev01031oJ1OwonaH2Yie0b8wPERDUKwB=ERA@mail.gmail.com>
Thanks Mike, Aritra, Erik, and Robin. I looked at the type of objects not
being instrumented. Some examples below. Based on my experience, I don't
see anything particular (or consistent) about these class types.

Xalan:

Ljava/util/HashMap;
Lorg/apache/xerces/parsers/SAXParser;
Lorg/apache/xerces/parsers/XIncludeAwareParserConfiguration;
Lorg/apache/xml/dtm/ref/DTMManagerDefault;
Lorg/apache/xml/serializer/ToHTMLStream;
Lorg/apache/xml/serializer/ToTextStream;
Lorg/apache/xml/utils/FastStringBuffer;
Lorg/apache/xpath/axes/AttributeIterator;
Lorg/apache/xpath/axes/AxesWalker;
Lorg/apache/xpath/axes/ChildIterator;
Lorg/apache/xpath/axes/ChildTestIterator;
Lorg/apache/xpath/axes/FilterExprWalker;
Lorg/apache/xpath/axes/OneStepIterator;
Lorg/apache/xpath/axes/OneStepIteratorForward;
Lorg/apache/xpath/axes/ReverseAxesWalker;
Lorg/apache/xpath/axes/WalkingIterator;
Lorg/dacapo/harness/Xalan;
Lorg/mmtk/plan/generational/marksweep/GenMSCollector;
Lprobe/DacapoBachCallback;
[Ljava/lang/Object;
[Lorg/apache/xml/dtm/DTM;
[Lorg/jikesrvm/compilers/common/CompiledMethod;

Pmd:

Lgnu/java/util/regex/REMatch;
Lnet/sourceforge/pmd/rules/OverrideBothEqualsAndHashcode;
Lnet/sourceforge/pmd/rules/UnnecessaryConversionTemporary;
Lnet/sourceforge/pmd/rules/UselessOverridingMethod;
Lnet/sourceforge/pmd/rules/XPathRule;
Lnet/sourceforge/pmd/rules/basic/BooleanInstantiation;
Lorg/dacapo/harness/Pmd;
Lorg/mmtk/plan/generational/marksweep/GenMSCollector;
Lprobe/DacapoBachCallback;
[Lgnu/java/util/regex/BacktrackStack$Backtrack;
[Ljava/lang/Object;
[Lnet/sourceforge/pmd/ast/JavaParser$JJCalls;
[Lorg/jikesrvm/compilers/common/CompiledMethod;

Lusearch:

[Ljava/lang/Object;
Lorg/apache/lucene/analysis/Token;
Lorg/apache/lucene/index/CompoundFileReader$CSIndexInput;
Lorg/apache/lucene/index/SegmentReader;
Lorg/apache/lucene/index/SegmentTermEnum;
Lorg/apache/lucene/index/TermBuffer;
Lorg/apache/lucene/store/FSDirectory;
Lorg/apache/lucene/store/FSDirectory$FSIndexInput;
Lorg/dacapo/harness/Lusearch;
Lorg/dacapo/lusearch/Search;
[Lorg/jikesrvm/compilers/common/CompiledMethod;
Lorg/mmtk/plan/generational/marksweep/GenMSCollector;
Lprobe/DacapoBachCallback;


On Tue, Jun 14, 2016 at 6:10 AM, Robin Garner <[email protected]>
wrote:

> Which classes are not being instrumented ?  This might give a clue.
>
> One way to track it down might be to add an assertion to
> MemoryManager.allocSpace if 'site' is MAGIC_NUMBER.
>
> cheers
>
> On 13/06/16 02:30, Shoaib Akram wrote:
> > Hi Aritra,
> >
> > I do add instrumentation in case of emit_resolved_new() in the baseline
> > compiler. It just slipped my mind when writing the previous email.
> >
> > Regards,
> > Shoaib.
> >
> > On Sun, Jun 12, 2016 at 6:24 PM, Aritra Sengupta
> > <[email protected] <mailto:[email protected]>> wrote:
> >
> >     Hi Shoaib,
> >                     Is there a reason why you skip instrumentation in
> >     case of resolved classes in the baseline compiler using
> >     emit_resolved_new()? It could just be that this case is not covered.
> >
> >     Thanks,
> >     Aritra Sengupta.
> >     PhD Candidate,
> >     Ohio State University.
> >
> >     On Sun, Jun 12, 2016 at 6:57 AM, Shoaib Akram <[email protected]
> >     <mailto:[email protected]>> wrote:
> >
> >         Hi Mike,
> >
> >         Sure. This step is part of a larger project. First, some
> >         background. I am using the generational mark-sweep collector
> >         with a 4 MB nursery and 3 GB mark-sweep mature space. The mature
> >         space is never collected. The idea is to record some statistics
> >         per object (those in the mature space) in a table as an (object,
> >         statistics) tuple. I am intercepting all reads and writes using
> >         barriers to collect the statistics I want. At the end of the
> >         execution of program, I want to see each object's statistics
> >         along with its allocation site. To accomplish the later, I first
> >         add an extra word to MiscHeader. Then, since I am not interested
> >         in the context right now, I include the OriginTracking.java file
> >         from your patch. Now, the places where I calculate the site id
> >         using the OriginTracking:getValueFromLocation() function are
> >         located in two files:
> >
> >         (1)
> >
>  rvm/src/org/jikesrvm/compilers/baseline/ia32/BaselineCompiler.java
> >         (2)
> rvm/src/org/jikesrvm/compilers/opt/hir2lir/ExpandRuntimeServices.java
> >
> >         In the baseline compiler, I add instrumentation to four
> >         functions: (1) emit_unresolved_new, (2) emit_resolved_newarray,
> >         (3) emit_unresolved_newarray, and (4) emit_multianewarray. So,
> >         at the end of each of these functions, I call
> >         the insertInitAllocSite(), which looks like this (credit to your
> >         patch here):
> >
> >            private final void insertInitAllocSite() {
> >                  asm.emitPUSH_Reg(T0);
> >                  // push the value so the lowest bit of the header word
> >         is 0, which is expected for alignment-based scanning
> >                  int value = OriginTracking.getValueFromLocation(method,
> >         biStart) << 2;
> >                  asm.emitPUSH_Imm(value);
> >                  genParameterRegisterLoad(asm, 2);
> >
> >
>  asm.emitCALL_Abs(Magic.getTocPointer().plus(Entrypoints.initAllocSiteContextInsensitiveMethod.getOffset()));
> >            }
> >
> >         Similarly, in the optimizing compiler, I add instrumentation
> >         wherever I see: (1) NEW_opcode, (2) NEW_UNRESOLVED_opcode,
> >         (3) NEWARRAY_opcode, and (4) NEWARRAY_UNRESOLVED_opcode.
> >
> >         This time, the insertInitAllocSite() looks like this:
> >
> >            private Instruction insertInitAllocSite(Instruction inst,
> >         RegisterOperand objOperand, IR ir) {
> >                RVMMethod target;
> >                Instruction callInst;
> >                target =
> Entrypoints.initAllocSiteContextInsensitiveMethod;
> >                int value =
> >         OriginTracking.getValueFromLocation(inst.position.getMethod(),
> >         inst.bcIndex) << 2;
> >                callInst = Call.create2(CALL,
> >                                          null,
> >                                          IRTools.AC(target.getOffset()),
> >                                          MethodOperand.STATIC(target),
> >                                          objOperand.copyRO(),
> >                                          IRTools.IC(value));
> >                Instruction nextInst = inst.nextInstructionInCodeOrder();
> >                inst.insertAfter(callInst);
> >                return nextInst;
> >            }
> >
> >         EntryPoints are correctly defined. At the end of the execution
> >         of the program, I print out the table of statistics and
> >         allocation sites. The issue is that, for some objects, the
> >         allocation site is reported as "MAGIC_NUMBER," which is the
> >         number I used to initialize the extra word in MiscHeader. So, I
> >         am just wondering if some objects are following a different
> >         allocation path(?) Hope I was able to provide all the relevant
> >         details.
> >
> >
> >         Regards,
> >         Shoaib.
> >
> >         On Sat, Jun 11, 2016 at 11:34 PM, Michael Bond
> >         <[email protected]
> >         <mailto:[email protected]>> wrote:
> >
> >             Hi Shoaib,
> >
> >             It's hard to tell what exactly's going on or what your code
> >             changes are. Could you please provide more detail?
> >
> >             Cheers,
> >             Mike
> >
> >
> >             On 06/11/2016 12:31 AM, Shoaib Akram wrote:
> >>             Sorry Mike. I din’t state my question clearly enough. For
> >>             some objects, the extra word in the MiscHeader I reserve
> >>             for encoding the site id is never modified. It is the same
> >>             value with what I initialized it with in MiscHeader.java.
> >>             For others it is overwritten by either the instrumentation
> >>             in the baseline or the optimizing compiler.
> >>
> >>
> >>>             On Jun 11, 2016, at 1:06 AM, Michael Bond
> >>>             <<mailto:[email protected]>
> [email protected]
> >>>             <mailto:[email protected]>> wrote:
> >>>
> >>>             Hi Shoaib,
> >>>
> >>>             This sounds like the expected behavior: the value in an
> >>>             object's MiscHeader is preserved even after GC copies it.
> >>>             Are you wanting something else to happen? (If so, try
> >>>             modifying how copying in GC works; there are method that
> >>>             you can implement/modify called "postCopyAlloc" or
> >>>             something like that to modify what's in the MiscHeader.)
> >>>
> >>>             If I'm missing the point, can you say what's the
> >>>             high-level thing you're trying to do? Maybe people on
> >>>             this list will have suggestions for what's the best way
> >>>             to do that.
> >>>
> >>>             Cheers,
> >>>             Mike
> >>>
> >>>             On 06/10/2016 01:29 PM, Shoaib Akram wrote:
> >>>>             Thanks Mike! I used the patch to encode the static
> >>>>             allocation site ids in the object header. I added
> >>>>             instrumentation code to both the baseline compiler and
> >>>>             the optimizing compiler (BaselineCompilerImpl.java and
> >>>>             opt/hir2lir/ExpandRuntimeServices.java), wherever new
> >>>>             allocations are being handled. But for some objects, the
> >>>>             allocation site id in MiscHeader at the end of the
> >>>>             execution of programs is still the same value I used
> >>>>             during initialization. I understand this happening for
> >>>>             objects in the boot space But I don't see why this is
> >>>>             happening to objects in the mature and the large space.
> >>>>             Am I missing something?
> >>>>
> >>>>             On Wed, May 25, 2016 at 4:10 AM, Michael Bond
> >>>>             <<mailto:[email protected]>
> [email protected]
> >>>>             <mailto:[email protected]>> wrote:
> >>>>
> >>>>                 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]
> >>>>>                 <mailto:[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]
> >>>>                 <mailto:[email protected]>
> >>>>
> https://lists.sourceforge.net/lists/listinfo/jikesrvm-researchers
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>             --
> >>>>             *Shoaib Akram*
> >>>>             *ELIS - Gent University*
> >>>>             *Belgium*
> >>>>
> >>>>
> >>>>
>  ------------------------------------------------------------------------------
> >>>>             What NetFlow Analyzer can do for you? Monitors network
> bandwidth and traffic
> >>>>             patterns at an interface-level. Reveals which users,
> apps, and protocols are
> >>>>             consuming the most bandwidth. Provides multi-vendor
> support for NetFlow,
> >>>>             J-Flow, sFlow and other flows. Make informed decisions
> using capacity
> >>>>             planning reports.
> https://ad.doubleclick.net/ddm/clk/305295220;132659582;e
> >>>>
> >>>>
> >>>>             _______________________________________________
> >>>>             Jikesrvm-researchers mailing list
> >>>>             [email protected]
> >>>>             <mailto:[email protected]>
> >>>>
> https://lists.sourceforge.net/lists/listinfo/jikesrvm-researchers
> >>>
> >>>
>  ------------------------------------------------------------------------------
> >>>             What NetFlow Analyzer can do for you? Monitors network
> >>>             bandwidth and traffic
> >>>             patterns at an interface-level. Reveals which users,
> >>>             apps, and protocols are
> >>>             consuming the most bandwidth. Provides multi-vendor
> >>>             support for NetFlow,
> >>>             J-Flow, sFlow and other flows. Make informed decisions
> >>>             using capacity
> >>>             planning reports.
> >>>
> https://ad.doubleclick.net/ddm/clk/305295220;132659582;e_______________________________________________
> >>>             Jikesrvm-researchers mailing list
> >>>             [email protected]
> >>>             <mailto:[email protected]>
> >>>
> https://lists.sourceforge.net/lists/listinfo/jikesrvm-researchers
> >>
> >>
> >>
> >>
>  ------------------------------------------------------------------------------
> >>             What NetFlow Analyzer can do for you? Monitors network
> bandwidth and traffic
> >>             patterns at an interface-level. Reveals which users, apps,
> and protocols are
> >>             consuming the most bandwidth. Provides multi-vendor support
> for NetFlow,
> >>             J-Flow, sFlow and other flows. Make informed decisions
> using capacity
> >>             planning reports.
> https://ad.doubleclick.net/ddm/clk/305295220;132659582;e
> >>
> >>
> >>             _______________________________________________
> >>             Jikesrvm-researchers mailing list
> >>             [email protected]
> >>             <mailto:[email protected]>
> >>
> https://lists.sourceforge.net/lists/listinfo/jikesrvm-researchers
> >
> >
> >
>  ------------------------------------------------------------------------------
> >             What NetFlow Analyzer can do for you? Monitors network
> >             bandwidth and traffic
> >             patterns at an interface-level. Reveals which users, apps,
> >             and protocols are
> >             consuming the most bandwidth. Provides multi-vendor support
> >             for NetFlow,
> >             J-Flow, sFlow and other flows. Make informed decisions using
> >             capacity
> >             planning reports.
> >             https://ad.doubleclick.net/ddm/clk/305295220;132659582;e
> >             _______________________________________________
> >             Jikesrvm-researchers mailing list
> >             [email protected]
> >             <mailto:[email protected]>
> >
> https://lists.sourceforge.net/lists/listinfo/jikesrvm-researchers
> >
> >
> >
> >
> >         --
> >         *Shoaib Akram*
> >         *ELIS - Gent University*
> >         *Belgium*
> >
> >
>  ------------------------------------------------------------------------------
> >         What NetFlow Analyzer can do for you? Monitors network bandwidth
> >         and traffic
> >         patterns at an interface-level. Reveals which users, apps, and
> >         protocols are
> >         consuming the most bandwidth. Provides multi-vendor support for
> >         NetFlow,
> >         J-Flow, sFlow and other flows. Make informed decisions using
> >         capacity
> >         planning reports.
> >         https://ad.doubleclick.net/ddm/clk/305295220;132659582;e
> >         _______________________________________________
> >         Jikesrvm-researchers mailing list
> >         [email protected]
> >         <mailto:[email protected]>
> >
> https://lists.sourceforge.net/lists/listinfo/jikesrvm-researchers
> >
> >
> >
> >
>  ------------------------------------------------------------------------------
> >     What NetFlow Analyzer can do for you? Monitors network bandwidth and
> >     traffic
> >     patterns at an interface-level. Reveals which users, apps, and
> >     protocols are
> >     consuming the most bandwidth. Provides multi-vendor support for
> NetFlow,
> >     J-Flow, sFlow and other flows. Make informed decisions using capacity
> >     planning reports.
> >     https://ad.doubleclick.net/ddm/clk/305295220;132659582;e
> >     _______________________________________________
> >     Jikesrvm-researchers mailing list
> >     [email protected]
> >     <mailto:[email protected]>
> >     https://lists.sourceforge.net/lists/listinfo/jikesrvm-researchers
> >
> >
> >
> >
> > --
> > *Shoaib Akram*
> > *ELIS - Gent University*
> > *Belgium*
> >
> >
> >
> ------------------------------------------------------------------------------
> > What NetFlow Analyzer can do for you? Monitors network bandwidth and
> traffic
> > patterns at an interface-level. Reveals which users, apps, and protocols
> are
> > consuming the most bandwidth. Provides multi-vendor support for NetFlow,
> > J-Flow, sFlow and other flows. Make informed decisions using capacity
> > planning reports.
> https://ad.doubleclick.net/ddm/clk/305295220;132659582;e
> >
> >
> >
> > _______________________________________________
> > Jikesrvm-researchers mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/jikesrvm-researchers
> >
>
>
>
> ------------------------------------------------------------------------------
> What NetFlow Analyzer can do for you? Monitors network bandwidth and
> traffic
> patterns at an interface-level. Reveals which users, apps, and protocols
> are
> consuming the most bandwidth. Provides multi-vendor support for NetFlow,
> J-Flow, sFlow and other flows. Make informed decisions using capacity
> planning reports. https://ad.doubleclick.net/ddm/clk/305295220;132659582;e
> _______________________________________________
> Jikesrvm-researchers mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/jikesrvm-researchers
>



-- 
*Shoaib Akram*
*ELIS - Gent University*
*Belgium*

------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are 
consuming the most bandwidth. Provides multi-vendor support for NetFlow, 
J-Flow, sFlow and other flows. Make informed decisions using capacity 
planning reports. https://ad.doubleclick.net/ddm/clk/305295220;132659582;e

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