diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-10-29 17:17:52 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-10-29 17:17:52 -0700 |
commit | 4af62232d03bd71db0f1ec907ff2a52ecef2f5d9 (patch) | |
tree | 7518f38211be1f5f195b43aa09d3ddbaa01dd28f | |
parent | 7be5a908230091693fc68514ccef7dfb6bb65896 (diff) |
handle vector types in calcAllocatedSize
-rw-r--r-- | src/parseTools.js | 8 | ||||
-rw-r--r-- | src/runtime.js | 4 |
2 files changed, 6 insertions, 6 deletions
diff --git a/src/parseTools.js b/src/parseTools.js index dae386f1..223adbbf 100644 --- a/src/parseTools.js +++ b/src/parseTools.js @@ -1009,11 +1009,9 @@ function getOldLabel(label) { } function calcAllocatedSize(type) { - if (pointingLevels(type) == 0 && isStructType(type)) { - return Types.types[type].flatSize; // makeEmptyStruct(item.allocatedType).length; - } else { - return Runtime.getNativeTypeSize(type); // We can really get away with '1', though, at least on the stack... - } + var ret = Runtime.getNativeTypeSize(type); + if (ret) return ret; + return Types.types[type].flatSize; // known type } // Generates the type signature for a structure, for each byte, the type that is there. diff --git a/src/runtime.js b/src/runtime.js index 5d5cb43b..ca2304da 100644 --- a/src/runtime.js +++ b/src/runtime.js @@ -145,7 +145,7 @@ var Runtime = { //! @param type The type, by name. getNativeTypeSize: function(type) { #if QUANTUM_SIZE == 1 - return 1; + return 1; #else switch (type) { case 'i1': case 'i8': return 1; @@ -161,6 +161,8 @@ var Runtime = { var bits = parseInt(type.substr(1)); assert(bits % 8 === 0); return bits/8; + } else { + return 0; } } } |