File tree 1 file changed +5
-2
lines changed
src/hotspot/share/utilities
1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change 1
1
/*
2
- * Copyright (c) 2012, 2022 , Oracle and/or its affiliates. All rights reserved.
2
+ * Copyright (c) 2012, 2023 , Oracle and/or its affiliates. All rights reserved.
3
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
4
*
5
5
* This code is free software; you can redistribute it and/or modify it
@@ -228,12 +228,15 @@ class ResourceHashtableBase : public STORAGE {
228
228
void iterate (Function function) const { // lambda enabled API
229
229
Node* const * bucket = table ();
230
230
const unsigned sz = table_size ();
231
- while (bucket < bucket_at (sz)) {
231
+ int cnt = _number_of_entries;
232
+
233
+ while (cnt > 0 && bucket < bucket_at (sz)) {
232
234
Node* node = *bucket;
233
235
while (node != NULL ) {
234
236
bool cont = function (node->_key , node->_value );
235
237
if (!cont) { return ; }
236
238
node = node->_next ;
239
+ --cnt;
237
240
}
238
241
++bucket;
239
242
}
You can’t perform that action at this time.
0 commit comments