Conversation
`GCWork::do_work` has an `mmtk` parameter, and the `MMTK::get_plan()` and `MMTK::get_plan_mut()` methods provide access to the plan instance. It is therefore pointless for a work packet to capture a pointer or reference inside the struct itself. This PR does not fix the fact that `Plan::prepare` and `Plan::release` have `&mut self` arguments. Therefore, getting `&mut Plan` from an `MMTK` instance is still unsafe. See: mmtk#852
|
I am not sure if it is worth making this change. It is always safer to use fewer raw pointers and weird casting statements like |
I think it is cleaner. With the refactoring, all we need to address is the |
GCWork::do_workhas anmmtkparameter, and theMMTK::get_plan()andMMTK::get_plan_mut()methods provide access to the plan instance. It is therefore pointless for a work packet to capture a pointer or reference inside the struct itself.This PR does not fix the fact that
Plan::prepareandPlan::releasehave&mut selfarguments. Therefore, getting&mut Planfrom anMMTKinstance is still unsafe. See:#852