You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We have a few large structs (Vm, VmCpu) that we place in Page containers but, in the absence of guaranteed copy elision, we may end up with the struct being constructed on the stack and then copied into the page. And in fact, this is exactly what appears to be happening currently with VmCpu. This is going to become more of a problem as we add more per-vCPU state: vector state, PMU, IMSIC, etc.
We should consider initializing these structs in-place. Unfortunately Rust does not have support for a "placement new" or "emplace" so it looks like the best we can do right now is MaybeUninit + a bunch of unsafe.
The text was updated successfully, but these errors were encountered:
Vm::finalize() and VmPages::finalize() effectively turn into a huge memcpy(). I don't see a good way to avoid this with the type-state pattern; we may need an alternate approach to type-safe Vm states.
The moveit crate, or something like it, might be of use to us here for in-place construction.
We have a few large structs (
Vm
,VmCpu
) that we place inPage
containers but, in the absence of guaranteed copy elision, we may end up with the struct being constructed on the stack and then copied into the page. And in fact, this is exactly what appears to be happening currently withVmCpu
. This is going to become more of a problem as we add more per-vCPU state: vector state, PMU, IMSIC, etc.We should consider initializing these structs in-place. Unfortunately Rust does not have support for a "placement new" or "emplace" so it looks like the best we can do right now is
MaybeUninit
+ a bunch ofunsafe
.The text was updated successfully, but these errors were encountered: