Skip to content

Instantly share code, notes, and snippets.

using System;
using System.Collections;
using System.Threading;
using System.Collections.Generic;
public class Foo {
static Foo resurrect;
static Foo reference;
static List<Foo> list = new List<Foo> ();
using System;
public class Program {
string str = "str";
/* Nursery size 4 000 000 000 */
public const int NURSERY_SIZE = 4000000;
public const int SIZEOF_OBJECT = 24;
public const int NUM_ELEMENTS = (NURSERY_SIZE * 2 / 3)/ SIZEOF_OBJECT;
public static void Main (string[] args)
{
/* Array in major heap */
public void TestEjectFromImplicitCache ()
{
WeakRef weakFirst, weakLast;
FinalizerHelpers.PerformNoPinAction ( () => {
var compilations = new List<Compilation> ();
for (int i = 0; i < ProjectCacheService.ImplicitCacheSize + 1; i++) {
compilations.Add (CSharpCompilation.Create (i.ToString ()));
@BrzVlad
BrzVlad / gist:dcee172c24cc532a02d887b96cd4704c
Created September 28, 2018 12:55
mmap/mprotect reversal
diff --git a/mono/mini/mini-exceptions.c b/mono/mini/mini-exceptions.c
index 6297bacf704..f78807139f0 100644
--- a/mono/mini/mini-exceptions.c
+++ b/mono/mini/mini-exceptions.c
@@ -2750,12 +2750,10 @@ mono_setup_altstack (MonoJitTlsData *tls)
g_assert ((guint8*)&sa >= (guint8*)tls->stack_ovf_guard_base + tls->stack_ovf_guard_size);
- if (mono_mprotect (tls->stack_ovf_guard_base, tls->stack_ovf_guard_size, MONO_MMAP_NONE)) {
- /* mprotect can fail for the main thread stack */
using System;
using System.IO;
using System.IO.Compression;
public class Program
{
static string directoryPath = ".";
public static void Main()
{
for (int i = 0; i < 10000; i++) {
default split default/split
ahcbench 5.52 6.25 0.88
bh 4.82 5.66 0.85
binarytree 2.16 2.92 0.74
bisort 21.33 26.21 0.81
compress 19.42 22.91 0.85
concurrentdict 4.46 5.95 0.75
db 186.86 237.25 0.79
euler 165.88 169.30 0.98
grandetracer 23.88 32.54 0.73
@BrzVlad
BrzVlad / fix
Created September 28, 2019 08:27
diff --git a/mono/utils/mono-threads-coop.c b/mono/utils/mono-threads-coop.c
index 28bf12c..dacaa1d 100644
--- a/mono/utils/mono-threads-coop.c
+++ b/mono/utils/mono-threads-coop.c
@@ -314,12 +314,15 @@ mono_threads_enter_gc_safe_region_unbalanced (gpointer *stackpointer)
return mono_threads_enter_gc_safe_region_unbalanced_internal (&stackdata);
}
-static MONO_NO_OPTIMIZATION gpointer
+static gpointer
@BrzVlad
BrzVlad / hello.cs
Created November 18, 2019 16:15
GC Prototype testcase
// Simple testcase for verifying basic GC functionality
// (allocation, collection, root scanning, object scanning, write barriers)
using System;
using System.Collections.Generic;
public class Program {
public string s;
public static List<Program> list = new List<Program> ();
// Global variable
#define mono_break() variable = 0x6666
volatile int variable;
// interp_exec_method_switch
case MINT_LDARGFLD_I8: {
mono_break ();
gpointer *o = frame->stack_args [ip [1]].data.p;
if (!o)
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
typedef int gint;
typedef unsigned int guint;
typedef short gint16;
typedef unsigned short guint16;
typedef long glong;