Transition from bytecode to more general linker objects.

This commit is contained in:
chriseth
2015-09-11 15:21:37 +02:00
parent 337fde9d11
commit a9edc7b1a6
16 changed files with 90 additions and 78 deletions
+1 -1
View File
@@ -233,7 +233,7 @@ protected:
m_compiler.reset(false, m_addStandardSources);
m_compiler.addSource("", registrarCode);
ETH_TEST_REQUIRE_NO_THROW(m_compiler.compile(m_optimize, m_optimizeRuns), "Compiling contract failed");
s_compiledRegistrar.reset(new bytes(m_compiler.bytecode("GlobalRegistrar")));
s_compiledRegistrar.reset(new bytes(m_compiler.object("GlobalRegistrar").bytecode));
}
sendMessage(*s_compiledRegistrar, true);
BOOST_REQUIRE(!m_output.empty());
+1 -1
View File
@@ -125,7 +125,7 @@ protected:
m_compiler.reset(false, m_addStandardSources);
m_compiler.addSource("", registrarCode);
ETH_TEST_REQUIRE_NO_THROW(m_compiler.compile(m_optimize, m_optimizeRuns), "Compiling contract failed");
s_compiledRegistrar.reset(new bytes(m_compiler.bytecode("FixedFeeRegistrar")));
s_compiledRegistrar.reset(new bytes(m_compiler.object("FixedFeeRegistrar").bytecode));
}
sendMessage(*s_compiledRegistrar, true);
BOOST_REQUIRE(!m_output.empty());
+1 -1
View File
@@ -440,7 +440,7 @@ protected:
m_compiler.reset(false, m_addStandardSources);
m_compiler.addSource("", walletCode);
ETH_TEST_REQUIRE_NO_THROW(m_compiler.compile(m_optimize, m_optimizeRuns), "Compiling contract failed");
s_compiledWallet.reset(new bytes(m_compiler.bytecode("Wallet")));
s_compiledWallet.reset(new bytes(m_compiler.object("Wallet").bytecode));
}
bytes args = encodeArgs(u256(0x60), _required, _dailyLimit, u256(_owners.size()), _owners);
sendMessage(*s_compiledWallet + args, true, _value);
+1 -1
View File
@@ -66,7 +66,7 @@ eth::AssemblyItems compileContract(const string& _sourceCode)
if (ContractDefinition* contract = dynamic_cast<ContractDefinition*>(node.get()))
{
Compiler compiler;
compiler.compileContract(*contract, map<ContractDefinition const*, bytes const*>{});
compiler.compileContract(*contract, map<ContractDefinition const*, Assembly const*>{});
return compiler.runtimeAssemblyItems();
}
+1 -1
View File
@@ -63,7 +63,7 @@ public:
auto state = make_shared<KnownState>();
PathGasMeter meter(*m_compiler.assemblyItems());
GasMeter::GasConsumption gas = meter.estimateMax(0, state);
u256 bytecodeSize(m_compiler.runtimeBytecode().size());
u256 bytecodeSize(m_compiler.runtimeObject().bytecode.size());
gas += bytecodeSize * c_createDataGas;
BOOST_REQUIRE(!gas.isInfinite);
BOOST_CHECK(gas.value == m_gasUsed);
@@ -138,7 +138,7 @@ bytes compileFirstExpression(const string& _sourceCode, vector<vector<string>> _
for (vector<string> const& function: _functions)
context << context.functionEntryLabel(dynamic_cast<FunctionDefinition const&>(resolveDeclaration(function, resolver)));
bytes instructions = context.assembledBytecode();
bytes instructions = context.assembledObject().bytecode;
// debug
// cout << eth::disassemble(instructions) << endl;
return instructions;
@@ -59,7 +59,7 @@ public:
m_compiler.reset(false, m_addStandardSources);
m_compiler.addSource("", _sourceCode);
ETH_TEST_REQUIRE_NO_THROW(m_compiler.compile(m_optimize, m_optimizeRuns), "Compiling contract failed");
bytes code = m_compiler.bytecode(_contractName);
bytes code = m_compiler.object(_contractName).bytecode;
sendMessage(code + _arguments, true, _value);
return m_output;
}