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:
Cyrill Leutwiler
2024-10-17 10:55:27 +02:00
committed by GitHub
parent 20e3560398
commit 82ae22c163
18 changed files with 162 additions and 242 deletions
@@ -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",
)?