JDK-7043987 : JVMTI FollowReferences is slow
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: jvmti
  • Affected Version: hs21
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2011-05-11
  • Updated: 2013-06-22
  • Resolved: 2011-09-30
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 6 JDK 7 JDK 8 Other
6u43Fixed 7u2Fixed 8Fixed hs22Fixed
Related Reports
Relates :  
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 See main CR
14-09-2011

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

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
27-06-2011

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

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

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()
23-06-2011

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.
23-06-2011