knah/Il2CppAssemblyUnhollower

Implement non-boxing invokers for methods returning value types

Opened this issue · 1 comments

knah commented

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.

Kein commented

Performance-wise that'd be real neat.