mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Output runtime object in IR
This commit is contained in:
@@ -1226,7 +1226,7 @@ void CompilerStack::compileContract(
|
||||
}
|
||||
|
||||
// Throw a warning if EIP-170 limits are exceeded:
|
||||
// If contract creation initialization returns data with length of more than 0x6000 (214 + 213) bytes,
|
||||
// If contract creation returns data with length greater than 0x6000 (214 + 213) bytes,
|
||||
// contract creation fails with an out of gas error.
|
||||
if (
|
||||
m_evmVersion >= langutil::EVMVersion::spuriousDragon() &&
|
||||
@@ -1299,12 +1299,30 @@ void CompilerStack::generateEVMFromIR(ContractDefinition const& _contract)
|
||||
//cout << yul::AsmPrinter{}(*stack.parserResult()->code) << endl;
|
||||
|
||||
// TODO: support passing metadata
|
||||
auto result = stack.assemble(yul::AssemblyStack::Machine::EVM);
|
||||
compiledContract.object = std::move(*result.bytecode);
|
||||
// TODO: support runtimeObject
|
||||
// TODO: add EIP-170 size check for runtimeObject
|
||||
// TODO: use stack.assemble here!
|
||||
yul::MachineAssemblyObject init;
|
||||
yul::MachineAssemblyObject runtime;
|
||||
std::tie(init, runtime) = stack.assembleAndGuessRuntime();
|
||||
compiledContract.object = std::move(*init.bytecode);
|
||||
compiledContract.runtimeObject = std::move(*runtime.bytecode);
|
||||
// TODO: refactor assemblyItems, runtimeAssemblyItems, generatedSources,
|
||||
// assemblyString, assemblyJSON, and functionEntryPoints to work with this code path
|
||||
|
||||
// Throw a warning if EIP-170 limits are exceeded:
|
||||
// If contract creation returns data with length greater than 0x6000 (214 + 213) bytes,
|
||||
// contract creation fails with an out of gas error.
|
||||
if (
|
||||
m_evmVersion >= langutil::EVMVersion::spuriousDragon() &&
|
||||
compiledContract.runtimeObject.bytecode.size() > 0x6000
|
||||
)
|
||||
m_errorReporter.warning(
|
||||
9609_error,
|
||||
_contract.location(),
|
||||
"Contract code size exceeds 24576 bytes (a limit introduced in Spurious Dragon). "
|
||||
"This contract may not be deployable on mainnet. "
|
||||
"Consider enabling the optimizer (with a low \"runs\" value!), "
|
||||
"turning off revert strings, or using libraries."
|
||||
);
|
||||
}
|
||||
|
||||
void CompilerStack::generateEwasm(ContractDefinition const& _contract)
|
||||
|
||||
Reference in New Issue
Block a user