aboutsummaryrefslogtreecommitdiff
path: root/src/runtime.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/runtime.js')
-rw-r--r--src/runtime.js5
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;