@@ -527,7 +527,7 @@ impl<'a> Arbitrary<'a> for Config {
527
527
528
528
config
529
529
. wasmtime
530
- . update_module_config ( & mut config. module_config . config , u) ?;
530
+ . update_module_config ( & mut config. module_config , u) ?;
531
531
532
532
Ok ( config)
533
533
}
@@ -604,7 +604,7 @@ impl WasmtimeConfig {
604
604
/// too.
605
605
pub fn update_module_config (
606
606
& mut self ,
607
- config : & mut wasm_smith :: Config ,
607
+ config : & mut ModuleConfig ,
608
608
u : & mut Unstructured < ' _ > ,
609
609
) -> arbitrary:: Result < ( ) > {
610
610
match self . compiler_strategy {
@@ -627,10 +627,11 @@ impl WasmtimeConfig {
627
627
// at this time, so if winch is selected be sure to disable wasm
628
628
// proposals in `Config` to ensure that Winch can compile the
629
629
// module that wasm-smith generates.
630
- config. relaxed_simd_enabled = false ;
631
- config. gc_enabled = false ;
632
- config. tail_call_enabled = false ;
633
- config. reference_types_enabled = false ;
630
+ config. config . relaxed_simd_enabled = false ;
631
+ config. config . gc_enabled = false ;
632
+ config. config . tail_call_enabled = false ;
633
+ config. config . reference_types_enabled = false ;
634
+ config. function_references_enabled = false ;
634
635
635
636
// Winch's SIMD implementations require AVX and AVX2.
636
637
if self
@@ -640,7 +641,7 @@ impl WasmtimeConfig {
640
641
. codegen_flag ( "has_avx2" )
641
642
. is_some_and ( |value| value == "false" )
642
643
{
643
- config. simd_enabled = false ;
644
+ config. config . simd_enabled = false ;
644
645
}
645
646
646
647
// Tuning the following engine options is currently not supported
@@ -651,7 +652,7 @@ impl WasmtimeConfig {
651
652
}
652
653
653
654
CompilerStrategy :: CraneliftPulley => {
654
- config. threads_enabled = false ;
655
+ config. config . threads_enabled = false ;
655
656
}
656
657
}
657
658
@@ -661,7 +662,8 @@ impl WasmtimeConfig {
661
662
// and for wasm threads that will require some refactoring of the
662
663
// `LinearMemory` trait to bubble up the request that the linear memory
663
664
// not move. Otherwise that just generates a panic right now.
664
- if config. threads_enabled || matches ! ( self . strategy, InstanceAllocationStrategy :: Pooling ( _) )
665
+ if config. config . threads_enabled
666
+ || matches ! ( self . strategy, InstanceAllocationStrategy :: Pooling ( _) )
665
667
{
666
668
self . avoid_custom_unaligned_memory ( u) ?;
667
669
}
@@ -672,31 +674,38 @@ impl WasmtimeConfig {
672
674
// If the pooling allocator is used, do not allow shared memory to
673
675
// be created. FIXME: see
674
676
// https://github.com/bytecodealliance/wasmtime/issues/4244.
675
- config. threads_enabled = false ;
677
+ config. config . threads_enabled = false ;
676
678
677
679
// Ensure the pooling allocator can support the maximal size of
678
680
// memory, picking the smaller of the two to win.
679
681
let min_bytes = config
682
+ . config
680
683
. max_memory32_bytes
681
684
// memory64_bytes is a u128, but since we are taking the min
682
685
// we can truncate it down to a u64.
683
- . min ( config. max_memory64_bytes . try_into ( ) . unwrap_or ( u64:: MAX ) ) ;
686
+ . min (
687
+ config
688
+ . config
689
+ . max_memory64_bytes
690
+ . try_into ( )
691
+ . unwrap_or ( u64:: MAX ) ,
692
+ ) ;
684
693
let mut min = min_bytes. min ( pooling. max_memory_size as u64 ) ;
685
694
if let MemoryConfig :: Normal ( cfg) = & self . memory_config {
686
695
min = min. min ( cfg. memory_reservation . unwrap_or ( 0 ) ) ;
687
696
}
688
697
pooling. max_memory_size = min as usize ;
689
- config. max_memory32_bytes = min;
690
- config. max_memory64_bytes = min as u128 ;
698
+ config. config . max_memory32_bytes = min;
699
+ config. config . max_memory64_bytes = min as u128 ;
691
700
692
701
// If traps are disallowed then memories must have at least one page
693
702
// of memory so if we still are only allowing 0 pages of memory then
694
703
// increase that to one here.
695
- if config. disallow_traps {
704
+ if config. config . disallow_traps {
696
705
if pooling. max_memory_size < ( 1 << 16 ) {
697
706
pooling. max_memory_size = 1 << 16 ;
698
- config. max_memory32_bytes = 1 << 16 ;
699
- config. max_memory64_bytes = 1 << 16 ;
707
+ config. config . max_memory32_bytes = 1 << 16 ;
708
+ config. config . max_memory64_bytes = 1 << 16 ;
700
709
if let MemoryConfig :: Normal ( cfg) = & mut self . memory_config {
701
710
match & mut cfg. memory_reservation {
702
711
Some ( size) => * size = ( * size) . max ( pooling. max_memory_size as u64 ) ,
@@ -712,13 +721,13 @@ impl WasmtimeConfig {
712
721
713
722
// Don't allow too many linear memories per instance since massive
714
723
// virtual mappings can fail to get allocated.
715
- config. min_memories = config. min_memories . min ( 10 ) ;
716
- config. max_memories = config. max_memories . min ( 10 ) ;
724
+ config. config . min_memories = config . config . min_memories . min ( 10 ) ;
725
+ config. config . max_memories = config . config . max_memories . min ( 10 ) ;
717
726
718
727
// Force this pooling allocator to always be able to accommodate the
719
728
// module that may be generated.
720
- pooling. total_memories = config. max_memories as u32 ;
721
- pooling. total_tables = config. max_tables as u32 ;
729
+ pooling. total_memories = config. config . max_memories as u32 ;
730
+ pooling. total_tables = config. config . max_tables as u32 ;
722
731
}
723
732
724
733
if !self . signals_based_traps {
@@ -728,7 +737,7 @@ impl WasmtimeConfig {
728
737
// fixable with some more work on the bounds-checks side of things
729
738
// to do a full bounds check even on static memories, but that's
730
739
// left for a future PR.
731
- config. threads_enabled = false ;
740
+ config. config . threads_enabled = false ;
732
741
733
742
// Spectre-based heap mitigations require signal handlers so this
734
743
// must always be disabled if signals-based traps are disabled.
0 commit comments