You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This PR refactors MMTk's write barrier interface.
MMTk now contains three sets of different write barrier APIs:
* **Subsuming write barrer**. The barrier replaces the store operation in VMs and does the store in Rust. Used for quick (but slow) implementation for new bindings. The barrier implementation in Rust should contain both fast-path and a call to slow-path.
* **Full pre/post write barrier**. Used for VMs (like OpenJDK) that cannot support subsuming barrier easily. The pre barrier will be called before the store operation, and the post barrier will be called after the store. The barrier implementation in Rust should contain both fast-path and a call to slow-path.
* **Barrier Slow-path**. For performance optimization, VMs may implement the store and barrier fast-path in their IR, and only call into Rust for a slow-path call.
/// The *subsuming* write barrier by MMTk. For performance reasons, a VM should implement the write barrier
164
+
/// fast-path on their side rather than just calling this function.
165
+
///
166
+
/// For a correct barrier implementation, a VM binding needs to choose one of the following options:
167
+
/// * Use subsuming barrier `object_reference_write`
168
+
/// * Use both `object_reference_write_pre` and `object_reference_write_post`, or both, if the binding has difficulty delegating the store to mmtk-core with the subsuming barrier.
169
+
/// * Implement fast-path on the VM side, and call the generic api `object_reference_slow` as barrier slow-path call.
170
+
/// * Implement fast-path on the VM side, and do a specialized slow-path call.
171
+
///
172
+
/// Arguments:
173
+
/// * `mutator`: The mutator for the current thread.
174
+
/// * `src`: The modified source object.
175
+
/// * `slot`: The location of the field to be modified.
176
+
/// * `target`: The target for the write operation.
/// The write barrier by MMTk. This is a *pre* write barrier, which we expect a binding to call
188
+
/// *before* it modifies an object. For performance reasons, a VM should implement the write barrier
189
+
/// fast-path on their side rather than just calling this function.
190
+
///
191
+
/// For a correct barrier implementation, a VM binding needs to choose one of the following options:
192
+
/// * Use subsuming barrier `object_reference_write`
193
+
/// * Use both `object_reference_write_pre` and `object_reference_write_post`, or both, if the binding has difficulty delegating the store to mmtk-core with the subsuming barrier.
194
+
/// * Implement fast-path on the VM side, and call the generic api `object_reference_slow` as barrier slow-path call.
195
+
/// * Implement fast-path on the VM side, and do a specialized slow-path call.
196
+
///
197
+
/// Arguments:
198
+
/// * `mutator`: The mutator for the current thread.
199
+
/// * `src`: The modified source object.
200
+
/// * `slot`: The location of the field to be modified.
201
+
/// * `target`: The target for the write operation.
202
+
#[inline(always)]
203
+
pubfnobject_reference_write_pre<VM:VMBinding>(
204
+
mutator:&mutMutator<VM>,
205
+
src:ObjectReference,
206
+
slot:VM::VMEdge,
207
+
target:ObjectReference,
208
+
){
209
+
mutator
210
+
.barrier()
211
+
.object_reference_write_pre(src, slot, target);
212
+
}
213
+
163
214
/// The write barrier by MMTk. This is a *post* write barrier, which we expect a binding to call
164
-
/// *after* they modify an object. For performance reasons, a VM should implement the write barrier
215
+
/// *after* it modifies an object. For performance reasons, a VM should implement the write barrier
165
216
/// fast-path on their side rather than just calling this function.
166
217
///
167
-
/// TODO: We plan to replace this API with a subsuming barrier API.
218
+
/// For a correct barrier implementation, a VM binding needs to choose one of the following options:
219
+
/// * Use subsuming barrier `object_reference_write`
220
+
/// * Use both `object_reference_write_pre` and `object_reference_write_post`, or both, if the binding has difficulty delegating the store to mmtk-core with the subsuming barrier.
221
+
/// * Implement fast-path on the VM side, and call the generic api `object_reference_slow` as barrier slow-path call.
222
+
/// * Implement fast-path on the VM side, and do a specialized slow-path call.
168
223
///
169
224
/// Arguments:
170
225
/// * `mutator`: The mutator for the current thread.
226
+
/// * `src`: The modified source object.
227
+
/// * `slot`: The location of the field to be modified.
171
228
/// * `target`: The target for the write operation.
0 commit comments