diff options
author | monojenkins <jo.shields+jenkins@xamarin.com> | 2018-10-20 21:05:32 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-20 21:05:32 +0300 |
commit | f55f7e53e3611f70580f1da13de0cab9c7fe3637 (patch) | |
tree | 15a0522256ec19e12a613123631d21d6c4bf19e5 | |
parent | 5986920bdbcf2e6b980593102df8d98d9ce5a1e6 (diff) |
[interp] use unsigned conversion for nuint (#11285)
[2018-06] [interp] use unsigned conversion for nuint
Backport of #11259.
/cc @lewurm
Description:
Fixes `MutableDataTest.Constructor` on Xamarin.iOS with interpreter.
monotouch tests are looking good now with interp-only:
<img width="906" alt="screenshot 2018-10-19 at 11 22 07" src="https://user-images.githubusercontent.com/75403/47209686-3d7b2780-d391-11e8-887f-9e1f39de2026.png">
😬
-rw-r--r-- | mono/mini/builtin-types.cs | 18 | ||||
-rw-r--r-- | mono/mini/interp/transform.c | 10 |
2 files changed, 26 insertions, 2 deletions
diff --git a/mono/mini/builtin-types.cs b/mono/mini/builtin-types.cs index 0596116571e..42131a766a8 100644 --- a/mono/mini/builtin-types.cs +++ b/mono/mini/builtin-types.cs @@ -421,6 +421,24 @@ public class BuiltinTests { return 0; } + static int NuintConstructor (nuint cap) + { + if (cap > (ulong) nint.MaxValue) + return 1; + return 0; + } + + /* resembles https://github.com/xamarin/xamarin-macios/blob/bc492585d137d8c3d3a2ffc827db3cdaae3cc869/tests/monotouch-test/Foundation/MutableDataTest.cs#L62-L89 */ + static int test_0_nint_maxintcmp () + { + /* does not work on 32bit */ + if (IntPtr.Size == 4) + return 0; + + uint cap = (uint) Int32.MaxValue + 2; + return NuintConstructor (cap); + } + static int test_0_nuint_ctor () { diff --git a/mono/mini/interp/transform.c b/mono/mini/interp/transform.c index 0c50be8ec04..edaf32db8d1 100644 --- a/mono/mini/interp/transform.c +++ b/mono/mini/interp/transform.c @@ -959,9 +959,12 @@ interp_handle_intrinsics (TransformData *td, MonoMethod *target_method, MonoMeth if (arg_size < SIZEOF_VOID_P) { // 4 -> 8 switch (type_index) { - case 0: case 1: + case 0: ADD_CODE (td, MINT_CONV_I8_I4); break; + case 1: + ADD_CODE (td, MINT_CONV_I8_U4); + break; case 2: ADD_CODE (td, MINT_CONV_R8_R4); break; @@ -1038,9 +1041,12 @@ interp_handle_intrinsics (TransformData *td, MonoMethod *target_method, MonoMeth #if SIZEOF_VOID_P == 8 if (src_size < dst_size) { // 4 -> 8 switch (type_index) { - case 0: case 1: + case 0: ADD_CODE (td, MINT_CONV_I8_I4); break; + case 1: + ADD_CODE (td, MINT_CONV_I8_U4); + break; case 2: ADD_CODE (td, MINT_CONV_R8_R4); break; |