Skip to content

Commit b058b1b

Browse files
committed
initial
1 parent ff99e1c commit b058b1b

File tree

5 files changed

+15
-3
lines changed

5 files changed

+15
-3
lines changed

src/ir/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1435,7 +1435,7 @@ pub struct MemArg {
14351435
/// The alignment of the memory operation, must be a power of two
14361436
pub align: u32,
14371437
/// The offset of the memory operation, in bytes from the source address
1438-
pub offset: u32,
1438+
pub offset: u64,
14391439
}
14401440

14411441
/// The different kinds of atomic rmw operations

src/module/data.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,9 @@ impl Module {
225225
ConstExpr::Value(Value::I64(_)) => {}
226226
ConstExpr::Global(global)
227227
if self.globals.get(global).ty == ValType::I64 => {}
228+
// Extended const expressions are already validated
229+
// by wasmparser to produce the correct type.
230+
ConstExpr::Extended(_) => {}
228231
_ => bail!(
229232
"data {} is active for 64-bit memory but has non-i64 offset",
230233
i
@@ -235,6 +238,9 @@ impl Module {
235238
ConstExpr::Value(Value::I32(_)) => {}
236239
ConstExpr::Global(global)
237240
if self.globals.get(global).ty == ValType::I32 => {}
241+
// Extended const expressions are already validated
242+
// by wasmparser to produce the correct type.
243+
ConstExpr::Extended(_) => {}
238244
_ => bail!(
239245
"data {} is active for 32-bit memory but has non-i32 offset",
240246
i

src/module/elements.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,9 @@ impl Module {
171171
ConstExpr::Value(Value::I64(_)) => {}
172172
ConstExpr::Global(global)
173173
if self.globals.get(global).ty == ValType::I64 => {}
174+
// Extended const expressions are already validated
175+
// by wasmparser to produce the correct type.
176+
ConstExpr::Extended(_) => {}
174177
_ => bail!(
175178
"element {} is active for 64-bit table but has non-i64 offset",
176179
i
@@ -181,6 +184,9 @@ impl Module {
181184
ConstExpr::Value(Value::I32(_)) => {}
182185
ConstExpr::Global(global)
183186
if self.globals.get(global).ty == ValType::I32 => {}
187+
// Extended const expressions are already validated
188+
// by wasmparser to produce the correct type.
189+
ConstExpr::Extended(_) => {}
184190
_ => bail!(
185191
"element {} is active for 32-bit table but has non-i32 offset",
186192
i

src/module/functions/local_function/emit.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1134,7 +1134,7 @@ impl Emit<'_, '_> {
11341134
align >>= 1;
11351135
}
11361136
wasm_encoder::MemArg {
1137-
offset: offset as u64,
1137+
offset,
11381138
align: align_exponent,
11391139
memory_index,
11401140
}

src/module/functions/local_function/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ fn append_instruction(ctx: &mut ValidationContext, inst: Operator, loc: InstrLoc
328328
ctx.indices.get_memory(arg.memory).unwrap(),
329329
MemArg {
330330
align: 1 << (arg.align as i32),
331-
offset: arg.offset as u32,
331+
offset: arg.offset,
332332
},
333333
)
334334
};

0 commit comments

Comments
 (0)