Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Commit

Permalink
Fixing jit feature compilation (#2310)
Browse files Browse the repository at this point in the history
Conflicts:
	Cargo.lock
  • Loading branch information
tomusdrw authored and Tomasz Drwięga committed Sep 28, 2016
1 parent 5db4ea0 commit 15b4811
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 6 additions & 5 deletions ethcore/src/evm/jit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ impl<'a> evmjit::Ext for ExtAdapter<'a> {
receive_address: *const evmjit::H256,
code_address: *const evmjit::H256,
transfer_value: *const evmjit::I256,
// TODO [ToDr] Why do we ignore that?
_apparent_value: *const evmjit::I256,
in_beg: *const u8,
in_size: u64,
Expand All @@ -208,12 +209,12 @@ impl<'a> evmjit::Ext for ExtAdapter<'a> {
let sender_address = unsafe { Address::from_jit(&*sender_address) };
let receive_address = unsafe { Address::from_jit(&*receive_address) };
let code_address = unsafe { Address::from_jit(&*code_address) };
// TODO Is it always safe in case of DELEGATE_CALL?
let transfer_value = unsafe { U256::from_jit(&*transfer_value) };
let value = Some(transfer_value);

// receive address and code address are the same in normal calls
let is_callcode = receive_address != code_address;
let is_delegatecall = is_callcode && sender_address != receive_address;

if !is_callcode && !self.ext.exists(&code_address) {
gas_cost = gas_cost + U256::from(self.ext.schedule().call_new_account_gas);
Expand Down Expand Up @@ -242,10 +243,10 @@ impl<'a> evmjit::Ext for ExtAdapter<'a> {
}
}

// TODO [ToDr] Any way to detect DelegateCall?
let call_type = match is_callcode {
true => CallType::CallCode,
false => CallType::Call,
let call_type = match (is_callcode, is_delegatecall) {
(_, true) => CallType::DelegateCall,
(true, false) => CallType::CallCode,
(false, false) => CallType::Call,
};

match self.ext.call(
Expand Down
3 changes: 2 additions & 1 deletion ethcore/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@ extern crate rand;
extern crate bit_set;
extern crate lru_cache;

#[cfg(feature = "jit" )] extern crate evmjit;
#[cfg(feature = "jit" )]
extern crate evmjit;

pub mod account_provider;
pub mod engines;
Expand Down

0 comments on commit 15b4811

Please sign in to comment.