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
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 name global.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 has global.rs, mutator.rs and gc_work.rs. That basically follows the pattern in JikesRVM MMTk, for example, Immix, ImmixMutator, ImmixCollector and ImmixTraceLocal. (Actually in Rust MMTk, global.rs basically does everything. gc_work.rs simply declares what ProcessEdgesWork to use. mutator.rs simply creates Mutator instances, and everything else is done by the Mutator 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 the Plan trait and related top-level types such as CommonPlan and BasePlan. But it also contains things like fn create_mutator, fn create_gc_work_context and AllocationSemantics which obviously don't belong to the global part of a plan.
src/util/metadata/global.rs: This file defines enum 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 in mod.rs, instead.
The text was updated successfully, but these errors were encountered:
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.
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.The text was updated successfully, but these errors were encountered: