|
56 | 56 | #include <libsolidity/interface/Version.h>
|
57 | 57 | #include <libsolidity/parsing/Parser.h>
|
58 | 58 |
|
| 59 | +#include <libsolidity/codegen/ir/Common.h> |
59 | 60 | #include <libsolidity/codegen/ir/IRGenerator.h>
|
60 | 61 |
|
61 | 62 | #include <libyul/YulString.h>
|
@@ -1375,30 +1376,11 @@ void CompilerStack::generateEVMFromIR(ContractDefinition const& _contract)
|
1375 | 1376 | //cout << yul::AsmPrinter{}(*stack.parserResult()->code) << endl;
|
1376 | 1377 |
|
1377 | 1378 | // 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 |
1386 | 1379 |
|
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); |
1402 | 1384 | }
|
1403 | 1385 |
|
1404 | 1386 | void CompilerStack::generateEwasm(ContractDefinition const& _contract)
|
|
0 commit comments