From af51318a09bb126b5213b141da94149a9886f988 Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Wed, 26 Feb 2014 11:52:13 +0000 Subject: [PATCH 1/3] Branch for obsoleting mps_args_done. Copied from Perforce Change: 184537 ServerID: perforce.ravenbrook.com From 6971bee496cd312553123991f19b467ca47a9210 Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Wed, 26 Feb 2014 12:47:27 +0000 Subject: [PATCH 2/3] Make mps_args_done obsolete. Copied from Perforce Change: 184543 ServerID: perforce.ravenbrook.com --- mps/code/amsss.c | 4 ---- mps/code/arena.c | 1 - mps/code/arenacv.c | 2 -- mps/code/awlut.c | 1 - mps/code/awluthe.c | 1 - mps/code/cbs.c | 1 - mps/code/dbgpool.c | 1 - mps/code/djbench.c | 1 - mps/code/fotest.c | 2 -- mps/code/gcbench.c | 2 -- mps/code/mps.h | 8 +++++--- mps/code/mpsi.c | 4 ---- mps/code/mv2test.c | 1 - mps/code/poolamc.c | 1 - mps/code/poolawl.c | 1 - mps/code/poolmrg.c | 1 - mps/code/poolmv.c | 2 -- mps/code/poolncv.c | 1 - mps/code/segsmss.c | 1 - mps/example/scheme/scheme-advanced.c | 8 -------- mps/example/scheme/scheme.c | 3 --- mps/manual/source/guide/advanced.rst | 4 ---- mps/manual/source/guide/lang.rst | 4 ---- mps/manual/source/pool/amc.rst | 1 - mps/manual/source/pool/amcz.rst | 1 - mps/manual/source/pool/ams.rst | 2 -- mps/manual/source/pool/awl.rst | 2 -- mps/manual/source/pool/lo.rst | 1 - mps/manual/source/pool/mfs.rst | 1 - mps/manual/source/pool/mv.rst | 1 - mps/manual/source/pool/mvff.rst | 1 - mps/manual/source/pool/mvt.rst | 1 - mps/manual/source/pool/snc.rst | 2 -- mps/manual/source/topic/arena.rst | 2 -- mps/manual/source/topic/debugging.rst | 1 - mps/manual/source/topic/format.rst | 1 - mps/manual/source/topic/keyword.rst | 28 ++++++++++----------------- 37 files changed, 15 insertions(+), 85 deletions(-) diff --git a/mps/code/amsss.c b/mps/code/amsss.c index 67d1018aba8..43d2541f401 100644 --- a/mps/code/amsss.c +++ b/mps/code/amsss.c @@ -226,7 +226,6 @@ int main(int argc, char *argv[]) MPS_ARGS_ADD(args, MPS_KEY_FORMAT, format); MPS_ARGS_ADD(args, MPS_KEY_AMS_SUPPORT_AMBIGUOUS, FALSE); MPS_ARGS_ADD(args, MPS_KEY_POOL_DEBUG_OPTIONS, &freecheckOptions); - MPS_ARGS_DONE(args); die(mps_pool_create_k(&pool, arena, mps_class_ams_debug(), args), "pool_create(ams_debug,share)"); } MPS_ARGS_END(args); @@ -239,7 +238,6 @@ int main(int argc, char *argv[]) MPS_ARGS_ADD(args, MPS_KEY_FORMAT, format); MPS_ARGS_ADD(args, MPS_KEY_AMS_SUPPORT_AMBIGUOUS, TRUE); MPS_ARGS_ADD(args, MPS_KEY_POOL_DEBUG_OPTIONS, &freecheckOptions); - MPS_ARGS_DONE(args); die(mps_pool_create_k(&pool, arena, mps_class_ams_debug(), args), "pool_create(ams_debug,ambig)"); } MPS_ARGS_END(args); @@ -252,7 +250,6 @@ int main(int argc, char *argv[]) MPS_ARGS_ADD(args, MPS_KEY_FORMAT, format); MPS_ARGS_ADD(args, MPS_KEY_AMS_SUPPORT_AMBIGUOUS, TRUE); MPS_ARGS_ADD(args, MPS_KEY_POOL_DEBUG_OPTIONS, &freecheckOptions); - MPS_ARGS_DONE(args); die(mps_pool_create_k(&pool, arena, mps_class_ams(), args), "pool_create(ams,ambig)"); } MPS_ARGS_END(args); @@ -265,7 +262,6 @@ int main(int argc, char *argv[]) MPS_ARGS_ADD(args, MPS_KEY_FORMAT, format); MPS_ARGS_ADD(args, MPS_KEY_AMS_SUPPORT_AMBIGUOUS, FALSE); MPS_ARGS_ADD(args, MPS_KEY_POOL_DEBUG_OPTIONS, &freecheckOptions); - MPS_ARGS_DONE(args); die(mps_pool_create_k(&pool, arena, mps_class_ams(), args), "pool_create(ams,share)"); } MPS_ARGS_END(args); diff --git a/mps/code/arena.c b/mps/code/arena.c index b1584cb733e..f2e94f99fed 100644 --- a/mps/code/arena.c +++ b/mps/code/arena.c @@ -314,7 +314,6 @@ Res ControlInit(Arena arena) AVERT(Arena, arena); MPS_ARGS_BEGIN(args) { MPS_ARGS_ADD(args, MPS_KEY_EXTEND_BY, CONTROL_EXTEND_BY); - MPS_ARGS_DONE(args); res = PoolInit(&arena->controlPoolStruct.poolStruct, arena, PoolClassMV(), args); } MPS_ARGS_END(args); diff --git a/mps/code/arenacv.c b/mps/code/arenacv.c index 10ef9c45314..b52345f9013 100644 --- a/mps/code/arenacv.c +++ b/mps/code/arenacv.c @@ -344,7 +344,6 @@ static void testPageTable(ArenaClass class, Size size, Addr addr) MPS_ARGS_BEGIN(args) { MPS_ARGS_ADD(args, MPS_KEY_ARENA_SIZE, size); MPS_ARGS_ADD(args, MPS_KEY_ARENA_CL_BASE, addr); - MPS_ARGS_DONE(args); die(ArenaCreate(&arena, class, args), "ArenaCreate"); } MPS_ARGS_END(args); @@ -382,7 +381,6 @@ static void testSize(Size size) do { MPS_ARGS_BEGIN(args) { MPS_ARGS_ADD(args, MPS_KEY_ARENA_SIZE, size); - MPS_ARGS_DONE(args); res = ArenaCreate(&arena, class, args); } MPS_ARGS_END(args); if (res == ResOK) diff --git a/mps/code/awlut.c b/mps/code/awlut.c index a39ccb7c6cb..25ceb34b29b 100644 --- a/mps/code/awlut.c +++ b/mps/code/awlut.c @@ -278,7 +278,6 @@ static void *setup(void *v, size_t s) weaknesss and want things to die in it promptly. */ MPS_ARGS_ADD(args, MPS_KEY_GEN, 0); MPS_ARGS_ADD(args, MPS_KEY_FORMAT, dylanfmt); - MPS_ARGS_DONE(args); die(mps_pool_create_k(&leafpool, arena, mps_class_lo(), args), "Leaf Pool Create\n"); } MPS_ARGS_END(args); diff --git a/mps/code/awluthe.c b/mps/code/awluthe.c index 9f450d55c50..6b56d05f78d 100644 --- a/mps/code/awluthe.c +++ b/mps/code/awluthe.c @@ -281,7 +281,6 @@ static void *setup(void *v, size_t s) weaknesss and want things to die in it promptly. */ MPS_ARGS_ADD(args, MPS_KEY_GEN, 0); MPS_ARGS_ADD(args, MPS_KEY_FORMAT, dylanfmt); - MPS_ARGS_DONE(args); die(mps_pool_create_k(&leafpool, arena, mps_class_lo(), args), "Leaf Pool Create\n"); } MPS_ARGS_END(args); diff --git a/mps/code/cbs.c b/mps/code/cbs.c index 98b57c789b0..84913dd9eab 100644 --- a/mps/code/cbs.c +++ b/mps/code/cbs.c @@ -223,7 +223,6 @@ Res CBSInit(Arena arena, CBS cbs, void *owner, Align alignment, MPS_ARGS_BEGIN(pcArgs) { MPS_ARGS_ADD(pcArgs, MPS_KEY_MFS_UNIT_SIZE, sizeof(CBSBlockStruct)); MPS_ARGS_ADD(pcArgs, MPS_KEY_EXTEND_BY, extendBy); - MPS_ARGS_DONE(pcArgs); res = PoolCreate(&(cbs->blockPool), arena, PoolClassMFS(), pcArgs); } MPS_ARGS_END(pcArgs); if (res != ResOK) diff --git a/mps/code/dbgpool.c b/mps/code/dbgpool.c index 3d670d8d361..db4fab371c3 100644 --- a/mps/code/dbgpool.c +++ b/mps/code/dbgpool.c @@ -188,7 +188,6 @@ static Res DebugPoolInit(Pool pool, ArgList args) MPS_ARGS_BEGIN(pcArgs) { MPS_ARGS_ADD(pcArgs, MPS_KEY_EXTEND_BY, debug->tagSize); /* FIXME: Check this */ MPS_ARGS_ADD(pcArgs, MPS_KEY_MFS_UNIT_SIZE, debug->tagSize); - MPS_ARGS_DONE(pcArgs); res = PoolCreate(&debug->tagPool, PoolArena(pool), PoolClassMFS(), pcArgs); } MPS_ARGS_END(pcArgs); if (res != ResOK) diff --git a/mps/code/djbench.c b/mps/code/djbench.c index 74fd09dadab..09eaa6d513c 100644 --- a/mps/code/djbench.c +++ b/mps/code/djbench.c @@ -187,7 +187,6 @@ static void arena_wrap(dj_t dj, mps_class_t pool_class, const char *name) { MPS_ARGS_BEGIN(args) { MPS_ARGS_ADD(args, MPS_KEY_ARENA_SIZE, 256ul * 1024 * 1024); /* FIXME: Why is there no default? */ - MPS_ARGS_DONE(args); DJMUST(mps_arena_create_k(&arena, mps_arena_class_vm(), args)); } MPS_ARGS_END(args); DJMUST(mps_pool_create_k(&pool, arena, pool_class, mps_args_none)); diff --git a/mps/code/fotest.c b/mps/code/fotest.c index 333da328475..cab1d0f4e31 100644 --- a/mps/code/fotest.c +++ b/mps/code/fotest.c @@ -183,7 +183,6 @@ int main(int argc, char *argv[]) MPS_ARGS_ADD(args, MPS_KEY_MVFF_ARENA_HIGH, rnd() % 2); MPS_ARGS_ADD(args, MPS_KEY_MVFF_SLOT_HIGH, rnd() % 2); MPS_ARGS_ADD(args, MPS_KEY_MVFF_FIRST_FIT, rnd() % 2); - MPS_ARGS_DONE(args); die(mps_pool_create_k(&pool, arena, mps_class_mvff(), args), "create MVFF"); } MPS_ARGS_END(args); { @@ -203,7 +202,6 @@ int main(int argc, char *argv[]) MPS_ARGS_ADD(args, MPS_KEY_MAX_SIZE, (1 + rnd() % 4) * 1024); MPS_ARGS_ADD(args, MPS_KEY_MVT_RESERVE_DEPTH, (1 + rnd() % 64) * 16); MPS_ARGS_ADD(args, MPS_KEY_MVT_FRAG_LIMIT, (rnd() % 101) / 100.0); - MPS_ARGS_DONE(args); die(mps_pool_create_k(&pool, arena, mps_class_mvt(), args), "create MVFF"); } MPS_ARGS_END(args); { diff --git a/mps/code/gcbench.c b/mps/code/gcbench.c index 833203a23c2..7e0ccbfb323 100644 --- a/mps/code/gcbench.c +++ b/mps/code/gcbench.c @@ -240,7 +240,6 @@ static void arena_setup(gcthread_fn_t fn, { MPS_ARGS_BEGIN(args) { MPS_ARGS_ADD(args, MPS_KEY_ARENA_SIZE, arenasize); - MPS_ARGS_DONE(args); RESMUST(mps_arena_create_k(&arena, mps_arena_class_vm(), args)); } MPS_ARGS_END(args); RESMUST(dylan_fmt(&format, arena)); @@ -253,7 +252,6 @@ static void arena_setup(gcthread_fn_t fn, MPS_ARGS_ADD(args, MPS_KEY_FORMAT, format); if (ngen > 0) MPS_ARGS_ADD(args, MPS_KEY_CHAIN, chain); - MPS_ARGS_DONE(args); RESMUST(mps_pool_create_k(&pool, arena, pool_class, args)); } MPS_ARGS_END(args); watch(fn, name); diff --git a/mps/code/mps.h b/mps/code/mps.h index f8751d01372..156e0fae7b7 100644 --- a/mps/code/mps.h +++ b/mps/code/mps.h @@ -222,9 +222,10 @@ extern const struct mps_key_s _mps_key_fmt_class; #define MPS_ARGS_BEGIN(_var) \ MPS_BEGIN \ - mps_arg_s _var[MPS_ARGS_MAX]; \ - unsigned _var##_i = 0; \ - MPS_BEGIN + mps_arg_s _var[MPS_ARGS_MAX]; \ + unsigned _var##_i = 0; \ + _var[_var##_i].key = MPS_KEY_ARGS_END; \ + MPS_BEGIN #define MPS_ARGS_ADD_FIELD(_var, _key, _field, _val) \ MPS_BEGIN \ @@ -232,6 +233,7 @@ extern const struct mps_key_s _mps_key_fmt_class; _var[_var##_i].key = (_key); \ _var[_var##_i].val._field = (_val); \ ++_var##_i; \ + _var[_var##_i].key = MPS_KEY_ARGS_END; \ MPS_END #define MPS_ARGS_ADD(_var, _key, _val) \ diff --git a/mps/code/mpsi.c b/mps/code/mpsi.c index eb7fdb89558..1d52208be9a 100644 --- a/mps/code/mpsi.c +++ b/mps/code/mpsi.c @@ -498,7 +498,6 @@ mps_res_t mps_fmt_create_A(mps_fmt_t *mps_fmt_o, MPS_ARGS_ADD(args, MPS_KEY_FMT_FWD, mps_fmt_A->fwd); MPS_ARGS_ADD(args, MPS_KEY_FMT_ISFWD, mps_fmt_A->isfwd); MPS_ARGS_ADD(args, MPS_KEY_FMT_PAD, mps_fmt_A->pad); - MPS_ARGS_DONE(args); res = FormatCreate(&format, arena, args); } MPS_ARGS_END(args); @@ -533,7 +532,6 @@ mps_res_t mps_fmt_create_B(mps_fmt_t *mps_fmt_o, MPS_ARGS_ADD(args, MPS_KEY_FMT_ISFWD, mps_fmt_B->isfwd); MPS_ARGS_ADD(args, MPS_KEY_FMT_PAD, mps_fmt_B->pad); MPS_ARGS_ADD(args, MPS_KEY_FMT_CLASS, mps_fmt_B->mps_class); - MPS_ARGS_DONE(args); res = FormatCreate(&format, arena, args); } MPS_ARGS_END(args); @@ -568,7 +566,6 @@ mps_res_t mps_fmt_create_auto_header(mps_fmt_t *mps_fmt_o, MPS_ARGS_ADD(args, MPS_KEY_FMT_FWD, mps_fmt->fwd); MPS_ARGS_ADD(args, MPS_KEY_FMT_ISFWD, mps_fmt->isfwd); MPS_ARGS_ADD(args, MPS_KEY_FMT_PAD, mps_fmt->pad); - MPS_ARGS_DONE(args); res = FormatCreate(&format, arena, args); } MPS_ARGS_END(args); @@ -601,7 +598,6 @@ mps_res_t mps_fmt_create_fixed(mps_fmt_t *mps_fmt_o, MPS_ARGS_ADD(args, MPS_KEY_FMT_FWD, mps_fmt_fixed->fwd); MPS_ARGS_ADD(args, MPS_KEY_FMT_ISFWD, mps_fmt_fixed->isfwd); MPS_ARGS_ADD(args, MPS_KEY_FMT_PAD, mps_fmt_fixed->pad); - MPS_ARGS_DONE(args); res = FormatCreate(&format, arena, args); } MPS_ARGS_END(args); diff --git a/mps/code/mv2test.c b/mps/code/mv2test.c index 29e5606327a..10f7f3353c5 100644 --- a/mps/code/mv2test.c +++ b/mps/code/mv2test.c @@ -187,7 +187,6 @@ static void stress_with_arena_class(mps_arena_class_t aclass) MPS_ARGS_ADD(args, MPS_KEY_MAX_SIZE, max); MPS_ARGS_ADD(args, MPS_KEY_MVT_RESERVE_DEPTH, TEST_SET_SIZE/2); MPS_ARGS_ADD(args, MPS_KEY_MVT_FRAG_LIMIT, 0.3); - MPS_ARGS_DONE(args); die(stress(mps_class_mvt(), arena, randomSize, args), "stress MVT"); } MPS_ARGS_END(args); diff --git a/mps/code/poolamc.c b/mps/code/poolamc.c index b6ce34ff624..d7d8e0cbfd1 100644 --- a/mps/code/poolamc.c +++ b/mps/code/poolamc.c @@ -1191,7 +1191,6 @@ static Res AMCBufferFill(Addr *baseReturn, Addr *limitReturn, alignedSize = SizeAlignUp(size, ArenaAlign(arena)); MPS_ARGS_BEGIN(args) { MPS_ARGS_ADD_FIELD(args, amcKeySegType, p, &gen->type); /* .segtype */ - MPS_ARGS_DONE(args); res = ChainAlloc(&seg, amc->chain, PoolGenNr(pgen), amcSegClassGet(), alignedSize, pool, withReservoirPermit, args); } MPS_ARGS_END(args); diff --git a/mps/code/poolawl.c b/mps/code/poolawl.c index 26979c6c2f2..83890b34b6e 100644 --- a/mps/code/poolawl.c +++ b/mps/code/poolawl.c @@ -467,7 +467,6 @@ static Res AWLSegCreate(AWLSeg *awlsegReturn, return ResMEMORY; MPS_ARGS_BEGIN(args) { MPS_ARGS_ADD_FIELD(args, awlKeySegRankSet, u, rankSet); - MPS_ARGS_DONE(args); res = ChainAlloc(&seg, awl->chain, awl->pgen.nr, AWLSegClassGet(), size, pool, reservoirPermit, args); } MPS_ARGS_END(args); diff --git a/mps/code/poolmrg.c b/mps/code/poolmrg.c index 8e8086ae16c..c945029a9db 100644 --- a/mps/code/poolmrg.c +++ b/mps/code/poolmrg.c @@ -526,7 +526,6 @@ static Res MRGSegPairCreate(MRGRefSeg *refSegReturn, MRG mrg, MPS_ARGS_BEGIN(args) { MPS_ARGS_ADD_FIELD(args, mrgKeyLinkSeg, p, linkseg); /* .ref.initarg */ - MPS_ARGS_DONE(args); res = SegAlloc(&segRefPart, EnsureMRGRefSegClass(), SegPrefDefault(), mrg->extendBy, pool, withReservoirPermit, args); diff --git a/mps/code/poolmv.c b/mps/code/poolmv.c index 14cf2c12ce2..9acd64380f6 100644 --- a/mps/code/poolmv.c +++ b/mps/code/poolmv.c @@ -243,7 +243,6 @@ static Res MVInit(Pool pool, ArgList args) MPS_ARGS_BEGIN(piArgs) { MPS_ARGS_ADD(piArgs, MPS_KEY_EXTEND_BY, blockExtendBy); MPS_ARGS_ADD(piArgs, MPS_KEY_MFS_UNIT_SIZE, sizeof(MVBlockStruct)); - MPS_ARGS_DONE(piArgs); res = PoolInit(&mv->blockPoolStruct.poolStruct, arena, PoolClassMFS(), piArgs); } MPS_ARGS_END(piArgs); if(res != ResOK) @@ -254,7 +253,6 @@ static Res MVInit(Pool pool, ArgList args) MPS_ARGS_BEGIN(piArgs) { MPS_ARGS_ADD(piArgs, MPS_KEY_EXTEND_BY, spanExtendBy); MPS_ARGS_ADD(piArgs, MPS_KEY_MFS_UNIT_SIZE, sizeof(MVSpanStruct)); - MPS_ARGS_DONE(piArgs); res = PoolInit(&mv->spanPoolStruct.poolStruct, arena, PoolClassMFS(), piArgs); } MPS_ARGS_END(piArgs); if(res != ResOK) diff --git a/mps/code/poolncv.c b/mps/code/poolncv.c index 3df734a3df8..deee10715da 100644 --- a/mps/code/poolncv.c +++ b/mps/code/poolncv.c @@ -36,7 +36,6 @@ int main(int argc, char *argv[]) testlib_unused(argc); MPS_ARGS_BEGIN(args) { MPS_ARGS_ADD(args, MPS_KEY_ARENA_SIZE, 600000); - MPS_ARGS_DONE(args); testit((ArenaClass)mps_arena_class_vm(), args); } MPS_ARGS_END(args); printf("%s: Conclusion: Failed to find any defects.\n", argv[0]); diff --git a/mps/code/segsmss.c b/mps/code/segsmss.c index a1d53669494..2e071e6dc0f 100644 --- a/mps/code/segsmss.c +++ b/mps/code/segsmss.c @@ -767,7 +767,6 @@ static void *test(void *arg, size_t s) MPS_ARGS_BEGIN(args) { MPS_ARGS_ADD(args, MPS_KEY_FORMAT, format); - MPS_ARGS_DONE(args); die(mps_pool_create_k(&pool, arena, mps_class_amst(), args), "pool_create(amst)"); } MPS_ARGS_END(args); diff --git a/mps/example/scheme/scheme-advanced.c b/mps/example/scheme/scheme-advanced.c index 837556b333b..22009cf2323 100644 --- a/mps/example/scheme/scheme-advanced.c +++ b/mps/example/scheme/scheme-advanced.c @@ -4458,7 +4458,6 @@ int main(int argc, char *argv[]) It holds all the MPS "global" state and is where everything happens. */ MPS_ARGS_BEGIN(args) { MPS_ARGS_ADD(args, MPS_KEY_ARENA_SIZE, 32 * 1024 * 1024); - MPS_ARGS_DONE(args); res = mps_arena_create_k(&arena, mps_arena_class_vm(), args); } MPS_ARGS_END(args); if (res != MPS_RES_OK) error("Couldn't create arena"); @@ -4473,7 +4472,6 @@ int main(int argc, char *argv[]) MPS_ARGS_ADD(args, MPS_KEY_FMT_FWD, obj_fwd); MPS_ARGS_ADD(args, MPS_KEY_FMT_ISFWD, obj_isfwd); MPS_ARGS_ADD(args, MPS_KEY_FMT_PAD, obj_pad); - MPS_ARGS_DONE(args); res = mps_fmt_create_k(&obj_fmt, arena, args); } MPS_ARGS_END(args); if (res != MPS_RES_OK) error("Couldn't create obj format"); @@ -4490,7 +4488,6 @@ int main(int argc, char *argv[]) MPS_ARGS_BEGIN(args) { MPS_ARGS_ADD(args, MPS_KEY_CHAIN, obj_chain); MPS_ARGS_ADD(args, MPS_KEY_FORMAT, obj_fmt); - MPS_ARGS_DONE(args); res = mps_pool_create_k(&obj_pool, arena, mps_class_amc(), args); } MPS_ARGS_END(args); if (res != MPS_RES_OK) error("Couldn't create obj pool"); @@ -4507,7 +4504,6 @@ int main(int argc, char *argv[]) MPS_ARGS_BEGIN(args) { MPS_ARGS_ADD(args, MPS_KEY_CHAIN, obj_chain); MPS_ARGS_ADD(args, MPS_KEY_FORMAT, obj_fmt); - MPS_ARGS_DONE(args); res = mps_pool_create_k(&leaf_pool, arena, mps_class_amcz(), args); } MPS_ARGS_END(args); if (res != MPS_RES_OK) error("Couldn't create leaf pool"); @@ -4521,7 +4517,6 @@ int main(int argc, char *argv[]) MPS_ARGS_ADD(args, MPS_KEY_FMT_ALIGN, ALIGNMENT); MPS_ARGS_ADD(args, MPS_KEY_FMT_SCAN, buckets_scan); MPS_ARGS_ADD(args, MPS_KEY_FMT_SKIP, buckets_skip); - MPS_ARGS_DONE(args); res = mps_fmt_create_k(&buckets_fmt, arena, args); } MPS_ARGS_END(args); if (res != MPS_RES_OK) error("Couldn't create buckets format"); @@ -4531,7 +4526,6 @@ int main(int argc, char *argv[]) MPS_ARGS_BEGIN(args) { MPS_ARGS_ADD(args, MPS_KEY_FORMAT, buckets_fmt); MPS_ARGS_ADD(args, MPS_KEY_AWL_FIND_DEPENDENT, buckets_find_dependent); - MPS_ARGS_DONE(args); res = mps_pool_create_k(&buckets_pool, arena, mps_class_awl(), args); } MPS_ARGS_END(args); if (res != MPS_RES_OK) error("Couldn't create buckets pool"); @@ -4539,13 +4533,11 @@ int main(int argc, char *argv[]) /* Create allocation points for weak and strong buckets. */ MPS_ARGS_BEGIN(args) { MPS_ARGS_ADD(args, MPS_KEY_RANK, mps_rank_exact()); - MPS_ARGS_DONE(args); res = mps_ap_create_k(&strong_buckets_ap, buckets_pool, args); } MPS_ARGS_END(args); if (res != MPS_RES_OK) error("Couldn't create strong buckets allocation point"); MPS_ARGS_BEGIN(args) { MPS_ARGS_ADD(args, MPS_KEY_RANK, mps_rank_weak()); - MPS_ARGS_DONE(args); res = mps_ap_create_k(&weak_buckets_ap, buckets_pool, args); } MPS_ARGS_END(args); if (res != MPS_RES_OK) error("Couldn't create weak buckets allocation point"); diff --git a/mps/example/scheme/scheme.c b/mps/example/scheme/scheme.c index 4b825581bc1..4b2b36797c5 100644 --- a/mps/example/scheme/scheme.c +++ b/mps/example/scheme/scheme.c @@ -4392,7 +4392,6 @@ int main(int argc, char *argv[]) It holds all the MPS "global" state and is where everything happens. */ MPS_ARGS_BEGIN(args) { MPS_ARGS_ADD(args, MPS_KEY_ARENA_SIZE, 32 * 1024 * 1024); - MPS_ARGS_DONE(args); res = mps_arena_create_k(&arena, mps_arena_class_vm(), args); } MPS_ARGS_END(args); if (res != MPS_RES_OK) error("Couldn't create arena"); @@ -4407,7 +4406,6 @@ int main(int argc, char *argv[]) MPS_ARGS_ADD(args, MPS_KEY_FMT_FWD, obj_fwd); MPS_ARGS_ADD(args, MPS_KEY_FMT_ISFWD, obj_isfwd); MPS_ARGS_ADD(args, MPS_KEY_FMT_PAD, obj_pad); - MPS_ARGS_DONE(args); res = mps_fmt_create_k(&obj_fmt, arena, args); } MPS_ARGS_END(args); if (res != MPS_RES_OK) error("Couldn't create obj format"); @@ -4424,7 +4422,6 @@ int main(int argc, char *argv[]) MPS_ARGS_BEGIN(args) { MPS_ARGS_ADD(args, MPS_KEY_CHAIN, obj_chain); MPS_ARGS_ADD(args, MPS_KEY_FORMAT, obj_fmt); - MPS_ARGS_DONE(args); res = mps_pool_create_k(&obj_pool, arena, mps_class_amc(), args); } MPS_ARGS_END(args); if (res != MPS_RES_OK) error("Couldn't create obj pool"); diff --git a/mps/manual/source/guide/advanced.rst b/mps/manual/source/guide/advanced.rst index 13635cca796..69a9934823b 100644 --- a/mps/manual/source/guide/advanced.rst +++ b/mps/manual/source/guide/advanced.rst @@ -691,7 +691,6 @@ points:: MPS_ARGS_BEGIN(args) { MPS_ARGS_ADD(args, MPS_KEY_FORMAT, buckets_fmt); MPS_ARGS_ADD(args, MPS_KEY_AWL_FIND_DEPENDENT, buckets_find_dependent); - MPS_ARGS_DONE(args); res = mps_pool_create_k(&buckets_pool, arena, mps_class_awl(), args); } MPS_ARGS_END(args); if (res != MPS_RES_OK) error("Couldn't create buckets pool"); @@ -699,13 +698,11 @@ points:: /* Create allocation points for weak and strong buckets. */ MPS_ARGS_BEGIN(args) { MPS_ARGS_ADD(args, MPS_KEY_RANK, mps_rank_exact()); - MPS_ARGS_DONE(args); res = mps_ap_create_k(&strong_buckets_ap, buckets_pool, args); } MPS_ARGS_END(args); if (res != MPS_RES_OK) error("Couldn't create strong buckets allocation point"); MPS_ARGS_BEGIN(args) { MPS_ARGS_ADD(args, MPS_KEY_RANK, mps_rank_weak()); - MPS_ARGS_DONE(args); res = mps_ap_create_k(&weak_buckets_ap, buckets_pool, args); } MPS_ARGS_END(args); if (res != MPS_RES_OK) error("Couldn't create weak buckets allocation point"); @@ -880,7 +877,6 @@ Second, the leaf objects must be allocated on ``leaf_ap`` instead of MPS_ARGS_BEGIN(args) { MPS_ARGS_ADD(args, MPS_KEY_CHAIN, obj_chain); MPS_ARGS_ADD(args, MPS_KEY_FORMAT, obj_fmt); - MPS_ARGS_DONE(args); res = mps_pool_create_k(&leaf_pool, arena, mps_class_amcz(), args); } MPS_ARGS_END(args); if (res != MPS_RES_OK) error("Couldn't create leaf pool"); diff --git a/mps/manual/source/guide/lang.rst b/mps/manual/source/guide/lang.rst index aa18ac80174..3b71f61ff20 100644 --- a/mps/manual/source/guide/lang.rst +++ b/mps/manual/source/guide/lang.rst @@ -177,7 +177,6 @@ Let's reserve 32 megabytes:: mps_res_t res; MPS_ARGS_BEGIN(args) { MPS_ARGS_ADD(args, MPS_KEY_ARENA_SIZE, 32 * 1024 * 1024); - MPS_ARGS_DONE(args); res = mps_arena_create_k(&arena, mps_arena_class_vm(), args); } MPS_ARGS_END(args); if (res != MPS_RES_OK) error("Couldn't create arena"); @@ -263,7 +262,6 @@ code for creating the object format for the toy Scheme interpreter:: MPS_ARGS_ADD(args, MPS_KEY_FMT_FWD, obj_fwd); MPS_ARGS_ADD(args, MPS_KEY_FMT_ISFWD, obj_isfwd); MPS_ARGS_ADD(args, MPS_KEY_FMT_PAD, obj_pad); - MPS_ARGS_DONE(args); res = mps_fmt_create_k(&obj_fmt, arena, args); } MPS_ARGS_END(args); if (res != MPS_RES_OK) error("Couldn't create obj format"); @@ -694,7 +692,6 @@ Second, the :term:`object format`:: MPS_ARGS_ADD(args, MPS_KEY_FMT_FWD, obj_fwd); MPS_ARGS_ADD(args, MPS_KEY_FMT_ISFWD, obj_isfwd); MPS_ARGS_ADD(args, MPS_KEY_FMT_PAD, obj_pad); - MPS_ARGS_DONE(args); res = mps_fmt_create_k(&obj_fmt, arena, args); } MPS_ARGS_END(args); if (res != MPS_RES_OK) error("Couldn't create obj format"); @@ -704,7 +701,6 @@ And finally the :term:`pool`:: mps_pool_t obj_pool; MPS_ARGS_BEGIN(args) { MPS_ARGS_ADD(args, MPS_KEY_FORMAT, obj_fmt); - MPS_ARGS_DONE(args); res = mps_pool_create_k(&obj_pool, arena, mps_class_amc(), args); } MPS_ARGS_END(args); if (res != MPS_RES_OK) error("Couldn't create obj pool"); diff --git a/mps/manual/source/pool/amc.rst b/mps/manual/source/pool/amc.rst index beef282c141..37d03f263eb 100644 --- a/mps/manual/source/pool/amc.rst +++ b/mps/manual/source/pool/amc.rst @@ -123,7 +123,6 @@ AMC interface MPS_ARGS_BEGIN(args) { MPS_ARGS_ADD(args, MPS_KEY_FORMAT, fmt); - MPS_ARGS_DONE(args); res = mps_pool_create_k(&pool, arena, mps_class_amc(), args); } MPS_ARGS_END(args); diff --git a/mps/manual/source/pool/amcz.rst b/mps/manual/source/pool/amcz.rst index 8f72af9050a..70d38ffa6ab 100644 --- a/mps/manual/source/pool/amcz.rst +++ b/mps/manual/source/pool/amcz.rst @@ -78,7 +78,6 @@ AMCZ interface MPS_ARGS_BEGIN(args) { MPS_ARGS_ADD(args, MPS_KEY_FORMAT, fmt); - MPS_ARGS_DONE(args); res = mps_pool_create_k(&pool, arena, mps_class_amcz(), args); } MPS_ARGS_END(args); diff --git a/mps/manual/source/pool/ams.rst b/mps/manual/source/pool/ams.rst index 922d9d8e366..7bcc47c928a 100644 --- a/mps/manual/source/pool/ams.rst +++ b/mps/manual/source/pool/ams.rst @@ -138,7 +138,6 @@ AMS interface MPS_ARGS_BEGIN(args) { MPS_ARGS_ADD(args, MPS_KEY_FORMAT, fmt); MPS_ARGS_ADD(args, MPS_KEY_AMS_SUPPORT_AMBIGUOUS, 1); - MPS_ARGS_DONE(args); res = mps_pool_create_k(&pool, arena, mps_class_ams(), args); } MPS_ARGS_END(args); @@ -168,7 +167,6 @@ AMS interface MPS_ARGS_BEGIN(args) { MPS_ARGS_ADD(args, MPS_KEY_RANK, mps_rank_ambig()); - MPS_ARGS_DONE(args); res = mps_ap_create_k(&ap, ams_pool, args); } MPS_ARGS_END(args); diff --git a/mps/manual/source/pool/awl.rst b/mps/manual/source/pool/awl.rst index b187965bb0c..4128339227a 100644 --- a/mps/manual/source/pool/awl.rst +++ b/mps/manual/source/pool/awl.rst @@ -346,7 +346,6 @@ AWL interface MPS_ARGS_BEGIN(args) { MPS_ARGS_ADD(args, MPS_KEY_FORMAT, fmt); MPS_ARGS_ADD(args, MPS_KEY_AWL_FIND_DEPENDENT, find_dependent); - MPS_ARGS_DONE(args); res = mps_pool_create_k(&pool, arena, mps_class_awl(), args); } MPS_ARGS_END(args); @@ -375,7 +374,6 @@ AWL interface MPS_ARGS_BEGIN(args) { MPS_ARGS_ADD(args, MPS_KEY_RANK, mps_rank_weak()); - MPS_ARGS_DONE(args); res = mps_ap_create_k(&ap, awl_pool, args); } MPS_ARGS_END(args); diff --git a/mps/manual/source/pool/lo.rst b/mps/manual/source/pool/lo.rst index 5814e36e0a7..e1723a42e0d 100644 --- a/mps/manual/source/pool/lo.rst +++ b/mps/manual/source/pool/lo.rst @@ -134,7 +134,6 @@ LO interface MPS_ARGS_BEGIN(args) { MPS_ARGS_ADD(args, MPS_KEY_FORMAT, fmt); - MPS_ARGS_DONE(args); res = mps_pool_create_k(&pool, arena, mps_class_lo(), args); } MPS_ARGS_END(args); diff --git a/mps/manual/source/pool/mfs.rst b/mps/manual/source/pool/mfs.rst index d4b3155f650..cfaad56e6ab 100644 --- a/mps/manual/source/pool/mfs.rst +++ b/mps/manual/source/pool/mfs.rst @@ -101,7 +101,6 @@ MFS interface MPS_ARGS_BEGIN(args) { MPS_ARGS_ADD(args, MPS_KEY_MFS_UNIT_SIZE, 1024); MPS_ARGS_ADD(args, MPS_KEY_EXTEND_BY, 1024 * 1024); - MPS_ARGS_DONE(args); res = mps_pool_create_k(&pool, arena, mps_class_mfs(), args); } MPS_ARGS_END(args); diff --git a/mps/manual/source/pool/mv.rst b/mps/manual/source/pool/mv.rst index b49fc34e1f9..19d8363a253 100644 --- a/mps/manual/source/pool/mv.rst +++ b/mps/manual/source/pool/mv.rst @@ -96,7 +96,6 @@ MV interface MPS_ARGS_ADD(args, MPS_KEY_MEAN_SIZE, 32); MPS_ARGS_ADD(args, MPS_KEY_MAX_SIZE, 1024); MPS_ARGS_ADD(args, MPS_KEY_EXTEND_BY, 1024 * 1024); - MPS_ARGS_DONE(args); res = mps_pool_create_k(&pool, arena, mps_class_mfs(), args); } MPS_ARGS_END(args); diff --git a/mps/manual/source/pool/mvff.rst b/mps/manual/source/pool/mvff.rst index 0b184615909..4379c912acf 100644 --- a/mps/manual/source/pool/mvff.rst +++ b/mps/manual/source/pool/mvff.rst @@ -170,7 +170,6 @@ MVFF interface MPS_ARGS_ADD(args, MPS_KEY_MVFF_ARENA_HIGH, 1); MPS_ARGS_ADD(args, MPS_KEY_MVFF_SLOT_HIGH, 1); MPS_ARGS_ADD(args, MPS_KEY_MVFF_FIRST_FIT, 0); - MPS_ARGS_DONE(args); res = mps_pool_create_k(&pool, arena, mps_class_mvff(), args); } MPS_ARGS_END(args); diff --git a/mps/manual/source/pool/mvt.rst b/mps/manual/source/pool/mvt.rst index 79501c81465..f3bbba705a0 100644 --- a/mps/manual/source/pool/mvt.rst +++ b/mps/manual/source/pool/mvt.rst @@ -191,7 +191,6 @@ MVT interface MPS_ARGS_ADD(args, MPS_KEY_MAX_SIZE, 1024); MPS_ARGS_ADD(args, MPS_KEY_MVT_RESERVE_DEPTH, 256); MPS_ARGS_ADD(args, MPS_KEY_MVT_FRAG_LIMIT, 0.5); - MPS_ARGS_DONE(args); res = mps_pool_create_k(&pool, arena, mps_class_mvt(), args); } MPS_ARGS_END(args); diff --git a/mps/manual/source/pool/snc.rst b/mps/manual/source/pool/snc.rst index 25cdae8b739..2146a417552 100644 --- a/mps/manual/source/pool/snc.rst +++ b/mps/manual/source/pool/snc.rst @@ -108,7 +108,6 @@ SNC introspection MPS_ARGS_BEGIN(args) { MPS_ARGS_ADD(args, MPS_KEY_FORMAT, fmt); - MPS_ARGS_DONE(args); res = mps_pool_create_k(&pool, arena, mps_class_snc(), args); } MPS_ARGS_END(args); @@ -132,7 +131,6 @@ SNC introspection MPS_ARGS_BEGIN(args) { MPS_ARGS_ADD(args, MPS_KEY_RANK, mps_rank_exact()); - MPS_ARGS_DONE(args); res = mps_ap_create_k(&ap, awl_pool, args); } MPS_ARGS_END(args); diff --git a/mps/manual/source/topic/arena.rst b/mps/manual/source/topic/arena.rst index a8de113f6ed..5220ece4007 100644 --- a/mps/manual/source/topic/arena.rst +++ b/mps/manual/source/topic/arena.rst @@ -170,7 +170,6 @@ Client arenas MPS_ARGS_BEGIN(args) { MPS_ARGS_ADD(args, MPS_KEY_ARENA_CL_BASE, base); MPS_ARGS_ADD(args, MPS_KEY_ARENA_SIZE, size); - MPS_ARGS_DONE(args); res = mps_arena_create_k(&arena, mps_arena_class_cl(), args); } MPS_ARGS_END(args); @@ -281,7 +280,6 @@ Virtual memory arenas MPS_ARGS_BEGIN(args) { MPS_ARGS_ADD(args, MPS_KEY_ARENA_SIZE, size); - MPS_ARGS_DONE(args); res = mps_arena_create_k(&arena, mps_arena_class_cl(), args); } MPS_ARGS_END(args); diff --git a/mps/manual/source/topic/debugging.rst b/mps/manual/source/topic/debugging.rst index 980e982da60..70494aa20cf 100644 --- a/mps/manual/source/topic/debugging.rst +++ b/mps/manual/source/topic/debugging.rst @@ -74,7 +74,6 @@ For example:: MPS_ARGS_BEGIN(args) { MPS_ARGS_ADD(args, MPS_KEY_POOL_DEBUG_OPTIONS, &debug_options); MPS_ARGS_ADD(args, MPS_KEY_FORMAT, &fmt); - MPS_ARGS_DONE(args); res = mps_pool_create_k(&pool, arena, mps_class_ams_debug(), args); } MPS_ARGS_END(args); if (res != MPS_RES_OK) error("can't create debug pool"); diff --git a/mps/manual/source/topic/format.rst b/mps/manual/source/topic/format.rst index 7c24f70d011..91ac7ae6462 100644 --- a/mps/manual/source/topic/format.rst +++ b/mps/manual/source/topic/format.rst @@ -118,7 +118,6 @@ Interface MPS_ARGS_ADD(args, MPS_KEY_FMT_FWD, obj_fwd); MPS_ARGS_ADD(args, MPS_KEY_FMT_ISFWD, obj_isfwd); MPS_ARGS_ADD(args, MPS_KEY_FMT_PAD, obj_pad); - MPS_ARGS_DONE(args); res = mps_fmt_create_k(&obj_fmt, arena, args); } MPS_ARGS_END(args); if (res != MPS_RES_OK) error("Couldn't create obj format"); diff --git a/mps/manual/source/topic/keyword.rst b/mps/manual/source/topic/keyword.rst index dac5cce2626..5f804a63847 100644 --- a/mps/manual/source/topic/keyword.rst +++ b/mps/manual/source/topic/keyword.rst @@ -32,7 +32,6 @@ help with forming keyword argument lists:: MPS_ARGS_BEGIN(args) { MPS_ARGS_ADD(args, MPS_KEY_ARENA_SIZE, 6553600); MPS_ARGS_ADD(args, MPS_KEY_ARENA_CL_BASE, base_address); - MPS_ARGS_DONE(args); res = mps_arena_create_k(&arena, mps_arena_class_cl(), args); } MPS_ARGS_END(args); @@ -128,14 +127,12 @@ now :c:macro:`MPS_KEY_ARGS_END`. MPS_ARGS_BEGIN(args) { MPS_ARGS_ADD(args, MPS_KEY_ARENA_SIZE, 6553600); MPS_ARGS_ADD(args, MPS_KEY_ARENA_CL_BASE, base_address); - MPS_ARGS_DONE(args); res = mps_arena_create_k(&arena, mps_arena_class_cl(), args); } MPS_ARGS_END(args); That is, you must call :c:func:`MPS_ARGS_ADD` (or - :c:func:`MPS_ARGS_ADD_FIELD`) zero or more times, and then call - :c:func:`MPS_ARGS_DONE` before passing the arguments to a - function. + :c:func:`MPS_ARGS_ADD_FIELD`) zero or more times, and then pass + the arguments to a function. ``args`` is the name of the array that contains the keyword arguments. The array is stack-allocated, and exists between @@ -185,19 +182,6 @@ now :c:macro:`MPS_KEY_ARGS_END`. you don't need to look up the name of the field. -.. c:function:: MPS_ARGS_DONE(args) - - Finalize a list of keyword arguments. This macro must be used only - between :c:macro:`MPS_ARGS_BEGIN` and :c:macro:`MPS_ARGS_END`. - - ``args`` is the name of array that contains the keyword arguments. - It must match the argument to the preceding call to - :c:func:`MPS_ARGS_BEGIN`. - - After calling this macro, the array ``args`` is ready to pass to a - function. - - .. c:function:: MPS_ARGS_END(args) Finish using a list of keyword arguments whose construction was @@ -206,3 +190,11 @@ now :c:macro:`MPS_KEY_ARGS_END`. ``args`` is the name of array that contains the keyword arguments. It must match the argument to the preceding call to :c:func:`MPS_ARGS_BEGIN`. + + +.. c:function:: MPS_ARGS_DONE(args) + + .. deprecated:: starting with version 1.113. + + Formerly this was used to finalize a list of keyword arguments + before passing it to a function. It is no longer needed. From 00898bf2e9716e7e6cb27d0e0fca46845f8f5d0d Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Wed, 26 Feb 2014 12:51:30 +0000 Subject: [PATCH 3/3] Fix the aver: need two slots in the array, not just one. Copied from Perforce Change: 184545 ServerID: perforce.ravenbrook.com --- mps/code/mps.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mps/code/mps.h b/mps/code/mps.h index 156e0fae7b7..a767da3b29d 100644 --- a/mps/code/mps.h +++ b/mps/code/mps.h @@ -229,7 +229,7 @@ extern const struct mps_key_s _mps_key_fmt_class; #define MPS_ARGS_ADD_FIELD(_var, _key, _field, _val) \ MPS_BEGIN \ - /* TODO: AVER(_var##_i < MPS_ARGS_MAX); */ \ + /* TODO: AVER(_var##_i + 1 < MPS_ARGS_MAX); */ \ _var[_var##_i].key = (_key); \ _var[_var##_i].val._field = (_val); \ ++_var##_i; \