diff options
author | Alon Zakai <alonzakai@gmail.com> | 2012-02-29 15:57:24 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2012-02-29 15:57:24 -0800 |
commit | 5c0f26d60d432795ef4810b37cd6787b4bf1bdef (patch) | |
tree | 48a9612e62e457a9d8f55bfc4c7a3d3fb84fe1d3 /src | |
parent | fa69915201b3689ba7ebc8ab411b4eef2046ca3a (diff) |
fix i64 invoke args, and parsing of very large i64 (and other illegal) constants
Diffstat (limited to 'src')
-rw-r--r-- | src/analyzer.js | 3 | ||||
-rw-r--r-- | src/parseTools.js | 8 |
2 files changed, 6 insertions, 5 deletions
diff --git a/src/analyzer.js b/src/analyzer.js index 9aa84650..26e0721c 100644 --- a/src/analyzer.js +++ b/src/analyzer.js @@ -319,7 +319,8 @@ function analyzer(data, sidePass) { continue; } case 'invoke': { - // We can't add lines after this, since invoke already modifies control flow. So we handle this in invoke + legalizeFunctionParameters(value.params); + // We can't add lines after this, since invoke already modifies control flow. So we handle the return in invoke i++; continue; } diff --git a/src/parseTools.js b/src/parseTools.js index 5c1dcdac..ff578c0a 100644 --- a/src/parseTools.js +++ b/src/parseTools.js @@ -324,7 +324,7 @@ function parseParamTokens(params) { ret.push({ intertype: 'value', type: segment[0].text, - ident: toNiceIdent(parseNumerical(segment[1].text)) + ident: toNiceIdent(parseNumerical(segment[1].text, segment[0].text)) }); Types.needAnalysis[removeAllPointing(ret[ret.length-1].type)] = 0; } @@ -701,8 +701,8 @@ function parseNumerical(value, type) { // Hexadecimal double value, as the llvm docs say, // "The one non-intuitive notation for constants is the hexadecimal form of floating point constants." value = IEEEUnHex(value); - } else if (type == 'i64' && USE_TYPED_ARRAYS == 2) { - value = parseI64Constant(value); + } else if (USE_TYPED_ARRAYS == 2 && isIllegalType(type)) { + return value; // do not parseFloat etc., that can lead to loss of precision } else if (value == 'null') { // NULL *is* 0, in C/C++. No JS null! (null == 0 is false, etc.) value = '0'; @@ -1453,7 +1453,7 @@ function finalizeLLVMParameter(param, noIndexizeFunctions) { if (param.type == 'i64' && USE_TYPED_ARRAYS == 2) { ret = parseI64Constant(ret); } - ret = parseNumerical(ret); + ret = parseNumerical(ret, param.type); } else if (param.intertype == 'structvalue') { ret = makeLLVMStruct(param.params.map(function(value) { return finalizeLLVMParameter(value, noIndexizeFunctions) })); } else if (param.intertype === 'blockaddress') { |