Skip to content

Commit 16f4598

Browse files
committed
change fields of global ops to improve alignment
1 parent c6ad9d7 commit 16f4598

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

crates/ir2/build/isa.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -542,8 +542,8 @@ fn add_global_ops(isa: &mut Isa) {
542542
Op::from(GenericOp::new(
543543
Ident::GlobalGet,
544544
[
545-
Field::new(Ident::Result, FieldTy::Slot),
546545
Field::new(Ident::Global, FieldTy::Global),
546+
Field::new(Ident::Result, FieldTy::Slot),
547547
],
548548
)),
549549
Op::from(GenericOp::new(
@@ -563,8 +563,8 @@ fn add_global_ops(isa: &mut Isa) {
563563
Op::from(GenericOp::new(
564564
Ident::GlobalSet64,
565565
[
566-
Field::new(Ident::Global, FieldTy::Global),
567566
Field::new(Ident::Value, FieldTy::U64),
567+
Field::new(Ident::Global, FieldTy::Global),
568568
],
569569
)),
570570
];

crates/wasmi/src/engine/translator/func/visit.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ impl<'a> VisitOperator<'a> for FuncTranslator {
403403
let global_idx = ir::index::Global::from(global_index);
404404
self.push_instr_with_result(
405405
content,
406-
|result| Op::global_get(result, global_idx),
406+
|result| Op::global_get(global_idx, result),
407407
FuelCostsProvider::instance,
408408
)?;
409409
Ok(())
@@ -430,10 +430,10 @@ impl<'a> VisitOperator<'a> for FuncTranslator {
430430
debug_assert_eq!(global_type.content(), value.ty());
431431
let global_set_instr = match global_type.content() {
432432
ValType::I32 => Op::global_set32(global, u32::from(value)),
433-
ValType::I64 => Op::global_set64(global, u64::from(value)),
433+
ValType::I64 => Op::global_set64(u64::from(value), global),
434434
ValType::F32 => Op::global_set32(global, f32::from(value).to_bits()),
435-
ValType::F64 => Op::global_set64(global, f64::from(value).to_bits()),
436-
ValType::FuncRef | ValType::ExternRef => Op::global_set64(global, u64::from(value)),
435+
ValType::F64 => Op::global_set64(f64::from(value).to_bits(), global),
436+
ValType::FuncRef | ValType::ExternRef => Op::global_set64(u64::from(value), global),
437437
ValType::V128 => {
438438
let consume_fuel = self.stack.consume_fuel_instr();
439439
let temp = self.copy_operand_to_temp(input, consume_fuel)?;

0 commit comments

Comments
 (0)