Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assume all data/element/table/memory segments needed #995

Merged
merged 1 commit into from
Oct 29, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions crates/gc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,20 +71,18 @@ fn run(config: &mut Config, module: &mut Module) {
}
}

// Pessimistically assume all passive data and table segments are
// Pessimistically assume all data and table segments are
// required
//
// TODO: this shouldn't assume this!
if let Some(section) = module.data_section() {
for entry in section.entries() {
if entry.passive() {
cx.add_data_segment(entry);
}
cx.add_data_segment(entry);
}
}
if let Some(elements) = module.elements_section() {
for seg in elements.entries() {
if seg.passive() {
cx.add_element_segment(seg);
}
cx.add_element_segment(seg);
}
}

Expand Down Expand Up @@ -526,7 +524,8 @@ impl<'a> RemapContext<'a> {
}
if let Some(s) = m.table_section() {
for i in 0..(s.entries().len() as u32) {
if analysis.tables.contains(&(i + analysis.imported_tables)) {
// TODO: should remove `|| true` here when this is better tested
if analysis.tables.contains(&(i + analysis.imported_tables)) || true {
tables.push(ntables);
ntables += 1;
} else {
Expand All @@ -537,7 +536,8 @@ impl<'a> RemapContext<'a> {
}
if let Some(s) = m.memory_section() {
for i in 0..(s.entries().len() as u32) {
if analysis.memories.contains(&(i + analysis.imported_memories)) {
// TODO: should remove `|| true` here when this is better tested
if analysis.memories.contains(&(i + analysis.imported_memories)) || true {
memories.push(nmemories);
nmemories += 1;
} else {
Expand Down