aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/inlineasm/AsmData.h
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2018-10-29 22:12:02 +0800
committerchriseth <chris@ethereum.org>2018-11-08 02:30:27 +0800
commit674e17c2a895eff6729357d8c10db709ac368b79 (patch)
tree300a55700b068709f36340563db1b43e5b8b1188 /libsolidity/inlineasm/AsmData.h
parent0a96f091ab63e8d77106e00590a442c59714eecb (diff)
downloaddexon-solidity-674e17c2a895eff6729357d8c10db709ac368b79.tar.gz
dexon-solidity-674e17c2a895eff6729357d8c10db709ac368b79.tar.zst
dexon-solidity-674e17c2a895eff6729357d8c10db709ac368b79.zip
Performance: Replace string by special single-copy YulString class.
Diffstat (limited to 'libsolidity/inlineasm/AsmData.h')
-rw-r--r--libsolidity/inlineasm/AsmData.h19
1 files changed, 13 insertions, 6 deletions
diff --git a/libsolidity/inlineasm/AsmData.h b/libsolidity/inlineasm/AsmData.h
index 2982d5e0..a8d5e327 100644
--- a/libsolidity/inlineasm/AsmData.h
+++ b/libsolidity/inlineasm/AsmData.h
@@ -27,7 +27,13 @@
#include <libevmasm/Instruction.h>
#include <libevmasm/SourceLocation.h>
+#include <libyul/YulString.h>
+
#include <boost/variant.hpp>
+#include <boost/noncopyable.hpp>
+
+#include <map>
+#include <memory>
namespace dev
{
@@ -36,20 +42,21 @@ namespace solidity
namespace assembly
{
-using Type = std::string;
+using YulString = dev::yul::YulString;
+using Type = YulString;
-struct TypedName { SourceLocation location; std::string name; Type type; };
+struct TypedName { SourceLocation location; YulString name; Type type; };
using TypedNameList = std::vector<TypedName>;
/// Direct EVM instruction (except PUSHi and JUMPDEST)
struct Instruction { SourceLocation location; solidity::Instruction instruction; };
/// Literal number or string (up to 32 bytes)
enum class LiteralKind { Number, Boolean, String };
-struct Literal { SourceLocation location; LiteralKind kind; std::string value; Type type; };
+struct Literal { SourceLocation location; LiteralKind kind; YulString value; Type type; };
/// External / internal identifier or label reference
-struct Identifier { SourceLocation location; std::string name; };
+struct Identifier { SourceLocation location; YulString name; };
/// Jump label ("name:")
-struct Label { SourceLocation location; std::string name; };
+struct Label { SourceLocation location; YulString name; };
/// Assignment from stack (":= x", moves stack top into x, potentially multiple slots)
struct StackAssignment { SourceLocation location; Identifier variableName; };
/// Assignment ("x := mload(20:u256)", expects push-1-expression on the right hand
@@ -69,7 +76,7 @@ struct VariableDeclaration { SourceLocation location; TypedNameList variables; s
/// Block that creates a scope (frees declared stack variables)
struct Block { SourceLocation location; std::vector<Statement> statements; };
/// Function definition ("function f(a, b) -> (d, e) { ... }")
-struct FunctionDefinition { SourceLocation location; std::string name; TypedNameList parameters; TypedNameList returnVariables; Block body; };
+struct FunctionDefinition { SourceLocation location; YulString name; TypedNameList parameters; TypedNameList returnVariables; Block body; };
/// Conditional execution without "else" part.
struct If { SourceLocation location; std::shared_ptr<Expression> condition; Block body; };
/// Switch case or default case