diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-10-18 16:14:17 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-10-18 17:31:20 -0700 |
commit | 5a09572550870a5304b0a5d2e425e3f579cd1ed2 (patch) | |
tree | d549422beb58aedd749efc6992b16197df14dbd5 /src/runtime.js | |
parent | 8f14b5c6400133e88c89060ce978114b2455d667 (diff) |
avoid allocating huge lists for [BIGNUM x type] types
Diffstat (limited to 'src/runtime.js')
-rw-r--r-- | src/runtime.js | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/runtime.js b/src/runtime.js index 6839f556..fa127fe7 100644 --- a/src/runtime.js +++ b/src/runtime.js @@ -238,6 +238,11 @@ var Runtime = { prev = curr; return curr; }); + if (type.name_[0] === '[') { + // arrays have 2 elements, so we get the proper difference. then we scale here. that way we avoid + // allocating a potentially huge array for [999999 x i8] etc. + type.flatSize = parseInt(type.name_.substr(1))*type.flatSize/2; + } type.flatSize = Runtime.alignMemory(type.flatSize, type.alignSize); if (diffs.length == 0) { type.flatFactor = type.flatSize; |