aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoralon@honor <none@none>2010-10-17 21:24:03 -0700
committeralon@honor <none@none>2010-10-17 21:24:03 -0700
commit04dff51782dd5e8bb1a209e93d39499c59b190fa (patch)
tree20e38183923abe6d4007c2d7b27126a6d2a81a90
parentd16c1a6c068b8a293cf63723324e792dea187992 (diff)
more permissive stack analysis of initial allocations
-rw-r--r--src/analyzer.js4
-rw-r--r--src/enzymatic.js25
2 files changed, 20 insertions, 9 deletions
diff --git a/src/analyzer.js b/src/analyzer.js
index fff9cd48..54acbc54 100644
--- a/src/analyzer.js
+++ b/src/analyzer.js
@@ -315,7 +315,7 @@ function analyzer(data) {
for (var i = 0; i < lines.length; i++) {
var line = lines[i];
var item = line.value;
- if (!item || item.intertype != 'alloca') break;
+ if (!item || item.intertype != 'alloca') continue;
item.allocatedSize = func.variables[line.ident].impl === VAR_EMULATED ?
calcAllocatedSize(item.allocatedType, data.types) : 0;
total += item.allocatedSize;
@@ -324,7 +324,7 @@ function analyzer(data) {
var index = 0;
for (var i = 0; i < lines.length; i++) {
var item = lines[i].value;
- if (!item || item.intertype != 'alloca') break;
+ if (!item || item.intertype != 'alloca') continue;
item.allocatedIndex = index;
index += item.allocatedSize;
delete item.allocatedSize;
diff --git a/src/enzymatic.js b/src/enzymatic.js
index 5983f305..bb4458fe 100644
--- a/src/enzymatic.js
+++ b/src/enzymatic.js
@@ -76,10 +76,16 @@ Substrate.prototype = {
var inputs = zyme.items.slice(0);
var outputs;
var currResultCount = that.results.length;
- 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));
+ 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;
+ }
hadProcessing = true;
if (outputs) {
@@ -118,9 +124,14 @@ Zyme.prototype = {
var ret = [];
for (var i = 0; i < items.length; i++) {
var item = items[i];
- var outputs = this.processItem(item);
- if (outputs) {
- ret = ret.concat(outputs);
+ 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;
}
}
return ret;