From a72ab1c9c1b2160adca6a88ab84b3ffaae53bbfe Mon Sep 17 00:00:00 2001 From: chriseth Date: Wed, 10 Feb 2021 00:55:12 +0100 Subject: [PATCH] Replace "runtime" by "deployed" naming. --- libsolidity/codegen/ir/Common.cpp | 2 +- libsolidity/codegen/ir/Common.h | 2 +- libsolidity/codegen/ir/IRGenerator.cpp | 24 +++++++++---------- .../codegen/ir/IRGeneratorForStatements.cpp | 2 +- libsolidity/interface/CompilerStack.cpp | 2 +- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/libsolidity/codegen/ir/Common.cpp b/libsolidity/codegen/ir/Common.cpp index d11680f09..321becc51 100644 --- a/libsolidity/codegen/ir/Common.cpp +++ b/libsolidity/codegen/ir/Common.cpp @@ -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"; } diff --git a/libsolidity/codegen/ir/Common.h b/libsolidity/codegen/ir/Common.h index 66f09287f..76bb575aa 100644 --- a/libsolidity/codegen/ir/Common.h +++ b/libsolidity/codegen/ir/Common.h @@ -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(); diff --git a/libsolidity/codegen/ir/IRGenerator.cpp b/libsolidity/codegen/ir/IRGenerator.cpp index c91e2536e..339230cb8 100644 --- a/libsolidity/codegen/ir/IRGenerator.cpp +++ b/libsolidity/codegen/ir/IRGenerator.cpp @@ -102,16 +102,16 @@ string IRGenerator::generate( } - object "" { + object "" { code { - + let called_via_delegatecall := iszero(eq(loadimmutable(""), address())) - + } - + } } @@ -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("")) )X"); - t("object", IRNames::runtimeObject(_contract)); + t("object", IRNames::deployedObject(_contract)); vector> loadImmutables; vector> storeImmutables; diff --git a/libsolidity/codegen/ir/IRGeneratorForStatements.cpp b/libsolidity/codegen/ir/IRGeneratorForStatements.cpp index 2a9dad8cd..66e1e9393 100644 --- a/libsolidity/codegen/ir/IRGeneratorForStatements.cpp +++ b/libsolidity/codegen/ir/IRGeneratorForStatements.cpp @@ -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") diff --git a/libsolidity/interface/CompilerStack.cpp b/libsolidity/interface/CompilerStack.cpp index ef0c999c2..d518c50d3 100644 --- a/libsolidity/interface/CompilerStack.cpp +++ b/libsolidity/interface/CompilerStack.cpp @@ -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,