Skip to content
Next Next commit
Fix test
  • Loading branch information
EgorBo committed Nov 23, 2022
commit 041867bb54f05ecb87c9d5dfcbc3b3adc2886098
14 changes: 7 additions & 7 deletions src/tests/JIT/Regression/JitBlue/Runtime_76194/Runtime_76194.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,6 @@ public static int Main()
}
return 100;
}

[MethodImpl(MethodImplOptions.NoInlining)]
static T Read<T>(byte* location) => Unsafe.ReadUnaligned<T>(location);

[MethodImpl(MethodImplOptions.NoInlining)]
static void Write<T>(byte* location, T t) => Unsafe.WriteUnaligned(location, t);
}

// Cross-platform implementation of VirtualAlloc that is focused on reproducing problems
Expand Down Expand Up @@ -127,6 +121,7 @@ public CrossVirtualAlloc()
if (_ptr != null && mprotect(_ptr + PageSize, PageSize, PROT_NONE) != 0)
{
munmap(_ptr, 2 * PageSize);
_ptr = null;
}
}
}
Expand All @@ -140,14 +135,19 @@ public CrossVirtualAlloc()

public void Dispose()
{
if (IsFailedToCommit)
{
return;
}

if (OperatingSystem.IsWindows())
{
const int MEM_RELEASE = 0x8000;
VirtualFree(_ptr, 0, MEM_RELEASE);
}
else
{
munmap(_ptr, (nuint)Environment.SystemPageSize * 2);
munmap(_ptr, PageSize * 2);
}
}

Expand Down