Getting rid of get_info
This commit is contained in:
parent
3647628ae2
commit
c7a11418bb
@ -146,7 +146,7 @@ impl InstructionInfo {
|
||||
}
|
||||
|
||||
lazy_static! {
|
||||
static ref INSTRUCTIONS: [InstructionInfo; 0x100] = {
|
||||
pub static ref INSTRUCTIONS: [InstructionInfo; 0x100] = {
|
||||
let mut arr = [InstructionInfo::default(); 0x100];
|
||||
arr[STOP as usize] = InstructionInfo::new("STOP", 0, 0, 0, true, GasPriceTier::Zero);
|
||||
arr[ADD as usize] = InstructionInfo::new("ADD", 0, 2, 1, false, GasPriceTier::VeryLow);
|
||||
@ -282,11 +282,6 @@ lazy_static! {
|
||||
};
|
||||
}
|
||||
|
||||
/// Return details about specific instruction
|
||||
pub fn get_info(instruction: Instruction) -> &'static InstructionInfo {
|
||||
&INSTRUCTIONS[instruction as usize]
|
||||
}
|
||||
|
||||
/// Virtual machine bytecode instruction.
|
||||
/// halts execution
|
||||
pub const STOP: Instruction = 0x00;
|
||||
|
@ -104,12 +104,13 @@ impl<Cost: CostType> evm::Evm for Interpreter<Cost> {
|
||||
position: 0,
|
||||
code: &code
|
||||
};
|
||||
let infos = &*instructions::INSTRUCTIONS;
|
||||
|
||||
while reader.position < code.len() {
|
||||
let instruction = code[reader.position];
|
||||
reader.position += 1;
|
||||
|
||||
let info = instructions::get_info(instruction);
|
||||
let info = infos[instruction as usize];
|
||||
try!(self.verify_instruction(ext, instruction, &info, &stack));
|
||||
|
||||
// Calculate gas cost
|
||||
|
@ -35,4 +35,3 @@ pub use self::evm::{Evm, Error, Finalize, GasLeft, Result, CostType};
|
||||
pub use self::ext::{Ext, ContractCreateResult, MessageCallResult};
|
||||
pub use self::factory::{Factory, VMType};
|
||||
pub use self::schedule::Schedule;
|
||||
pub use self::instructions::get_info;
|
||||
|
@ -146,5 +146,4 @@ mod tests;
|
||||
mod json_tests;
|
||||
|
||||
pub use types::*;
|
||||
pub use evm::get_info;
|
||||
pub use executive::contract_address;
|
||||
|
Loading…
Reference in New Issue
Block a user