Skip to content

Commit d40239e

Browse files
authored
use MCPI for contract call address instantiation (#365)
* use MCPI for contract calls instead of MCP * merge from master
1 parent a3546cc commit d40239e

File tree

2 files changed

+57
-16
lines changed

2 files changed

+57
-16
lines changed

Cargo.lock

Lines changed: 55 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

core_lang/src/asm_generation/expression/contract_call.rs

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -114,22 +114,12 @@ pub(crate) fn convert_contract_call_to_asm<'sc>(
114114
// the contract address and parameters
115115
//
116116
// first, copy the address over
117-
//
118-
// load 32 into a register
119-
let data_label = namespace.insert_data_value(&Literal::U32(32));
120-
let num32_register = register_sequencer.next();
121-
asm_buf.push(Op {
122-
opcode: Either::Left(VirtualOp::LWDataId(num32_register.clone(), data_label)),
123-
comment: "constant 32 load for call".into(),
124-
owning_span: Some(span.clone()),
125-
});
126-
127117
// write the contract addr to bytes 0-32
128118
asm_buf.push(Op {
129-
opcode: Either::Left(VirtualOp::MCP(
119+
opcode: Either::Left(VirtualOp::MCPI(
130120
ra_pointer.clone(),
131121
contract_address,
132-
num32_register,
122+
VirtualImmediate12::new_unchecked(32, "infallible constant 32"),
133123
)),
134124
comment: "copy contract address for call".into(),
135125
owning_span: Some(span.clone()),

0 commit comments

Comments
 (0)