aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/inlineasm/AsmScope.h
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2018-11-08 03:26:33 +0800
committerGitHub <noreply@github.com>2018-11-08 03:26:33 +0800
commitdeed8e21f6149a9712ebd77556cdb6e3b4b9c566 (patch)
tree300a55700b068709f36340563db1b43e5b8b1188 /libsolidity/inlineasm/AsmScope.h
parent0a96f091ab63e8d77106e00590a442c59714eecb (diff)
parent674e17c2a895eff6729357d8c10db709ac368b79 (diff)
downloaddexon-solidity-deed8e21f6149a9712ebd77556cdb6e3b4b9c566.tar
dexon-solidity-deed8e21f6149a9712ebd77556cdb6e3b4b9c566.tar.gz
dexon-solidity-deed8e21f6149a9712ebd77556cdb6e3b4b9c566.tar.bz2
dexon-solidity-deed8e21f6149a9712ebd77556cdb6e3b4b9c566.tar.lz
dexon-solidity-deed8e21f6149a9712ebd77556cdb6e3b4b9c566.tar.xz
dexon-solidity-deed8e21f6149a9712ebd77556cdb6e3b4b9c566.tar.zst
dexon-solidity-deed8e21f6149a9712ebd77556cdb6e3b4b9c566.zip
Merge pull request #5334 from ethereum/stringPerformance
[Yul] String performance
Diffstat (limited to 'libsolidity/inlineasm/AsmScope.h')
-rw-r--r--libsolidity/inlineasm/AsmScope.h18
1 files changed, 10 insertions, 8 deletions
diff --git a/libsolidity/inlineasm/AsmScope.h b/libsolidity/inlineasm/AsmScope.h
index fc674e71..65848018 100644
--- a/libsolidity/inlineasm/AsmScope.h
+++ b/libsolidity/inlineasm/AsmScope.h
@@ -22,6 +22,8 @@
#include <libsolidity/interface/Exceptions.h>
+#include <libyul/YulString.h>
+
#include <libdevcore/Visitor.h>
#include <boost/variant.hpp>
@@ -39,7 +41,7 @@ namespace assembly
struct Scope
{
- using YulType = std::string;
+ using YulType = yul::YulString;
using LabelID = size_t;
struct Variable { YulType type; };
@@ -54,10 +56,10 @@ struct Scope
using Visitor = GenericVisitor<Variable const, Label const, Function const>;
using NonconstVisitor = GenericVisitor<Variable, Label, Function>;
- bool registerVariable(std::string const& _name, YulType const& _type);
- bool registerLabel(std::string const& _name);
+ bool registerVariable(yul::YulString _name, YulType const& _type);
+ bool registerLabel(yul::YulString _name);
bool registerFunction(
- std::string const& _name,
+ yul::YulString _name,
std::vector<YulType> const& _arguments,
std::vector<YulType> const& _returns
);
@@ -67,12 +69,12 @@ struct Scope
/// will any lookups across assembly boundaries.
/// The pointer will be invalidated if the scope is modified.
/// @param _crossedFunction if true, we already crossed a function boundary during recursive lookup
- Identifier* lookup(std::string const& _name);
+ Identifier* lookup(yul::YulString _name);
/// Looks up the identifier in this and super scopes (will not find variables across function
/// boundaries and generally stops at assembly boundaries) and calls the visitor, returns
/// false if not found.
template <class V>
- bool lookup(std::string const& _name, V const& _visitor)
+ bool lookup(yul::YulString _name, V const& _visitor)
{
if (Identifier* id = lookup(_name))
{
@@ -84,7 +86,7 @@ struct Scope
}
/// @returns true if the name exists in this scope or in super scopes (also searches
/// across function and assembly boundaries).
- bool exists(std::string const& _name) const;
+ bool exists(yul::YulString _name) const;
/// @returns the number of variables directly registered inside the scope.
size_t numberOfVariables() const;
@@ -95,7 +97,7 @@ struct Scope
/// If true, variables from the super scope are not visible here (other identifiers are),
/// but they are still taken into account to prevent shadowing.
bool functionScope = false;
- std::map<std::string, Identifier> identifiers;
+ std::map<yul::YulString, Identifier> identifiers;
};
}