aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/intertyper.js7
-rw-r--r--src/jsifier.js3
-rw-r--r--src/utility.js13
3 files changed, 19 insertions, 4 deletions
diff --git a/src/intertyper.js b/src/intertyper.js
index 7e071935..f72d33a4 100644
--- a/src/intertyper.js
+++ b/src/intertyper.js
@@ -525,11 +525,18 @@ function intertyper(data, parseFunctions, baseLineNum) {
item.type = item.tokens[1].text;
item.functionType = '';
while (['@', '%'].indexOf(item.tokens[2].text[0]) == -1 && !(item.tokens[2].text in PARSABLE_LLVM_FUNCTIONS)) {
+ // We cannot compile assembly. If you hit this, perhaps tell the compiler not
+ // to generate arch-specific code? |-U__i386__ -U__x86_64__| might help, it undefines
+ // the standard archs.
+ assert(item.tokens[2].text != 'asm', 'Inline assembly cannot be compiled to JavaScript!');
+
item.functionType += item.tokens[2].text;
item.tokens.splice(2, 1);
}
var tokensLeft = item.tokens.slice(2);
item.ident = eatLLVMIdent(tokensLeft);
+ // We cannot compile assembly, see above.
+ assert(item.ident != 'asm', 'Inline assembly cannot be compiled to JavaScript!');
if (item.ident.substr(-2) == '()') {
// See comment in isStructType()
item.ident = item.ident.substr(0, item.ident.length-2);
diff --git a/src/jsifier.js b/src/jsifier.js
index 1404e63f..90f4ae86 100644
--- a/src/jsifier.js
+++ b/src/jsifier.js
@@ -913,6 +913,9 @@ function JSify(data, functionsOnly, givenTypes, givenFunctions) {
});
function makeFunctionCall(ident, params, funcData) {
+ // We cannot compile assembly. See comment in intertyper.js:'Call'
+ assert(ident != 'asm', 'Inline assembly cannot be compiled to JavaScript!');
+
// Special cases
if (ident == '_llvm_va_start') {
// varargs - we received a pointer to the varargs as a final 'extra' parameter
diff --git a/src/utility.js b/src/utility.js
index ec4bf99b..ce726fbe 100644
--- a/src/utility.js
+++ b/src/utility.js
@@ -46,13 +46,18 @@ function dumpKeys(item) {
function assertEq(a, b) {
if (a !== b) {
- print("Stack: " + new Error().stack);
- throw "Should have been equal: " + a + " : " + b;
+ print('Stack: ' + new Error().stack);
+ throw 'Should have been equal: ' + a + ' : ' + b;
}
}
-function assertTrue(a) {
- assertEq(!!a, true);
+function assertTrue(a, msg) {
+ if (!a) {
+ msg = 'Assertion failed: ' + msg;
+ print(msg);
+ print('Stack: ' + new Error().stack);
+ throw msg;
+ }
}
assert = assertTrue;