Skip to content

Commit eb919f2

Browse files
authored
Set the unlog bits for objects in the bootimage (#1168)
1 parent b8355f8 commit eb919f2

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

Cargo.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,12 @@ mock_test = []
8888
# If a binding would need to trace/scan objects that is allocated and managed by the VM, `ActivePlan::vm_trace_object()` is an alternative.
8989
vm_space = []
9090

91+
# Bulk set unlog bits for all objects inside the VM space. A binding can use
92+
# this in case they do not have a way to iterate through objects in the
93+
# bootimage to set the unlog bit. Note that this will set the unlog bit for
94+
# addresses that may not correspond to valid objects.
95+
set_unlog_bits_vm_space = []
96+
9197
# A readonly space.
9298
# TODO: This is not properly implemented yet. We currently use an immortal space instead, and do not guarantee read-only semantics.
9399
ro_space = []

src/policy/vmspace.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ use crate::util::heap::externalpageresource::{ExternalPageResource, ExternalPage
99
use crate::util::heap::layout::vm_layout::BYTES_IN_CHUNK;
1010
use crate::util::heap::PageResource;
1111
use crate::util::metadata::mark_bit::MarkState;
12+
#[cfg(feature = "set_unlog_bits_vm_space")]
13+
use crate::util::metadata::MetadataSpec;
1214
use crate::util::opaque_pointer::*;
1315
use crate::util::ObjectReference;
1416
use crate::vm::{ObjectModel, VMBinding};
@@ -224,6 +226,15 @@ impl<VM: VMBinding> VMSpace<VM> {
224226
start: start.align_down(BYTES_IN_PAGE),
225227
end: end.align_up(BYTES_IN_PAGE),
226228
});
229+
230+
#[cfg(feature = "set_unlog_bits_vm_space")]
231+
if self.common.needs_log_bit {
232+
// Bulk set unlog bits for all addresses in the VM space. This ensures that any
233+
// modification to the bootimage is logged
234+
if let MetadataSpec::OnSide(side) = *VM::VMObjectModel::GLOBAL_LOG_BIT_SPEC {
235+
side.bset_metadata(start, size);
236+
}
237+
}
227238
}
228239

229240
pub fn prepare(&mut self) {

0 commit comments

Comments
 (0)