mirror of
https://github.com/pezkuwichain/revive.git
synced 2026-06-16 05:01:07 +00:00
internalize runtime API function symbols
Signed-off-by: xermicus <cyrill@parity.io>
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
use crate::polkavm::context::Context;
|
||||
use crate::polkavm::Dependency;
|
||||
use crate::polkavm_const::runtime_api;
|
||||
|
||||
/// Translates the `sha3` instruction.
|
||||
pub fn sha3<'ctx, D>(
|
||||
@@ -28,20 +29,14 @@ where
|
||||
"output_pointer_casted",
|
||||
)?;
|
||||
|
||||
let function = context
|
||||
.module()
|
||||
.get_function("hash_keccak_256")
|
||||
.expect("is declared");
|
||||
|
||||
context.builder().build_call(
|
||||
function,
|
||||
context.build_runtime_call(
|
||||
runtime_api::HASH_KECCAK_256,
|
||||
&[
|
||||
input_pointer_casted.into(),
|
||||
length_casted.into(),
|
||||
output_pointer_casted.into(),
|
||||
],
|
||||
"call_seal_hash_keccak_256",
|
||||
)?;
|
||||
);
|
||||
|
||||
Ok(context.build_byte_swap(context.build_load(output_pointer, "sha3_output")?))
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ use inkwell::values::BasicValue;
|
||||
|
||||
use crate::polkavm::context::Context;
|
||||
use crate::polkavm::Dependency;
|
||||
use crate::polkavm_const::runtime_api;
|
||||
|
||||
/// Translates the `gas` instruction.
|
||||
pub fn gas<'ctx, D>(
|
||||
@@ -43,17 +44,13 @@ where
|
||||
),
|
||||
)?;
|
||||
|
||||
context.builder().build_call(
|
||||
context
|
||||
.module()
|
||||
.get_function("value_transferred")
|
||||
.expect("is declared"),
|
||||
context.build_runtime_call(
|
||||
runtime_api::VALUE_TRANSFERRED,
|
||||
&[
|
||||
output_pointer_casted.into(),
|
||||
output_length_pointer_casted.into(),
|
||||
],
|
||||
"call_seal_value_transferred",
|
||||
)?;
|
||||
);
|
||||
|
||||
let value = context.build_load(output_pointer, "transferred_value")?;
|
||||
let value_extended = context.builder().build_int_z_extend(
|
||||
|
||||
Reference in New Issue
Block a user