MPS issue job003318

TitleNo interface to get collection number from a gc start message
Statussuspended
Prioritynice
Assigned userRichard Brooksby
OrganizationRavenbrook
DescriptionThe Scheme example [1] contains this code:

    if (type == mps_message_type_gc_start()) {
      printf("Collection %lu started.\n", (unsigned long)mps_collections(arena));

This is bogus because mps_collections returns the *current* count of collections for the arena, whereas what we are interested in when processing this message is the number of the collection that posted the message.
AnalysisI removed the collection number from this line of output (it now says just, "Collection started.").

I suggest that an external interface function be added for getting the collection number from a message of type mps_message_type_gc_start().

RB suggests that mps_arena_collect, mps_arena_step, and mps_arena_park could return a collection id. This would allow you match the call against the message if you needed to do that.

Also, shouldn't "mps_collections" be called "mps_arena_collections"? Maybe "mps_collections" should be deprecated?

GDR 2018-07-15: What is the point of having a collection number at all? It does not seem to meet any customer use case. It could only be used for debugging or garbage collection "chatter".
How foundinspection
Evidence[1] <https://info.ravenbrook.com/project/mps/master/example/scheme/scheme.c>
Observed in1.110.0
Created byGareth Rees
Created on2012-10-17 17:41:22
Last modified byGareth Rees
Last modified on2018-07-15 19:10:32
History2012-10-17 GDR Created.
2012-10-23 GDR Added note about collect/step/park returning collection id.
2018-07-15 GDR Declined as explained in analysis.