Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Kyte <alexmkyte@gmail.com>2015-06-01 21:14:00 +0300
committerAlexander Kyte <alexmkyte@gmail.com>2015-06-02 22:31:00 +0300
commitc5d5da257e9ba9ed3a4cd3191b8165065933b115 (patch)
tree057ad28b75132bd4d3e85b8031f55c85de52f5b0 /mcs/class/dlr
parent8b7564815190fa35178a7c2305fc0e44c87add95 (diff)
[runtime] Emit the necessary left shift anding in the LambdaCompiler
We were observing dtest-006.exe test failing on armhf. This test checks that a right shift with a negative shift amount and a dynamic base is shifted by the right amount. We were failing it because we were excluding the step that we do in regular code generation, which is to do a binary and of the shift amount so it behaves like we are shifting by the original shift amount modulo 32. The C# spec defines left shift like so. This commit adds that to the LambdaCompiler.
Diffstat (limited to 'mcs/class/dlr')
-rw-r--r--mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/LambdaCompiler.Binary.cs6
1 files changed, 6 insertions, 0 deletions
diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/LambdaCompiler.Binary.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/LambdaCompiler.Binary.cs
index a089b81222d..3c9ec62326e 100644
--- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/LambdaCompiler.Binary.cs
+++ b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/LambdaCompiler.Binary.cs
@@ -275,6 +275,12 @@ namespace System.Linq.Expressions.Compiler {
if (rightType != typeof(int)) {
throw ContractUtils.Unreachable;
}
+ // Note: If this code is made to handle unsigned
+ // rightType types, emit the following when rightType:
+ // is unsigned
+ //_ilg.EmitInt(0x3f);
+ _ilg.EmitInt(0x1f);
+ _ilg.Emit(OpCodes.And);
_ilg.Emit(OpCodes.Shl);
break;
case ExpressionType.RightShift: