Permalink
Browse files

misc minor fixes

  • Loading branch information...
1 parent 4acb8fa commit d16c1a6c068b8a293cf63723324e792dea187992 alon@honor committed Oct 18, 2010
Showing with 15 additions and 22 deletions.
  1. +2 −2 emscripten.py
  2. +7 −18 src/enzymatic.js
  3. +5 −1 src/intertyper.js
  4. +1 −1 src/parseTools.js
View
@@ -13,7 +13,7 @@ def emscripten(filename, settings):
data = open(filename, 'r').read()
cwd = os.getcwd()
os.chdir(os.path.dirname(COMPILER))
- subprocess.Popen([JS_ENGINE, COMPILER], stdin=subprocess.PIPE).communicate(settings+'\n'+data)[0]
+ subprocess.Popen(JS_ENGINE + [COMPILER], stdin=subprocess.PIPE).communicate(settings+'\n'+data)[0]
os.chdir(cwd)
if __name__ == '__main__':
@@ -32,6 +32,6 @@ def emscripten(filename, settings):
'''
else:
if len(sys.argv) >= 3:
- JS_ENGINE = sys.argv[2]
+ JS_ENGINE = [sys.argv[2]]
emscripten(sys.argv[1], sys.argv[3] if len(sys.argv) == 4 else "{}")
View
@@ -76,16 +76,10 @@ Substrate.prototype = {
var inputs = zyme.items.slice(0);
var outputs;
var currResultCount = that.results.length;
- try {
- dprint('Processing using ' + zyme.name_ + ': ' + inputs.length);
- zyme.items = []; // More may be added in process(); we'll get to them next time
- outputs = zyme.process(inputs);
- dprint('New results: ' + (outputs.length + that.results.length - currResultCount) + ' out of ' + (that.results.length + outputs.length));
- } catch (e) {
- print("Exception, current selected are: " + inputs.map(dump).join('\n\n'));
- print("Stack: " + dump(new Error().stack));
- throw e;
- }
+ dprint('Processing using ' + zyme.name_ + ': ' + inputs.length);
+ zyme.items = []; // More may be added in process(); we'll get to them next time
+ outputs = zyme.process(inputs);
+ dprint('New results: ' + (outputs.length + that.results.length - currResultCount) + ' out of ' + (that.results.length + outputs.length));
hadProcessing = true;
if (outputs) {
@@ -124,14 +118,9 @@ Zyme.prototype = {
var ret = [];
for (var i = 0; i < items.length; i++) {
var item = items[i];
- try {
- var outputs = this.processItem(item);
- if (outputs) {
- ret = ret.concat(outputs);
- }
- } catch (e) {
- print("Exception in process(), current item is: " + dump(item));
- throw e;
+ var outputs = this.processItem(item);
+ if (outputs) {
+ ret = ret.concat(outputs);
}
}
return ret;
View
@@ -178,7 +178,7 @@ function intertyper(data) {
return 'Bitcast';
if (!item.intertype && item.indent === -1 && item.tokens && item.tokens.length >= 3 && item.tokens[0].text == 'getelementptr')
return 'GEP';
- if (item.tokens && item.tokens.length >= 3 && item.tokens[0].text == 'call' && !item.intertype)
+ if (item.tokens && item.tokens.length >= 3 && (item.tokens[0].text == 'call' || item.tokens[1].text == 'call') && !item.intertype)
return 'Call';
if (item.tokens && item.tokens.length >= 3 && item.tokens[0].text == 'invoke' && !item.intertype)
return 'Invoke';
@@ -410,6 +410,10 @@ function intertyper(data) {
substrate.addZyme('Call', {
processItem: function(item) {
item.intertype = 'call';
+ if (['tail'].indexOf(item.tokens[0].text) != -1) {
+ item.tokens.splice(0, 1);
+ }
+ assertEq(item.tokens[0].text, 'call');
if (['signext', 'zeroext'].indexOf(item.tokens[1].text) != -1) {
item.tokens.splice(1, 1);
}
View
@@ -153,7 +153,7 @@ function compareTokens(a, b) {
function getTokenIndexByText(tokens, text) {
var i = 0;
- while (tokens[i].text != ';') i++;
+ while (tokens[i] && tokens[i].text != text) i++;
return i;
}

0 comments on commit d16c1a6

Please sign in to comment.