Get spectests passing with compiler-cranelift with hacks

This commit is contained in:
Mark McCaskey
2021-02-10 11:20:47 -08:00
parent 6e3f835db8
commit 1d3ee22991
10 changed files with 286 additions and 69 deletions

View File

@@ -97,18 +97,9 @@ impl Table {
/// Returns an error if the `delta` is out of bounds for the table.
pub fn grow(&self, delta: u32, init: Val) -> Result<u32, RuntimeError> {
let item = init.into_table_reference(&self.store)?;
match self.table.grow(delta) {
Some(len) => {
for i in 0..delta {
set_table_item(self.table.as_ref(), len + i, item.clone())?;
}
Ok(len)
}
None => Err(RuntimeError::new(format!(
"failed to grow table by `{}`",
delta
))),
}
self.table
.grow(delta, item)
.ok_or_else(|| RuntimeError::new(format!("failed to grow table by `{}`", delta)))
}
/// Copies the `len` elements of `src_table` starting at `src_index`