src/hotspot/share/gc/g1/sparsePRT.cpp
branchdatagramsocketimpl-branch
changeset 58678 9cf78a70fa4f
parent 52716 877dd2b0f36c
child 58679 9c3209ff7550
--- a/src/hotspot/share/gc/g1/sparsePRT.cpp	Thu Oct 17 20:27:44 2019 +0100
+++ b/src/hotspot/share/gc/g1/sparsePRT.cpp	Thu Oct 17 20:53:35 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 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
@@ -104,14 +104,8 @@
 }
 
 RSHashTable::~RSHashTable() {
-  if (_entries != NULL) {
-    FREE_C_HEAP_ARRAY(SparsePRTEntry, _entries);
-    _entries = NULL;
-  }
-  if (_buckets != NULL) {
-    FREE_C_HEAP_ARRAY(int, _buckets);
-    _buckets = NULL;
-  }
+  FREE_C_HEAP_ARRAY(SparsePRTEntry, _entries);
+  FREE_C_HEAP_ARRAY(int, _buckets);
 }
 
 void RSHashTable::clear() {
@@ -275,6 +269,19 @@
   return false;
 }
 
+bool RSHashTableBucketIter::has_next(SparsePRTEntry*& entry) {
+  while (_bl_ind == RSHashTable::NullEntry)  {
+    if (_tbl_ind == (int)_rsht->capacity() - 1) {
+      return false;
+    }
+    _tbl_ind++;
+    _bl_ind = _rsht->_buckets[_tbl_ind];
+  }
+  entry = _rsht->entry(_bl_ind);
+  _bl_ind = entry->next_index();
+  return true;
+}
+
 bool RSHashTable::contains_card(RegionIdx_t region_index, CardIdx_t card_index) const {
   SparsePRTEntry* e = get_entry(region_index);
   return (e != NULL && e->contains_card(card_index));