File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -55,7 +55,7 @@ pub(crate) fn convert_module_data(
5555 global_types : & [ WasmType ] ,
5656) -> Result < tinywasm_types:: Data > {
5757 Ok ( tinywasm_types:: Data {
58- data : data. data . to_vec ( ) . into_boxed_slice ( ) ,
58+ data : data. data . into ( ) ,
5959 range : data. range ,
6060 kind : match data. kind {
6161 wasmparser:: DataKind :: Active { memory_index, offset_expr } => {
Original file line number Diff line number Diff line change 1- use alloc :: vec :: Vec ;
1+ use tinywasm_types :: Shared ;
22
33/// A WebAssembly Data Instance
44///
55/// See <https://webassembly.github.io/spec/core/exec/runtime.html#data-instances>
66#[ cfg_attr( feature = "debug" , derive( Debug ) ) ]
77pub ( crate ) struct DataInstance {
8- pub ( crate ) data : Option < Vec < u8 > > ,
8+ pub ( crate ) data : Option < Shared < [ u8 ] > > ,
99}
1010
1111impl DataInstance {
Original file line number Diff line number Diff line change @@ -747,7 +747,7 @@ impl Store {
747747 }
748748 }
749749 }
750- tinywasm_types:: DataKind :: Passive => Some ( data. data . to_vec ( ) ) ,
750+ tinywasm_types:: DataKind :: Passive => Some ( data. data . clone ( ) ) ,
751751 } ;
752752
753753 self . state . data . push ( DataInstance { data : data_val } ) ;
Original file line number Diff line number Diff line change @@ -750,7 +750,7 @@ impl From<&ImportKind> for ExternalKind {
750750#[ cfg_attr( feature = "debug" , derive( Debug ) ) ]
751751#[ cfg_attr( feature = "archive" , derive( serde:: Serialize , serde:: Deserialize ) ) ]
752752pub struct Data {
753- pub data : Box < [ u8 ] > ,
753+ pub data : Shared < [ u8 ] > ,
754754 pub range : Range < u64 > ,
755755 pub kind : DataKind ,
756756}
You can’t perform that action at this time.
0 commit comments