aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoralon@honor <none@none>2010-10-18 21:15:36 -0700
committeralon@honor <none@none>2010-10-18 21:15:36 -0700
commit890130e93bc1128d7b5fbdcc512e243ef78cd712 (patch)
tree161ed3d2fd17a4858e82d1c751861598a95c474a /src
parentbaa2806fdd6c01df82058bf523a767e88d7049ae (diff)
fix bug with size of small structures, and parsing them
Diffstat (limited to 'src')
-rw-r--r--src/analyzer.js4
-rw-r--r--src/enzymatic.js3
-rw-r--r--src/intertyper.js4
-rw-r--r--src/settings.js2
4 files changed, 8 insertions, 5 deletions
diff --git a/src/analyzer.js b/src/analyzer.js
index 4a692826..d1039e1c 100644
--- a/src/analyzer.js
+++ b/src/analyzer.js
@@ -197,7 +197,9 @@ function analyzer(data) {
} else if (dedup(diffs).length == 1) {
type.flatFactor = diffs[0];
}
- type.flatSize = Runtime.alignMemory(type.flatSize); // final padding at end
+ if (type.flatSize > QUANTUM_SIZE) {
+ type.flatSize = Runtime.alignMemory(type.flatSize); // final padding at end
+ }
type.needsFlattening = (this.flatFactor != 1);
dprint('types', 'type: ' + type.name_ + ' : ' + JSON.stringify(type.fields));
dprint('types', ' has final size of ' + type.flatSize + ', flatting: ' + type.needsFlattening + ' ? ' + (type.flatFactor ? type.flatFactor : JSON.stringify(type.flatIndexes)));
diff --git a/src/enzymatic.js b/src/enzymatic.js
index bb4458fe..d940030e 100644
--- a/src/enzymatic.js
+++ b/src/enzymatic.js
@@ -42,6 +42,7 @@ Substrate.prototype = {
zyme.forwardItems = bind(this, this.addItems);
this.zymes[name_] = zyme;
if (!zyme.process) zyme.process = Zyme.prototype.process;
+ return zyme;
},
solve: function() {
@@ -83,7 +84,7 @@ Substrate.prototype = {
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));
+ print("Stack: " + new Error().stack);
throw e;
}
hadProcessing = true;
diff --git a/src/intertyper.js b/src/intertyper.js
index cb92e9ea..d5d41c3a 100644
--- a/src/intertyper.js
+++ b/src/intertyper.js
@@ -38,7 +38,7 @@ function intertyper(data) {
});
// Line tokenizer
- substrate.addZyme('Tokenizer', {
+ var tokenizer = substrate.addZyme('Tokenizer', {
processItem: function(item, inner) {
var lineText = item.lineText + " ";
var tokens = [];
@@ -238,7 +238,7 @@ function intertyper(data) {
fields = [item.tokens[3].text];
} else if (item.tokens[3].text != 'opaque') {
if (item.tokens[3].type == '<') { // type <{ i8 }> XXX - check spec
- item.tokens[3] = item.tokens[3].item[0];
+ item.tokens[3] = tokenizer.processItem({ lineText: '{ ' + item.tokens[3].item[0].tokens[0].text + ' }' }, true)[0].tokens[0];
}
var subTokens = item.tokens[3].tokens;
subTokens.push({text:','});
diff --git a/src/settings.js b/src/settings.js
index 3018a32f..221a9e84 100644
--- a/src/settings.js
+++ b/src/settings.js
@@ -34,7 +34,7 @@ EXCEPTION_DEBUG = 1; // Print out exceptions in emscriptened code
EXECUTION_TIMEOUT = -1; // Throw an exception after X seconds - useful to debug infinite loops
// Compiler debugging options
-DEBUG_TAGS_SHOWING = ['enzymatic', 'relooping'];
+DEBUG_TAGS_SHOWING = ['enzymatic', 'types'];
// Some useful items:
// gconst
// types