124 // |
124 // |
125 // For any future collector, this code should be reexamined with |
125 // For any future collector, this code should be reexamined with |
126 // that specific collector in mind, and the documentation above suitably |
126 // that specific collector in mind, and the documentation above suitably |
127 // extended and updated. |
127 // extended and updated. |
128 void CardTableBarrierSet::on_slowpath_allocation_exit(JavaThread* thread, oop new_obj) { |
128 void CardTableBarrierSet::on_slowpath_allocation_exit(JavaThread* thread, oop new_obj) { |
129 #if defined(COMPILER2) || INCLUDE_JVMCI |
129 #if COMPILER2_OR_JVMCI |
130 if (!ReduceInitialCardMarks) { |
130 if (!ReduceInitialCardMarks) { |
131 return; |
131 return; |
132 } |
132 } |
133 // If a previous card-mark was deferred, flush it now. |
133 // If a previous card-mark was deferred, flush it now. |
134 flush_deferred_card_mark_barrier(thread); |
134 flush_deferred_card_mark_barrier(thread); |
146 } else { |
146 } else { |
147 // Do the card mark |
147 // Do the card mark |
148 invalidate(mr); |
148 invalidate(mr); |
149 } |
149 } |
150 } |
150 } |
151 #endif // COMPILER2 || JVMCI |
151 #endif // COMPILER2_OR_JVMCI |
152 } |
152 } |
153 |
153 |
154 void CardTableBarrierSet::initialize_deferred_card_mark_barriers() { |
154 void CardTableBarrierSet::initialize_deferred_card_mark_barriers() { |
155 // Used for ReduceInitialCardMarks (when COMPILER2 or JVMCI is used); |
155 // Used for ReduceInitialCardMarks (when COMPILER2 or JVMCI is used); |
156 // otherwise remains unused. |
156 // otherwise remains unused. |
157 #if defined(COMPILER2) || INCLUDE_JVMCI |
157 #if COMPILER2_OR_JVMCI |
158 _defer_initial_card_mark = is_server_compilation_mode_vm() && ReduceInitialCardMarks && can_elide_tlab_store_barriers() |
158 _defer_initial_card_mark = is_server_compilation_mode_vm() && ReduceInitialCardMarks && can_elide_tlab_store_barriers() |
159 && (DeferInitialCardMark || card_mark_must_follow_store()); |
159 && (DeferInitialCardMark || card_mark_must_follow_store()); |
160 #else |
160 #else |
161 assert(_defer_initial_card_mark == false, "Who would set it?"); |
161 assert(_defer_initial_card_mark == false, "Who would set it?"); |
162 #endif |
162 #endif |
163 } |
163 } |
164 |
164 |
165 void CardTableBarrierSet::flush_deferred_card_mark_barrier(JavaThread* thread) { |
165 void CardTableBarrierSet::flush_deferred_card_mark_barrier(JavaThread* thread) { |
166 #if defined(COMPILER2) || INCLUDE_JVMCI |
166 #if COMPILER2_OR_JVMCI |
167 MemRegion deferred = thread->deferred_card_mark(); |
167 MemRegion deferred = thread->deferred_card_mark(); |
168 if (!deferred.is_empty()) { |
168 if (!deferred.is_empty()) { |
169 assert(_defer_initial_card_mark, "Otherwise should be empty"); |
169 assert(_defer_initial_card_mark, "Otherwise should be empty"); |
170 { |
170 { |
171 // Verify that the storage points to a parsable object in heap |
171 // Verify that the storage points to a parsable object in heap |