Skip to content

Commit

Permalink
Remove comments about ObjectReference::NULL.
Browse files Browse the repository at this point in the history
There were a few comments that still mentioned null ObjectReference.
They have been removed.
  • Loading branch information
wks committed Apr 27, 2024
1 parent edd0d0a commit 3474c98
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/plan/global.rs
Original file line number Diff line number Diff line change
Expand Up @@ -691,7 +691,7 @@ pub trait PlanTraceObject<VM: VMBinding> {
///
/// Arguments:
/// * `trace`: the current transitive closure
/// * `object`: the object to trace. This is a non-nullable object reference.
/// * `object`: the object to trace.
/// * `worker`: the GC worker that is tracing this object.
fn trace_object<Q: ObjectQueue, const KIND: TraceKind>(
&self,
Expand Down
6 changes: 3 additions & 3 deletions src/util/reference_processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ impl ReferenceProcessor {
// This is the end of a GC. We do some assertions here to make sure our reference tables are correct.
#[cfg(debug_assertions)]
{
// For references in the table, the reference needs to be valid, and if the referent is not null, it should be valid as well
// For references in the table, the reference needs to be valid, and if the referent is not cleared, it should be valid as well
sync.references.iter().for_each(|reff| {
debug_assert!(reff.is_in_any_space::<VM>());
if let Some(referent) = VM::VMReferenceGlue::get_referent(*reff) {
Expand All @@ -269,7 +269,7 @@ impl ReferenceProcessor {
);
}
});
// For references that will be enqueue'd, the referent needs to be valid, and the referent needs to be null.
// For references that will be enqueue'd, the reference needs to be valid, and the referent needs to be cleared.
sync.enqueued_references.iter().for_each(|reff| {
debug_assert!(reff.is_in_any_space::<VM>());
let maybe_referent = VM::VMReferenceGlue::get_referent(*reff);
Expand Down Expand Up @@ -421,7 +421,7 @@ impl ReferenceProcessor {

/// Process a reference.
/// * If both the reference and the referent is alive, return the updated reference and update its referent properly.
/// * If the reference is alive, and the referent is not null but not alive, return None and the reference (with cleared referent) is enqueued.
/// * If the reference is alive, and the referent is not cleared but not alive, return None and the reference (with cleared referent) is enqueued.
/// * For other cases, return None.
///
/// If a None value is returned, the reference can be removed from the reference table. Otherwise, the updated reference should be kept
Expand Down
6 changes: 3 additions & 3 deletions src/vm/object_model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ pub trait ObjectModel<VM: VMBinding> {
/// the address that a binding gets by an allocation call ([`crate::memory_manager::alloc`]).
///
/// Arguments:
/// * `object`: The object to be queried. It should not be null.
/// * `object`: The object to be queried.
fn ref_to_object_start(object: ObjectReference) -> Address;

/// Return the header base address from an object reference. Any object header metadata
Expand All @@ -433,7 +433,7 @@ pub trait ObjectModel<VM: VMBinding> {
/// will not be called, and the binding can simply use `unreachable!()` for the method.
///
/// Arguments:
/// * `object`: The object to be queried. It should not be null.
/// * `object`: The object to be queried.
fn ref_to_header(object: ObjectReference) -> Address;

/// Return an address guaranteed to be inside the storage associated
Expand All @@ -449,7 +449,7 @@ pub trait ObjectModel<VM: VMBinding> {
/// MMTk uses this method more frequently than [`crate::vm::ObjectModel::ref_to_object_start`].
///
/// Arguments:
/// * `object`: The object to be queried. It should not be null.
/// * `object`: The object to be queried.
fn ref_to_address(object: ObjectReference) -> Address;

/// Return an object for a given address returned by `ref_to_address()`.
Expand Down
1 change: 0 additions & 1 deletion src/vm/scanning.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ impl<ES: Edge, F: FnMut(ES)> EdgeVisitor<ES> for F {
/// Callback trait of scanning functions that directly trace through edges.
pub trait ObjectTracer {
/// Call this function to trace through an object graph edge which points to `object`.
/// `object` must point to a valid object, and cannot be `ObjectReference::NULL`.
///
/// The return value is the new object reference for `object` if it is moved, or `object` if
/// not moved. If moved, the caller should update the slot that holds the reference to
Expand Down

0 comments on commit 3474c98

Please sign in to comment.