From 4129d3d2bde00286c22ce46e3dfd73f92c4c2fda Mon Sep 17 00:00:00 2001 From: Vaivaswatha Nagaraj Date: Fri, 14 Feb 2025 16:28:40 +0530 Subject: [PATCH] fix bugs --- sway-core/src/asm_generation/fuel/fuel_asm_builder.rs | 6 +++--- sway-core/src/ir_generation/const_eval.rs | 4 +--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/sway-core/src/asm_generation/fuel/fuel_asm_builder.rs b/sway-core/src/asm_generation/fuel/fuel_asm_builder.rs index d21462b3e9a..c92fa12a841 100644 --- a/sway-core/src/asm_generation/fuel/fuel_asm_builder.rs +++ b/sway-core/src/asm_generation/fuel/fuel_asm_builder.rs @@ -1273,11 +1273,11 @@ impl<'ir, 'eng> FuelAsmBuilder<'ir, 'eng> { ); let data_id = self.data_section.insert_data_value(entry); - // Allocate a register for it, and a load instruction. + // Allocate a register for it, and an address_of instruction. let reg = self.reg_seqr.next(); self.cur_bytecode.push(Op { - opcode: either::Either::Left(VirtualOp::LoadDataId(reg.clone(), data_id.clone())), - comment: "load constant from data section".into(), + opcode: either::Either::Left(VirtualOp::AddrDataId(reg.clone(), data_id.clone())), + comment: "constant address in data section".into(), owning_span: Some(span), }); self.reg_map.insert(*instr_val, reg); diff --git a/sway-core/src/ir_generation/const_eval.rs b/sway-core/src/ir_generation/const_eval.rs index 52775a4f923..0a9478768c3 100644 --- a/sway-core/src/ir_generation/const_eval.rs +++ b/sway-core/src/ir_generation/const_eval.rs @@ -171,9 +171,7 @@ pub(crate) fn compile_const_decl( .expect("Must have been compiled to a constant"); let c_ty = const_val_c.get_content(env.context).ty; - let c_ty_ptr = Type::new_ptr(env.context, c_ty); - let const_global = - GlobalVar::new(env.context, c_ty_ptr, Some(const_val_c), false); + let const_global = GlobalVar::new(env.context, c_ty, Some(const_val_c), false); env.module.add_global_variable( env.context,