diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-12-16 17:45:36 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-12-16 17:45:47 -0800 |
commit | b01d1845c4a4155db54da713691d86e2d2f42040 (patch) | |
tree | ad926566a6bde12c346df151a4a103b41d4519f0 /src | |
parent | 328f383f7c8b97b94d9a50e6adf68981036f0a30 (diff) |
handle a single empty alloca; fixes #1919
Diffstat (limited to 'src')
-rw-r--r-- | src/analyzer.js | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/analyzer.js b/src/analyzer.js index 253c5505..17582ea3 100644 --- a/src/analyzer.js +++ b/src/analyzer.js @@ -1662,11 +1662,13 @@ function analyzer(data, sidePass) { function stackAnalyzer() { data.functions.forEach(function(func) { var lines = func.labels[0].lines; + var hasAlloca = false; for (var i = 0; i < lines.length; i++) { var item = lines[i]; if (!item.assignTo || item.intertype != 'alloca' || !isNumber(item.ident)) break; item.allocatedSize = func.variables[item.assignTo].impl === VAR_EMULATED ? calcAllocatedSize(item.allocatedType)*item.ident: 0; + hasAlloca = true; if (USE_TYPED_ARRAYS === 2) { // We need to keep the stack aligned item.allocatedSize = Runtime.forceAlign(item.allocatedSize, Runtime.STACK_ALIGN); @@ -1682,6 +1684,7 @@ function analyzer(data, sidePass) { } func.initialStack = index; func.otherStackAllocations = false; + if (func.initialStack === 0 && hasAlloca) func.otherStackAllocations = true; // a single alloca of zero still requires us to emit stack support code while (func.initialStack == 0) { // one-time loop with possible abort in the middle // If there is no obvious need for stack management, perhaps we don't need it // (we try to optimize that way with SKIP_STACK_IN_SMALL). However, |