Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0e8e4ea

Browse files
axicchriseth
authored andcommitted
Pass on assembly instance from AssemblyStack to CompilerStack
This allows for generation of various output artifacts supported by the old codegen
1 parent 6ae09ee commit 0e8e4ea

File tree

1 file changed

+5
-23
lines changed

1 file changed

+5
-23
lines changed

libsolidity/interface/CompilerStack.cpp

Lines changed: 5 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
#include <libsolidity/interface/Version.h>
5757
#include <libsolidity/parsing/Parser.h>
5858

59+
#include <libsolidity/codegen/ir/Common.h>
5960
#include <libsolidity/codegen/ir/IRGenerator.h>
6061

6162
#include <libyul/YulString.h>
@@ -1375,30 +1376,11 @@ void CompilerStack::generateEVMFromIR(ContractDefinition const& _contract)
13751376
//cout << yul::AsmPrinter{}(*stack.parserResult()->code) << endl;
13761377

13771378
// TODO: support passing metadata
1378-
// TODO: use stack.assemble here!
1379-
yul::MachineAssemblyObject init;
1380-
yul::MachineAssemblyObject runtime;
1381-
std::tie(init, runtime) = stack.assembleWithDeployed(IRNames::deployedObject(_contract));
1382-
compiledContract.object = std::move(*init.bytecode);
1383-
compiledContract.runtimeObject = std::move(*runtime.bytecode);
1384-
// TODO: refactor assemblyItems, runtimeAssemblyItems, generatedSources,
1385-
// assemblyString, assemblyJSON, and functionEntryPoints to work with this code path
13861379

1387-
// Throw a warning if EIP-170 limits are exceeded:
1388-
// If contract creation returns data with length greater than 0x6000 (214 + 213) bytes,
1389-
// contract creation fails with an out of gas error.
1390-
if (
1391-
m_evmVersion >= langutil::EVMVersion::spuriousDragon() &&
1392-
compiledContract.runtimeObject.bytecode.size() > 0x6000
1393-
)
1394-
m_errorReporter.warning(
1395-
9609_error,
1396-
_contract.location(),
1397-
"Contract code size exceeds 24576 bytes (a limit introduced in Spurious Dragon). "
1398-
"This contract may not be deployable on mainnet. "
1399-
"Consider enabling the optimizer (with a low \"runs\" value!), "
1400-
"turning off revert strings, or using libraries."
1401-
);
1380+
string deployedName = IRNames::deployedObject(_contract);
1381+
solAssert(!deployedName.empty(), "");
1382+
tie(compiledContract.evmAssembly, compiledContract.evmRuntimeAssembly) = stack.assembleEVMWithDeployed(deployedName);
1383+
assemble(_contract, compiledContract.evmAssembly, compiledContract.evmRuntimeAssembly);
14021384
}
14031385

14041386
void CompilerStack::generateEwasm(ContractDefinition const& _contract)

0 commit comments

Comments
 (0)