Skip to content

Instantly share code, notes, and snippets.

@hypeartist
hypeartist / .log
Created August 5, 2020 19:48
logcat
08-05 23:46:53.120 588 588 I /vendor/bin/sscrpcd: vendor/qcom/proprietary/commonsys-intf/adsprpc/src/fastrpc_pm.c:113: fastrpc_wake_lock_deinit done
08-05 23:46:53.120 588 588 I /vendor/bin/sscrpcd: vendor/qcom/proprietary/commonsys-intf/adsprpc/src/fastrpc_apps_user.c:2493: fastrpc_apps_user_deinit done
08-05 23:46:53.120 588 588 E /vendor/bin/sscrpcd: vendor/qcom/proprietary/sensors-see/sscrpcd/src/sscrpcd.cpp:89:sscrpcd daemon will restart after 25ms...
08-05 23:46:53.124 1082 1082 I /vendor/bin/adsprpcd: vendor/qcom/proprietary/commonsys-intf/adsprpc/src/fastrpc_apps_user.c:2548: fastrpc_apps_user_init done
08-05 23:46:53.124 1082 1082 I /vendor/bin/adsprpcd: vendor/qcom/proprietary/commonsys-intf/adsprpc/src/fastrpc_apps_user.c:1153: remote_handle_open: Successfully opened handle 0x56 for '":;./\attachguestos on domain 0
08-05 23:46:53.124 1082 1082 E /vendor/bin/adsprpcd: vendor/qcom/proprietary/commonsys-intf/adsprpc/src/fastrpc_apps_user.c:2357: Error 0xffffffff: apps_dev_init failed
@hypeartist
hypeartist / count_utf8_chars.cs
Last active February 3, 2021 22:34
Count .NET char instances containing in UTF8 byte array
[Benchmark]
public int GetCharInstanceCountCustomScalar()
{
return GetCharInstanceCountCustomScalarImpl(_srcBuffer, _srcBufferlength);
}
[Benchmark]
public int GetCharInstanceCountCustomSse2()
{
return GetCharInstanceCountCustomSse2Impl(_srcBuffer, _srcBufferlength);
@hypeartist
hypeartist / gen_utf8.cs
Last active February 3, 2021 23:43
Generate set of random UTF8 chars
public struct GenStats
{
public int OneByteCharCount;
public int TwoBytesCharCount;
public int ThreeBytesCharCount;
public int FourBytesCharCount;
public int OneCharSeqCount;
public int TwoCharsSeqCount;
@hypeartist
hypeartist / count_utf8_chars_rev2.cs
Last active July 20, 2022 01:06
Count .NET char instances containing in UTF8 byte array (rev2)
[Benchmark]
public int GetCharInstanceCountCustomScalar()
{
return GetCharInstanceCountCustomScalarImpl(_srcBuffer, _srcBufferlength);
}
[Benchmark]
public int GetCharInstanceCountCustomSse2()
{
return GetCharInstanceCountCustomSse2Impl(_srcBuffer, _srcBufferlength);
using System;
using System.Runtime.CompilerServices;
using System.Threading;
namespace CoreClrDebugTarget
{
class Program
{
internal static unsafe void Main(string[] args)
{
@hypeartist
hypeartist / Hex2Int32.cs
Created September 13, 2021 19:45
Hex2Int32
using System;
using System.IO;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Intrinsics;
using System.Runtime.Intrinsics.X86;
namespace Repos
{
public static class Misc
@hypeartist
hypeartist / core-imaging-playground
Created February 8, 2022 13:07
core-imaging-playground
BenchmarkDotNet=v0.13.1, OS=Windows 10.0.22000
Intel Core i7-4702MQ CPU 2.20GHz (Haswell), 1 CPU, 8 logical and 4 physical cores
.NET SDK=6.0.101
[Host] : .NET 6.0.1 (6.0.121.56705), X64 RyuJIT [AttachedDebugger]
ShortRun : .NET 6.0.1 (6.0.121.56705), X64 RyuJIT
Job=ShortRun Arguments=/p:DebugType=portable IterationCount=5
LaunchCount=1 WarmupCount=5
| Method | Mean | Error | StdDev | Ratio | RatioSD | Gen 0 | Gen 1 | Gen 2 | Allocated |
BenchmarkDotNet=v0.13.1, OS=Windows 10.0.22000
Intel Core i7-4702MQ CPU 2.20GHz (Haswell), 1 CPU, 8 logical and 4 physical cores
.NET SDK=6.0.101
  [Host]   : .NET 6.0.1 (6.0.121.56705), X64 RyuJIT
  ShortRun : .NET 6.0.1 (6.0.121.56705), X64 RyuJIT

Job=ShortRun  Arguments=/p:DebugType=portable  IterationCount=5  
LaunchCount=1 WarmupCount=5 
diff --git a/src/PowerUp.Core/Decompilation/JITExtensions.cs b/src/PowerUp.Core/Decompilation/JITExtensions.cs
index 88b3397..0f18362 100644
--- a/src/PowerUp.Core/Decompilation/JITExtensions.cs
+++ b/src/PowerUp.Core/Decompilation/JITExtensions.cs
@@ -5,23 +5,18 @@ using System.Runtime.CompilerServices;
using System.Text;
using PowerUp.Core.Console;
using System.Linq;
+using System.Runtime.InteropServices;
using PowerUp.Core.Decompilation.Attributes;
@hypeartist
hypeartist / code.cs
Created July 16, 2022 19:19
Type instantiation (default .ctor)
object obj;
var r = 0;
const int cnt = 1000000;
var constructorInfo = typeof(Class).GetConstructor(Array.Empty<Type>())!;
var hCtorDefault = constructorInfo.MethodHandle;
RuntimeHelpers.PrepareMethod(RuntimeMethodHandle.FromIntPtr(hCtorDefault.Value));
var pCtor = (delegate*<object, void>)hCtorDefault.GetFunctionPointer();