Il2CppAssemblyUnhollower icon indicating copy to clipboard operation
Il2CppAssemblyUnhollower copied to clipboard

Implement non-boxing invokers for methods returning value types

Open knah opened this issue 3 years ago • 1 comments

Currently, Unhollower uses il2cpp_runtime_invoke, which boxes returned values if they have value types. This boxing happens in the invoker function, so a simple replacement for runtime_invoke seems non-viable - instead, custom invokers (plus perhaps a custom runtime_invoke) need to be generated to allow for non-boxing returns of value types. Like all allocations, this boxing can degrade performance quite a lot.

To solve this, custom invokers that don't box the returned value can be generated. Ideally, invokers would be generated at runtime. However, given the difficulty of achieving that for multiple platforms while keeping compatibility with C++ exceptions, a precompiled native library with invokers for most-common method signatures might be a good middle ground.

Naturally, assembly generation must be changed to make use of those non-boxing invoker methods.

knah avatar Jun 08 '21 17:06 knah

Performance-wise that'd be real neat.

Kein avatar Aug 06 '21 23:08 Kein