MPS issue job000534

TitleNo varieties are doing any checking
Statusclosed
Priorityessential
Assigned userNick Barnes
OrganizationRavenbrook
DescriptionRelated job: job001545 hot varieties still aren't checking.

The MPS has a large amount of checking code. The degree to which this code is included when compiling the MPS should depend on the variety being compiled, so that the "cool" variety does a lot of checking, the "hot" variety does a little, and the "white hot" variety doesn't do any. Currently, there is no such dependency and all varieties are compiled without any checking at all.
AnalysisRecent changes to the build system at Global Graphics have redefined the way in which checking code is turned on and off. Global Graphics don't use "varieties" at all any more. Merging those changes into the MPS masters at Ravenbrook has resulted in the variety switches CONFIG_VAR_*, which used to control everything through some preprocessor code in config.h, being totally ignored.

The old system worked like this:
 CONFIG_VAR_* was used to define MPS_VARIETY_STRING, MPS_COOL (or MPS_HOT and MPS_HOT_*), and EVENT or EVENT_NONE, like this:

 COOL: CI CE TI
 HOT_WHITE: WI WE
 HOT_RED: HI HE II
 EVENT: TI II
 EVENT_NONE: CI CE HI HE WI WE

 EVENT/EVENT_NONE becomes DIAGNOSTICS/DIAGNOSTICS_NONE in config.h; this is used to control the gathering and reporting of statistics.

 EVENT is also used (in event.c, event.h, eventcom.h, eventgen.h) to control telemetry events.

 COOL and HOT_* are then used like this in check.h:

                 RED WHITE COOL

 AVER ASSERT DISCARD ASSERT
 AVERT ASSERT DISCARD ASSERT
 AVER_CRITICAL DISCARD DISCARD ASSERT
 AVERT_CRITICAL DISCARD DISCARD ASSERT
 NOTREACHED fail DISCARD fail
 CHECKS CHECKT DISCARD CHECKT
 CHECKL DISCARD DISCARD SHALLOW|DEEP: ASSERT
 CHECKD DISCARD DISCARD SHALLOW: CHECKT
                                     DEEP: Check
 CHECKD_NOSIG DISCARD DISCARD SHALLOW: non-NULL
                                     DEEP: Check
 CHECKU DISCARD DISCARD SHALLOW|DEEP: CHECKT
 CHECKU_NOSIG DISCARD DISCARD SHALLOW|DEEP: non-NULL

 HOT_WHITE is also used in config.h to pragma off some compiler warnings.

 HOT is also used in config.h to make mps_lib_mem* turn into C library calls on Windows (which can then be inlines).

The new system works like this:

There are three parameters settable in Jam: CONFIG_ASSERT, CONFIG_LOG, and CONFIG_DEBUG.

 config.h turns these into:

- CHECK/CHECK_NONE (controlled by CONFIG_ASSERT),
- EVENT/EVENT_NONE (controlled by CONFIG_LOG),
- DIAGNOSTICS/DIAGNOSTICS_NONE (controlled by CONFIG_DEBUG).

 and also constructs MPS_VARIETY_STRING on the basis of these settings.

 DIAGNOSTICS and EVENT are then used in the same way that they always were.

 CHECK_NONE turns off the same warnings that HOT_WHITE used to.

 The mps_lib_mem* functions are always turned into C library calls on
 Windows.

 In check.h, CHECK_NONE is like WHITE used to be (everything is DISCARDed). CHECK looks like this:

 AVER ASSERT
 AVERT ASSERT
 AVER_CRITICAL ASSERT if not CheckNONE
 AVERT_CRITICAL ASSERT if not CheckNONE
 NOTREACHED fail
 CHECKS CHECKT
 CHECKL SHALLOW|DEEP: ASSERT
 CHECKD SHALLOW: CHECKT
                 DEEP: Check
 CHECKD_NOSIG SHALLOW: non-NULL
                 DEEP: Check
 CHECKU SHALLOW|DEEP: CHECKT
 CHECKU_NOSIG SHALLOW|DEEP: non-NULL

So CHECK is the same as COOL used to be, except that the _CRITICAL checks are now conditional on CheckNONE. Note that setting CheckLevel to NONE is now a lot like RED used to be, except (a) it is configurable at runtime by setting CheckLevel, and (b) it will include a lot of code and a lot of checks of CheckLevel.

We should add code to config.h to turn the old directives into new directives. We probably want to turn DIAGNOSTICS on in cool varieties, because diagnostic statistics are good.

Hot varieties should set CHECK_DEFAULT to CheckNONE. CHECK_DEFAULT is currently set according to the CONFIG_PROD_* directive. We can let "hot" override that. So we can turn the old directives into new directives like this:

 CI DEBUG ASSERT
 CE DEBUG ASSERT
 TI LOG DEBUG ASSERT
 WI
 WE
 HI DEBUG,NONE
 HE DEBUG,NONE
 II LOG DEBUG,NONE

 ********************

 [RHSK 2006-12-13]

 Not quite right. For "hot" we want asserts but with a minimal checklevel. That means we need "ASSERT,NONE", for HI,HE,II in the final diagram above, not "DEBUG,NONE". Remember that "DEBUG" means "DIAGNOSTICS" means "STATISTICs" means "METERs".

 See job001545.
How foundinspection
EvidenceThe check methods didn't get run when chasing down a bug.
Observed in1.100.0
Introduced in1.100.0
Created byNick Barnes
Created on2002-06-19 14:27:14
Last modified byRichard Kistruck
Last modified on2006-12-13 15:28:18
History2002-06-19 NB Created.
2006-12-13 RHSK Ooops: hot varieties were still doing no checking. Added footnote to Analysis.

Fixes

Change Effect Date User Description
30298 closed 2002-06-19 14:09:20 Nick Barnes Checking varieties weren't actually checking anything. Oops.