Merge pull request #2503 from ethereum/julia-analyzer

Add Julia-mode to AsmAnalyzer/CodeGen
This commit is contained in:
chriseth 2017-07-03 13:17:52 +02:00 committed by GitHub
commit aa262d5c8f
4 changed files with 9 additions and 5 deletions

View File

@ -294,7 +294,7 @@ void CodeTransform::operator()(FunctionDefinition const& _function)
m_assembly.appendConstant(u256(0));
}
CodeTransform(m_assembly, m_info, m_evm15, m_identifierAccess, localStackAdjustment, m_context)
CodeTransform(m_assembly, m_info, m_julia, m_evm15, m_identifierAccess, localStackAdjustment, m_context)
(_function.body);
{

View File

@ -48,11 +48,13 @@ public:
CodeTransform(
julia::AbstractAssembly& _assembly,
solidity::assembly::AsmAnalysisInfo& _analysisInfo,
bool _julia = false,
bool _evm15 = false,
ExternalIdentifierAccess const& _identifierAccess = ExternalIdentifierAccess()
): CodeTransform(
_assembly,
_analysisInfo,
_julia,
_evm15,
_identifierAccess,
_assembly.stackHeight(),
@ -73,6 +75,7 @@ protected:
CodeTransform(
julia::AbstractAssembly& _assembly,
solidity::assembly::AsmAnalysisInfo& _analysisInfo,
bool _julia,
bool _evm15,
ExternalIdentifierAccess const& _identifierAccess,
int _stackAdjustment,
@ -80,6 +83,7 @@ protected:
):
m_assembly(_assembly),
m_info(_analysisInfo),
m_julia(_julia),
m_evm15(_evm15),
m_identifierAccess(_identifierAccess),
m_stackAdjustment(_stackAdjustment),
@ -130,6 +134,7 @@ private:
julia::AbstractAssembly& m_assembly;
solidity::assembly::AsmAnalysisInfo& m_info;
solidity::assembly::Scope* m_scope = nullptr;
bool m_julia = false;
bool m_evm15 = false;
ExternalIdentifierAccess m_identifierAccess;
/// Adjustment between the stack height as determined during the analysis phase

View File

@ -137,7 +137,6 @@ private:
eth::Assembly& m_assembly;
};
void assembly::CodeGenerator::assemble(
Block const& _parsedData,
AsmAnalysisInfo& _analysisInfo,
@ -146,5 +145,5 @@ void assembly::CodeGenerator::assemble(
)
{
EthAssemblyAdapter assemblyAdapter(_assembly);
julia::CodeTransform(assemblyAdapter, _analysisInfo, false, _identifierAccess)(_parsedData);
julia::CodeTransform(assemblyAdapter, _analysisInfo, false, false, _identifierAccess)(_parsedData);
}

View File

@ -72,7 +72,7 @@ bool AssemblyStack::analyze(assembly::Block const& _block, Scanner const* _scann
bool AssemblyStack::analyzeParsed()
{
m_analysisInfo = make_shared<assembly::AsmAnalysisInfo>();
assembly::AsmAnalyzer analyzer(*m_analysisInfo, m_errorReporter);
assembly::AsmAnalyzer analyzer(*m_analysisInfo, m_errorReporter, m_language == Language::JULIA);
m_analysisSuccessful = analyzer.analyze(*m_parserResult);
return m_analysisSuccessful;
}
@ -100,7 +100,7 @@ MachineAssemblyObject AssemblyStack::assemble(Machine _machine) const
{
MachineAssemblyObject object;
julia::EVMAssembly assembly(true);
julia::CodeTransform(assembly, *m_analysisInfo, true)(*m_parserResult);
julia::CodeTransform(assembly, *m_analysisInfo, m_language == Language::JULIA, true)(*m_parserResult);
object.bytecode = make_shared<eth::LinkerObject>(assembly.finalize());
/// TOOD: fill out text representation
return object;