Skip to content

Commit

Permalink
fix bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
vaivaswatha committed Feb 14, 2025
1 parent 269c3cc commit 4129d3d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
6 changes: 3 additions & 3 deletions sway-core/src/asm_generation/fuel/fuel_asm_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 1 addition & 3 deletions sway-core/src/ir_generation/const_eval.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 4129d3d

Please sign in to comment.