Getting rid of get_info

This commit is contained in:
Tomasz Drwięga 2016-07-12 10:28:42 +02:00
parent 3647628ae2
commit c7a11418bb
4 changed files with 3 additions and 9 deletions

View File

@ -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;

View File

@ -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

View File

@ -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;

View File

@ -146,5 +146,4 @@ mod tests;
mod json_tests;
pub use types::*;
pub use evm::get_info;
pub use executive::contract_address;