diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-04-04 10:31:44 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-04-04 10:31:44 -0700 |
commit | a61d054621e06f41dd760552a6db3d2a38006f90 (patch) | |
tree | 9c70329e9666ced1f71fef4d12cefe788fc67b56 /src/jsifier.js | |
parent | 1e7414017b599d7b3b990922ca905ee679b81ff9 (diff) |
ensure aligned sizes for all constants
Diffstat (limited to 'src/jsifier.js')
-rw-r--r-- | src/jsifier.js | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/jsifier.js b/src/jsifier.js index a583da1e..88f86d5b 100644 --- a/src/jsifier.js +++ b/src/jsifier.js @@ -311,9 +311,12 @@ function JSify(data, functionsOnly, givenFunctions) { if (!LibraryManager.library[item.ident.slice(1)]) return ret; } + // ensure alignment + constant = constant.concat(zeros(Runtime.alignMemory(constant.length) - constant.length)); + // Special case: class vtables. We make sure they are null-terminated, to allow easy runtime operations if (item.ident.substr(0, 5) == '__ZTV') { - constant = constant.concat(zeros(Runtime.alignMemory(constant.length + QUANTUM_SIZE) - constant.length)); + constant = constant.concat(zeros(Runtime.alignMemory(QUANTUM_SIZE))); } // NOTE: This is the only place that could potentially create static |