aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2012-01-27 17:59:14 -0800
committerAlon Zakai <alonzakai@gmail.com>2012-01-27 17:59:14 -0800
commit9d4067101193ec2cb1a9691c4d835fd8960fb069 (patch)
treebbb82fad1387268d249c0bfada137c5783052313 /src
parent2c652b36d9df45fd70d6ff603bdf82a1a52e06d4 (diff)
support legalizing stores with tails of non-32 (but legal) size
Diffstat (limited to 'src')
-rw-r--r--src/analyzer.js9
-rw-r--r--src/parseTools.js2
2 files changed, 7 insertions, 4 deletions
diff --git a/src/analyzer.js b/src/analyzer.js
index 758d0b59..ece8fd53 100644
--- a/src/analyzer.js
+++ b/src/analyzer.js
@@ -186,13 +186,14 @@ function analyzer(data, sidePass) {
},
lineNum: item.lineNum + (j/100)
});
+ var actualSizeType = 'i' + element.bits; // The last one may be smaller than 32 bits
label.lines.splice(i+j*2+1, 0, {
intertype: 'store',
- valueType: 'i32',
- value: { intertype: 'value', ident: element.ident, type: 'i32' },
- pointer: { intertype: 'value', ident: tempVar, type: 'i32' },
+ valueType: actualSizeType,
+ value: { intertype: 'value', ident: element.ident, type: actualSizeType },
+ pointer: { intertype: 'value', ident: tempVar, type: actualSizeType + '*' },
ident: tempVar,
- pointerType: 'i32*',
+ pointerType: actualSizeType + '*',
align: item.align,
lineNum: item.lineNum + ((j+0.5)/100)
});
diff --git a/src/parseTools.js b/src/parseTools.js
index 0a246fdd..45cee958 100644
--- a/src/parseTools.js
+++ b/src/parseTools.js
@@ -605,6 +605,8 @@ function makeCopyI64(value) {
function parseArbitraryInt(str, bits) {
// We parse the string into a vector of digits, base 10. This is convenient to work on.
+ assert(('i' + (bits % 32)) in Runtime.INT_TYPES, 'Arbitrary-sized ints must tails that are of legal size');
+
function str2vec(s) { // index 0 is the highest value
var ret = [];
for (var i = 0; i < s.length; i++) {