This looks very like a thing that Facebook did back in the early days of Android. Back then Dalvik used a 16-bit ID for method numbers. This was completely fine, they thought, because only a crazy person would write a class with more than 2^16 methods. Unfortunately the Facebook app was some unholy abomination translated to Java from something else (JavaScript?) and so ended up with around a hundred thousand methods in a single class (not many classes though). To fix this, Facebook simply put most of their app in a loadable class bundle and had a simple loader app that first loaded a native library, which hot-patched Dalvik to expand this field to 32 bits and update everything that depended on the size of the field, then loaded the rest of the app. Somewhat surprisingly, this actually worked. Right up until Google bumped the size of this field to 32 bits and broke the hot patching (at which point Google was blamed for breaking the Facebook app in an Android update). Since then, the Android team has been quite enthusiastic about being able to protect the Android runtime from tampering by apps…
what the fuck, c++
This looks very like a thing that Facebook did back in the early days of Android. Back then Dalvik used a 16-bit ID for method numbers. This was completely fine, they thought, because only a crazy person would write a class with more than 2^16 methods. Unfortunately the Facebook app was some unholy abomination translated to Java from something else (JavaScript?) and so ended up with around a hundred thousand methods in a single class (not many classes though). To fix this, Facebook simply put most of their app in a loadable class bundle and had a simple loader app that first loaded a native library, which hot-patched Dalvik to expand this field to 32 bits and update everything that depended on the size of the field, then loaded the rest of the app. Somewhat surprisingly, this actually worked. Right up until Google bumped the size of this field to 32 bits and broke the hot patching (at which point Google was blamed for breaking the Facebook app in an Android update). Since then, the Android team has been quite enthusiastic about being able to protect the Android runtime from tampering by apps…