Browse Source

A bit of work in evmcc. Not ready yet.

cl-refactor
Paweł Bylica 10 years ago
parent
commit
adb5a6869f
  1. 45
      evmcc/evmcc.cpp

45
evmcc/evmcc.cpp

@ -16,8 +16,8 @@
#include <libdevcore/CommonIO.h>
#include <libevmcore/Instruction.h>
#include <libevm/ExtVMFace.h>
#include <libevmjit/Compiler.h>
#include <libevmjit/ExecutionEngine.h>
#include <evmjit/libevmjit/Compiler.h>
#include <evmjit/libevmjit/ExecutionEngine.h>
void parseProgramOptions(int _argc, char** _argv, boost::program_options::variables_map& _varMap)
@ -97,7 +97,7 @@ int main(int argc, char** argv)
}
std::string src((std::istreambuf_iterator<char>(ifs)),
(std::istreambuf_iterator<char>()));
(std::istreambuf_iterator<char>()));
boost::algorithm::trim(src);
@ -165,8 +165,8 @@ int main(int argc, char** argv)
if (options.count("verbose"))
{
std::cerr << "*** Compilation time: "
<< std::chrono::duration_cast<std::chrono::microseconds>(compilationEndTime - compilationStartTime).count()
<< std::endl;
<< std::chrono::duration_cast<std::chrono::microseconds>(compilationEndTime - compilationStartTime).count()
<< std::endl;
}
if (options.count("interpret"))
@ -174,23 +174,24 @@ int main(int argc, char** argv)
auto engine = eth::jit::ExecutionEngine();
u256 gas = initialGas;
// Create fake ExtVM interface
eth::ExtVMFace ext;
ext.myAddress = Address(1122334455667788);
ext.caller = Address(0xfacefacefaceface);
ext.origin = Address(101010101010101010);
ext.value = 0xabcd;
ext.gasPrice = 1002;
ext.previousBlock.hash = u256(1003);
ext.currentBlock.coinbaseAddress = Address(1004);
ext.currentBlock.timestamp = 1005;
ext.currentBlock.number = 1006;
ext.currentBlock.difficulty = 1007;
ext.currentBlock.gasLimit = 1008;
ext.data = std::string("Hello the Beautiful World of Ethereum!");
ext.code = { 0x0d, 0x0e, 0x0a, 0x0d, 0x0b, 0x0e, 0xe, 0xf };
auto result = engine.run(std::move(module), gas, options.count("show-logs") > 0, ext);
// Create fake ExtVM interface
eth::ExtVMFace ext;
ext.myAddress = Address(1122334455667788);
ext.caller = Address(0xfacefacefaceface);
ext.origin = Address(101010101010101010);
ext.value = 0xabcd;
ext.gasPrice = 1002;
ext.previousBlock.hash = u256(1003);
ext.currentBlock.coinbaseAddress = Address(1004);
ext.currentBlock.timestamp = 1005;
ext.currentBlock.number = 1006;
ext.currentBlock.difficulty = 1007;
ext.currentBlock.gasLimit = 1008;
ext.data = std::string("Hello the Beautiful World of Ethereum!");
ext.code = { 0x0d, 0x0e, 0x0a, 0x0d, 0x0b, 0x0e, 0xe, 0xf };
// BROKEN: env_* functions must be implemented & RuntimeData struct created
auto result = engine.run(std::move(module), gas, ext);
return result;
}
}

Loading…
Cancel
Save