Commandline interface additions for webassembly binary.

This commit is contained in:
chriseth 2019-10-31 18:43:54 +01:00
parent e79a32e9d5
commit 587c87b15b
3 changed files with 11 additions and 1 deletions

View File

@ -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:

View File

@ -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);

View File

@ -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;
}
}
}