--- old/src/hotspot/share/gc/g1/g1CardTableEntryClosure.hpp 2019-09-03 21:16:11.525477171 -0400 +++ new/src/hotspot/share/gc/g1/g1CardTableEntryClosure.hpp 2019-09-03 21:16:11.349467686 -0400 @@ -26,6 +26,7 @@ #define SHARE_GC_G1_G1CARDTABLEENTRYCLOSURE_HPP #include "gc/shared/cardTable.hpp" +#include "gc/shared/ptrQueue.hpp" #include "memory/allocation.hpp" // A closure class for processing card table entries. Note that we don't @@ -34,9 +35,17 @@ public: typedef CardTable::CardValue CardValue; - // Process the card whose card table entry is "card_ptr". If returns - // "false", terminate the iteration early. - virtual bool do_card_ptr(CardValue* card_ptr, uint worker_id) = 0; + // Process the card whose card table entry is "card_ptr". + virtual void do_card_ptr(CardValue* card_ptr, uint worker_id) = 0; + + // Process all the card_ptrs in node. + void apply_to_buffer(BufferNode* node, size_t buffer_size, uint worker_id) { + void** buffer = BufferNode::make_buffer_from_node(node); + for (size_t i = node->index(); i < buffer_size; ++i) { + CardValue* card_ptr = static_cast(buffer[i]); + do_card_ptr(card_ptr, worker_id); + } + } }; #endif // SHARE_GC_G1_G1CARDTABLEENTRYCLOSURE_HPP