Function hashes and new compiler version.

pull/1/head
chriseth 10 years ago
parent a8451b7bb1
commit 583a45ff15
  1. 30
      index.html

@ -56,7 +56,7 @@ body {
Source code on the left, compiled code and AST on the right (or error).<br/> Source code on the left, compiled code and AST on the right (or error).<br/>
<b>Note:</b> Chrome/Chromium currently reports &quot;Uncaught JavaScript Exception&quot;. <b>Note:</b> Chrome/Chromium currently reports &quot;Uncaught JavaScript Exception&quot;.
To work around this problem, enable the debug console (Ctrl+Shift+i) and reload.<br/> To work around this problem, enable the debug console (Ctrl+Shift+i) and reload.<br/>
Version: <a href="https://github.com/ethereum/cpp-ethereum/commit/0d48ad1d585511cf3a31e547477ebbaafaaf6ffa">0d48ad...</a> 2015-04-22 Version: <a href="https://github.com/ethereum/cpp-ethereum/commit/dea8d55f904e8eaa0a1da237748810b2ead69cfd">dea8d55f...</a> 2015-05-18
<div id="optimizeBox"> <div id="optimizeBox">
<input id="optimize" type="checkbox"><label for="optimize">optimize</label> <input id="optimize" type="checkbox"><label for="optimize">optimize</label>
</div> </div>
@ -179,8 +179,7 @@ var renderContracts = function(data, source) {
.append(tableRow('Bytecode', contract.bytecode)) .append(tableRow('Bytecode', contract.bytecode))
.append(tableRow('Interface', contract['interface'])) .append(tableRow('Interface', contract['interface']))
.append(tableRow('Solidity Interface', contract.solidity_interface)) .append(tableRow('Solidity Interface', contract.solidity_interface))
.append(tableRow('Opcodes', contract.opcodes)) .append(getDetails(contract, source));
.append(formatAssembly(contract.assembly, source));
$('#output').append(contractOutput); $('#output').append(contractOutput);
} }
}; };
@ -189,11 +188,20 @@ var tableRow = function(description, data) {
.append($('<span class="col1">').text(description)) .append($('<span class="col1">').text(description))
.append($('<input readonly="readonly" class="col2">').val(data)); .append($('<input readonly="readonly" class="col2">').val(data));
}; };
var formatAssembly = function(asm, source) { var getDetails = function(contract, source) {
var button = $('<button>Assembly</button>'); var button = $('<button>Details</button>');
var text = $('<pre style="display: none;"/>').text(formatAssemblyText(asm, '', source)); var details = $('<div style="display: none;"/>')
button.click(function() { text.toggle(); }); .append(tableRow('Opcodes', contract.opcodes));
return $('<div/>').append(button).append(text); var funHashes = '';
for (var fun in contract.functionHashes)
funHashes += contract.functionHashes[fun] + ' ' + fun + '\n';
details.append($('<span class="col1">Functions</span>'));
details.append($('<pre/>').text(funHashes));
details.append($('<span class="col1">Assembly</span>'));
var assembly = $('<pre/>').text(formatAssemblyText(contract.assembly, '', source));
details.append(assembly);
button.click(function() { details.toggle(); });
return $('<div/>').append(button).append(details);
}; };
var formatAssemblyText = function(asm, prefix, source) { var formatAssemblyText = function(asm, prefix, source) {
var text = ''; var text = '';
@ -203,7 +211,11 @@ var formatAssemblyText = function(asm, prefix, source) {
var src = ''; var src = '';
if (item.begin !== undefined && item.end != undefined) if (item.begin !== undefined && item.end != undefined)
src = source.slice(item.begin, item.end).replace('\n', '\\n', 'g'); src = source.slice(item.begin, item.end).replace('\n', '\\n', 'g');
text += ' ' + prefix + item.name + ' ' + v + '\t\t\t' + src + '\n'; if (src.length > 30)
src = src.slice(0, 30) + '...';
if (item.name != 'tag')
text += ' ';
text += prefix + item.name + ' ' + v + '\t\t\t' + src + '\n';
}); });
text += prefix + '.data\n'; text += prefix + '.data\n';
if (asm['.data']) if (asm['.data'])

Loading…
Cancel
Save