"importing" evmjit callbacks abi

This commit is contained in:
debris 2015-12-24 02:28:09 +01:00
parent 000d8fe8d0
commit 142bba096a
2 changed files with 31 additions and 0 deletions

View File

@ -75,6 +75,7 @@ pub struct ContextHandle {
impl ContextHandle {
/// Creates new context handle.
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) };
ContextHandle {
context: context,
@ -220,6 +221,35 @@ pub mod ffi {
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]
pub unsafe extern fn env_sload(env: *const EnvHandle, index: *const JitI256, out_value: *mut JitI256) {
let env = &*env;

View File

@ -81,6 +81,7 @@ extern crate heapsize;
extern crate env_logger;
#[cfg(feature = "jit" )]
extern crate evmjit;
extern crate ethcore_util as util;
//use util::error::*;