mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Pass on assembly instance from AssemblyStack to CompilerStack
This allows for generation of various output artifacts supported by the old codegen
This commit is contained in:
parent
6ae09ee0cc
commit
0e8e4eacd5
@ -56,6 +56,7 @@
|
|||||||
#include <libsolidity/interface/Version.h>
|
#include <libsolidity/interface/Version.h>
|
||||||
#include <libsolidity/parsing/Parser.h>
|
#include <libsolidity/parsing/Parser.h>
|
||||||
|
|
||||||
|
#include <libsolidity/codegen/ir/Common.h>
|
||||||
#include <libsolidity/codegen/ir/IRGenerator.h>
|
#include <libsolidity/codegen/ir/IRGenerator.h>
|
||||||
|
|
||||||
#include <libyul/YulString.h>
|
#include <libyul/YulString.h>
|
||||||
@ -1375,30 +1376,11 @@ void CompilerStack::generateEVMFromIR(ContractDefinition const& _contract)
|
|||||||
//cout << yul::AsmPrinter{}(*stack.parserResult()->code) << endl;
|
//cout << yul::AsmPrinter{}(*stack.parserResult()->code) << endl;
|
||||||
|
|
||||||
// TODO: support passing metadata
|
// TODO: support passing metadata
|
||||||
// TODO: use stack.assemble here!
|
|
||||||
yul::MachineAssemblyObject init;
|
|
||||||
yul::MachineAssemblyObject runtime;
|
|
||||||
std::tie(init, runtime) = stack.assembleWithDeployed(IRNames::deployedObject(_contract));
|
|
||||||
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:
|
string deployedName = IRNames::deployedObject(_contract);
|
||||||
// If contract creation returns data with length greater than 0x6000 (214 + 213) bytes,
|
solAssert(!deployedName.empty(), "");
|
||||||
// contract creation fails with an out of gas error.
|
tie(compiledContract.evmAssembly, compiledContract.evmRuntimeAssembly) = stack.assembleEVMWithDeployed(deployedName);
|
||||||
if (
|
assemble(_contract, compiledContract.evmAssembly, compiledContract.evmRuntimeAssembly);
|
||||||
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)
|
void CompilerStack::generateEwasm(ContractDefinition const& _contract)
|
||||||
|
Loading…
Reference in New Issue
Block a user