aboutsummaryrefslogtreecommitdiffstats
path: root/CompilerContext.h
diff options
context:
space:
mode:
authorChristian <c@ethdev.com>2014-12-08 23:56:41 +0800
committerChristian <c@ethdev.com>2014-12-08 23:56:41 +0800
commitcd5f4958613ab131980c4b15563ad9d0017d8d5c (patch)
tree7e9f4ef84501756e20a042ffd3a24b9802735ead /CompilerContext.h
parent57e6827cb57708ed8f687bf9b0a304b1481cf742 (diff)
downloaddexon-solidity-cd5f4958613ab131980c4b15563ad9d0017d8d5c.tar
dexon-solidity-cd5f4958613ab131980c4b15563ad9d0017d8d5c.tar.gz
dexon-solidity-cd5f4958613ab131980c4b15563ad9d0017d8d5c.tar.bz2
dexon-solidity-cd5f4958613ab131980c4b15563ad9d0017d8d5c.tar.lz
dexon-solidity-cd5f4958613ab131980c4b15563ad9d0017d8d5c.tar.xz
dexon-solidity-cd5f4958613ab131980c4b15563ad9d0017d8d5c.tar.zst
dexon-solidity-cd5f4958613ab131980c4b15563ad9d0017d8d5c.zip
Register variably-sized variables on stack.
Diffstat (limited to 'CompilerContext.h')
-rw-r--r--CompilerContext.h10
1 files changed, 6 insertions, 4 deletions
diff --git a/CompilerContext.h b/CompilerContext.h
index 6a48e148..7272a368 100644
--- a/CompilerContext.h
+++ b/CompilerContext.h
@@ -43,8 +43,8 @@ public:
void addMagicGlobal(MagicVariableDeclaration const& _declaration);
void addStateVariable(VariableDeclaration const& _declaration);
void startNewFunction() { m_localVariables.clear(); m_asm.setDeposit(0); }
- void initializeLocalVariables(unsigned _numVariables);
- void addVariable(VariableDeclaration const& _declaration) { m_localVariables.push_back(&_declaration); }
+ void addVariable(VariableDeclaration const& _declaration);
+ void addAndInitializeVariable(VariableDeclaration const& _declaration);
void addFunction(FunctionDefinition const& _function) { m_functionEntryLabels.insert(std::make_pair(&_function, m_asm.newTag())); }
void adjustStackOffset(int _adjustment) { m_asm.adjustDeposit(_adjustment); }
@@ -98,8 +98,10 @@ private:
u256 m_stateVariablesSize;
/// Storage offsets of state variables
std::map<Declaration const*, u256> m_stateVariables;
- /// Offsets of local variables on the stack.
- std::vector<Declaration const*> m_localVariables;
+ /// Offsets of local variables on the stack (relative to stack base).
+ std::map<Declaration const*, unsigned> m_localVariables;
+ /// Sum of stack sizes of local variables
+ unsigned m_localVariablesSize;
/// Labels pointing to the entry points of funcitons.
std::map<Declaration const*, eth::AssemblyItem> m_functionEntryLabels;
};