change getters to register version (#138)

This commit is contained in:
Cyrill Leutwiler
2024-12-18 17:56:37 +01:00
committed by GitHub
parent 14a598e840
commit d299dd1a19
7 changed files with 409 additions and 413 deletions
+11 -10
View File
@@ -16,19 +16,20 @@ where
Some(address) => address,
None => super::context::address(context)?.into_int_value(),
};
let address_pointer = context.build_address_argument_store(address)?;
let output_pointer = context.build_alloca_at_entry(context.word_type(), "output_pointer");
context.build_runtime_call(
revive_runtime_api::polkavm_imports::CODE_SIZE,
&[
address_pointer.to_int(context).into(),
output_pointer.to_int(context).into(),
],
);
let code_size_value = context
.build_runtime_call(
revive_runtime_api::polkavm_imports::CODE_SIZE,
&[address_pointer.to_int(context).into()],
)
.expect("the code_size syscall method should return a value")
.into_int_value();
context.build_load(output_pointer, "code_size")
Ok(context
.builder()
.build_int_z_extend(code_size_value, context.word_type(), "code_size")?
.into())
}
/// Translates the `extcodehash` instruction.