# HG changeset patch # User ysuenaga # Date 1502327315 14400 # Node ID 6eb16341d52b2cb9cb15241b5888fc599c22baec # Parent 0405d7196df4b55f3eef4732ae0bebe153cccbcd 8186018: SA: Monitor Cache Dump in HSDB does not work Reviewed-by: dholmes, dcubed diff -r 0405d7196df4 -r 6eb16341d52b hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/ObjectSynchronizer.java --- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/ObjectSynchronizer.java Wed Aug 09 23:19:43 2017 +0000 +++ b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/ObjectSynchronizer.java Wed Aug 09 21:08:35 2017 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -108,13 +108,16 @@ public Object next() { Address addr; - if (index > 0) { - addr = blockAddr.addOffsetTo(index*objectMonitorTypeSize); - } else { + if (index == 0) { + // advance to next block blockAddr = block.freeNext(); + if (blockAddr == null) { + throw new NoSuchElementException(); + } + block = new ObjectMonitor(blockAddr); index = blockSize - 1; - addr = blockAddr.addOffsetTo(index*objectMonitorTypeSize); } + addr = blockAddr.addOffsetTo(index*objectMonitorTypeSize); index --; return new ObjectMonitor(addr); }