diff --git a/Changelog.md b/Changelog.md index 9924dbf4f..7c69ac008 100644 --- a/Changelog.md +++ b/Changelog.md @@ -7,6 +7,7 @@ Compiler Features: * Code Generator: Use SELFBALANCE for ``address(this).balance`` if using Istanbul EVM * SMTChecker: Add break/continue support to the CHC engine. * SMTChecker: Support assignments to multi-dimensional arrays and mappings. + * EWasm: Experimental EWasm binary output. Bugfixes: diff --git a/libsolidity/interface/StandardCompiler.cpp b/libsolidity/interface/StandardCompiler.cpp index 86e88ce3d..d1701320f 100644 --- a/libsolidity/interface/StandardCompiler.cpp +++ b/libsolidity/interface/StandardCompiler.cpp @@ -907,6 +907,8 @@ Json::Value StandardCompiler::compileSolidity(StandardCompiler::InputsAndSetting // eWasm if (compilationSuccess && isArtifactRequested(_inputsAndSettings.outputSelection, file, name, "ewasm.wast", wildcardMatchesExperimental)) contractData["ewasm"]["wast"] = compilerStack.eWasm(contractName); + if (compilationSuccess && isArtifactRequested(_inputsAndSettings.outputSelection, file, name, "ewasm.wasm", wildcardMatchesExperimental)) + contractData["ewasm"]["wasm"] = compilerStack.eWasmObject(contractName).toHex(); // EVM Json::Value evmData(Json::objectValue); diff --git a/solc/CommandLineInterface.cpp b/solc/CommandLineInterface.cpp index 28f4d6074..34b7c67c5 100644 --- a/solc/CommandLineInterface.cpp +++ b/solc/CommandLineInterface.cpp @@ -318,11 +318,18 @@ void CommandLineInterface::handleEWasm(string const& _contractName) if (m_args.count(g_argEWasm)) { if (m_args.count(g_argOutputDir)) + { createFile(m_compiler->filesystemFriendlyName(_contractName) + ".wast", m_compiler->eWasm(_contractName)); + createFile( + m_compiler->filesystemFriendlyName(_contractName) + ".wasm", + asString(m_compiler->eWasmObject(_contractName).bytecode) + ); + } else { - sout() << "eWasm: " << endl; + sout() << "EWasm text: " << endl; sout() << m_compiler->eWasm(_contractName) << endl; + sout() << "EWasm binary (hex): " << m_compiler->eWasmObject(_contractName).toHex() << endl; } } }