Open wks opened 2 months ago
The plan modules were previously named as plan::plan
(src/plan/plan.rs
), plan::semispace::semispace
(src/plan/semispace/semispace.rs
), etc. This mostly follows what Java MMTk names plans. However, clippy does not like this. So the inner modules are renamed to global
. It actually makes sense, as what are defined in the plan are the global-level stuff.
The global.rs
files in metadata are simply a misuse.
We should definitely fix the latter. We may keep the former, or change it -- I don't mind too much.
More places with the filename global.rs
:
src/policy/marksweep/native_ms/global.rs
src/policy/marksweep/malloc_ms/global.rs
These are wrong as well.
In Rust, the idiomatic place to put top-level items (functions, types, constants, ...) of a module is
mod.rs
.In mmtk-core, many modules contain
global.rs
. The file nameglobal.rs
is intended for plans, policies, allocators and other things that contain global parts (data structures not specific to any mutator), mutator-specific parts, and GC worker-specific parts. For example, the Immix plan hasglobal.rs
,mutator.rs
andgc_work.rs
. That basically follows the pattern in JikesRVM MMTk, for example,Immix
,ImmixMutator
,ImmixCollector
andImmixTraceLocal
. (Actually in Rust MMTk,global.rs
basically does everything.gc_work.rs
simply declares what ProcessEdgesWork to use.mutator.rs
simply createsMutator
instances, and everything else is done by theMutator
itself.)But the filename
global.rs
does not make sense for other things that don't have such distinction. For example,src/plan/global.rs
: It simply defines thePlan
trait and related top-level types such asCommonPlan
andBasePlan
. But it also contains things likefn create_mutator
,fn create_gc_work_context
andAllocationSemantics
which obviously don't belong to the global part of a plan.src/util/metadata/global.rs
: This file definesenum MetadataSpec
and its methods. It is neutral to whether the metadata is global or local. Instead,object_model.rs
defines concrete metadata types, including both global and local metadata.src/util/metadata/global.rs
: This is for side metadata, regardless whether it is global or local..The three places above may be abusing the name
global.rs
for module-level items, and should be inmod.rs
, instead.