Ejemplo n.º 1
0
        protected MethodDumperBase(UnpackerContext context)
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }

            _context = context;
            _jitHook = JitHookFactory.Create(_context.Settings.HookType);
            _jitHook.TargetModuleHandle = _context.ModuleHandle;
            _jitHook.Callback           = OnJitCompilation;
            SetIdle();
        }
Ejemplo n.º 2
0
        public static void PrepareOriginalCompileGetter(this IJitHook hook, bool is64Bit)
        {
            // Preload the original method property getter
            Type hookType = hook.GetType();
            Type[] genParams = hookType.GetGenericArguments();
            RuntimeTypeHandle[] genRTs = new RuntimeTypeHandle[genParams.Length];

            for (int i = 0; i < genParams.Length; i++)
            {
                genRTs[i] = genParams[i].TypeHandle;
            }

            RuntimeHelpers.PrepareMethod(
                hookType.GetMethod($"get_OriginalCompileMethod{(is64Bit ? "64" : "32")}").MethodHandle, genRTs);
        }