Skip to content

Commit b567cc4

Browse files
wkscaizixian
andauthored
Stop using the name "ForwardingWord" (#976)
The name is likely inherited from JikesRVM. But since we changed its name, we should just use the module name "object_forwarding" directly. This cleans up some naming issues, and prepares for subsequent refactoring that intends to change the logic of object forwarding in ImmixSpace. At that time, I intend to fix this naming issue anyway. Co-authored-by: Zixian Cai <2891235+caizixian@users.noreply.github.com>
1 parent 29e37b8 commit b567cc4

File tree

2 files changed

+11
-12
lines changed

2 files changed

+11
-12
lines changed

src/policy/immix/immixspace.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use crate::util::metadata::side_metadata::SideMetadataSpec;
1616
#[cfg(feature = "vo_bit")]
1717
use crate::util::metadata::vo_bit;
1818
use crate::util::metadata::{self, MetadataSpec};
19-
use crate::util::object_forwarding as ForwardingWord;
19+
use crate::util::object_forwarding;
2020
use crate::util::{Address, ObjectReference};
2121
use crate::vm::*;
2222
use crate::{
@@ -91,8 +91,8 @@ impl<VM: VMBinding> SFT for ImmixSpace<VM> {
9191
return None;
9292
}
9393

94-
if ForwardingWord::is_forwarded::<VM>(object) {
95-
Some(ForwardingWord::read_forwarding_pointer::<VM>(object))
94+
if object_forwarding::is_forwarded::<VM>(object) {
95+
Some(object_forwarding::read_forwarding_pointer::<VM>(object))
9696
} else {
9797
None
9898
}
@@ -110,7 +110,7 @@ impl<VM: VMBinding> SFT for ImmixSpace<VM> {
110110
}
111111

112112
// If the object is forwarded, it is live, too.
113-
ForwardingWord::is_forwarded::<VM>(object)
113+
object_forwarding::is_forwarded::<VM>(object)
114114
}
115115
#[cfg(feature = "object_pinning")]
116116
fn pin_object(&self, object: ObjectReference) -> bool {
@@ -581,14 +581,14 @@ impl<VM: VMBinding> ImmixSpace<VM> {
581581
#[cfg(feature = "vo_bit")]
582582
vo_bit::helper::on_trace_object::<VM>(object);
583583

584-
let forwarding_status = ForwardingWord::attempt_to_forward::<VM>(object);
585-
if ForwardingWord::state_is_forwarded_or_being_forwarded(forwarding_status) {
584+
let forwarding_status = object_forwarding::attempt_to_forward::<VM>(object);
585+
if object_forwarding::state_is_forwarded_or_being_forwarded(forwarding_status) {
586586
// We lost the forwarding race as some other thread has set the forwarding word; wait
587587
// until the object has been forwarded by the winner. Note that the object may not
588588
// necessarily get forwarded since Immix opportunistically moves objects.
589589
#[allow(clippy::let_and_return)]
590590
let new_object =
591-
ForwardingWord::spin_and_get_forwarded_object::<VM>(object, forwarding_status);
591+
object_forwarding::spin_and_get_forwarded_object::<VM>(object, forwarding_status);
592592
#[cfg(debug_assertions)]
593593
{
594594
if new_object == object {
@@ -611,7 +611,7 @@ impl<VM: VMBinding> ImmixSpace<VM> {
611611
} else if self.is_marked(object) {
612612
// We won the forwarding race but the object is already marked so we clear the
613613
// forwarding status and return the unmoved object
614-
ForwardingWord::clear_forwarding_bits::<VM>(object);
614+
object_forwarding::clear_forwarding_bits::<VM>(object);
615615
object
616616
} else {
617617
// We won the forwarding race; actually forward and copy the object if it is not pinned
@@ -620,7 +620,7 @@ impl<VM: VMBinding> ImmixSpace<VM> {
620620
|| (!nursery_collection && self.defrag.space_exhausted())
621621
{
622622
self.attempt_mark(object, self.mark_state);
623-
ForwardingWord::clear_forwarding_bits::<VM>(object);
623+
object_forwarding::clear_forwarding_bits::<VM>(object);
624624
Block::containing::<VM>(object).set_state(BlockState::Marked);
625625

626626
#[cfg(feature = "vo_bit")]
@@ -634,7 +634,7 @@ impl<VM: VMBinding> ImmixSpace<VM> {
634634
// Clippy complains if the "vo_bit" feature is not enabled.
635635
#[allow(clippy::let_and_return)]
636636
let new_object =
637-
ForwardingWord::forward_object::<VM>(object, semantics, copy_context);
637+
object_forwarding::forward_object::<VM>(object, semantics, copy_context);
638638

639639
#[cfg(feature = "vo_bit")]
640640
vo_bit::helper::on_object_forwarded::<VM>(new_object);

src/util/object_forwarding.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
use crate::util::copy::*;
22
use crate::util::metadata::MetadataSpec;
3-
/// https://github.com/JikesRVM/JikesRVM/blob/master/MMTk/src/org/mmtk/utility/ForwardingWord.java
43
use crate::util::{constants, ObjectReference};
54
use crate::vm::ObjectModel;
65
use crate::vm::VMBinding;
@@ -174,7 +173,7 @@ pub fn write_forwarding_pointer<VM: VMBinding>(
174173
get_forwarding_status::<VM>(object),
175174
);
176175

177-
trace!("GCForwardingWord::write({:#?}, {:x})\n", object, new_object);
176+
trace!("write_forwarding_pointer({}, {})", object, new_object);
178177
VM::VMObjectModel::LOCAL_FORWARDING_POINTER_SPEC.store_atomic::<VM, usize>(
179178
object,
180179
new_object.to_raw_address().as_usize(),

0 commit comments

Comments
 (0)