Skip to content

Commit c567327

Browse files
committed
Remove EWASM backend.
1 parent 0a0c389 commit c567327

File tree

1,042 files changed

+97
-10946
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,042 files changed

+97
-10946
lines changed

Changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ Language Features:
44

55

66
Compiler Features:
7+
* EWasm: Remove EWasm backend.
78

89

910
Bugfixes:

cmake/templates/ewasm_polyfill.in

Lines changed: 0 additions & 13 deletions
This file was deleted.

docs/contributing.rst

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,7 @@ Prerequisites
9393

9494
For running all compiler tests you may want to optionally install a few
9595
dependencies (`evmone <https://github.com/ethereum/evmone/releases>`_,
96-
`libz3 <https://github.com/Z3Prover/z3>`_, and
97-
`libhera <https://github.com/ewasm/hera>`_).
96+
`libz3 <https://github.com/Z3Prover/z3>`_).
9897

9998
On macOS systems, some of the testing scripts expect GNU coreutils to be installed.
10099
This can be easiest accomplished using Homebrew: ``brew install coreutils``.
@@ -129,13 +128,7 @@ for the ``evmone`` shared object can be specified via the ``ETH_EVMONE`` environ
129128
If you do not have it installed, you can skip these tests by passing the ``--no-semantic-tests``
130129
flag to ``scripts/soltest.sh``.
131130

132-
Running Ewasm tests is disabled by default and can be explicitly enabled
133-
via ``./scripts/soltest.sh --ewasm`` and requires `hera <https://github.com/ewasm/hera>`_
134-
to be found by ``soltest``.
135-
The mechanism for locating the ``hera`` library is the same as for ``evmone``, except that the
136-
variable for specifying an explicit location is called ``ETH_HERA``.
137-
138-
The ``evmone`` and ``hera`` libraries should both end with the file name
131+
The ``evmone`` library should both end with the file name
139132
extension ``.so`` on Linux, ``.dll`` on Windows systems and ``.dylib`` on macOS.
140133

141134
For running SMT tests, the ``libz3`` library must be installed and locatable

docs/using-the-compiler.rst

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -404,10 +404,8 @@ Input Description
404404
// evm.deployedBytecode.immutableReferences - Map from AST ids to bytecode ranges that reference immutables
405405
// evm.methodIdentifiers - The list of function hashes
406406
// evm.gasEstimates - Function gas estimates
407-
// ewasm.wast - Ewasm in WebAssembly S-expressions format
408-
// ewasm.wasm - Ewasm in WebAssembly binary format
409407
//
410-
// Note that using a using `evm`, `evm.bytecode`, `ewasm`, etc. will select every
408+
// Note that using a using `evm`, `evm.bytecode`, etc. will select every
411409
// target part of that output. Additionally, `*` can be used as a wildcard to request everything.
412410
//
413411
"outputSelection": {
@@ -501,7 +499,7 @@ Output Description
501499
// Mandatory: Error type, such as "TypeError", "InternalCompilerError", "Exception", etc.
502500
// See below for complete list of types.
503501
"type": "TypeError",
504-
// Mandatory: Component where the error originated, such as "general", "ewasm", etc.
502+
// Mandatory: Component where the error originated, such as "general" etc.
505503
"component": "general",
506504
// Mandatory ("error", "warning" or "info", but please note that this may be extended in the future)
507505
"severity": "error",
@@ -617,13 +615,6 @@ Output Description
617615
"heavyLifting()": "infinite"
618616
}
619617
}
620-
},
621-
// Ewasm related outputs
622-
"ewasm": {
623-
// S-expressions format
624-
"wast": "",
625-
// Binary format (hex string)
626-
"wasm": ""
627618
}
628619
}
629620
}

docs/yul.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1194,8 +1194,7 @@ An example Yul Object is shown below:
11941194
// executing code is the constructor code)
11951195
size := datasize("Contract1_deployed")
11961196
offset := allocate(size)
1197-
// This will turn into a memory->memory copy for Ewasm and
1198-
// a codecopy for EVM
1197+
// This will turn into a codecopy for EVM
11991198
datacopy(offset, dataoffset("Contract1_deployed"), size)
12001199
return(offset, size)
12011200
}

libsolidity/interface/CompilerStack.cpp

