Update wasmparser to 0.59.0 (#2013)
This commit is intended to update wasmparser to 0.59.0. This primarily includes bytecodealliance/wasm-tools#40 which is a large update to how parsing and validation works. The impact on Wasmtime is pretty small at this time, but over time I'd like to refactor the internals here to lean more heavily on that upstream wasmparser refactoring. For now, though, the intention is to get on the train of wasmparser's latest `main` branch to ensure we get bug fixes and such. As part of this update a few other crates and such were updated. This is primarily to handle the new encoding of `ref.is_null` where the type is not part of the instruction encoding any more.
This commit is contained in:
@@ -213,14 +213,12 @@ fn arbitrary_config(
|
||||
/// it'll free up new slots to start making new instances.
|
||||
fn predict_rss(wasm: &[u8]) -> Result<usize> {
|
||||
let mut prediction = 0;
|
||||
let mut reader = ModuleReader::new(wasm)?;
|
||||
while !reader.eof() {
|
||||
let section = reader.read()?;
|
||||
match section.code {
|
||||
for payload in Parser::new(0).parse_all(wasm) {
|
||||
match payload? {
|
||||
// For each declared memory we'll have to map that all in, so add in
|
||||
// the minimum amount of memory to our predicted rss.
|
||||
SectionCode::Memory => {
|
||||
for entry in section.get_memory_section_reader()? {
|
||||
Payload::MemorySection(s) => {
|
||||
for entry in s {
|
||||
let initial = entry?.limits.initial as usize;
|
||||
prediction += initial * 64 * 1024;
|
||||
}
|
||||
@@ -228,8 +226,8 @@ fn predict_rss(wasm: &[u8]) -> Result<usize> {
|
||||
|
||||
// We'll need to allocate tables and space for table elements, and
|
||||
// currently this is 3 pointers per table entry.
|
||||
SectionCode::Table => {
|
||||
for entry in section.get_table_section_reader()? {
|
||||
Payload::TableSection(s) => {
|
||||
for entry in s {
|
||||
let initial = entry?.limits.initial as usize;
|
||||
prediction += initial * 3 * mem::size_of::<usize>();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user