aboutsummaryrefslogtreecommitdiffstats
path: root/vm.cpp
diff options
context:
space:
mode:
authorartur-zawlocki <artur.zawlocki@gmail.com>2014-10-29 18:29:34 +0800
committerartur-zawlocki <artur.zawlocki@gmail.com>2014-10-29 18:29:34 +0800
commit621d7fa4b04a030b8f6c828d18c6976c600683f2 (patch)
tree592b8f462b5972771176d5517cb9b2fd62e6e489 /vm.cpp
parent39a74029d2c9e26a7738e1ce1fc56bd68dadfb2d (diff)
downloaddexon-solidity-621d7fa4b04a030b8f6c828d18c6976c600683f2.tar.gz
dexon-solidity-621d7fa4b04a030b8f6c828d18c6976c600683f2.tar.zst
dexon-solidity-621d7fa4b04a030b8f6c828d18c6976c600683f2.zip
MULMOD/ADDMOD implemented in separate functions [FIXES #80566276]
Diffstat (limited to 'vm.cpp')
-rw-r--r--vm.cpp26
1 files changed, 24 insertions, 2 deletions
diff --git a/vm.cpp b/vm.cpp
index d62329af..c056abf5 100644
--- a/vm.cpp
+++ b/vm.cpp
@@ -24,7 +24,7 @@
#include <libdevcore/CommonIO.h>
#include <libevmjit/VM.h>
#include <boost/filesystem/path.hpp>
-
+#include <chrono>
//#define FILL_TESTS
using namespace std;
@@ -357,7 +357,7 @@ void FakeExtVM::importExec(mObject& _o)
thisTxCode.clear();
code = &thisTxCode;
if (_o["code"].type() == str_type)
- if (_o["code"].get_str().find_first_of("0x") == 0)
+ if (_o["code"].get_str().find_first_of("0x") != 0)
thisTxCode = compileLLL(_o["code"].get_str());
else
thisTxCode = fromHex(_o["code"].get_str().substr(2));
@@ -518,10 +518,16 @@ void doTests(json_spirit::mValue& v, bool _fillin)
auto argv = boost::unit_test::framework::master_test_suite().argv;
auto useJit = argc >= 2 && std::string(argv[1]) == "--jit";
+ auto showTimes = false;
+ for (auto i = 0; i < argc; ++i)
+ showTimes |= std::string(argv[i]) == "--show-times";
+
auto vmKind = useJit ? VMFace::JIT : VMFace::Interpreter;
auto vm = VMFace::create(vmKind, fev.gas);
bytes output;
auto outOfGas = false;
+
+ auto startTime = std::chrono::high_resolution_clock::now();
try
{
output = vm->go(fev).toVector();
@@ -538,6 +544,16 @@ void doTests(json_spirit::mValue& v, bool _fillin)
{
cnote << "VM did throw an exception: " << _e.what();
}
+
+ auto endTime = std::chrono::high_resolution_clock::now();
+ if (showTimes)
+ {
+ auto testDuration = endTime - startTime;
+ cnote << "Execution time: "
+ << std::chrono::duration_cast<std::chrono::milliseconds>(testDuration).count()
+ << " ms";
+ }
+
auto gas = vm->gas();
// delete null entries in storage for the sake of comparison
@@ -760,8 +776,14 @@ BOOST_AUTO_TEST_CASE(vmPushDupSwapTest)
dev::test::executeTests("vmPushDupSwapTest");
}
+BOOST_AUTO_TEST_CASE(vmPerformanceTest)
+{
+ dev::test::executeTests("vmPerformanceTest");
+}
+
BOOST_AUTO_TEST_CASE(vmSystemOperationsTest)
{
dev::test::executeTests("vmSystemOperationsTest");
}
+