mirror of
https://github.com/pezkuwichain/revive.git
synced 2026-06-15 13:51:12 +00:00
tidy up the runtime API crate (#85)
- remove unused runtime API imports and constants - move runtime api symbols into the revive-runtime-api crate Signed-off-by: Cyrill Leutwiler <bigcyrill@hotmail.com>
This commit is contained in:
@@ -5,7 +5,6 @@ use inkwell::types::BasicType;
|
||||
use crate::polkavm::context::address_space::AddressSpace;
|
||||
use crate::polkavm::context::function::runtime;
|
||||
use crate::polkavm::context::Context;
|
||||
use crate::polkavm::r#const::*;
|
||||
use crate::polkavm::Dependency;
|
||||
use crate::polkavm::WriteLLVM;
|
||||
|
||||
@@ -19,9 +18,6 @@ impl Entry {
|
||||
/// The call flags argument index.
|
||||
pub const ARGUMENT_INDEX_CALL_FLAGS: usize = 0;
|
||||
|
||||
/// The number of mandatory arguments.
|
||||
pub const MANDATORY_ARGUMENTS_COUNT: usize = 2;
|
||||
|
||||
/// Reserve 1kb for calldata.
|
||||
pub const MAX_CALLDATA_SIZE: usize = 1024;
|
||||
|
||||
@@ -112,7 +108,7 @@ impl Entry {
|
||||
context.integer_const(crate::polkavm::XLEN, Self::MAX_CALLDATA_SIZE as u64),
|
||||
)?;
|
||||
context.build_runtime_call(
|
||||
runtime_api::imports::INPUT,
|
||||
revive_runtime_api::polkavm_imports::INPUT,
|
||||
&[input_pointer_casted.into(), length_pointer_casted.into()],
|
||||
);
|
||||
|
||||
|
||||
@@ -4,8 +4,8 @@ use crate::polkavm::context::address_space::AddressSpace;
|
||||
use crate::polkavm::context::function::runtime;
|
||||
use crate::polkavm::context::pointer::Pointer;
|
||||
use crate::polkavm::context::Context;
|
||||
use crate::polkavm::Dependency;
|
||||
use crate::polkavm::WriteLLVM;
|
||||
use crate::polkavm::{runtime_api, Dependency};
|
||||
|
||||
/// A function for requesting the immutable data from the runtime.
|
||||
/// This is a special function that is only used by the front-end generated code.
|
||||
@@ -70,7 +70,7 @@ where
|
||||
.value
|
||||
.as_pointer_value();
|
||||
context.build_runtime_call(
|
||||
runtime_api::imports::GET_IMMUTABLE_DATA,
|
||||
revive_runtime_api::polkavm_imports::GET_IMMUTABLE_DATA,
|
||||
&[
|
||||
context
|
||||
.builder()
|
||||
|
||||
@@ -26,7 +26,6 @@ use inkwell::values::BasicValue;
|
||||
|
||||
use crate::optimizer::settings::Settings as OptimizerSettings;
|
||||
use crate::optimizer::Optimizer;
|
||||
use crate::polkavm::r#const::*;
|
||||
use crate::polkavm::DebugConfig;
|
||||
use crate::polkavm::Dependency;
|
||||
use crate::target_machine::target::Target;
|
||||
@@ -136,7 +135,7 @@ where
|
||||
)
|
||||
.expect("the PolkaVM imports module should be linkable");
|
||||
|
||||
for import in runtime_api::imports::IMPORTS {
|
||||
for import in revive_runtime_api::polkavm_imports::IMPORTS {
|
||||
module
|
||||
.get_function(import)
|
||||
.expect("should be declared")
|
||||
@@ -696,7 +695,7 @@ where
|
||||
let transient = pointer.address_space == AddressSpace::TransientStorage;
|
||||
|
||||
self.build_runtime_call(
|
||||
runtime_api::imports::GET_STORAGE,
|
||||
revive_runtime_api::polkavm_imports::GET_STORAGE,
|
||||
&[
|
||||
self.xlen_type().const_int(transient as u64, false).into(),
|
||||
storage_key_pointer_casted.into(),
|
||||
@@ -795,7 +794,7 @@ where
|
||||
let transient = pointer.address_space == AddressSpace::TransientStorage;
|
||||
|
||||
self.build_runtime_call(
|
||||
runtime_api::imports::SET_STORAGE,
|
||||
revive_runtime_api::polkavm_imports::SET_STORAGE,
|
||||
&[
|
||||
self.xlen_type().const_int(transient as u64, false).into(),
|
||||
storage_key_pointer_casted.into(),
|
||||
@@ -1030,7 +1029,7 @@ where
|
||||
)?;
|
||||
|
||||
self.build_runtime_call(
|
||||
runtime_api::imports::RETURN,
|
||||
revive_runtime_api::polkavm_imports::RETURN,
|
||||
&[flags.into(), offset_pointer.into(), length_pointer.into()],
|
||||
);
|
||||
self.build_unreachable();
|
||||
@@ -1100,7 +1099,7 @@ where
|
||||
Ok(self
|
||||
.builder()
|
||||
.build_call(
|
||||
self.runtime_api_method(runtime_api::imports::SBRK),
|
||||
self.runtime_api_method(revive_runtime_api::polkavm_imports::SBRK),
|
||||
&[offset.into(), size.into()],
|
||||
"call_sbrk",
|
||||
)?
|
||||
@@ -1115,7 +1114,7 @@ where
|
||||
Ok(self
|
||||
.builder()
|
||||
.build_call(
|
||||
self.runtime_api_method(runtime_api::imports::MEMORY_SIZE),
|
||||
self.runtime_api_method(revive_runtime_api::polkavm_imports::MEMORY_SIZE),
|
||||
&[],
|
||||
"call_msize",
|
||||
)?
|
||||
|
||||
Reference in New Issue
Block a user