Skip to content

Commit

Permalink
Rename EWasmBuiltinInterpreter to EwasmBuiltinInterpreter
Browse files Browse the repository at this point in the history
  • Loading branch information
axic committed Dec 19, 2019
1 parent 65e59ec commit 9c27e98
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 20 deletions.
4 changes: 2 additions & 2 deletions test/tools/yulInterpreter/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
set(sources
EVMInstructionInterpreter.h
EVMInstructionInterpreter.cpp
EWasmBuiltinInterpreter.h
EWasmBuiltinInterpreter.cpp
EwasmBuiltinInterpreter.h
EwasmBuiltinInterpreter.cpp
Interpreter.h
Interpreter.cpp
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
along with solidity. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* Yul interpreter module that evaluates EWasm builtins.
* Yul interpreter module that evaluates Ewasm builtins.
*/

#include <test/tools/yulInterpreter/EWasmBuiltinInterpreter.h>
#include <test/tools/yulInterpreter/EwasmBuiltinInterpreter.h>

#include <test/tools/yulInterpreter/Interpreter.h>

Expand Down Expand Up @@ -68,7 +68,7 @@ uint64_t clz(uint64_t _v)

using u512 = boost::multiprecision::number<boost::multiprecision::cpp_int_backend<512, 256, boost::multiprecision::unsigned_magnitude, boost::multiprecision::unchecked, void>>;

u256 EWasmBuiltinInterpreter::evalBuiltin(YulString _fun, vector<u256> const& _arguments)
u256 EwasmBuiltinInterpreter::evalBuiltin(YulString _fun, vector<u256> const& _arguments)
{
vector<uint64_t> arg;
for (u256 const& a: _arguments)
Expand Down Expand Up @@ -355,7 +355,7 @@ u256 EWasmBuiltinInterpreter::evalBuiltin(YulString _fun, vector<u256> const& _a
return 0;
}

bool EWasmBuiltinInterpreter::accessMemory(u256 const& _offset, u256 const& _size)
bool EwasmBuiltinInterpreter::accessMemory(u256 const& _offset, u256 const& _size)
{
if (((_offset + _size) >= _offset) && ((_offset + _size + 0x1f) >= (_offset + _size)))
{
Expand All @@ -369,7 +369,7 @@ bool EWasmBuiltinInterpreter::accessMemory(u256 const& _offset, u256 const& _siz
return false;
}

bytes EWasmBuiltinInterpreter::readMemory(uint64_t _offset, uint64_t _size)
bytes EwasmBuiltinInterpreter::readMemory(uint64_t _offset, uint64_t _size)
{
yulAssert(_size <= 0xffff, "Too large read.");
bytes data(size_t(_size), uint8_t(0));
Expand All @@ -378,26 +378,26 @@ bytes EWasmBuiltinInterpreter::readMemory(uint64_t _offset, uint64_t _size)
return data;
}

uint64_t EWasmBuiltinInterpreter::readMemoryWord(uint64_t _offset)
uint64_t EwasmBuiltinInterpreter::readMemoryWord(uint64_t _offset)
{
uint64_t r = 0;
for (size_t i = 0; i < 8; i++)
r |= uint64_t(m_state.memory[_offset + i]) << (i * 8);
return r;
}

void EWasmBuiltinInterpreter::writeMemoryWord(uint64_t _offset, uint64_t _value)
void EwasmBuiltinInterpreter::writeMemoryWord(uint64_t _offset, uint64_t _value)
{
for (size_t i = 0; i < 8; i++)
m_state.memory[_offset + i] = uint8_t((_value >> (i * 8)) & 0xff);
}

void EWasmBuiltinInterpreter::writeMemoryByte(uint64_t _offset, uint8_t _value)
void EwasmBuiltinInterpreter::writeMemoryByte(uint64_t _offset, uint8_t _value)
{
m_state.memory[_offset] = _value;
}

void EWasmBuiltinInterpreter::writeU256(uint64_t _offset, u256 _value, size_t _croppedTo)
void EwasmBuiltinInterpreter::writeU256(uint64_t _offset, u256 _value, size_t _croppedTo)
{
accessMemory(_offset, _croppedTo);
for (size_t i = 0; i < _croppedTo; i++)
Expand All @@ -407,7 +407,7 @@ void EWasmBuiltinInterpreter::writeU256(uint64_t _offset, u256 _value, size_t _c
}
}

u256 EWasmBuiltinInterpreter::readU256(uint64_t _offset, size_t _croppedTo)
u256 EwasmBuiltinInterpreter::readU256(uint64_t _offset, size_t _croppedTo)
{
accessMemory(_offset, _croppedTo);
u256 value;
Expand All @@ -417,12 +417,12 @@ u256 EWasmBuiltinInterpreter::readU256(uint64_t _offset, size_t _croppedTo)
return value;
}

void EWasmBuiltinInterpreter::logTrace(dev::eth::Instruction _instruction, std::vector<u256> const& _arguments, bytes const& _data)
void EwasmBuiltinInterpreter::logTrace(dev::eth::Instruction _instruction, std::vector<u256> const& _arguments, bytes const& _data)
{
logTrace(dev::eth::instructionInfo(_instruction).name, _arguments, _data);
}

void EWasmBuiltinInterpreter::logTrace(std::string const& _pseudoInstruction, std::vector<u256> const& _arguments, bytes const& _data)
void EwasmBuiltinInterpreter::logTrace(std::string const& _pseudoInstruction, std::vector<u256> const& _arguments, bytes const& _data)
{
string message = _pseudoInstruction + "(";
for (size_t i = 0; i < _arguments.size(); ++i)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
along with solidity. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* Yul interpreter module that evaluates EWasm builtins.
* Yul interpreter module that evaluates Ewasm builtins.
*/

#pragma once
Expand Down Expand Up @@ -45,7 +45,7 @@ namespace test
struct InterpreterState;

/**
* Interprets EWasm builtins based on the current state and logs instructions with
* Interprets Ewasm builtins based on the current state and logs instructions with
* side-effects.
*
* Since this is mainly meant to be used for differential fuzz testing, it is focused
Expand All @@ -63,10 +63,10 @@ struct InterpreterState;
* The main focus is that the generated execution trace is the same for equivalent executions
* and likely to be different for non-equivalent executions.
*/
class EWasmBuiltinInterpreter
class EwasmBuiltinInterpreter
{
public:
explicit EWasmBuiltinInterpreter(InterpreterState& _state):
explicit EwasmBuiltinInterpreter(InterpreterState& _state):
m_state(_state)
{}
/// Evaluate builtin function
Expand Down
4 changes: 2 additions & 2 deletions test/tools/yulInterpreter/Interpreter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include <test/tools/yulInterpreter/Interpreter.h>

#include <test/tools/yulInterpreter/EVMInstructionInterpreter.h>
#include <test/tools/yulInterpreter/EWasmBuiltinInterpreter.h>
#include <test/tools/yulInterpreter/EwasmBuiltinInterpreter.h>

#include <libyul/AsmData.h>
#include <libyul/Dialect.h>
Expand Down Expand Up @@ -246,7 +246,7 @@ void ExpressionEvaluator::operator()(FunctionCall const& _funCall)
else if (WasmDialect const* dialect = dynamic_cast<WasmDialect const*>(&m_dialect))
if (dialect->builtin(_funCall.functionName.name))
{
EWasmBuiltinInterpreter interpreter(m_state);
EwasmBuiltinInterpreter interpreter(m_state);
setValue(interpreter.evalBuiltin(_funCall.functionName.name, values()));
return;
}
Expand Down

0 comments on commit 9c27e98

Please sign in to comment.