aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/jsifier.js2
-rw-r--r--src/library.js1
-rw-r--r--src/parseTools.js2
-rw-r--r--src/preamble.js4
4 files changed, 5 insertions, 4 deletions
diff --git a/src/jsifier.js b/src/jsifier.js
index 4720798c..5d982395 100644
--- a/src/jsifier.js
+++ b/src/jsifier.js
@@ -914,7 +914,7 @@ function JSify(data, functionsOnly, givenTypes, givenFunctions) {
return makeSetValue(item.value.ident, getGetElementPtrIndexes(item.value), parseNumerical(item.ident), true, item.type) + ';';
});
- makeFuncLineZyme('unreachable', function(item) { return '// unreachable' });
+ makeFuncLineZyme('unreachable', function(item) { return 'throw "Reached an unreachable! Original .ll line: ' + item.lineNum + '";' });
// Final combiner
diff --git a/src/library.js b/src/library.js
index c1312e1f..76c657bd 100644
--- a/src/library.js
+++ b/src/library.js
@@ -247,6 +247,7 @@ var Library = {
return 'code-generated exception: ' + (new Error().stack);
},
llvm_eh_selector: function(exception, personality, num) {
+ return 0;
},
__cxa_begin_catch: function(ptr) {
},
diff --git a/src/parseTools.js b/src/parseTools.js
index 37e0a881..e226b395 100644
--- a/src/parseTools.js
+++ b/src/parseTools.js
@@ -459,7 +459,7 @@ function calcAllocatedSize(type, TYPES) {
if (pointingLevels(type) == 0 && isStructType(type)) {
return TYPES[type].flatSize; // makeEmptyStruct(item.allocatedType).length;
} else {
- return 1;
+ return getNativeFieldSize(type, true); // We can really get away with '1', though, at least on the stack...
}
}
diff --git a/src/preamble.js b/src/preamble.js
index f02ada7a..16b55d53 100644
--- a/src/preamble.js
+++ b/src/preamble.js
@@ -27,8 +27,8 @@ function SAFE_HEAP_ACCESS(dest, type, store) {
if (store) {
HEAP_HISTORY[dest] = [{ type: type, /*stack: new Error().stack */ }]; // |stack| is useful for debugging
} else {
- if (!HEAP[dest] && HEAP[dest] !== 0) {
- print('Warning: Reading an invalid value at ' + dest + ' :: ' + new Error().stack + '\n');
+ if (!HEAP[dest] && HEAP[dest] !== 0 && HEAP[dest] !== false) { // false can be the result of a mathop comparator
+ throw('Warning: Reading an invalid value at ' + dest + ' :: ' + new Error().stack + '\n');
}
var history = HEAP_HISTORY[dest];
assert((history && history[0]) /* || HEAP[dest] === 0 */, "Loading from where there was no store! " + dest + ',' + HEAP[dest] + ',' + type + ', \n\n' + new Error().stack + '\n');