"importing" evmjit callbacks abi
This commit is contained in:
parent
000d8fe8d0
commit
142bba096a
@ -75,6 +75,7 @@ pub struct ContextHandle {
|
|||||||
impl ContextHandle {
|
impl ContextHandle {
|
||||||
/// Creates new context handle.
|
/// Creates new context handle.
|
||||||
pub fn new(mut data_handle: RuntimeDataHandle, mut env: EnvHandle) -> Self {
|
pub fn new(mut data_handle: RuntimeDataHandle, mut env: EnvHandle) -> Self {
|
||||||
|
import_evmjit_abi();
|
||||||
let context = unsafe { evmjit_create_context(data_handle.mut_runtime_data(), &mut env) };
|
let context = unsafe { evmjit_create_context(data_handle.mut_runtime_data(), &mut env) };
|
||||||
ContextHandle {
|
ContextHandle {
|
||||||
context: context,
|
context: context,
|
||||||
@ -220,6 +221,35 @@ pub mod ffi {
|
|||||||
pub code_hash: JitI256
|
pub code_hash: JitI256
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Dumb function to "import" c abi in libraries
|
||||||
|
/// which inherit from this library.
|
||||||
|
///
|
||||||
|
/// It needs compiled as a part of main executable.
|
||||||
|
///
|
||||||
|
/// To verify that c abi is "imported" correctly, run:
|
||||||
|
///
|
||||||
|
/// ```bash
|
||||||
|
/// nm your_executable -g | grep env
|
||||||
|
/// ```
|
||||||
|
///
|
||||||
|
/// It Should give the following output:
|
||||||
|
///
|
||||||
|
/// ```bash
|
||||||
|
/// 0000000100078500 T _env_sha3
|
||||||
|
/// 0000000100078470 T _env_sstore
|
||||||
|
/// ```
|
||||||
|
pub fn import_evmjit_abi() {
|
||||||
|
let _env_sload = env_sload;
|
||||||
|
let _env_sstore = env_sstore;
|
||||||
|
let _env_balance = env_balance;
|
||||||
|
let _env_blockhash = env_blockhash;
|
||||||
|
let _env_create = env_create;
|
||||||
|
let _env_call = env_call;
|
||||||
|
let _env_sha3 = env_sha3;
|
||||||
|
let _env_extcode = env_extcode;
|
||||||
|
let _env_log = env_log;
|
||||||
|
}
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub unsafe extern fn env_sload(env: *const EnvHandle, index: *const JitI256, out_value: *mut JitI256) {
|
pub unsafe extern fn env_sload(env: *const EnvHandle, index: *const JitI256, out_value: *mut JitI256) {
|
||||||
let env = &*env;
|
let env = &*env;
|
||||||
|
@ -81,6 +81,7 @@ extern crate heapsize;
|
|||||||
extern crate env_logger;
|
extern crate env_logger;
|
||||||
#[cfg(feature = "jit" )]
|
#[cfg(feature = "jit" )]
|
||||||
extern crate evmjit;
|
extern crate evmjit;
|
||||||
|
|
||||||
extern crate ethcore_util as util;
|
extern crate ethcore_util as util;
|
||||||
|
|
||||||
//use util::error::*;
|
//use util::error::*;
|
||||||
|
Loading…
Reference in New Issue
Block a user