aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/analyzer.js25
-rw-r--r--src/library.js4
-rw-r--r--src/relooper/Relooper.cpp3
3 files changed, 15 insertions, 17 deletions
diff --git a/src/analyzer.js b/src/analyzer.js
index b1991c3f..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, []);
@@ -1326,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.
@@ -1368,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
@@ -1573,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/library.js b/src/library.js
index f8ea67ba..166a015f 100644
--- a/src/library.js
+++ b/src/library.js
@@ -5082,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/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);
}
}