Skip to content

Commit 6dae7eb

Browse files
authored
Enable warnings if cache is disabled (bytecodealliance#10140)
Continuation of work in bytecodealliance#10131
1 parent cfef9fb commit 6dae7eb

File tree

2 files changed

+10
-12
lines changed

2 files changed

+10
-12
lines changed

crates/wasmtime/src/compile/runtime.rs

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
use crate::compile::HashedEngineCompileEnv;
21
#[cfg(feature = "component-model")]
32
use crate::component::Component;
43
use crate::prelude::*;
54
use crate::runtime::vm::MmapVec;
65
use crate::{CodeBuilder, CodeMemory, Engine, Module};
76
use object::write::WritableBuffer;
87
use std::sync::Arc;
9-
use wasmtime_environ::{FinishedObject, ObjectBuilder, ObjectKind};
8+
use wasmtime_environ::{FinishedObject, ObjectBuilder};
109

1110
impl<'a> CodeBuilder<'a> {
1211
fn compile_cached<T, S>(
@@ -29,7 +28,7 @@ impl<'a> CodeBuilder<'a> {
2928
#[cfg(feature = "cache")]
3029
{
3130
let state = (
32-
HashedEngineCompileEnv(self.engine),
31+
crate::compile::HashedEngineCompileEnv(self.engine),
3332
&wasm,
3433
&dwarf_package,
3534
// Don't hash this as it's just its own "pure" function pointer.
@@ -61,15 +60,21 @@ impl<'a> CodeBuilder<'a> {
6160
// Cache hit, deserialize the provided artifacts
6261
|(engine, wasm, _, _, _), serialized_bytes| {
6362
let kind = if wasmparser::Parser::is_component(&wasm) {
64-
ObjectKind::Component
63+
wasmtime_environ::ObjectKind::Component
6564
} else {
66-
ObjectKind::Module
65+
wasmtime_environ::ObjectKind::Module
6766
};
6867
let code = engine.0.load_code_bytes(&serialized_bytes, kind).ok()?;
6968
Some((code, None))
7069
},
7170
)?;
7271
return Ok((code, info_and_types));
72+
73+
struct NotHashed<T>(T);
74+
75+
impl<T> std::hash::Hash for NotHashed<T> {
76+
fn hash<H: std::hash::Hasher>(&self, _hasher: &mut H) {}
77+
}
7378
}
7479

7580
#[cfg(not(feature = "cache"))]
@@ -79,12 +84,6 @@ impl<'a> CodeBuilder<'a> {
7984
let code = publish_mmap(self.engine, mmap.0)?;
8085
return Ok((code, info_and_types));
8186
}
82-
83-
struct NotHashed<T>(T);
84-
85-
impl<T> std::hash::Hash for NotHashed<T> {
86-
fn hash<H: std::hash::Hasher>(&self, _hasher: &mut H) {}
87-
}
8887
}
8988

9089
/// Same as [`CodeBuilder::compile_module_serialized`] except that a

crates/wasmtime/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,6 @@
286286
#![cfg_attr(
287287
any(
288288
not(feature = "async"),
289-
not(feature = "cache"),
290289
not(feature = "gc"),
291290
not(feature = "gc-drc"),
292291
not(feature = "gc-null"),

0 commit comments

Comments
 (0)