diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/analyzer.js | 28 | ||||
-rw-r--r-- | src/jsifier.js | 8 | ||||
-rw-r--r-- | src/library.js | 9 | ||||
-rw-r--r-- | src/library_openal.js | 2 | ||||
-rw-r--r-- | src/relooper/Relooper.cpp | 3 |
5 files changed, 28 insertions, 22 deletions
diff --git a/src/analyzer.js b/src/analyzer.js index 92b7d8cf..6ed55414 100644 --- a/src/analyzer.js +++ b/src/analyzer.js @@ -9,7 +9,6 @@ var VAR_NATIVIZED = 'nativized'; var VAR_EMULATED = 'emulated'; var ENTRY_IDENT = toNiceIdent('%0'); -var ENTRY_IDENT_IDS = set(0, 1); // XXX function recomputeLines(func) { func.lines = func.labels.map(function(label) { return label.lines }).reduce(concatenator, []); @@ -979,6 +978,9 @@ function analyzer(data, sidePass) { if (variable.origin === 'alloca') { variable.allocatedNum = item.allocatedNum; } + if (variable.origin === 'call') { + variable.type = getReturnType(variable.type); + } } }); @@ -1323,14 +1325,14 @@ function analyzer(data, sidePass) { func.labelsDict = {}; func.labelIds = {}; func.labelIdsInverse = {}; - func.labelIds[toNiceIdent('%0')] = 0; + func.labelIds[toNiceIdent('%0')] = 1; func.labelIdsInverse[0] = toNiceIdent('%0'); - func.labelIds[toNiceIdent('%1')] = 1; - func.labelIdsInverse[1] = toNiceIdent('%1'); func.labelIdCounter = 2; func.labels.forEach(function(label) { - func.labelIds[label.ident] = func.labelIdCounter++; - func.labelIdsInverse[func.labelIdCounter-1] = label.ident; + if (!(label.ident in func.labelIds)) { + func.labelIds[label.ident] = func.labelIdCounter++; + func.labelIdsInverse[func.labelIdCounter-1] = label.ident; + } }); // Minify label ids to numeric ids. @@ -1365,16 +1367,12 @@ function analyzer(data, sidePass) { } }); - // The entry might not have an explicit label, and there is no consistent naming convention for it - it can be %0 or %1 - // So we need to handle that in a special way here. function getActualLabelId(labelId) { if (func.labelsDict[labelId]) return labelId; - if (labelId in ENTRY_IDENT_IDS) { - labelId = func.labelIds[ENTRY_IDENT]; - assert(func.labelsDict[labelId]); - return labelId; - } - return null; + // If not present, it must be a surprisingly-named entry (or undefined behavior, in which case, still ok to use the entry) + labelId = func.labelIds[ENTRY_IDENT]; + assert(func.labelsDict[labelId]); + return labelId; } // Basic longjmp support, see library.js setjmp/longjmp @@ -1570,7 +1568,7 @@ function analyzer(data, sidePass) { } item.functions.forEach(function(func) { dprint('relooping', "// relooping function: " + func.ident); - func.block = makeBlock(func.labels, [toNiceIdent(func.labels[0].ident)], func.labelsDict, func.forceEmulated); + func.block = makeBlock(func.labels, [func.labels[0].ident], func.labelsDict, func.forceEmulated); }); return finish(); diff --git a/src/jsifier.js b/src/jsifier.js index b966b5c8..c55072b4 100644 --- a/src/jsifier.js +++ b/src/jsifier.js @@ -495,10 +495,10 @@ function JSify(data, functionsOnly, givenFunctions) { EXPORTED_FUNCTIONS[ident] = 1; delete Functions.libraryFunctions[ident.substr(1)]; } - } else { - if (EXPORT_ALL || (ident in EXPORTED_FUNCTIONS)) { - contentText += '\nModule["' + ident + '"] = ' + ident + ';'; - } + } + if ((!ASM_JS || phase == 'pre') && + (EXPORT_ALL || (ident in EXPORTED_FUNCTIONS))) { + contentText += '\nModule["' + ident + '"] = ' + ident + ';'; } return depsText + contentText; } diff --git a/src/library.js b/src/library.js index 66b0ef26..b63ac955 100644 --- a/src/library.js +++ b/src/library.js @@ -3712,6 +3712,11 @@ LibraryManager.library = { __exit(status); }, + _ZSt9terminatev__deps: ['exit'], + _ZSt9terminatev: function() { + _exit(-1234); + }, + atexit: function(func, arg) { __ATEXIT__.unshift({ func: func, arg: arg }); }, @@ -5077,6 +5082,10 @@ LibraryManager.library = { _ZSt18uncaught_exceptionv: function() { // std::uncaught_exception() return !!__ZSt18uncaught_exceptionv.uncaught_exception; }, + __cxa_uncaught_exception__deps: ['_Zst18uncaught_exceptionv'], + __cxa_uncaught_exception: function() { + return !!__ZSt18uncaught_exceptionv.uncaught_exception; + }, __cxa_call_unexpected: function(exception) { Module.printErr('Unexpected exception thrown, this is not properly supported - aborting'); diff --git a/src/library_openal.js b/src/library_openal.js index b785a89f..df1d15db 100644 --- a/src/library_openal.js +++ b/src/library_openal.js @@ -57,7 +57,6 @@ var LibraryOpenAL = { } if (ctx) { - ctx.listener.panningModel = "equalpower"; AL.contexts.push({ctx: ctx, err: 0, src: [], buf: []}); return AL.contexts.length; } else { @@ -103,6 +102,7 @@ var LibraryOpenAL = { for (var i = 0; i < count; ++i) { var gain = AL.currentContext.ctx.createGain(); var panner = AL.currentContext.ctx.createPanner(); + panner.panningModel = "equalpower"; gain.connect(panner); panner.connect(AL.currentContext.ctx.destination); AL.currentContext.src.push({ diff --git a/src/relooper/Relooper.cpp b/src/relooper/Relooper.cpp index ae393de3..61daed79 100644 --- a/src/relooper/Relooper.cpp +++ b/src/relooper/Relooper.cpp @@ -499,8 +499,7 @@ void Relooper::Calculate(Block *Entry) { Block *Curr = *iter; for (BlockBranchMap::iterator iter = Curr->BranchesOut.begin(); iter != Curr->BranchesOut.end(); iter++) { Block *Possible = iter->first; - if (InnerBlocks.find(Possible) == InnerBlocks.end() && - NextEntries.find(Possible) == NextEntries.find(Possible)) { + if (InnerBlocks.find(Possible) == InnerBlocks.end()) { NextEntries.insert(Possible); } } |