2015-12-30 12:46:10 +01:00
|
|
|
//! Evm factory.
|
2015-12-29 12:37:38 +01:00
|
|
|
|
|
|
|
use evm::Evm;
|
|
|
|
|
2016-01-11 02:42:02 +01:00
|
|
|
/// Evm factory. Creates appropriate Evm.
|
2016-01-11 19:01:42 +01:00
|
|
|
pub struct Factory;
|
2015-12-29 12:37:38 +01:00
|
|
|
|
2016-01-11 19:01:42 +01:00
|
|
|
impl Factory {
|
2015-12-29 12:37:38 +01:00
|
|
|
/// Returns jit vm
|
|
|
|
#[cfg(feature = "jit")]
|
|
|
|
pub fn create() -> Box<Evm> {
|
|
|
|
Box::new(super::jit::JitEvm)
|
|
|
|
}
|
|
|
|
|
|
|
|
/// Returns native rust evm
|
|
|
|
#[cfg(not(feature = "jit"))]
|
|
|
|
pub fn create() -> Box<Evm> {
|
2016-01-13 00:13:09 +01:00
|
|
|
Box::new(super::interpreter::Interpreter::new())
|
2015-12-29 12:37:38 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn test_create_vm() {
|
2016-01-11 19:01:42 +01:00
|
|
|
let _vm = Factory::create();
|
2015-12-29 12:37:38 +01:00
|
|
|
}
|