summaryrefslogtreecommitdiff
path: root/tests/src/JIT/Regression
diff options
context:
space:
mode:
authorCarol Eidt <carol.eidt@microsoft.com>2019-06-05 14:51:04 -0700
committerGitHub <noreply@github.com>2019-06-05 14:51:04 -0700
commit3809a06b68ac70148a19a37cd3cec650ba4f27c7 (patch)
tree5e42b80a5057e2c26177294d3b1cbbc8f19890ca /tests/src/JIT/Regression
parenta2db030f1b9f1a5184ea3fd27ccbefb4588d4451 (diff)
downloadcoreclr-3809a06b68ac70148a19a37cd3cec650ba4f27c7.tar.gz
coreclr-3809a06b68ac70148a19a37cd3cec650ba4f27c7.tar.bz2
coreclr-3809a06b68ac70148a19a37cd3cec650ba4f27c7.zip
Cleanup block stores and test for 24846 (#24950)
* Cleanup block stores and test for 24846 Fix zero-length assert/bad codegen for initblk. Remove redundant assertions in codegen and those that don't directly relate to codegen requirements. Eliminate redundant LEA that was being generated by `genCodeForCpBlk`. Rename `genCodeFor[Cp|Init]Blk` to `genCodeFor[Cp|Init]BlkHelper` to parallel the other forms. Fix the test case for #24846.
Diffstat (limited to 'tests/src/JIT/Regression')
-rw-r--r--tests/src/JIT/Regression/JitBlue/GitHub_24846/GitHub_24846.cs88
1 files changed, 39 insertions, 49 deletions
diff --git a/tests/src/JIT/Regression/JitBlue/GitHub_24846/GitHub_24846.cs b/tests/src/JIT/Regression/JitBlue/GitHub_24846/GitHub_24846.cs
index dbd276f142..77aec9998b 100644
--- a/tests/src/JIT/Regression/JitBlue/GitHub_24846/GitHub_24846.cs
+++ b/tests/src/JIT/Regression/JitBlue/GitHub_24846/GitHub_24846.cs
@@ -5,11 +5,16 @@
using System;
using System.Runtime.CompilerServices;
-public class GitHub_24846
+unsafe public class GitHub_24846
{
- public static void Test(byte[] destination, byte[] source)
+ public static void TestCopy(byte* destination, byte* source)
{
- Unsafe.CopyBlockUnaligned(ref destination[0], ref source[0], 0);
+ Unsafe.CopyBlockUnaligned(destination, source, 0);
+ }
+
+ public static void TestInit(byte* destination)
+ {
+ Unsafe.InitBlockUnaligned(destination, 0xff, 0);
}
public static int Main(string[] args)
@@ -17,52 +22,37 @@ public class GitHub_24846
int returnVal = 100;
var destination = new byte[1];
var source = new byte[1];
- try
- {
- Test(destination, source);
- }
- catch (Exception e)
- {
- Console.WriteLine("FAILED: " + e.Message);
- returnVal = -1;
- }
- bool caught = false;
- try
- {
- Test(destination, null);
- }
- catch (NullReferenceException e)
- {
- caught = true;
- }
- catch (Exception e)
- {
- Console.WriteLine("FAILED: Wrong Exception " + e.Message);
- returnVal = -1;
- }
- if (!caught)
- {
- Console.WriteLine("FAILED: null destination didn't throw");
- returnVal = -1;
- }
- caught = false;
- try
- {
- Test(null, source);
- }
- catch (NullReferenceException e)
- {
- caught = true;
- }
- catch (Exception e)
- {
- Console.WriteLine("FAILED: Wrong Exception " + e.Message);
- returnVal = -1;
- }
- if (!caught)
- {
- Console.WriteLine("FAILED: null source didn't throw");
- returnVal = -1;
+ fixed (byte* destPtr = &destination[0], srcPtr = &source[0])
+ {
+ try
+ {
+ TestCopy(destPtr, srcPtr);
+ TestInit(destPtr);
+ }
+ catch (Exception e)
+ {
+ Console.WriteLine("FAILED: " + e.Message);
+ returnVal = -1;
+ }
+ try
+ {
+ TestCopy(destPtr, null);
+ }
+ catch (Exception e)
+ {
+ Console.WriteLine("FAILED: " + e.Message);
+ returnVal = -1;
+ }
+ try
+ {
+ TestCopy(null, srcPtr);
+ TestInit(null);
+ }
+ catch (Exception e)
+ {
+ Console.WriteLine("FAILED: " + e.Message);
+ returnVal = -1;
+ }
}
return returnVal;
}