Skip to content

Instantly share code, notes, and snippets.

View lambdageek's full-sized avatar
🪣

Aleksey Kliger (λgeek) lambdageek

🪣
View GitHub Profile
@lambdageek
lambdageek / dump-method-flags-if-FOO.patch
Created August 17, 2018 16:35
Dump method flags from Type.GetInterfaces
From aef2462e3c0283734e2c2c36f2a3af162df825b0 Mon Sep 17 00:00:00 2001
From: Aleksey Kliger <[email protected]>
Date: Fri, 17 Aug 2018 12:32:24 -0400
Subject: [PATCH] dump some method info if env var FOOF is set
---
mono/metadata/icall.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/mono/metadata/icall.c b/mono/metadata/icall.c
@lambdageek
lambdageek / managed-pointer.cpp
Created September 25, 2018 18:54
Ugly pointer to managed
#include <type_traits>
namespace mono {
namespace traits {
/// mono::traits::Managed<T>::value is true if T is a managed type.
/// In that case mono::traits::Managed<T>::type is defined to be T
template<typename T>
struct Managed {
* thread #1, name = 'tid_307', queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
* frame #0: 0x00007fff7f14d1b2 libsystem_kernel.dylib`__psynch_cvwait + 10
frame #1: 0x00007fff7f2065cb libsystem_pthread.dylib`_pthread_cond_wait + 724
frame #2: 0x000000010ee689b0 mono`mono_os_cond_timedwait [inlined] mono_os_cond_wait(cond=0x00007fdf44004d20, mutex=0x00007fdf44004ce0) at mono-os-mutex.h:173 [opt]
frame #3: 0x000000010ee689a5 mono`mono_os_cond_timedwait(cond=0x00007fdf44004d20, mutex=0x00007fdf44004ce0, timeout_ms=4294967295) at mono-os-mutex.c:32 [opt]
frame #4: 0x000000010edd2249 mono`mono_w32handle_timedwait_signal_handle at mono-coop-mutex.h:102 [opt]
frame #5: 0x000000010edd221c mono`mono_w32handle_timedwait_signal_handle [inlined] mono_w32handle_timedwait_signal_naked(poll=0, alerted=<unavailable>) at w32handle.c:641 [opt]
frame #6: 0x000000010edd221c mono`mono_w32handle_timedwait_signal_handle(handle_data=<unavailable>, timeout=<unavailable>, poll=0, alerted=<unavail
Process: xammac_tests [54741]
Path: /Users/USER/*/xammac_tests.app/Contents/MacOS/xammac_tests
Identifier: com.xamarin.xammac_tests
Version: 1
Code Type: X86-64 (Native)
Parent Process: mono-sgen64 [52765]
Responsible: xammac_tests [54741]
User ID: 501
Date/Time: 2018-10-26 17:30:11.094 -0400
Process: xammac_tests [34662]
Path: /Users/USER/*/xammac_tests.app/Contents/MacOS/xammac_tests
Identifier: com.xamarin.xammac_tests
Version: 1
Code Type: X86-64 (Native)
Parent Process: mono-sgen64 [34307]
Responsible: xammac_tests [34662]
User ID: 501
Date/Time: 2018-10-29 10:41:09.209 -0400
From 751aa448f441d79ec96160887198437aabb25445 Mon Sep 17 00:00:00 2001
From: Aleksey Kliger <[email protected]>
Date: Mon, 26 Nov 2018 17:23:54 -0500
Subject: [PATCH] [hack][mtouch] set MONO_THREAD_SUSPEND to coop to emit
safepoints
---
tools/mtouch/Assembly.cs | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
@lambdageek
lambdageek / explicit-ref-out-keywords.cpp
Last active November 30, 2018 23:41
Explicit ref and out keywords for arguments in C++11
#include <utility>
#include <functional>
#include <stdio.h>
template <typename U>
struct Out {
explicit Out (U& u_) : u (u_) {}
Out (const Out<U>& other) = default;
Out (Out<U>&& other) = default;
Out<U>& operator= (const Out<U>&) = delete;
#include <new>
#include <glib.h>
#include <stdlib.h>
//#include <stdio.h>
// C++17 will also require:
// void* operator new ( std::size_t count, std::align_val_t al);
// void* operator new[]( std::size_t count, std::align_val_t al);
// void operator delete ( void* ptr, std::align_val_t al );
// void operator delete[]( void* ptr, std::align_val_t al );
@lambdageek
lambdageek / Makefile
Created December 4, 2018 17:54
C++ dynamic alloc wrapper using placement forms
all:
clang -xc++ -c -Wall -std=c++11 -Wextra -fno-rtti -fno-exceptions hark.cpp pla.cpp
clang -fno-rtti -fno-exceptions -o hark hark.o pla.o
@lambdageek
lambdageek / Makefile
Last active December 4, 2018 19:41
Mono C++ basis header
all: main
.PHONY: all
main: main.o
clang -o main main.o
main.o: main.cpp
clang -c -xc++ -std=c++11 -fno-rtti -fno-exceptions -Wall -Wextra -O main.cpp