United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-7043987 JVMTI FollowReferences is slow
JDK-7043987 : JVMTI FollowReferences is slow

Details
Type:
Enhancement
Submit Date:
2011-05-11
Status:
Closed
Updated Date:
2013-06-22
Project Name:
JDK
Resolved Date:
2011-09-30
Component:
hotspot
OS:
generic
Sub-Component:
jvmti
CPU:
generic
Priority:
P3
Resolution:
Fixed
Affected Versions:
hs21
Fixed Versions:
hs22 (b02)

Related Reports
Backport:
Backport:
Backport:
Backport:
Backport:
Backport:
Backport:
Relates:

Sub Tasks

Description
A performance issue with the Hotspot implementation of FollowReferences causes
it to be 10x slower than JROckit.

There is an unnecessary reset of a "visited" flag on Java heap objects.
The flag is reset even when no objects are ever marked as visited.

See attached patch file and diffs for a suggested fix.

                                    

Comments
EVALUATION

The attached patch actually contains two changes:

- removes unnecessary reset of a "visited" flag on Java heap objects
- calls collect_stack_roots() before collect_simple_roots()

Ashok and I have been refining the two optimizations, running tests
and trying to characterize the results.
                                     
2011-06-23
EVALUATION

This bug will be used to handle the:

- removes unnecessary reset of a "visited" flag on Java heap objects

optimization.

The other optimization:

- calls collect_stack_roots() before collect_simple_roots()

will be handled by the following bug:

    6951623 3/3 possible performance problems in FollowReferences()
                and GetObjectsWithTags()
                                     
2011-06-23
SUGGESTED FIX

Minor rename done during code review round 0:

$ diff -c src/share/vm/prims/jvmtiTagMap.cpp{.cr0,}
*** src/share/vm/prims/jvmtiTagMap.cpp.cr0      Thu Jun 23 07:49:40 2011
--- src/share/vm/prims/jvmtiTagMap.cpp  Thu Jun 23 16:07:05 2011
***************
*** 1656,1662 ****
    static inline void mark(oop o);           // mark an object
    static inline bool visited(oop o);        // check if object has been visited
  
!   static inline bool get_needs_reset()        { return _needs_reset; }
    static inline void set_needs_reset(bool v)  { _needs_reset = v; }
  };
  
--- 1656,1662 ----
    static inline void mark(oop o);           // mark an object
    static inline bool visited(oop o);        // check if object has been visited
  
!   static inline bool needs_reset()            { return _needs_reset; }
    static inline void set_needs_reset(bool v)  { _needs_reset = v; }
  };
  
***************
*** 1685,1691 ****
    // iterate over all objects and restore the mark bits to
    // their initial value
    RestoreMarksClosure blk;
!   if (get_needs_reset()) {
      Universe::heap()->object_iterate(&blk);
    } else {
      // We don't need to reset mark bits on this call, but reset the
--- 1685,1691 ----
    // iterate over all objects and restore the mark bits to
    // their initial value
    RestoreMarksClosure blk;
!   if (needs_reset()) {
      Universe::heap()->object_iterate(&blk);
    } else {
      // We don't need to reset mark bits on this call, but reset the
                                     
2011-06-27
SUGGESTED FIX

Please see the attached 7043987-webrev-cr0.tgz for
the proposed fix (code review round 0).
                                     
2011-06-23
EVALUATION

http://hg.openjdk.java.net/hsx/hotspot-rt/hotspot/rev/d425748f2203
                                     
2011-06-24
EVALUATION

http://hg.openjdk.java.net/hsx/hotspot-main/hotspot/rev/d425748f2203
                                     
2011-07-27
EVALUATION

See main CR
                                     
2011-09-14



Hardware and Software, Engineered to Work Together