Skip to content

Instantly share code, notes, and snippets.

View kumpera's full-sized avatar

Rodrigo Kumpera kumpera

View GitHub Profile
var Module = {
onRuntimeInitialized: function () {
MONO.mono_load_runtime_and_bcl (
"managed",
"managed",
1,
[ "sample.dll","sample.pdb","mscorlib.dll","System.Core.dll","System.dll","Mono.Security.dll","System.Xml.dll","bindings.dll" ],
function () {
Module.mono_bindings_init ("bindings");
App.init ();
using System;
using System.Reflection;
using System.Reflection.Emit;
using System.Collections.Generic;
using System.Linq;
// using Microsoft.Extensions.FileSystemGlobbing.Abstractions;
// using Microsoft.Extensions.FileSystemGlobbing.Internal.PathSegments;
// using Microsoft.Extensions.FileSystemGlobbing.Util;
using Microsoft.Extensions.FileSystemGlobbing.Internal;
class Program
@kumpera
kumpera / sob.md
Created May 15, 2018 15:40
Safe Object Publication

Safe Object Publication

The notion of SOP (Safe Object Publication) is that objects are made globally visible as whole after constructed or initialized to a given state. This assumption makes usage of immutable objects a lot simpler as you never need any read-side coordination.

For example:


class Foo {
Incident Identifier: 67D5AB9F-F180-4C2A-8FF7-E43DDA7CE2C2
CrashReporter Key: cc3f0f851c99d7d7612ac469ca7be2e43b331b4d
Hardware Model: iPhone7,2
Process: com.apple.WebKit.WebContent [264]
Path: /System/Library/Frameworks/WebKit.framework/XPCServices/com.apple.WebKit.WebContent.xpc/com.apple.WebKit.WebContent
Identifier: com.apple.WebKit.WebContent
Version: 8605.1.33.0.2 (8605)
Code Type: ARM-64 (Native)
Role: Unspecified
Parent Process: launchd [1]
Incident Identifier: 67D5AB9F-F180-4C2A-8FF7-E43DDA7CE2C2
CrashReporter Key: cc3f0f851c99d7d7612ac469ca7be2e43b331b4d
Hardware Model: iPhone7,2
Process: com.apple.WebKit.WebContent [264]
Path: /System/Library/Frameworks/WebKit.framework/XPCServices/com.apple.WebKit.WebContent.xpc/com.apple.WebKit.WebContent
Identifier: com.apple.WebKit.WebContent
Version: 8605.1.33.0.2 (8605)
Code Type: ARM-64 (Native)
Role: Unspecified
Parent Process: launchd [1]
Incident Identifier: 940F3297-6553-4BF2-9AA1-EBAB8FBCF384
CrashReporter Key: cc3f0f851c99d7d7612ac469ca7be2e43b331b4d
Hardware Model: iPhone7,2
Process: com.apple.WebKit.WebContent [258]
Path: /System/Library/Frameworks/WebKit.framework/XPCServices/com.apple.WebKit.WebContent.xpc/com.apple.WebKit.WebContent
Identifier: com.apple.WebKit.WebContent
Version: 8605.1.33.0.2 (8605)
Code Type: ARM-64 (Native)
Role: Unspecified
Parent Process: launchd [1]
Incident Identifier: 7C6BE689-C282-4F02-B8E1-4484A8251B25
CrashReporter Key: cc3f0f851c99d7d7612ac469ca7be2e43b331b4d
Hardware Model: iPhone7,2
Process: com.apple.WebKit.WebContent [242]
Path: /System/Library/Frameworks/WebKit.framework/XPCServices/com.apple.WebKit.WebContent.xpc/com.apple.WebKit.WebContent
Identifier: com.apple.WebKit.WebContent
Version: 8605.1.33.0.2 (8605)
Code Type: ARM-64 (Native)
Role: Unspecified
Parent Process: launchd [1]
(module
(type $0 (func (param i32 i32) (result i32)))
(table 1 1 anyfunc)
(elem (i32.const 0) $Main)
(memory $0 0)
(func $Main (type $0) (param $0 i32) (param $1 i32) (result i32)
(i32.add
(get_local $0)
(get_local $1)
)
kumpera-macpro:wasm-hack rokumper$ make run
STATUS: Preparing... (0/1)
STATUS: All downloads complete.
LOADING mscorlib.dll
LOADING System.dll
LOADING System.Core.dll
LOADING hello.exe
LOADING nunitlite.dll
LOADING mini_tests.dll
-----LOADED ----
@kumpera
kumpera / repro.c
Created August 28, 2017 23:27
emscripten test case
//first file
#include <emscripten.h>
#include <stdio.h>
#include <stdlib.h>
void* mono_native_tls_get_value(int key);
void mono_native_tls_set_value(int key, void *value);
void mono_threads_platform_exit (int exit_code);
#define G_STMT_START do