diff options
-rw-r--r-- | src/analyzer.js | 25 | ||||
-rw-r--r-- | src/jsifier.js | 2 | ||||
-rw-r--r-- | src/parseTools.js | 2 | ||||
-rw-r--r-- | src/runtime.js | 4 |
4 files changed, 15 insertions, 18 deletions
diff --git a/src/analyzer.js b/src/analyzer.js index edd5c08f..d8d285c4 100644 --- a/src/analyzer.js +++ b/src/analyzer.js @@ -79,10 +79,10 @@ function analyzer(data) { currLabelFinished = true; } } else { - print('// WARNING: content after a branch in a label, line: ' + subItem.lineNum + '::' + dump(subItem)); + print('// WARNING: content after a branch in a label, line: ' + subItem.lineNum); } } else { - throw "ERROR: what is this? " + JSON.stringify(subItem); + throw 'ERROR: what is this? ' + dump(subItem); } } delete item.items; @@ -220,8 +220,8 @@ function analyzer(data) { Runtime.calculateStructAlignment(type); - dprint('types', 'type (fat=' + !!fatTypes + '): ' + 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))); + if (dcheck('types')) dprint('type (fat=' + !!fatTypes + '): ' + type.name_ + ' : ' + JSON.stringify(type.fields)); + if (dcheck('types')) dprint(' has final size of ' + type.flatSize + ', flatting: ' + type.needsFlattening + ' ? ' + (type.flatFactor ? type.flatFactor : JSON.stringify(type.flatIndexes))); }); } @@ -336,7 +336,6 @@ function analyzer(data) { variable.stores = 0; func.lines.forEach(function(line) { - //print(dump(line)) if (line.intertype == 'store' && line.ident == vname) { variable.stores ++; } else if (line.intertype == 'assign' && line.value.intertype == 'load' && line.value.ident == vname) { @@ -374,7 +373,7 @@ function analyzer(data) { } else { variable.impl = VAR_EMULATED; } - dprint('vars', '// var ' + vname + ': ' + JSON.stringify(variable)); + if (dcheck('vars')) dprint('// var ' + vname + ': ' + JSON.stringify(variable)); } }); this.forwardItem(item, 'Signalyzer'); @@ -768,7 +767,7 @@ function analyzer(data) { operateOnLabels(line, function process(item, id) { if (item[id] in labelIds || (wildcard && wildcardCheck(item[id]))) { ret.push(item[id]); - dprint('relooping', 'zz ' + id + ' replace ' + item[id] + ' with ' + toLabelId); + if (dcheck('relooping')) dprint('zz ' + id + ' replace ' + item[id] + ' with ' + toLabelId); if (toLabelId) { // replace wildcards in new value with old parts var oldParts = item[id].split('|'); @@ -986,7 +985,7 @@ function analyzer(data) { var internals = split_.leftIn; var currExitLabels = set(getLabelIds(externals)); - dprint('relooping', function() { return ' Creating reloop: Inner: ' + dump(getLabelIds(internals)) + ', Exxer: ' + dump(currExitLabels) }); + if (dcheck('relooping')) dprint(' Creating reloop: Inner: ' + dump(getLabelIds(internals)) + ', Exxer: ' + dump(currExitLabels)); // Verify that no external can reach an internal var inLabels = set(getLabelIds(internals)); @@ -1003,14 +1002,14 @@ function analyzer(data) { }); // To get to any of our (not our parents') exit labels, we will break. - dprint('relooping', 'for exit purposes, Replacing: ' + dump(currExitLabels)); + if (dcheck('relooping')) dprint('for exit purposes, Replacing: ' + dump(currExitLabels)); var enteredExitLabels = {}; if (externals.length > 0) { entries.forEach(function(entry) { mergeInto(enteredExitLabels, set(replaceLabelLabels(internals, currExitLabels, 'BREAK|' + blockId))); }); enteredExitLabels = keys(enteredExitLabels).map(cleanLabel); - dprint('relooping', 'enteredExitLabels: ' + dump(enteredExitLabels)); + if (dcheck('relooping')) dprint('enteredExitLabels: ' + dump(enteredExitLabels)); assert(enteredExitLabels.length > 0); } @@ -1069,15 +1068,15 @@ function analyzer(data) { } }); - dprint('relooping', ' Considering multiple, canHandle: ' + getLabelIds(handlingNow)); + if (dcheck('relooping')) dprint(' Considering multiple, canHandle: ' + getLabelIds(handlingNow)); if (handlingNow.length > 0) { // This is a 'multiple' var actualEntries = getLabelIds(actualEntryLabels); - dprint('relooping', ' Creating multiple, with entries: ' + actualEntries + ', post entries: ' + dump(postEntryLabels)); + if (dcheck('relooping')) dprint(' Creating multiple, with entries: ' + actualEntries + ', post entries: ' + dump(postEntryLabels)); actualEntryLabels.forEach(function(actualEntryLabel) { - dprint('relooping', ' creating sub-block in multiple for ' + actualEntryLabel.ident + ' : ' + getLabelIds(actualEntryLabel.blockChildren) + ' ::: ' + actualEntryLabel.blockChildren.length); + if (dcheck('relooping')) dprint(' creating sub-block in multiple for ' + actualEntryLabel.ident + ' : ' + getLabelIds(actualEntryLabel.blockChildren) + ' ::: ' + actualEntryLabel.blockChildren.length); keys(postEntryLabels).forEach(function(post) { replaceLabelLabels(actualEntryLabel.blockChildren, set(post), 'BREAK|' + blockId); diff --git a/src/jsifier.js b/src/jsifier.js index 581df37d..3ba725bb 100644 --- a/src/jsifier.js +++ b/src/jsifier.js @@ -213,7 +213,7 @@ function JSify(data, functionsOnly, givenFunctions) { } else { throw 'Invalid segment: ' + dump(segment); } - assert(segment.type, 'Missing type for constant segment: ' + dump(segment)); + assert(segment.type, 'Missing type for constant segment!'); return indexizeFunctions(ret, segment.type); }; return tokens.map(handleSegment) diff --git a/src/parseTools.js b/src/parseTools.js index f2ef3374..3f8c09bb 100644 --- a/src/parseTools.js +++ b/src/parseTools.js @@ -1470,7 +1470,7 @@ function finalizeLLVMParameter(param, noIndexizeFunctions) { } else { throw 'invalid llvm parameter: ' + param.intertype; } - assert(param.type || (typeof param === 'string' && param.substr(0, 6) === 'CHECK_'), 'Missing type for param: ' + dump(param)); + assert(param.type || (typeof param === 'string' && param.substr(0, 6) === 'CHECK_'), 'Missing type for param!'); if (!noIndexizeFunctions) ret = indexizeFunctions(ret, param.type); return ret; } diff --git a/src/runtime.js b/src/runtime.js index dcb10de9..255b977e 100644 --- a/src/runtime.js +++ b/src/runtime.js @@ -67,7 +67,6 @@ RuntimeGenerator = { function unInline(name_, params) { var src = '(function ' + name_ + '(' + params + ') { var ret = ' + RuntimeGenerator[name_].apply(null, params) + '; return ret; })'; - //print('src: ' + src); return eval(src); } @@ -137,8 +136,7 @@ Runtime = { size = Types.types[field].flatSize; alignSize = Types.types[field].alignSize; } else { - dprint('Unclear type in struct: ' + field + ', in ' + type.name_ + ' :: ' + dump(Types.types[type.name_])); - assert(0); + throw 'Unclear type in struct: ' + field + ', in ' + type.name_ + ' :: ' + dump(Types.types[type.name_]); } alignSize = type.packed ? 1 : Math.min(alignSize, QUANTUM_SIZE); type.alignSize = Math.max(type.alignSize, alignSize); |