mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #10934 from ethereum/useDeployedNaming
Replace "runtime" by "deployed" naming.
This commit is contained in:
commit
72c6932bf5
@ -63,7 +63,7 @@ string IRNames::creationObject(ContractDefinition const& _contract)
|
|||||||
return _contract.name() + "_" + toString(_contract.id());
|
return _contract.name() + "_" + toString(_contract.id());
|
||||||
}
|
}
|
||||||
|
|
||||||
string IRNames::runtimeObject(ContractDefinition const& _contract)
|
string IRNames::deployedObject(ContractDefinition const& _contract)
|
||||||
{
|
{
|
||||||
return _contract.name() + "_" + toString(_contract.id()) + "_deployed";
|
return _contract.name() + "_" + toString(_contract.id()) + "_deployed";
|
||||||
}
|
}
|
||||||
|
@ -52,7 +52,7 @@ struct IRNames
|
|||||||
static std::string modifierInvocation(ModifierInvocation const& _modifierInvocation);
|
static std::string modifierInvocation(ModifierInvocation const& _modifierInvocation);
|
||||||
static std::string functionWithModifierInner(FunctionDefinition const& _function);
|
static std::string functionWithModifierInner(FunctionDefinition const& _function);
|
||||||
static std::string creationObject(ContractDefinition const& _contract);
|
static std::string creationObject(ContractDefinition const& _contract);
|
||||||
static std::string runtimeObject(ContractDefinition const& _contract);
|
static std::string deployedObject(ContractDefinition const& _contract);
|
||||||
static std::string internalDispatch(YulArity const& _arity);
|
static std::string internalDispatch(YulArity const& _arity);
|
||||||
static std::string implicitConstructor(ContractDefinition const& _contract);
|
static std::string implicitConstructor(ContractDefinition const& _contract);
|
||||||
static std::string libraryAddressImmutable();
|
static std::string libraryAddressImmutable();
|
||||||
|
@ -102,16 +102,16 @@ string IRGenerator::generate(
|
|||||||
<deploy>
|
<deploy>
|
||||||
<functions>
|
<functions>
|
||||||
}
|
}
|
||||||
object "<RuntimeObject>" {
|
object "<DeployedObject>" {
|
||||||
code {
|
code {
|
||||||
<memoryInitRuntime>
|
<memoryInitDeployed>
|
||||||
<?library>
|
<?library>
|
||||||
let called_via_delegatecall := iszero(eq(loadimmutable("<library_address>"), address()))
|
let called_via_delegatecall := iszero(eq(loadimmutable("<library_address>"), address()))
|
||||||
</library>
|
</library>
|
||||||
<dispatch>
|
<dispatch>
|
||||||
<runtimeFunctions>
|
<deployedFunctions>
|
||||||
}
|
}
|
||||||
<runtimeSubObjects>
|
<deployedSubObjects>
|
||||||
}
|
}
|
||||||
<subObjects>
|
<subObjects>
|
||||||
}
|
}
|
||||||
@ -155,21 +155,21 @@ string IRGenerator::generate(
|
|||||||
|
|
||||||
// NOTE: Function pointers can be passed from creation code via storage variables. We need to
|
// NOTE: Function pointers can be passed from creation code via storage variables. We need to
|
||||||
// get all the functions they could point to into the dispatch functions even if they're never
|
// get all the functions they could point to into the dispatch functions even if they're never
|
||||||
// referenced by name in the runtime code.
|
// referenced by name in the deployed code.
|
||||||
m_context.initializeInternalDispatch(move(internalDispatchMap));
|
m_context.initializeInternalDispatch(move(internalDispatchMap));
|
||||||
|
|
||||||
// Do not register immutables to avoid assignment.
|
// Do not register immutables to avoid assignment.
|
||||||
t("RuntimeObject", IRNames::runtimeObject(_contract));
|
t("DeployedObject", IRNames::deployedObject(_contract));
|
||||||
t("library_address", IRNames::libraryAddressImmutable());
|
t("library_address", IRNames::libraryAddressImmutable());
|
||||||
t("dispatch", dispatchRoutine(_contract));
|
t("dispatch", dispatchRoutine(_contract));
|
||||||
generateQueuedFunctions();
|
generateQueuedFunctions();
|
||||||
generateInternalDispatchFunctions();
|
generateInternalDispatchFunctions();
|
||||||
t("runtimeFunctions", m_context.functionCollector().requestedFunctions());
|
t("deployedFunctions", m_context.functionCollector().requestedFunctions());
|
||||||
t("runtimeSubObjects", subObjectSources(m_context.subObjectsCreated()));
|
t("deployedSubObjects", subObjectSources(m_context.subObjectsCreated()));
|
||||||
|
|
||||||
// This has to be called only after all other code generation for the runtime object is complete.
|
// This has to be called only after all other code generation for the deployed object is complete.
|
||||||
bool runtimeInvolvesAssembly = m_context.inlineAssemblySeen();
|
bool deployedInvolvesAssembly = m_context.inlineAssemblySeen();
|
||||||
t("memoryInitRuntime", memoryInit(!runtimeInvolvesAssembly));
|
t("memoryInitDeployed", memoryInit(!deployedInvolvesAssembly));
|
||||||
return t.render();
|
return t.render();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -757,7 +757,7 @@ string IRGenerator::deployCode(ContractDefinition const& _contract)
|
|||||||
|
|
||||||
return(0, datasize("<object>"))
|
return(0, datasize("<object>"))
|
||||||
)X");
|
)X");
|
||||||
t("object", IRNames::runtimeObject(_contract));
|
t("object", IRNames::deployedObject(_contract));
|
||||||
|
|
||||||
vector<map<string, string>> loadImmutables;
|
vector<map<string, string>> loadImmutables;
|
||||||
vector<map<string, string>> storeImmutables;
|
vector<map<string, string>> storeImmutables;
|
||||||
|
@ -1764,7 +1764,7 @@ void IRGeneratorForStatements::endVisit(MemberAccess const& _memberAccess)
|
|||||||
)")
|
)")
|
||||||
("allocationFunction", m_utils.allocationFunction())
|
("allocationFunction", m_utils.allocationFunction())
|
||||||
("size", m_context.newYulVariable())
|
("size", m_context.newYulVariable())
|
||||||
("objectName", IRNames::creationObject(contract) + (member == "runtimeCode" ? "." + IRNames::runtimeObject(contract) : ""))
|
("objectName", IRNames::creationObject(contract) + (member == "runtimeCode" ? "." + IRNames::deployedObject(contract) : ""))
|
||||||
("result", IRVariable(_memberAccess).commaSeparatedList()).render();
|
("result", IRVariable(_memberAccess).commaSeparatedList()).render();
|
||||||
}
|
}
|
||||||
else if (member == "name")
|
else if (member == "name")
|
||||||
|
@ -1302,7 +1302,7 @@ void CompilerStack::generateEVMFromIR(ContractDefinition const& _contract)
|
|||||||
// TODO: use stack.assemble here!
|
// TODO: use stack.assemble here!
|
||||||
yul::MachineAssemblyObject init;
|
yul::MachineAssemblyObject init;
|
||||||
yul::MachineAssemblyObject runtime;
|
yul::MachineAssemblyObject runtime;
|
||||||
std::tie(init, runtime) = stack.assembleWithDeployed(IRNames::runtimeObject(_contract));
|
std::tie(init, runtime) = stack.assembleWithDeployed(IRNames::deployedObject(_contract));
|
||||||
compiledContract.object = std::move(*init.bytecode);
|
compiledContract.object = std::move(*init.bytecode);
|
||||||
compiledContract.runtimeObject = std::move(*runtime.bytecode);
|
compiledContract.runtimeObject = std::move(*runtime.bytecode);
|
||||||
// TODO: refactor assemblyItems, runtimeAssemblyItems, generatedSources,
|
// TODO: refactor assemblyItems, runtimeAssemblyItems, generatedSources,
|
||||||
|
Loading…
Reference in New Issue
Block a user