src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/PointerFinder.java
changeset 54955 46409371a691
parent 48787 7638bf98a312
--- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/PointerFinder.java	Tue May 21 00:52:04 2019 -0700
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/PointerFinder.java	Tue May 21 10:34:57 2019 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2019, 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
@@ -56,7 +56,9 @@
 
         if (VM.getVM().getUseTLAB()) {
           // Try to find thread containing it
-          for (JavaThread t = VM.getVM().getThreads().first(); t != null; t = t.next()) {
+          Threads threads = VM.getVM().getThreads();
+          for (int i = 0; i < threads.getNumberOfThreads(); i++) {
+            JavaThread t = threads.getJavaThreadAt(i);
             ThreadLocalAllocBuffer tlab = t.tlab();
             if (tlab.contains(a)) {
               loc.inTLAB = true;
@@ -125,7 +127,9 @@
       return loc;
     }
     // Look in thread-local handles
-    for (JavaThread t = VM.getVM().getThreads().first(); t != null; t = t.next()) {
+    Threads threads = VM.getVM().getThreads();
+    for (int i = 0; i < threads.getNumberOfThreads(); i++) {
+      JavaThread t = threads.getJavaThreadAt(i);
       JNIHandleBlock handleBlock = t.activeHandles();
       if (handleBlock != null) {
         handleBlock = handleBlock.blockContainingHandle(a);