Lines changed: 1 addition & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,6 @@ void CompilerStack::reset(bool _keepSettings)
315315
m_evmVersion = langutil::EVMVersion();
316316
m_modelCheckerSettings = ModelCheckerSettings{};
317317
m_generateIR = false;
318-
m_generateEwasm = false;
319318
m_revertStrings = RevertStrings::Default;
320319
m_optimiserSettings = OptimiserSettings::minimal();
321320
m_metadataLiteralSources = false;
@@ -681,7 +680,7 @@ bool CompilerStack::compile(State _stopAfter)
681680
{
682681
try
683682
{
684-
if (m_viaIR || m_generateIR || m_generateEwasm)
683+
if (m_viaIR || m_generateIR)
685684
generateIR(*contract);
686685
if (m_generateEvmBytecode)
687686
{
@@ -690,8 +689,6 @@ bool CompilerStack::compile(State _stopAfter)
690689
else
691690
compileContract(*contract, otherCompilers);
692691
}
693-
if (m_generateEwasm)
694-
generateEwasm(*contract);
695692
}
696693
catch (Error const& _error)
697694
{
@@ -892,22 +889,6 @@ string const& CompilerStack::yulIROptimized(string const& _contractName) const
892889
return contract(_contractName).yulIROptimized;
893890
}
894891

895-
string const& CompilerStack::ewasm(string const& _contractName) const
896-
{
897-
if (m_stackState != CompilationSuccessful)
898-
solThrow(CompilerError, "Compilation was not successful.");
899-
900-
return contract(_contractName).ewasm;
901-
}
902-
903-
evmasm::LinkerObject const& CompilerStack::ewasmObject(string const& _contractName) const
904-
{
905-
if (m_stackState != CompilationSuccessful)
906-
solThrow(CompilerError, "Compilation was not successful.");
907-
908-
return contract(_contractName).ewasmObject;
909-
}
910-
911892
evmasm::LinkerObject const& CompilerStack::object(string const& _contractName) const
912893
{
913894
if (m_stackState != CompilationSuccessful)
@@ -1479,42 +1460,6 @@ void CompilerStack::generateEVMFromIR(ContractDefinition const& _contract)
14791460
assembleYul(_contract, compiledContract.evmAssembly, compiledContract.evmRuntimeAssembly);
14801461
}
14811462

1482-
void CompilerStack::generateEwasm(ContractDefinition const& _contract)
1483-
{
1484-
solAssert(m_stackState >= AnalysisPerformed, "");
1485-
if (m_hasError)
1486-
solThrow(CompilerError, "Called generateEwasm with errors.");
1487-
1488-
if (!_contract.canBeDeployed())
1489-
return;
1490-
1491-
Contract& compiledContract = m_contracts.at(_contract.fullyQualifiedName());
1492-
solAssert(!compiledContract.yulIROptimized.empty(), "");
1493-
if (!compiledContract.ewasm.empty())
1494-
return;
1495-
1496-
// Re-parse the Yul IR in EVM dialect
1497-
yul::YulStack stack(
1498-
m_evmVersion,
1499-
m_eofVersion,
1500-
yul::YulStack::Language::StrictAssembly,
1501-
m_optimiserSettings,
1502-
m_debugInfoSelection
1503-
);
1504-
stack.parseAndAnalyze("", compiledContract.yulIROptimized);
1505-
1506-
stack.optimize();
1507-
stack.translate(yul::YulStack::Language::Ewasm);
1508-
stack.optimize();
1509-
1510-
//cout << yul::AsmPrinter{}(*stack.parserResult()->code) << endl;
1511-
1512-
// Turn into Ewasm text representation.
1513-
auto result = stack.assemble(yul::YulStack::Machine::Ewasm);
1514-
compiledContract.ewasm = std::move(result.assembly);
1515-
compiledContract.ewasmObject = std::move(*result.bytecode);
1516-
}
1517-
15181463
CompilerStack::Contract const& CompilerStack::contract(string const& _contractName) const
15191464
{
15201465
solAssert(m_stackState >= AnalysisPerformed, "");

libsolidity/interface/CompilerStack.h

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -203,9 +203,6 @@ class CompilerStack: public langutil::CharStreamProvider
203203
/// Enable generation of Yul IR code.
204204
void enableIRGeneration(bool _enable = true) { m_generateIR = _enable; }
205205

206-
/// Enable experimental generation of Ewasm code. If enabled, IR is also generated.
207-
void enableEwasmGeneration(bool _enable = true) { m_generateEwasm = _enable; }
208-
209206
/// @arg _metadataLiteralSources When true, store sources as literals in the contract metadata.
210207
/// Must be set before parsing.
211208
void useMetadataLiteralSources(bool _metadataLiteralSources);
@@ -282,12 +279,6 @@ class CompilerStack: public langutil::CharStreamProvider
282279
/// @returns the optimized IR representation of a contract.
283280
std::string const& yulIROptimized(std::string const& _contractName) const;
284281

285-
/// @returns the Ewasm text representation of a contract.
286-
std::string const& ewasm(std::string const& _contractName) const;
287-
288-
/// @returns the Ewasm representation of a contract.
289-
evmasm::LinkerObject const& ewasmObject(std::string const& _contractName) const;
290-
291282
/// @returns the assembled object for a contract.
292283
evmasm::LinkerObject const& object(std::string const& _contractName) const;
293284

@@ -389,8 +380,6 @@ class CompilerStack: public langutil::CharStreamProvider
389380
evmasm::LinkerObject runtimeObject; ///< Runtime object.
390381
std::string yulIR; ///< Yul IR code.
391382
std::string yulIROptimized; ///< Optimized Yul IR code.
392-
std::string ewasm; ///< Experimental Ewasm text representation
393-
evmasm::LinkerObject ewasmObject; ///< Experimental Ewasm code
394383
util::LazyInit<std::string const> metadata; ///< The metadata json that will be hashed into the chain.
395384
util::LazyInit<Json::Value const> abi;
396385
util::LazyInit<Json::Value const> storageLayout;
@@ -448,10 +437,6 @@ class CompilerStack: public langutil::CharStreamProvider
448437
/// Depends on output generated by generateIR.
449438
void generateEVMFromIR(ContractDefinition const& _contract);
450439

451-
/// Generate Ewasm representation for a single contract.
452-
/// Depends on output generated by generateIR.
453-
void generateEwasm(ContractDefinition const& _contract);
454-
455440
/// Links all the known library addresses in the available objects. Any unknown
456441
/// library will still be kept as an unlinked placeholder in the objects.
457442
void link();
@@ -510,7 +495,6 @@ class CompilerStack: public langutil::CharStreamProvider
510495
std::map<std::string, std::set<std::string>> m_requestedContractNames;
511496
bool m_generateEvmBytecode = true;
512497
bool m_generateIR = false;
513-
bool m_generateEwasm = false;
514498
std::map<std::string, util::h160> m_libraries;
515499
ImportRemapper m_importRemapper;
516500
std::map<std::string const, Source> m_sources;

libsolidity/interface/StandardCompiler.cpp

Lines changed: 2 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ bool hashMatchesContent(string const& _hash, string const& _content)
179179

180180
bool isArtifactRequested(Json::Value const& _outputSelection, string const& _artifact, bool _wildcardMatchesExperimental)
181181
{
182-
static set<string> experimental{"ir", "irOptimized", "wast", "ewasm", "ewasm.wast"};
182+
static set<string> experimental{"ir", "irOptimized"};
183183
for (auto const& selectedArtifactJson: _outputSelection)
184184
{
185185
string const& selectedArtifact = selectedArtifactJson.asString();
@@ -190,7 +190,7 @@ bool isArtifactRequested(Json::Value const& _outputSelection, string const& _art
190190
return true;
191191
else if (selectedArtifact == "*")
192192
{
193-
// "ir", "irOptimized", "wast" and "ewasm.wast" can only be matched by "*" if activated.
193+
// "ir", "irOptimized" can only be matched by "*" if activated.
194194
if (experimental.count(_artifact) == 0 || _wildcardMatchesExperimental)
195195
return true;
196196
}
@@ -264,7 +264,6 @@ bool isBinaryRequested(Json::Value const& _outputSelection)
264264
static vector<string> const outputsThatRequireBinaries = vector<string>{
265265
"*",
266266
"ir", "irOptimized",
267-
"wast", "wasm", "ewasm.wast", "ewasm.wasm",
268267
"evm.gasEstimates", "evm.legacyAssembly", "evm.assembly"
269268
} + evmObjectComponents("bytecode") + evmObjectComponents("deployedBytecode");
270269

@@ -295,29 +294,10 @@ bool isEvmBytecodeRequested(Json::Value const& _outputSelection)
295294
return false;
296295
}
297296

298-
/// @returns true if any Ewasm code was requested. Note that as an exception, '*' does not
299-
/// yet match "ewasm.wast" or "ewasm"
300-
bool isEwasmRequested(Json::Value const& _outputSelection)
301-
{
302-
if (!_outputSelection.isObject())
303-
return false;
304-
305-
for (auto const& fileRequests: _outputSelection)
306-
for (auto const& requests: fileRequests)
307-
for (auto const& request: requests)
308-
if (request == "ewasm" || request == "ewasm.wast")
309-
return true;
310-
311-
return false;
312-
}
313-
314297
/// @returns true if any Yul IR was requested. Note that as an exception, '*' does not
315298
/// yet match "ir" or "irOptimized"
316299
bool isIRRequested(Json::Value const& _outputSelection)
317300
{
318-
if (isEwasmRequested(_outputSelection))
319-
return true;
320-
321301
if (!_outputSelection.isObject())
322302
return false;
323303

@@ -1175,7 +1155,6 @@ Json::Value StandardCompiler::compileSolidity(StandardCompiler::InputsAndSetting
11751155

11761156
compilerStack.enableEvmBytecodeGeneration(isEvmBytecodeRequested(_inputsAndSettings.outputSelection));
11771157
compilerStack.enableIRGeneration(isIRRequested(_inputsAndSettings.outputSelection));
1178-
compilerStack.enableEwasmGeneration(isEwasmRequested(_inputsAndSettings.outputSelection));
11791158

11801159
Json::Value errors = std::move(_inputsAndSettings.errors);
11811160

@@ -1374,12 +1353,6 @@ Json::Value StandardCompiler::compileSolidity(StandardCompiler::InputsAndSetting
13741353
if (compilationSuccess && isArtifactRequested(_inputsAndSettings.outputSelection, file, name, "irOptimized", wildcardMatchesExperimental))
13751354
contractData["irOptimized"] = compilerStack.yulIROptimized(contractName);
13761355

1377-
// Ewasm
1378-
if (compilationSuccess && isArtifactRequested(_inputsAndSettings.outputSelection, file, name, "ewasm.wast", wildcardMatchesExperimental))
1379-
contractData["ewasm"]["wast"] = compilerStack.ewasm(contractName);
1380-
if (compilationSuccess && isArtifactRequested(_inputsAndSettings.outputSelection, file, name, "ewasm.wasm", wildcardMatchesExperimental))
1381-
contractData["ewasm"]["wasm"] = compilerStack.ewasmObject(contractName).toHex();
1382-
13831356
// EVM
13841357
Json::Value evmData(Json::objectValue);
13851358
if (compilationSuccess && isArtifactRequested(_inputsAndSettings.outputSelection, file, name, "evm.assembly", wildcardMatchesExperimental))

libyul/CMakeLists.txt

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,3 @@
1-
# This will re-generate the polyfill headers, if any file within libyul/backends/wasm/polyfill/ was modified.
2-
set_directory_properties(PROPERTY CMAKE_CONFIGURE_DEPENDS ${CMAKE_SOURCE_DIR}/libyul/backends/wasm/polyfill/)
3-
4-
set(POLYFILLS Arithmetic Bitwise Comparison Conversion Interface Keccak Logical Memory)
5-
set(GENERATED_POLYFILL_HEADERS)
6-
foreach(polyfill IN LISTS POLYFILLS)
7-
set(POLYFILL_FILE ${CMAKE_SOURCE_DIR}/libyul/backends/wasm/polyfill/${polyfill}.yul)
8-
file(READ ${POLYFILL_FILE} EWASM_POLYFILL_CONTENT HEX)
9-
string(REGEX MATCHALL ".." EWASM_POLYFILL_CONTENT "${EWASM_POLYFILL_CONTENT}")
10-
string(REGEX REPLACE ";" ",\n\t0x" EWASM_POLYFILL_CONTENT "${EWASM_POLYFILL_CONTENT}")
11-
set(EWASM_POLYFILL_CONTENT "0x${EWASM_POLYFILL_CONTENT}")
12-
set(EWASM_POLYFILL_NAME ${polyfill})
13-
configure_file("${CMAKE_SOURCE_DIR}/cmake/templates/ewasm_polyfill.in" ${CMAKE_BINARY_DIR}/include/ewasmPolyfills/${polyfill}.h @ONLY)
14-
list(APPEND GENERATED_POLYFILL_HEADERS ${CMAKE_BINARY_DIR}/include/ewasmPolyfills/${polyfill}.h)
15-
endforeach()
16-
171
add_library(yul
182
${GENERATED_POLYFILL_HEADERS}
193

@@ -80,20 +64,6 @@ add_library(yul
8064
backends/evm/StackLayoutGenerator.h
8165
backends/evm/VariableReferenceCounter.h
8266
backends/evm/VariableReferenceCounter.cpp
83-
backends/wasm/EVMToEwasmTranslator.cpp
84-
backends/wasm/EVMToEwasmTranslator.h
85-
backends/wasm/BinaryTransform.cpp
86-
backends/wasm/BinaryTransform.h
87-
backends/wasm/TextTransform.cpp
88-
backends/wasm/TextTransform.h
89-
backends/wasm/WasmCodeTransform.cpp
90-
backends/wasm/WasmCodeTransform.h
91-
backends/wasm/WasmDialect.cpp
92-
backends/wasm/WasmDialect.h
93-
backends/wasm/WasmObjectCompiler.cpp
94-
backends/wasm/WasmObjectCompiler.h
95-
backends/wasm/WordSizeTransform.cpp
96-
backends/wasm/WordSizeTransform.h
9767
optimiser/ASTCopier.cpp
9868
optimiser/ASTCopier.h
9969
optimiser/ASTWalker.cpp

0 commit comments

Comments
 (0)