Remove the Paged memory initialization variant (#4046)
* Remove the `Paged` memory initialization variant This commit simplifies the `MemoryInitialization` enum by removing the `Paged` variant. The `Paged` variant was originally added for uffd, but that support has now been removed in #4040. This is no longer necessary but is still used as an intermediate step of becoming a `Static` variant of initialized memory (which copy-on-write uses). As a result this commit largely modifies the static initialization of memory steps and folds the two methods together. * Apply suggestions from code review Co-authored-by: Peter Huene <peter@huene.dev> Co-authored-by: Peter Huene <peter@huene.dev>
This commit is contained in:
@@ -179,13 +179,12 @@ pub fn finish_compile(
|
||||
SectionKind::ReadOnlyData,
|
||||
);
|
||||
let mut total_data_len = 0;
|
||||
for data in data {
|
||||
let offset = obj.append_section_data(data_id, &data, data_align.unwrap_or(1));
|
||||
// All data segments are expected to be adjacent to one another, and
|
||||
// with a higher alignment each data segment needs to be individually
|
||||
// aligned to make this so, so assert that the offset this was placed at
|
||||
// is always against the previous segment.
|
||||
assert_eq!(offset as usize, total_data_len);
|
||||
for (i, data) in data.iter().enumerate() {
|
||||
// The first data segment has its alignment specified as the alignment
|
||||
// for the entire section, but everything afterwards is adjacent so it
|
||||
// has alignment of 1.
|
||||
let align = if i == 0 { data_align.unwrap_or(1) } else { 1 };
|
||||
obj.append_section_data(data_id, data, align);
|
||||
total_data_len += data.len();
|
||||
}
|
||||
for data in passive_data.iter() {
|
||||
|
||||
Reference in New Issue
Block a user