United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: 6868051 (SA) FreeChunk support for compressed oops is broken
6868051 : (SA) FreeChunk support for compressed oops is broken

Details
Type:
Bug
Submit Date:
2009-08-03
Status:
Closed
Updated Date:
2010-04-02
Project Name:
JDK
Resolved Date:
2010-01-15
Component:
hotspot
OS:
solaris_9
Sub-Component:
svc
CPU:
sparc
Priority:
P3
Resolution:
Fixed
Affected Versions:
hs16
Fixed Versions:
hs16

Related Reports
Backport:
Backport:

Sub Tasks

Description
The code for parsing FreeChunks when compressed oops is enabled is broken.  It's got the wrong level of indirection so it will always throw an exception.

Error: sun.jvm.hotspot.debugger.UnalignedAddressException: Trying to read at address: 0x0000000000000001 with alignment: 8
sun.jvm.hotspot.debugger.UnalignedAddressException: Trying to read at address: 0x0000000000000001 with alignment: 8   
        at sun.jvm.hotspot.debugger.DebuggerUtilities.checkAlignment(DebuggerUtilities.java:57)
        at sun.jvm.hotspot.debugger.proc.ProcDebuggerLocal.readCInteger(ProcDebuggerLocal.java:316)
        at sun.jvm.hotspot.debugger.proc.ProcAddress.getCIntegerAt(ProcAddress.java:68)
        at sun.jvm.hotspot.types.basic.BasicField.getCInteger(BasicField.java:162)
        at sun.jvm.hotspot.types.basic.BasicCIntegerField.getValue(BasicCIntegerField.java:54)
        at sun.jvm.hotspot.oops.Mark.value(Mark.java:138)
        at sun.jvm.hotspot.oops.Mark.isUnlocked(Mark.java:172)
        at sun.jvm.hotspot.oops.Mark.isCmsFreeChunk(Mark.java:306)
        at sun.jvm.hotspot.memory.FreeChunk.isFree(FreeChunk.java:87)
        at sun.jvm.hotspot.memory.FreeChunk.indicatesFreeChunk(FreeChunk.java:81)
        at sun.jvm.hotspot.memory.CompactibleFreeListSpace.getLiveRegions(CompactibleFreeListSpace.java:192)
        at sun.jvm.hotspot.oops.ObjectHeap$LiveRegionsCollector.doSpace(ObjectHeap.java:554)
        at sun.jvm.hotspot.memory.ConcurrentMarkSweepGeneration.spaceIterate(ConcurrentMarkSweepGeneration.java:66)   
        at sun.jvm.hotspot.oops.ObjectHeap.collectLiveRegions(ObjectHeap.java:579)
        at sun.jvm.hotspot.oops.ObjectHeap.iterateRaw(ObjectHeap.java:284)
        at sun.jvm.hotspot.CommandProcessor$26.doit(CommandProcessor.java:897)
        at sun.jvm.hotspot.CommandProcessor.executeCommand(CommandProcessor.java:1265)
        at sun.jvm.hotspot.CommandProcessor.executeCommand(CommandProcessor.java:1235)
        at sun.jvm.hotspot.CommandProcessor.run(CommandProcessor.java:1138)
        at sun.jvm.hotspot.CLHSDB.run(CLHSDB.java:91)
        at sun.jvm.hotspot.CLHSDB.main(CLHSDB.java:35)

                                    

Comments
EVALUATION

http://hg.openjdk.java.net/jdk7/hotspot-gc/hotspot/rev/ef671fb22f73
                                     
2009-08-10
EVALUATION

http://hg.openjdk.java.net/jdk7/hotspot-comp/hotspot/rev/ef671fb22f73
                                     
2009-08-06
SUGGESTED FIX

diff --git a/agent/src/share/classes/sun/jvm/hotspot/memory/FreeChunk.java b/agent/src/share/classes/sun/jvm/hotspot/memory/FreeChunk.java
--- a/agent/src/share/classes/sun/jvm/hotspot/memory/FreeChunk.java
+++ b/agent/src/share/classes/sun/jvm/hotspot/memory/FreeChunk.java
@@ -63,7 +63,7 @@ public class FreeChunk extends VMObject 
 
    public long size() {
       if (VM.getVM().isCompressedOopsEnabled()) {
-        Mark mark = new Mark(sizeField.getValue(addr));
+        Mark mark = new Mark(addr.addOffsetTo(sizeField.getOffset()));
         return mark.getSize();
       } else {
         Address size = sizeField.getValue(addr);
@@ -83,7 +83,7 @@ public class FreeChunk extends VMObject 
 
    public boolean isFree() {
       if (VM.getVM().isCompressedOopsEnabled()) {
-        Mark mark = new Mark(sizeField.getValue(addr));
+        Mark mark = new Mark(addr.addOffsetTo(sizeField.getOffset()));
         return mark.isCmsFreeChunk();
       } else {
         Address prev = prevField.getValue(addr);
                                     
2009-08-03
EVALUATION

it's loading the value instead of passing the address to Mark where it will actually be loaded.
                                     
2009-08-03



Hardware and Software, Engineered to Work Together