mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Rename EVMToEWasmTranslator to EVMToEwasmTranslator
This commit is contained in:
parent
018960ebb1
commit
7effc94f24
@ -34,7 +34,7 @@
|
|||||||
#include <libyul/backends/evm/EVMMetrics.h>
|
#include <libyul/backends/evm/EVMMetrics.h>
|
||||||
#include <libyul/backends/wasm/WasmDialect.h>
|
#include <libyul/backends/wasm/WasmDialect.h>
|
||||||
#include <libyul/backends/wasm/WasmObjectCompiler.h>
|
#include <libyul/backends/wasm/WasmObjectCompiler.h>
|
||||||
#include <libyul/backends/wasm/EVMToEWasmTranslator.h>
|
#include <libyul/backends/wasm/EVMToEwasmTranslator.h>
|
||||||
#include <libyul/optimiser/Metrics.h>
|
#include <libyul/optimiser/Metrics.h>
|
||||||
#include <libyul/ObjectParser.h>
|
#include <libyul/ObjectParser.h>
|
||||||
#include <libyul/optimiser/Suite.h>
|
#include <libyul/optimiser/Suite.h>
|
||||||
@ -112,7 +112,7 @@ void AssemblyStack::translate(AssemblyStack::Language _targetLanguage)
|
|||||||
"Invalid language combination"
|
"Invalid language combination"
|
||||||
);
|
);
|
||||||
|
|
||||||
*m_parserResult = EVMToEWasmTranslator(
|
*m_parserResult = EVMToEwasmTranslator(
|
||||||
languageToDialect(m_language, m_evmVersion)
|
languageToDialect(m_language, m_evmVersion)
|
||||||
).run(*parserResult());
|
).run(*parserResult());
|
||||||
|
|
||||||
|
@ -44,8 +44,8 @@ add_library(yul
|
|||||||
backends/evm/EVMMetrics.h
|
backends/evm/EVMMetrics.h
|
||||||
backends/evm/NoOutputAssembly.h
|
backends/evm/NoOutputAssembly.h
|
||||||
backends/evm/NoOutputAssembly.cpp
|
backends/evm/NoOutputAssembly.cpp
|
||||||
backends/wasm/EVMToEWasmTranslator.cpp
|
backends/wasm/EVMToEwasmTranslator.cpp
|
||||||
backends/wasm/EVMToEWasmTranslator.h
|
backends/wasm/EVMToEwasmTranslator.h
|
||||||
backends/wasm/BinaryTransform.cpp
|
backends/wasm/BinaryTransform.cpp
|
||||||
backends/wasm/BinaryTransform.h
|
backends/wasm/BinaryTransform.h
|
||||||
backends/wasm/TextTransform.cpp
|
backends/wasm/TextTransform.cpp
|
||||||
|
@ -15,10 +15,10 @@
|
|||||||
along with solidity. If not, see <http://www.gnu.org/licenses/>.
|
along with solidity. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
/**
|
/**
|
||||||
* Translates Yul code from EVM dialect to eWasm dialect.
|
* Translates Yul code from EVM dialect to Ewasm dialect.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <libyul/backends/wasm/EVMToEWasmTranslator.h>
|
#include <libyul/backends/wasm/EVMToEwasmTranslator.h>
|
||||||
|
|
||||||
#include <libyul/backends/wasm/WordSizeTransform.h>
|
#include <libyul/backends/wasm/WordSizeTransform.h>
|
||||||
#include <libyul/backends/wasm/WasmDialect.h>
|
#include <libyul/backends/wasm/WasmDialect.h>
|
||||||
@ -701,7 +701,7 @@ function invalid() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Object EVMToEWasmTranslator::run(Object const& _object)
|
Object EVMToEwasmTranslator::run(Object const& _object)
|
||||||
{
|
{
|
||||||
if (!m_polyfill)
|
if (!m_polyfill)
|
||||||
parsePolyfill();
|
parsePolyfill();
|
||||||
@ -749,7 +749,7 @@ Object EVMToEWasmTranslator::run(Object const& _object)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void EVMToEWasmTranslator::parsePolyfill()
|
void EVMToEwasmTranslator::parsePolyfill()
|
||||||
{
|
{
|
||||||
ErrorList errors;
|
ErrorList errors;
|
||||||
ErrorReporter errorReporter(errors);
|
ErrorReporter errorReporter(errors);
|
@ -15,7 +15,7 @@
|
|||||||
along with solidity. If not, see <http://www.gnu.org/licenses/>.
|
along with solidity. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
/**
|
/**
|
||||||
* Translates Yul code from EVM dialect to eWasm dialect.
|
* Translates Yul code from EVM dialect to Ewasm dialect.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
@ -28,10 +28,10 @@ namespace yul
|
|||||||
{
|
{
|
||||||
struct Object;
|
struct Object;
|
||||||
|
|
||||||
class EVMToEWasmTranslator: public ASTModifier
|
class EVMToEwasmTranslator: public ASTModifier
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
EVMToEWasmTranslator(Dialect const& _evmDialect): m_dialect(_evmDialect) {}
|
EVMToEwasmTranslator(Dialect const& _evmDialect): m_dialect(_evmDialect) {}
|
||||||
Object run(Object const& _object);
|
Object run(Object const& _object);
|
||||||
|
|
||||||
private:
|
private:
|
@ -131,8 +131,8 @@ set(libyul_sources
|
|||||||
libyul/Common.cpp
|
libyul/Common.cpp
|
||||||
libyul/Common.h
|
libyul/Common.h
|
||||||
libyul/CompilabilityChecker.cpp
|
libyul/CompilabilityChecker.cpp
|
||||||
libyul/EWasmTranslationTest.cpp
|
libyul/EwasmTranslationTest.cpp
|
||||||
libyul/EWasmTranslationTest.h
|
libyul/EwasmTranslationTest.h
|
||||||
libyul/FunctionSideEffects.cpp
|
libyul/FunctionSideEffects.cpp
|
||||||
libyul/FunctionSideEffects.h
|
libyul/FunctionSideEffects.h
|
||||||
libyul/Inliner.cpp
|
libyul/Inliner.cpp
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
#include <test/libsolidity/SemanticTest.h>
|
#include <test/libsolidity/SemanticTest.h>
|
||||||
#include <test/libsolidity/SMTCheckerTest.h>
|
#include <test/libsolidity/SMTCheckerTest.h>
|
||||||
#include <test/libsolidity/SMTCheckerJSONTest.h>
|
#include <test/libsolidity/SMTCheckerJSONTest.h>
|
||||||
#include <test/libyul/EWasmTranslationTest.h>
|
#include <test/libyul/EwasmTranslationTest.h>
|
||||||
#include <test/libyul/YulOptimizerTest.h>
|
#include <test/libyul/YulOptimizerTest.h>
|
||||||
#include <test/libyul/YulInterpreterTest.h>
|
#include <test/libyul/YulInterpreterTest.h>
|
||||||
#include <test/libyul/ObjectCompilerTest.h>
|
#include <test/libyul/ObjectCompilerTest.h>
|
||||||
@ -56,7 +56,7 @@ struct Testsuite
|
|||||||
Testsuite const g_interactiveTestsuites[] = {
|
Testsuite const g_interactiveTestsuites[] = {
|
||||||
/*
|
/*
|
||||||
Title Path Subpath SMT NeedsVM Creator function */
|
Title Path Subpath SMT NeedsVM Creator function */
|
||||||
{"EWasm Translation", "libyul", "ewasmTranslationTests",false,false, &yul::test::EWasmTranslationTest::create},
|
{"Ewasm Translation", "libyul", "ewasmTranslationTests",false,false, &yul::test::EwasmTranslationTest::create},
|
||||||
{"Yul Optimizer", "libyul", "yulOptimizerTests", false, false, &yul::test::YulOptimizerTest::create},
|
{"Yul Optimizer", "libyul", "yulOptimizerTests", false, false, &yul::test::YulOptimizerTest::create},
|
||||||
{"Yul Interpreter", "libyul", "yulInterpreterTests", false, false, &yul::test::YulInterpreterTest::create},
|
{"Yul Interpreter", "libyul", "yulInterpreterTests", false, false, &yul::test::YulInterpreterTest::create},
|
||||||
{"Yul Object Compiler", "libyul", "objectCompiler", false, false, &yul::test::ObjectCompilerTest::create},
|
{"Yul Object Compiler", "libyul", "objectCompiler", false, false, &yul::test::ObjectCompilerTest::create},
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
along with solidity. If not, see <http://www.gnu.org/licenses/>.
|
along with solidity. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <test/libyul/EWasmTranslationTest.h>
|
#include <test/libyul/EwasmTranslationTest.h>
|
||||||
|
|
||||||
#include <test/tools/yulInterpreter/Interpreter.h>
|
#include <test/tools/yulInterpreter/Interpreter.h>
|
||||||
|
|
||||||
@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
#include <libyul/backends/evm/EVMDialect.h>
|
#include <libyul/backends/evm/EVMDialect.h>
|
||||||
#include <libyul/backends/wasm/WasmDialect.h>
|
#include <libyul/backends/wasm/WasmDialect.h>
|
||||||
#include <libyul/backends/wasm/EVMToEWasmTranslator.h>
|
#include <libyul/backends/wasm/EVMToEwasmTranslator.h>
|
||||||
#include <libyul/AsmParser.h>
|
#include <libyul/AsmParser.h>
|
||||||
#include <libyul/AssemblyStack.h>
|
#include <libyul/AssemblyStack.h>
|
||||||
#include <libyul/AsmAnalysisInfo.h>
|
#include <libyul/AsmAnalysisInfo.h>
|
||||||
@ -47,7 +47,7 @@ using namespace dev::solidity::test;
|
|||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
|
||||||
EWasmTranslationTest::EWasmTranslationTest(string const& _filename)
|
EwasmTranslationTest::EwasmTranslationTest(string const& _filename)
|
||||||
{
|
{
|
||||||
boost::filesystem::path path(_filename);
|
boost::filesystem::path path(_filename);
|
||||||
|
|
||||||
@ -60,12 +60,12 @@ EWasmTranslationTest::EWasmTranslationTest(string const& _filename)
|
|||||||
m_expectation = parseSimpleExpectations(file);
|
m_expectation = parseSimpleExpectations(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
TestCase::TestResult EWasmTranslationTest::run(ostream& _stream, string const& _linePrefix, bool const _formatted)
|
TestCase::TestResult EwasmTranslationTest::run(ostream& _stream, string const& _linePrefix, bool const _formatted)
|
||||||
{
|
{
|
||||||
if (!parse(_stream, _linePrefix, _formatted))
|
if (!parse(_stream, _linePrefix, _formatted))
|
||||||
return TestResult::FatalError;
|
return TestResult::FatalError;
|
||||||
|
|
||||||
*m_object = EVMToEWasmTranslator(
|
*m_object = EVMToEwasmTranslator(
|
||||||
EVMDialect::strictAssemblyForEVMObjects(dev::test::Options::get().evmVersion())
|
EVMDialect::strictAssemblyForEVMObjects(dev::test::Options::get().evmVersion())
|
||||||
).run(*m_object);
|
).run(*m_object);
|
||||||
|
|
||||||
@ -89,17 +89,17 @@ TestCase::TestResult EWasmTranslationTest::run(ostream& _stream, string const& _
|
|||||||
return TestResult::Success;
|
return TestResult::Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
void EWasmTranslationTest::printSource(ostream& _stream, string const& _linePrefix, bool const) const
|
void EwasmTranslationTest::printSource(ostream& _stream, string const& _linePrefix, bool const) const
|
||||||
{
|
{
|
||||||
printIndented(_stream, m_source, _linePrefix);
|
printIndented(_stream, m_source, _linePrefix);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EWasmTranslationTest::printUpdatedExpectations(ostream& _stream, string const& _linePrefix) const
|
void EwasmTranslationTest::printUpdatedExpectations(ostream& _stream, string const& _linePrefix) const
|
||||||
{
|
{
|
||||||
printIndented(_stream, m_obtainedResult, _linePrefix);
|
printIndented(_stream, m_obtainedResult, _linePrefix);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EWasmTranslationTest::printIndented(ostream& _stream, string const& _output, string const& _linePrefix) const
|
void EwasmTranslationTest::printIndented(ostream& _stream, string const& _output, string const& _linePrefix) const
|
||||||
{
|
{
|
||||||
stringstream output(_output);
|
stringstream output(_output);
|
||||||
string line;
|
string line;
|
||||||
@ -107,7 +107,7 @@ void EWasmTranslationTest::printIndented(ostream& _stream, string const& _output
|
|||||||
_stream << _linePrefix << line << endl;
|
_stream << _linePrefix << line << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EWasmTranslationTest::parse(ostream& _stream, string const& _linePrefix, bool const _formatted)
|
bool EwasmTranslationTest::parse(ostream& _stream, string const& _linePrefix, bool const _formatted)
|
||||||
{
|
{
|
||||||
AssemblyStack stack(
|
AssemblyStack stack(
|
||||||
dev::test::Options::get().evmVersion(),
|
dev::test::Options::get().evmVersion(),
|
||||||
@ -127,7 +127,7 @@ bool EWasmTranslationTest::parse(ostream& _stream, string const& _linePrefix, bo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
string EWasmTranslationTest::interpret()
|
string EwasmTranslationTest::interpret()
|
||||||
{
|
{
|
||||||
InterpreterState state;
|
InterpreterState state;
|
||||||
state.maxTraceSize = 10000;
|
state.maxTraceSize = 10000;
|
||||||
@ -147,7 +147,7 @@ string EWasmTranslationTest::interpret()
|
|||||||
return result.str();
|
return result.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
void EWasmTranslationTest::printErrors(ostream& _stream, ErrorList const& _errors)
|
void EwasmTranslationTest::printErrors(ostream& _stream, ErrorList const& _errors)
|
||||||
{
|
{
|
||||||
SourceReferenceFormatter formatter(_stream);
|
SourceReferenceFormatter formatter(_stream);
|
||||||
|
|
@ -32,15 +32,15 @@ namespace yul
|
|||||||
namespace test
|
namespace test
|
||||||
{
|
{
|
||||||
|
|
||||||
class EWasmTranslationTest: public dev::solidity::test::EVMVersionRestrictedTestCase
|
class EwasmTranslationTest: public dev::solidity::test::EVMVersionRestrictedTestCase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static std::unique_ptr<TestCase> create(Config const& _config)
|
static std::unique_ptr<TestCase> create(Config const& _config)
|
||||||
{
|
{
|
||||||
return std::make_unique<EWasmTranslationTest>(_config.filename);
|
return std::make_unique<EwasmTranslationTest>(_config.filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
explicit EWasmTranslationTest(std::string const& _filename);
|
explicit EwasmTranslationTest(std::string const& _filename);
|
||||||
|
|
||||||
TestResult run(std::ostream& _stream, std::string const& _linePrefix = "", bool const _formatted = false) override;
|
TestResult run(std::ostream& _stream, std::string const& _linePrefix = "", bool const _formatted = false) override;
|
||||||
|
|
@ -32,7 +32,7 @@ add_executable(isoltest
|
|||||||
../libsolidity/SMTCheckerTest.cpp
|
../libsolidity/SMTCheckerTest.cpp
|
||||||
../libsolidity/SMTCheckerJSONTest.cpp
|
../libsolidity/SMTCheckerJSONTest.cpp
|
||||||
../libyul/Common.cpp
|
../libyul/Common.cpp
|
||||||
../libyul/EWasmTranslationTest.cpp
|
../libyul/EwasmTranslationTest.cpp
|
||||||
../libyul/FunctionSideEffects.cpp
|
../libyul/FunctionSideEffects.cpp
|
||||||
../libyul/ObjectCompilerTest.cpp
|
../libyul/ObjectCompilerTest.cpp
|
||||||
../libyul/YulOptimizerTest.cpp
|
../libyul/YulOptimizerTest.cpp
|
||||||
|
Loading…
Reference in New Issue
Block a user