Replace "runtime" by "deployed" naming.

This commit is contained in:
chriseth 2021-02-10 00:55:12 +01:00
parent 9b20c9840a
commit a72ab1c9c1
5 changed files with 16 additions and 16 deletions

View File

@ -63,7 +63,7 @@ string IRNames::creationObject(ContractDefinition const& _contract)
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";
}

View File

@ -52,7 +52,7 @@ struct IRNames
static std::string modifierInvocation(ModifierInvocation const& _modifierInvocation);
static std::string functionWithModifierInner(FunctionDefinition const& _function);
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 implicitConstructor(ContractDefinition const& _contract);
static std::string libraryAddressImmutable();

View File

@ -102,16 +102,16 @@ string IRGenerator::generate(
<deploy>
<functions>
}
object "<RuntimeObject>" {
object "<DeployedObject>" {
code {
<memoryInitRuntime>
<memoryInitDeployed>
<?library>
let called_via_delegatecall := iszero(eq(loadimmutable("<library_address>"), address()))
</library>
<dispatch>
<runtimeFunctions>
<deployedFunctions>
}
<runtimeSubObjects>
<deployedSubObjects>
}
<subObjects>
}
@ -155,21 +155,21 @@ string IRGenerator::generate(
// 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
// referenced by name in the runtime code.
// referenced by name in the deployed code.
m_context.initializeInternalDispatch(move(internalDispatchMap));
// Do not register immutables to avoid assignment.
t("RuntimeObject", IRNames::runtimeObject(_contract));
t("DeployedObject", IRNames::deployedObject(_contract));
t("library_address", IRNames::libraryAddressImmutable());
t("dispatch", dispatchRoutine(_contract));
generateQueuedFunctions();
generateInternalDispatchFunctions();
t("runtimeFunctions", m_context.functionCollector().requestedFunctions());
t("runtimeSubObjects", subObjectSources(m_context.subObjectsCreated()));
t("deployedFunctions", m_context.functionCollector().requestedFunctions());
t("deployedSubObjects", subObjectSources(m_context.subObjectsCreated()));
// This has to be called only after all other code generation for the runtime object is complete.
bool runtimeInvolvesAssembly = m_context.inlineAssemblySeen();
t("memoryInitRuntime", memoryInit(!runtimeInvolvesAssembly));
// This has to be called only after all other code generation for the deployed object is complete.
bool deployedInvolvesAssembly = m_context.inlineAssemblySeen();
t("memoryInitDeployed", memoryInit(!deployedInvolvesAssembly));
return t.render();
}
@ -757,7 +757,7 @@ string IRGenerator::deployCode(ContractDefinition const& _contract)
return(0, datasize("<object>"))
)X");
t("object", IRNames::runtimeObject(_contract));
t("object", IRNames::deployedObject(_contract));
vector<map<string, string>> loadImmutables;
vector<map<string, string>> storeImmutables;

View File

@ -1764,7 +1764,7 @@ void IRGeneratorForStatements::endVisit(MemberAccess const& _memberAccess)
)")
("allocationFunction", m_utils.allocationFunction())
("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();
}
else if (member == "name")

View File

@ -1302,7 +1302,7 @@ void CompilerStack::generateEVMFromIR(ContractDefinition const& _contract)
// TODO: use stack.assemble here!
yul::MachineAssemblyObject init;
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.runtimeObject = std::move(*runtime.bytecode);
// TODO: refactor assemblyItems, runtimeAssemblyItems, generatedSources,