Skip to content

Commit 1cf1e10

Browse files
committed
post-merge fixes
1 parent b663725 commit 1cf1e10

File tree

4 files changed

+60
-13
lines changed

4 files changed

+60
-13
lines changed

crates/environ/src/component/types_builder.rs

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -536,16 +536,24 @@ impl ComponentTypesBuilder {
536536
self.add_tuple_type(TypeTuple { types, abi })
537537
}
538538

539-
fn fixed_size_list_type(&mut self, types: TypesRef<'_>, ty: &ComponentValType, size: u32) -> Result<TypeFixedSizeListIndex> {
539+
fn fixed_size_list_type(
540+
&mut self,
541+
types: TypesRef<'_>,
542+
ty: &ComponentValType,
543+
size: u32,
544+
) -> Result<TypeFixedSizeListIndex> {
540545
assert_eq!(types.id(), self.module_types.validator_id());
541546
let element = self.valtype(types, ty)?;
542547
Ok(self.new_fixed_size_list_type(element, size))
543548
}
544549

545-
pub(crate) fn new_fixed_size_list_type(&mut self, element: InterfaceType, size: u32) -> TypeFixedSizeListIndex {
550+
pub(crate) fn new_fixed_size_list_type(
551+
&mut self,
552+
element: InterfaceType,
553+
size: u32,
554+
) -> TypeFixedSizeListIndex {
546555
let element_abi = self.component_types.canonical_abi(&element);
547-
let abi = CanonicalAbiInfo::record(
548-
(0..size).into_iter().map(|_| element_abi));
556+
let abi = CanonicalAbiInfo::record((0..size).into_iter().map(|_| element_abi));
549557
self.add_fixed_size_list_type(TypeFixedSizeList { element, size, abi })
550558
}
551559

@@ -1066,7 +1074,11 @@ impl TypeInformation {
10661074
}
10671075

10681076
fn fixed_size_lists(&mut self, types: &ComponentTypesBuilder, ty: &TypeFixedSizeList) {
1069-
self.build_record((0..ty.size).into_iter().map(|_| types.type_information(&ty.element)));
1077+
self.build_record(
1078+
(0..ty.size)
1079+
.into_iter()
1080+
.map(|_| types.type_information(&ty.element)),
1081+
);
10701082
}
10711083

10721084
fn enums(&mut self, _types: &ComponentTypesBuilder, _ty: &TypeEnum) {

crates/environ/src/fact/trampoline.rs

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ use crate::component::{
1919
CanonicalAbiInfo, ComponentTypesBuilder, FLAG_MAY_ENTER, FLAG_MAY_LEAVE, FixedEncoding as FE,
2020
FlatType, InterfaceType, MAX_FLAT_ASYNC_PARAMS, MAX_FLAT_PARAMS, PREPARE_ASYNC_NO_RESULT,
2121
PREPARE_ASYNC_WITH_RESULT, StringEncoding, Transcode, TypeComponentLocalErrorContextTableIndex,
22-
TypeEnumIndex, TypeFlagsIndex, TypeFutureTableIndex, TypeListIndex, TypeOptionIndex,
23-
TypeRecordIndex, TypeResourceTableIndex, TypeResultIndex, TypeStreamTableIndex, TypeTupleIndex,
24-
TypeVariantIndex, VariantInfo,
22+
TypeEnumIndex, TypeFixedSizeListIndex, TypeFlagsIndex, TypeFutureTableIndex, TypeListIndex,
23+
TypeOptionIndex, TypeRecordIndex, TypeResourceTableIndex, TypeResultIndex,
24+
TypeStreamTableIndex, TypeTupleIndex, TypeVariantIndex, VariantInfo,
2525
};
2626
use crate::fact::signature::Signature;
2727
use crate::fact::transcode::Transcoder;
@@ -2850,10 +2850,14 @@ impl<'a, 'b> Compiler<'a, 'b> {
28502850
// TODO: subtyping
28512851
assert_eq!(src_ty.size, dst_ty.size);
28522852

2853-
let srcs = src
2854-
.record_field_srcs(self.types, (0..src_ty.size).into_iter().map(|_| src_ty.element));
2855-
let dsts = dst
2856-
.record_field_dsts(self.types, (0..dst_ty.size).into_iter().map(|_| dst_ty.element));
2853+
let srcs = src.record_field_srcs(
2854+
self.types,
2855+
(0..src_ty.size).into_iter().map(|_| src_ty.element),
2856+
);
2857+
let dsts = dst.record_field_dsts(
2858+
self.types,
2859+
(0..dst_ty.size).into_iter().map(|_| dst_ty.element),
2860+
);
28572861
for (src, dst) in srcs.zip(dsts) {
28582862
self.translate(&src_ty.element, &src, &dst_ty.element, &dst);
28592863
}

crates/wasmtime/src/config.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1166,8 +1166,9 @@ impl Config {
11661166
#[cfg(feature = "component-model")]
11671167
pub fn wasm_component_model_fixed_size_lists(&mut self, enable: bool) -> &mut Self {
11681168
self.wasm_feature(WasmFeatures::CM_FIXED_SIZE_LIST, enable);
1169+
self
11691170
}
1170-
1171+
11711172
/// This corresponds to the 📝 emoji in the component model specification.
11721173
///
11731174
/// Please note that Wasmtime's support for this feature is _very_

crates/wasmtime/src/engine/serialization.rs

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,37 @@ impl Metadata<'_> {
208208
let engine_target = engine.target();
209209
let module_target =
210210
target_lexicon::Triple::from_str(&self.target).map_err(|e| anyhow!(e))?;
211+
212+
if module_target.architecture != engine_target.architecture {
213+
bail!(
214+
"Module was compiled for architecture '{}'",
215+
module_target.architecture
216+
);
217+
}
218+
219+
if module_target.operating_system != engine_target.operating_system {
220+
bail!(
221+
"Module was compiled for operating system '{}'",
222+
module_target.operating_system
223+
);
224+
}
225+
226+
Ok(())
227+
}
228+
229+
fn check_shared_flags(&mut self, engine: &Engine) -> Result<()> {
230+
for (name, val) in self.shared_flags.iter() {
231+
engine
232+
.check_compatible_with_shared_flag(name, val)
233+
.map_err(|s| anyhow::Error::msg(s))
234+
.context("compilation settings of module incompatible with native host")?;
235+
}
236+
Ok(())
237+
}
238+
239+
fn check_isa_flags(&mut self, engine: &Engine) -> Result<()> {
211240
for (name, val) in self.isa_flags.iter() {
241+
engine
212242
.check_compatible_with_isa_flag(name, val)
213243
.map_err(|s| anyhow::Error::msg(s))
214244
.context("compilation settings of module incompatible with native host")?;

0 commit comments

Comments
 (0)