aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-10-25 11:09:30 -0700
committerAlon Zakai <alonzakai@gmail.com>2013-10-25 11:10:01 -0700
commit52b97cb9116301bb42f16edc865f807ee920e0ba (patch)
treebdbe52ed5d44c275b680d386cceae515eea75aad /src
parent39cb6c0776360c72f3b34e5f8145919e7d794b04 (diff)
handle internal illegal iX fields in calculateStructAlignment
Diffstat (limited to 'src')
-rw-r--r--src/runtime.js11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/runtime.js b/src/runtime.js
index fa127fe7..5d5cb43b 100644
--- a/src/runtime.js
+++ b/src/runtime.js
@@ -224,9 +224,16 @@ var Runtime = {
// bN, large number field, like a [N x i8]
size = field.substr(1)|0;
alignSize = 1;
- } else {
- assert(field[0] === '<', field); // assumed to be a vector type, if none of the above
+ } else if (field[0] === '<') {
+ // vector type
size = alignSize = Types.types[field].flatSize; // fully aligned
+ } else if (field[0] === 'i') {
+ // illegal integer field, that could not be legalized because it is an internal structure field
+ // it is ok to have such fields, if we just use them as markers of field size and nothing more complex
+ size = alignSize = parseInt(field.substr(1))/8;
+ assert(size % 1 === 0, 'cannot handle non-byte-size field ' + field);
+ } else {
+ assert(false, 'invalid type for calculateStructAlignment');
}
if (type.packed) alignSize = 1;
type.alignSize = Math.max(type.alignSize, alignSize);