changeset 13484:1d0c5477cf60

Merge
author dholmes
date Thu, 10 Aug 2017 01:48:41 +0000
parents 51c11afb3169 1e2ddaa6bc3a
children 68e770d1796e
files
diffstat 1 files changed, 8 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/ObjectSynchronizer.java	Thu Aug 10 00:27:34 2017 +0000
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/ObjectSynchronizer.java	Thu Aug 10 01:48:41 2017 +0000
@@ -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);
     }