Since it forwards directly to FindState and has no script bindings there is no need to keep it, it'd only complicate the full scriptification of the weapon class if it stuck around.
* it was never saved in savegames, leaving the state of dead bodies undefined
* it shouldn't be subjected to pointer substitution because all it contains is old dead bodies, not live ones.
Since the only thing it gets used for is swapping out PlayerPawns it can safely skip all global variables that never point to a live player, which allowed to remove quite a bit of code here that stood in the way of scriptifying more content
Null pointers must be allowed and non-object pointers which are not null must be explicitly checked for because the code could crash on them when performing a static_cast on an incorrect type.
For the varargs functions that used the Type field to validate their parameters, now a hidden additional argument is passed which contains a byte array with the type info for the current call's arguments. Since this is static per call location it can be better prepared once when the code is being compiled instead of being put in a runtime created array for each invocation. Everything else uses the per-function instance of the same data.
The only thing that still needed the type field with a VMValue is the defaults array, so this uses a different struct type now to store its data.
Currently used for loading parameters into registers.
For checking parameters of native functions some more work is needed to get the info to the function. Currently it doesn't receive the function descriptor.
src/scripting/vm/jit_call.cpp:164:38: warning: offset of on non-standard-layout type 'VMScriptFunction' [-Winvalid-offsetof]
src/scripting/vm/jit_load.cpp:87:50: warning: offset of on non-standard-layout type 'DObject' [-Winvalid-offsetof]
src/scripting/vm/jit_load.cpp:96:50: warning: offset of on non-standard-layout type 'DObject' [-Winvalid-offsetof]
src/scripting/vm/jit_load.cpp:257:53: warning: offset of on non-standard-layout type 'DObject' [-Winvalid-offsetof]
The amount of support code for this minor optimization was quite large and this stood in the way of streamlining the VM's calling convention, so it was preferable to remove it before moving on.