diff --git a/mps/code/eventdef.h b/mps/code/eventdef.h index fc88e8fd720..907dbf3520f 100644 --- a/mps/code/eventdef.h +++ b/mps/code/eventdef.h @@ -36,7 +36,7 @@ */ #define EVENT_VERSION_MAJOR ((unsigned)1) -#define EVENT_VERSION_MEDIAN ((unsigned)5) +#define EVENT_VERSION_MEDIAN ((unsigned)6) #define EVENT_VERSION_MINOR ((unsigned)0) diff --git a/mps/code/format.c b/mps/code/format.c index 351c150208a..4fd62ac5e22 100644 --- a/mps/code/format.c +++ b/mps/code/format.c @@ -140,6 +140,7 @@ Res FormatCreate(Format *formatReturn, Arena arena, ArgList args) format->arena = arena; RingInit(&format->arenaRing); + format->poolCount = 0; format->alignment = fmtAlign; format->headerSize = fmtHeaderSize; format->scan = fmtScan; @@ -167,6 +168,7 @@ Res FormatCreate(Format *formatReturn, Arena arena, ArgList args) void FormatDestroy(Format format) { AVERT(Format, format); + AVER(format->poolCount == 0); RingRemove(&format->arenaRing); @@ -229,6 +231,7 @@ Res FormatDescribe(Format format, mps_lib_FILE *stream, Count depth) "Format $P ($U) {\n", (WriteFP)format, (WriteFU)format->serial, " arena $P ($U)\n", (WriteFP)format->arena, (WriteFU)format->arena->serial, + " poolCount $U\n", (WriteFU)format->poolCount, " alignment $W\n", (WriteFW)format->alignment, " scan $F\n", (WriteFF)format->scan, " skip $F\n", (WriteFF)format->skip, diff --git a/mps/code/mpmst.h b/mps/code/mpmst.h index 605ac21451a..2f6da006014 100644 --- a/mps/code/mpmst.h +++ b/mps/code/mpmst.h @@ -374,6 +374,7 @@ typedef struct mps_fmt_s { Serial serial; /* from arena->formatSerial */ Arena arena; /* owning arena */ RingStruct arenaRing; /* formats are attached to the arena */ + Count poolCount; /* number of pools using the format */ Align alignment; /* alignment of formatted objects */ mps_fmt_scan_t scan; mps_fmt_skip_t skip; diff --git a/mps/code/mps.h b/mps/code/mps.h index bbc9dc5a505..59c59b5abc6 100644 --- a/mps/code/mps.h +++ b/mps/code/mps.h @@ -533,6 +533,8 @@ extern mps_res_t (mps_reserve)(mps_addr_t *, mps_ap_t, size_t); extern mps_bool_t (mps_commit)(mps_ap_t, mps_addr_t, size_t); extern mps_res_t mps_ap_fill(mps_addr_t *, mps_ap_t, size_t); + +/* mps_ap_fill_with_reservoir_permit is deprecated */ extern mps_res_t mps_ap_fill_with_reservoir_permit(mps_addr_t *, mps_ap_t, size_t); diff --git a/mps/code/mpsi.c b/mps/code/mpsi.c index 3cc76ea8708..1e03a3da3cd 100644 --- a/mps/code/mpsi.c +++ b/mps/code/mpsi.c @@ -1175,7 +1175,7 @@ mps_res_t mps_sac_fill(mps_addr_t *p_o, mps_sac_t mps_sac, size_t size, AVER(p_o != NULL); AVER(TESTT(SAC, sac)); arena = SACArena(sac); - UNUSED(has_reservoir_permit); /* FIXME */ + UNUSED(has_reservoir_permit); /* deprecated */ ArenaEnter(arena); diff --git a/mps/code/pool.c b/mps/code/pool.c index 4200643f31d..9f41560e60e 100644 --- a/mps/code/pool.c +++ b/mps/code/pool.c @@ -169,6 +169,11 @@ Res PoolInit(Pool pool, Arena arena, PoolClass class, ArgList args) /* Add initialized pool to list of pools in arena. */ RingAppend(&globals->poolRing, &pool->arenaRing); + /* Add initialized pool to list of pools using format. */ + if (pool->format) { + ++ pool->format->poolCount; + } + return ResOK; failInit: @@ -228,8 +233,12 @@ void PoolFinish(Pool pool) /* Do any class-specific finishing. */ (*pool->class->finish)(pool); - /* Detach the pool from the arena, and unsig it. */ + /* Detach the pool from the arena and format, and unsig it. */ RingRemove(&pool->arenaRing); + if (pool->format) { + AVER(pool->format->poolCount > 0); + -- pool->format->poolCount; + } pool->sig = SigInvalid; RingFinish(&pool->segRing); diff --git a/mps/manual/source/topic/telemetry.rst b/mps/manual/source/topic/telemetry.rst index 0f107985c20..2c9136ce7da 100644 --- a/mps/manual/source/topic/telemetry.rst +++ b/mps/manual/source/topic/telemetry.rst @@ -306,14 +306,14 @@ takes the following options: For example, here's the result of passing the output shown above through :program:`mpseventtxt`:: - 000AE03973336E3C 002B VMCreate vm:00000001003FC000 base:00000001003FD000 limit:00000001003FE000 - 000AE0397333BC6D 002D VMMap vm:00000001003FC000 base:00000001003FD000 limit:00000001003FE000 - 000AE0397334DF9F 001A Intern stringId:0000000000000002 string:"Reservoir" - 000AE0397334E0A0 001B Label address:00000001078C85B8["Reservoir"] stringId:0000000000000002 - 000AE03973352375 0015 PoolInit pool:00000001003FD328 arena:00000001003FD000 poolClass:00000001078C85B8["Reservoir"] - 000AE039733592F9 002B VMCreate vm:00000001003FE000 base:00000001003FF000 limit:000000010992F000 - 000AE0397335C8B5 002D VMMap vm:00000001003FE000 base:00000001003FF000 limit:0000000107930000 - 000AE03973361D5A 0005 ArenaCreateVM arena:00000001003FD000 userSize:0000000002000000 chunkSize:0000000002000000 + 000021C9DB3812C7 0075 EventClockSync clock:0000000000001EE3 + 000021C9DB39E2FB 002B VMInit vm:00007FFF5429C4B8 base:000000010BA4A000 limit:000000010BA4B000 + 000021C9DB3A5630 002D VMMap vm:00007FFF5429C4B8 base:000000010BA4A000 limit:000000010BA4B000 + 000021C9DB3E6BAA 001A Intern stringId:0000000000000002 string:"MFS" + 000021C9DB3E6E17 001B Label address:000000010BA0C5D8["MFS"] stringId:0000000000000002 + 000021C9DB3EB6F8 0044 PoolInitMFS pool:000000010BA4A360 arena:000000010BA4A000 extendBy:0000000000001000 extendSelf:False unitSize:0000000000000030 + 000021C9DB3EFE3B 002B VMInit vm:00007FFF5429C3D0 base:000000010BC84000 limit:000000010CC24000 + 000021C9DB3F33F3 002D VMMap vm:00007FFF5429C3D0 base:000000010BC84000 limit:000000010BC85000 .. index:: diff --git a/mps/test/conerr/12.c b/mps/test/conerr/12.c index a8f932114ab..139abce195b 100644 --- a/mps/test/conerr/12.c +++ b/mps/test/conerr/12.c @@ -4,6 +4,10 @@ TEST_HEADER summary = destroy a format though attached to a pool language = c link = testlib.o +OUTPUT_SPEC + assert = true + assertfile P= format.c + assertcond = format->poolCount == 0 END_HEADER */