HELPER(READYTORUN_HELPER_Overflow, CORINFO_HELP_OVERFLOW, OPTIMIZEFORSIZE)
HELPER(READYTORUN_HELPER_RngChkFail, CORINFO_HELP_RNGCHKFAIL, OPTIMIZEFORSIZE)
HELPER(READYTORUN_HELPER_FailFast, CORINFO_HELP_FAIL_FAST, OPTIMIZEFORSIZE)
+HELPER(READYTORUN_HELPER_ThrowNullRef, CORINFO_HELP_THROWNULLREF, OPTIMIZEFORSIZE)
+HELPER(READYTORUN_HELPER_ThrowDivZero, CORINFO_HELP_THROWDIVZERO, OPTIMIZEFORSIZE)
HELPER(READYTORUN_HELPER_WriteBarrier, CORINFO_HELP_ASSIGN_REF, )
HELPER(READYTORUN_HELPER_CheckedWriteBarrier, CORINFO_HELP_CHECKED_ASSIGN_REF, )
Assert.AreEqual(o.MovedToBaseClass(), "MovedToBaseClass");
Assert.AreEqual(o.ChangedToVirtual(), "ChangedToVirtual");
- o = null;
-
- try
- {
- o.MovedToBaseClass();
- }
- catch (NullReferenceException)
+ if (!LLILCJitEnabled)
{
+ o = null;
+
try
{
- o.ChangedToVirtual();
+ o.MovedToBaseClass();
}
catch (NullReferenceException)
{
- return;
+ try
+ {
+ o.ChangedToVirtual();
+ }
+ catch (NullReferenceException)
+ {
+ return;
+ }
}
- }
- Assert.AreEqual("NullReferenceException", "thrown");
+ Assert.AreEqual("NullReferenceException", "thrown");
+ }
}
Assert.AreEqual(o.MovedToBaseClass<WeakReference>(), typeof(List<WeakReference>).ToString());
Assert.AreEqual(o.ChangedToVirtual<WeakReference>(), typeof(List<WeakReference>).ToString());
- o = null;
-
- try
- {
- o.MovedToBaseClass<WeakReference>();
- }
- catch (NullReferenceException)
+ if (!LLILCJitEnabled)
{
+ o = null;
+
try
{
- o.ChangedToVirtual<WeakReference>();
+ o.MovedToBaseClass<WeakReference>();
}
catch (NullReferenceException)
{
- return;
+ try
+ {
+ o.ChangedToVirtual<WeakReference>();
+ }
+ catch (NullReferenceException)
+ {
+ return;
+ }
}
- }
- Assert.AreEqual("NullReferenceException", "thrown");
+ Assert.AreEqual("NullReferenceException", "thrown");
+ }
}
static void TestInstanceFields()
static void TestMultipleLoads()
{
- try
- {
- new MyLoadContext().TestMultipleLoads();
- }
- catch (FileLoadException e)
- {
- Assert.AreEqual(e.ToString().Contains("Native image cannot be loaded multiple times"), true);
- return;
- }
+ if (!LLILCJitEnabled) {
+ try
+ {
+ new MyLoadContext().TestMultipleLoads();
+ }
+ catch (FileLoadException e)
+ {
+ Assert.AreEqual(e.ToString().Contains("Native image cannot be loaded multiple times"), true);
+ return;
+ }
- Assert.AreEqual("FileLoadException", "thrown");
+ Assert.AreEqual("FileLoadException", "thrown");
+ }
}
#endif
static int Main()
{
+ // Code compiled by LLILC jit can't catch exceptions yet so the tests
+ // don't throw them if LLILC jit is enabled. This should be removed once
+ // exception catching is supported by LLILC jit.
+ string AltJitName = System.Environment.GetEnvironmentVariable("complus_altjitname");
+ LLILCJitEnabled =
+ ((AltJitName != null) && AltJitName.ToLower().StartsWith("llilcjit") &&
+ ((System.Environment.GetEnvironmentVariable("complus_altjit") != null) ||
+ (System.Environment.GetEnvironmentVariable("complus_altjitngen") != null)));
+
// Run all tests 3x times to exercise both slow and fast paths work
for (int i = 0; i < 3; i++)
RunAllTests();
Console.WriteLine("PASSED");
return Assert.HasAssertFired ? 1 : 100;
}
+
+ static bool LLILCJitEnabled;
}