Avoid copying container data where possible
Currently, the kernel copies the container data twice. Input data (method arguments) gets copied first from caller module to kernel and then from kernel to callee module. Output data (changed parameters, return values) gets copied from callee module to kernel and then from kernel to caller module.
For some cases, it is possible to reduce the number of copying operations. However, there are certain limitations:
- Only copying of containers may be avoided. Individual values are cheaper to copy than to allow being located in some unexpected places.
- Copying of containers of non-primitive types can not be avoided, because kernel-side and module-side representations of non-primitive types are different.
- Module-to-kernel copying can not be avoided for local modules, as the module may not have any way of modifying the data after the validation starts.
- Kernel-to-module copying can not be avoided if the module address space is different from the kernel address space. For in-DLL modules the kernel-side data may be read by the modules, however, for standalone OS this is not the case. Here, the solution might be allocating kernel-side arrays in the space that will then be attached to the module domain.
- Currently, the remote data packs are flatly-packed and gets cleared once the reading is complete. If some data must be persisted for the kernel's future reference, this must be changed.