Skip to content

Commit

Permalink
Introduce LabelID typedef.
Browse files Browse the repository at this point in the history
  • Loading branch information
chriseth committed May 29, 2017
1 parent 002df12 commit 9adff68
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
8 changes: 5 additions & 3 deletions libjulia/backends/evm/AbstractAssembly.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ namespace julia
class AbstractAssembly
{
public:
using LabelID = size_t;

virtual ~AbstractAssembly() {}

/// Set a new source location valid starting from the next instruction.
Expand All @@ -56,11 +58,11 @@ class AbstractAssembly
/// Append a constant.
virtual void appendConstant(u256 const& _constant) = 0;
/// Append a label.
virtual void appendLabel(size_t _labelId) = 0;
virtual void appendLabel(LabelID _labelId) = 0;
/// Append a label reference.
virtual void appendLabelReference(size_t _labelId) = 0;
virtual void appendLabelReference(LabelID _labelId) = 0;
/// Generate a new unique label.
virtual size_t newLabelId() = 0;
virtual LabelID newLabelId() = 0;
/// Append a reference to a to-be-linked symobl.
/// Currently, we assume that the value is always a 20 byte number.
virtual void appendLinkerSymbol(std::string const& _name) = 0;
Expand Down
4 changes: 2 additions & 2 deletions libsolidity/inlineasm/AsmCodeGen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,12 @@ class EthAssemblyAdapter: public julia::AbstractAssembly
m_assembly.append(_constant);
}
/// Append a label.
virtual void appendLabel(size_t _labelId) override
virtual void appendLabel(LabelID _labelId) override
{
m_assembly.append(eth::AssemblyItem(eth::Tag, _labelId));
}
/// Append a label reference.
virtual void appendLabelReference(size_t _labelId) override
virtual void appendLabelReference(LabelID _labelId) override
{
m_assembly.append(eth::AssemblyItem(eth::PushTag, _labelId));
}
Expand Down
3 changes: 2 additions & 1 deletion libsolidity/inlineasm/AsmScope.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ struct GenericVisitor<>: public boost::static_visitor<> {
struct Scope
{
using JuliaType = std::string;
using LabelID = size_t;

struct Variable
{
Expand All @@ -76,7 +77,7 @@ struct Scope

struct Label
{
boost::optional<size_t> id;
boost::optional<LabelID> id;
};

struct Function
Expand Down

0 comments on commit 9adff68

Please sign in to comment.