diff options
| author | Richard Brooksby | 2013-05-08 22:43:51 +0100 |
|---|---|---|
| committer | Richard Brooksby | 2013-05-08 22:43:51 +0100 |
| commit | 71b7e4f70a710acc666bbdf55502c1ef66c76a09 (patch) | |
| tree | 3111a146c2266cbfafa0688843b2c08d4281ad7c /mps/code | |
| parent | d396431c252b0f6330c1c31995adddfcd0bad7ae (diff) | |
| download | emacs-71b7e4f70a710acc666bbdf55502c1ef66c76a09.tar.gz emacs-71b7e4f70a710acc666bbdf55502c1ef66c76a09.zip | |
Pushing varargs decoding into a pool class method. much simpler.
Copied from Perforce
Change: 181642
ServerID: perforce.ravenbrook.com
Diffstat (limited to 'mps/code')
| -rw-r--r-- | mps/code/config.h | 10 | ||||
| -rw-r--r-- | mps/code/mpm.h | 1 | ||||
| -rw-r--r-- | mps/code/mpmst.h | 1 | ||||
| -rw-r--r-- | mps/code/mpmtypes.h | 1 | ||||
| -rw-r--r-- | mps/code/mps.h | 1 | ||||
| -rw-r--r-- | mps/code/mps.xcodeproj/project.pbxproj | 2 | ||||
| -rw-r--r-- | mps/code/mpscmvt.h | 11 | ||||
| -rw-r--r-- | mps/code/mpsi.c | 92 | ||||
| -rw-r--r-- | mps/code/pool.c | 1 | ||||
| -rw-r--r-- | mps/code/poolabs.c | 8 | ||||
| -rw-r--r-- | mps/code/poolamc.c | 14 | ||||
| -rw-r--r-- | mps/code/poolams.c | 24 | ||||
| -rw-r--r-- | mps/code/poolawl.c | 14 | ||||
| -rw-r--r-- | mps/code/poollo.c | 12 | ||||
| -rw-r--r-- | mps/code/poolmfs.c | 14 | ||||
| -rw-r--r-- | mps/code/poolmv.c | 24 | ||||
| -rw-r--r-- | mps/code/poolmv2.c | 67 | ||||
| -rw-r--r-- | mps/code/poolmvff.c | 42 |
18 files changed, 228 insertions, 111 deletions
diff --git a/mps/code/config.h b/mps/code/config.h index 3165ef193cd..03d265c4dba 100644 --- a/mps/code/config.h +++ b/mps/code/config.h | |||
| @@ -259,6 +259,16 @@ | |||
| 259 | #define MVFF_FIRST_FIT_DEFAULT TRUE | 259 | #define MVFF_FIRST_FIT_DEFAULT TRUE |
| 260 | 260 | ||
| 261 | 261 | ||
| 262 | /* Pool MVT Configuration -- see <code.poolmv2.c> */ | ||
| 263 | /* FIXME: These numbers were lifted from mv2test and need thought. */ | ||
| 264 | |||
| 265 | #define MVT_MIN_SIZE_DEFAULT MPS_PF_ALIGN | ||
| 266 | #define MVT_MEAN_SIZE_DEFAULT 32 | ||
| 267 | #define MVT_MAX_SIZE_DEFAULT 8192 | ||
| 268 | #define MVT_RESERVE_DEPTH_DEFAULT 1024 | ||
| 269 | #define MVT_FRAG_LIMIT_DEFAULT 30 | ||
| 270 | |||
| 271 | |||
| 262 | /* Arena Configuration -- see <code/arena.c> | 272 | /* Arena Configuration -- see <code/arena.c> |
| 263 | * | 273 | * |
| 264 | * .client.seg-size: ARENA_CLIENT_PAGE_SIZE is the size in bytes of a | 274 | * .client.seg-size: ARENA_CLIENT_PAGE_SIZE is the size in bytes of a |
diff --git a/mps/code/mpm.h b/mps/code/mpm.h index cb9a6f49fa2..5346078c214 100644 --- a/mps/code/mpm.h +++ b/mps/code/mpm.h | |||
| @@ -230,6 +230,7 @@ extern void PoolTraceEnd(Pool pool, Trace trace); | |||
| 230 | extern void PoolWalk(Pool pool, Seg seg, FormattedObjectsStepMethod f, | 230 | extern void PoolWalk(Pool pool, Seg seg, FormattedObjectsStepMethod f, |
| 231 | void *v, size_t s); | 231 | void *v, size_t s); |
| 232 | extern void PoolFreeWalk(Pool pool, FreeBlockStepMethod f, void *p); | 232 | extern void PoolFreeWalk(Pool pool, FreeBlockStepMethod f, void *p); |
| 233 | extern void PoolTrivVarargs(ArgStruct args[], va_list varargs); | ||
| 233 | extern Res PoolTrivInit(Pool pool, ArgList arg); | 234 | extern Res PoolTrivInit(Pool pool, ArgList arg); |
| 234 | extern void PoolTrivFinish(Pool pool); | 235 | extern void PoolTrivFinish(Pool pool); |
| 235 | extern Res PoolNoAlloc(Addr *pReturn, Pool pool, Size size, | 236 | extern Res PoolNoAlloc(Addr *pReturn, Pool pool, Size size, |
diff --git a/mps/code/mpmst.h b/mps/code/mpmst.h index 5c5ca542074..93eda47809d 100644 --- a/mps/code/mpmst.h +++ b/mps/code/mpmst.h | |||
| @@ -52,6 +52,7 @@ typedef struct mps_class_s { | |||
| 52 | size_t size; /* size of outer structure */ | 52 | size_t size; /* size of outer structure */ |
| 53 | size_t offset; /* offset of generic struct in outer struct */ | 53 | size_t offset; /* offset of generic struct in outer struct */ |
| 54 | Attr attr; /* attributes */ | 54 | Attr attr; /* attributes */ |
| 55 | PoolVarargsMethod varargs; /* convert deprecated varargs into keywords */ | ||
| 55 | PoolInitMethod init; /* initialize the pool descriptor */ | 56 | PoolInitMethod init; /* initialize the pool descriptor */ |
| 56 | PoolFinishMethod finish; /* finish the pool descriptor */ | 57 | PoolFinishMethod finish; /* finish the pool descriptor */ |
| 57 | PoolAllocMethod alloc; /* allocate memory from pool */ | 58 | PoolAllocMethod alloc; /* allocate memory from pool */ |
diff --git a/mps/code/mpmtypes.h b/mps/code/mpmtypes.h index cadb8f2bff1..587dd3dbb76 100644 --- a/mps/code/mpmtypes.h +++ b/mps/code/mpmtypes.h | |||
| @@ -182,6 +182,7 @@ typedef Res (*BufferDescribeMethod)(Buffer buffer, mps_lib_FILE *stream); | |||
| 182 | 182 | ||
| 183 | /* Order of types corresponds to PoolClassStruct in <code/mpmst.h> */ | 183 | /* Order of types corresponds to PoolClassStruct in <code/mpmst.h> */ |
| 184 | 184 | ||
| 185 | typedef void (*PoolVarargsMethod)(ArgStruct args[], va_list varargs); | ||
| 185 | typedef Res (*PoolInitMethod)(Pool pool, ArgList args); | 186 | typedef Res (*PoolInitMethod)(Pool pool, ArgList args); |
| 186 | typedef void (*PoolFinishMethod)(Pool pool); | 187 | typedef void (*PoolFinishMethod)(Pool pool); |
| 187 | typedef Res (*PoolAllocMethod)(Addr *pReturn, Pool pool, Size size, | 188 | typedef Res (*PoolAllocMethod)(Addr *pReturn, Pool pool, Size size, |
diff --git a/mps/code/mps.h b/mps/code/mps.h index 3fb066e1752..f713d8d9229 100644 --- a/mps/code/mps.h +++ b/mps/code/mps.h | |||
| @@ -111,6 +111,7 @@ typedef struct mps_arg_s { | |||
| 111 | struct mps_pool_debug_option_s *pool_debug_option; | 111 | struct mps_pool_debug_option_s *pool_debug_option; |
| 112 | mps_addr_t (*addr_method)(mps_addr_t); | 112 | mps_addr_t (*addr_method)(mps_addr_t); |
| 113 | mps_align_t align; | 113 | mps_align_t align; |
| 114 | mps_word_t count; | ||
| 114 | } val; | 115 | } val; |
| 115 | } mps_arg_s; | 116 | } mps_arg_s; |
| 116 | 117 | ||
diff --git a/mps/code/mps.xcodeproj/project.pbxproj b/mps/code/mps.xcodeproj/project.pbxproj index 20510f2cf75..8a47451f8a7 100644 --- a/mps/code/mps.xcodeproj/project.pbxproj +++ b/mps/code/mps.xcodeproj/project.pbxproj | |||
| @@ -1101,6 +1101,7 @@ | |||
| 1101 | 31CD33BB173A9F1500524741 /* mpscams.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = mpscams.h; sourceTree = "<group>"; }; | 1101 | 31CD33BB173A9F1500524741 /* mpscams.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = mpscams.h; sourceTree = "<group>"; }; |
| 1102 | 31CD33BC173A9F1500524741 /* poolams.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = poolams.c; sourceTree = "<group>"; }; | 1102 | 31CD33BC173A9F1500524741 /* poolams.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = poolams.c; sourceTree = "<group>"; }; |
| 1103 | 31CD33BD173A9F1500524741 /* poolams.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = poolams.h; sourceTree = "<group>"; }; | 1103 | 31CD33BD173A9F1500524741 /* poolams.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = poolams.h; sourceTree = "<group>"; }; |
| 1104 | 31CD33BE173ABB3000524741 /* poolmv2.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = poolmv2.h; sourceTree = "<group>"; }; | ||
| 1104 | 31D60006156D3C5F00337B26 /* segsmss.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = segsmss.c; sourceTree = "<group>"; }; | 1105 | 31D60006156D3C5F00337B26 /* segsmss.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = segsmss.c; sourceTree = "<group>"; }; |
| 1105 | 31D6000D156D3CB200337B26 /* awluthe */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = awluthe; sourceTree = BUILT_PRODUCTS_DIR; }; | 1106 | 31D6000D156D3CB200337B26 /* awluthe */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = awluthe; sourceTree = BUILT_PRODUCTS_DIR; }; |
| 1106 | 31D60017156D3CC300337B26 /* awluthe.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = awluthe.c; sourceTree = "<group>"; }; | 1107 | 31D60017156D3CC300337B26 /* awluthe.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = awluthe.c; sourceTree = "<group>"; }; |
| @@ -1726,6 +1727,7 @@ | |||
| 1726 | 31EEAC5A156AB40800714D05 /* Extra pools */ = { | 1727 | 31EEAC5A156AB40800714D05 /* Extra pools */ = { |
| 1727 | isa = PBXGroup; | 1728 | isa = PBXGroup; |
| 1728 | children = ( | 1729 | children = ( |
| 1730 | 31CD33BE173ABB3000524741 /* poolmv2.h */, | ||
| 1729 | 311F2F5D17398B0400C15B6A /* lo.h */, | 1731 | 311F2F5D17398B0400C15B6A /* lo.h */, |
| 1730 | 31F6CCA91739B0CF00C48748 /* mpscamc.h */, | 1732 | 31F6CCA91739B0CF00C48748 /* mpscamc.h */, |
| 1731 | 31CD33BB173A9F1500524741 /* mpscams.h */, | 1733 | 31CD33BB173A9F1500524741 /* mpscams.h */, |
diff --git a/mps/code/mpscmvt.h b/mps/code/mpscmvt.h index be273177304..efc52b98e9e 100644 --- a/mps/code/mpscmvt.h +++ b/mps/code/mpscmvt.h | |||
| @@ -9,6 +9,17 @@ | |||
| 9 | 9 | ||
| 10 | #include "mps.h" | 10 | #include "mps.h" |
| 11 | 11 | ||
| 12 | extern const struct mps_key_s _mps_key_mvt_min_size; | ||
| 13 | #define MPS_KEY_MVT_MIN_SIZE (&_mps_key_mvt_min_size) | ||
| 14 | extern const struct mps_key_s _mps_key_mvt_mean_size; | ||
| 15 | #define MPS_KEY_MVT_MEAN_SIZE (&_mps_key_mvt_mean_size) | ||
| 16 | extern const struct mps_key_s _mps_key_mvt_max_size; | ||
| 17 | #define MPS_KEY_MVT_MAX_SIZE (&_mps_key_mvt_max_size) | ||
| 18 | extern const struct mps_key_s _mps_key_mvt_reserve_depth; | ||
| 19 | #define MPS_KEY_MVT_RESERVE_DEPTH (&_mps_key_mvt_reserve_depth) | ||
| 20 | extern const struct mps_key_s _mps_key_mvt_frag_limit; | ||
| 21 | #define MPS_KEY_MVT_FRAG_LIMIT (&_mps_key_mvt_frag_limit) | ||
| 22 | |||
| 12 | /* The mvt pool class has five extra parameters to mps_pool_create: | 23 | /* The mvt pool class has five extra parameters to mps_pool_create: |
| 13 | * mps_res_t mps_pool_create(mps_pool_t * pool, mps_arena_t arena, | 24 | * mps_res_t mps_pool_create(mps_pool_t * pool, mps_arena_t arena, |
| 14 | * mps_class_t mvt_class, | 25 | * mps_class_t mvt_class, |
diff --git a/mps/code/mpsi.c b/mps/code/mpsi.c index 404bb115360..2efa608389d 100644 --- a/mps/code/mpsi.c +++ b/mps/code/mpsi.c | |||
| @@ -55,14 +55,6 @@ | |||
| 55 | /* TODO: Remove these includes when varargs support is removed. */ | 55 | /* TODO: Remove these includes when varargs support is removed. */ |
| 56 | #include "mpsacl.h" | 56 | #include "mpsacl.h" |
| 57 | #include "mpsavm.h" | 57 | #include "mpsavm.h" |
| 58 | #include "mpscamc.h" | ||
| 59 | #include "mpscmfs.h" | ||
| 60 | #include "mpscmv.h" | ||
| 61 | #include "mpscams.h" | ||
| 62 | #include "mpscawl.h" | ||
| 63 | #include "mpsclo.h" | ||
| 64 | #include "mpscsnc.h" | ||
| 65 | #include "mpscmvff.h" | ||
| 66 | 58 | ||
| 67 | #include <stdarg.h> | 59 | #include <stdarg.h> |
| 68 | #include <string.h> | 60 | #include <string.h> |
| @@ -658,95 +650,15 @@ mps_res_t mps_pool_create(mps_pool_t *mps_pool_o, mps_arena_t arena, | |||
| 658 | return mps_pool_create_v(mps_pool_o, arena, mps_class, varargs); | 650 | return mps_pool_create_v(mps_pool_o, arena, mps_class, varargs); |
| 659 | } | 651 | } |
| 660 | 652 | ||
| 661 | /* Decode deprecated varargs. TODO: This can be deleted when varargs go. */ | ||
| 662 | |||
| 663 | static void mps_pool_create_v_decode(mps_arg_s args[], | ||
| 664 | mps_class_t class, | ||
| 665 | va_list varargs) { | ||
| 666 | if (class == mps_class_amc()) { | ||
| 667 | args[0].key = MPS_KEY_FORMAT; | ||
| 668 | args[0].val.format = va_arg(varargs, Format); | ||
| 669 | args[1].key = MPS_KEY_CHAIN; | ||
| 670 | args[1].val.chain = va_arg(varargs, Chain); | ||
| 671 | args[2].key = MPS_KEY_ARGS_END; | ||
| 672 | } else if (class == mps_class_mfs()) { | ||
| 673 | args[0].key = MPS_KEY_MFS_EXTEND_BY; | ||
| 674 | args[0].val.size = va_arg(varargs, Size); | ||
| 675 | args[1].key = MPS_KEY_MFS_UNIT_SIZE; | ||
| 676 | args[1].val.size = va_arg(varargs, Size); | ||
| 677 | args[2].key = MPS_KEY_ARGS_END; | ||
| 678 | } else if (class == mps_class_mv()) { | ||
| 679 | args[0].key = MPS_KEY_MV_EXTEND_BY; | ||
| 680 | args[0].val.size = va_arg(varargs, Size); | ||
| 681 | args[1].key = MPS_KEY_MV_AVG_SIZE; | ||
| 682 | args[1].val.size = va_arg(varargs, Size); | ||
| 683 | args[2].key = MPS_KEY_MV_MAX_SIZE; | ||
| 684 | args[2].val.size = va_arg(varargs, Size); | ||
| 685 | args[3].key = MPS_KEY_ARGS_END; | ||
| 686 | } else if (class == mps_class_ams()) { | ||
| 687 | args[0].key = MPS_KEY_FORMAT; | ||
| 688 | args[0].val.format = va_arg(varargs, Format); | ||
| 689 | args[1].key = MPS_KEY_CHAIN; | ||
| 690 | args[1].val.chain = va_arg(varargs, Chain); | ||
| 691 | args[2].key = MPS_KEY_AMS_SUPPORT_AMBIGUOUS; | ||
| 692 | args[2].val.b = va_arg(varargs, Bool); | ||
| 693 | args[3].key = MPS_KEY_ARGS_END; | ||
| 694 | } else if (class == mps_class_awl()) { | ||
| 695 | args[0].key = MPS_KEY_FORMAT; | ||
| 696 | args[0].val.format = va_arg(varargs, Format); | ||
| 697 | args[1].key = MPS_KEY_AWL_FIND_DEPENDENT; | ||
| 698 | args[1].val.addr_method = va_arg(varargs, mps_awl_find_dependent_t); | ||
| 699 | args[2].key = MPS_KEY_ARGS_END; | ||
| 700 | } else if (class == mps_class_lo() || class == mps_class_snc()) { | ||
| 701 | args[0].key = MPS_KEY_FORMAT; | ||
| 702 | args[0].val.format = va_arg(varargs, Format); | ||
| 703 | args[1].key = MPS_KEY_ARGS_END; | ||
| 704 | } else if (class == mps_class_mvff()) { | ||
| 705 | args[0].key = MPS_KEY_MVFF_EXTEND_BY; | ||
| 706 | args[0].val.size = va_arg(varargs, Size); | ||
| 707 | args[1].key = MPS_KEY_MVFF_AVG_SIZE; | ||
| 708 | args[1].val.size = va_arg(varargs, Size); | ||
| 709 | args[2].key = MPS_KEY_MVFF_ALIGN; | ||
| 710 | args[2].val.align = va_arg(varargs, Size); /* promoted type */ | ||
| 711 | args[3].key = MPS_KEY_MVFF_SLOT_HIGH; | ||
| 712 | args[3].val.b = va_arg(varargs, Bool); | ||
| 713 | args[4].key = MPS_KEY_MVFF_ARENA_HIGH; | ||
| 714 | args[4].val.b = va_arg(varargs, Bool); | ||
| 715 | args[5].key = MPS_KEY_MVFF_FIRST_FIT; | ||
| 716 | args[5].val.b = va_arg(varargs, Bool); | ||
| 717 | } else { | ||
| 718 | args[0].key = MPS_KEY_ARGS_END; | ||
| 719 | } | ||
| 720 | /* Do not extend this list. Future pools should not take varargs. */ | ||
| 721 | } | ||
| 722 | |||
| 723 | mps_res_t mps_pool_create_v(mps_pool_t *mps_pool_o, mps_arena_t arena, | 653 | mps_res_t mps_pool_create_v(mps_pool_t *mps_pool_o, mps_arena_t arena, |
| 724 | mps_class_t class, va_list varargs) | 654 | mps_class_t class, va_list varargs) |
| 725 | { | 655 | { |
| 726 | mps_arg_s args[16]; | 656 | mps_arg_s args[16]; /* FIXME: Have a maximum in config.h */ |
| 727 | 657 | class->varargs(args, varargs); | |
| 728 | if (class == mps_class_mv_debug()) { | ||
| 729 | args[0].key = MPS_KEY_POOL_DEBUG_OPTION; | ||
| 730 | args[1].val.pool_debug_option = va_arg(varargs, mps_pool_debug_option_s *); | ||
| 731 | mps_pool_create_v_decode(args + 1, mps_class_mv(), varargs); | ||
| 732 | } else if (class == mps_class_ams_debug()) { | ||
| 733 | args[0].key = MPS_KEY_POOL_DEBUG_OPTION; | ||
| 734 | args[1].val.pool_debug_option = va_arg(varargs, mps_pool_debug_option_s *); | ||
| 735 | mps_pool_create_v_decode(args + 1, mps_class_ams(), varargs); | ||
| 736 | } else if (class == mps_class_mvff_debug()) { | ||
| 737 | args[0].key = MPS_KEY_POOL_DEBUG_OPTION; | ||
| 738 | args[1].val.pool_debug_option = va_arg(varargs, mps_pool_debug_option_s *); | ||
| 739 | mps_pool_create_v_decode(args + 1, mps_class_mvff(), varargs); | ||
| 740 | } else | ||
| 741 | mps_pool_create_v_decode(args, class, varargs); | ||
| 742 | /* Do not extend this list. Future pools should not take varargs. */ | ||
| 743 | |||
| 744 | va_end(varargs); | 658 | va_end(varargs); |
| 745 | |||
| 746 | return mps_pool_create_k(mps_pool_o, arena, class, args); | 659 | return mps_pool_create_k(mps_pool_o, arena, class, args); |
| 747 | } | 660 | } |
| 748 | 661 | ||
| 749 | |||
| 750 | mps_res_t mps_pool_create_k(mps_pool_t *mps_pool_o, mps_arena_t arena, | 662 | mps_res_t mps_pool_create_k(mps_pool_t *mps_pool_o, mps_arena_t arena, |
| 751 | mps_class_t class, mps_arg_s args[]) | 663 | mps_class_t class, mps_arg_s args[]) |
| 752 | { | 664 | { |
diff --git a/mps/code/pool.c b/mps/code/pool.c index 283f3244ff4..865bf3ec2bf 100644 --- a/mps/code/pool.c +++ b/mps/code/pool.c | |||
| @@ -47,6 +47,7 @@ Bool PoolClassCheck(PoolClass class) | |||
| 47 | /* greater than the size of the class-specific portion of the instance */ | 47 | /* greater than the size of the class-specific portion of the instance */ |
| 48 | CHECKL(class->offset <= (size_t)(class->size - sizeof(PoolStruct))); | 48 | CHECKL(class->offset <= (size_t)(class->size - sizeof(PoolStruct))); |
| 49 | CHECKL(AttrCheck(class->attr)); | 49 | CHECKL(AttrCheck(class->attr)); |
| 50 | CHECKL(FUNCHECK(class->varargs)); | ||
| 50 | CHECKL(FUNCHECK(class->init)); | 51 | CHECKL(FUNCHECK(class->init)); |
| 51 | CHECKL(FUNCHECK(class->finish)); | 52 | CHECKL(FUNCHECK(class->finish)); |
| 52 | CHECKL(FUNCHECK(class->alloc)); | 53 | CHECKL(FUNCHECK(class->alloc)); |
diff --git a/mps/code/poolabs.c b/mps/code/poolabs.c index 1456ec66143..6fc0e279cb8 100644 --- a/mps/code/poolabs.c +++ b/mps/code/poolabs.c | |||
| @@ -122,6 +122,7 @@ DEFINE_CLASS(AbstractPoolClass, class) | |||
| 122 | class->size = 0; | 122 | class->size = 0; |
| 123 | class->offset = 0; | 123 | class->offset = 0; |
| 124 | class->attr = 0; | 124 | class->attr = 0; |
| 125 | class->varargs = PoolTrivVarargs; | ||
| 125 | class->init = PoolTrivInit; | 126 | class->init = PoolTrivInit; |
| 126 | class->finish = PoolTrivFinish; | 127 | class->finish = PoolTrivFinish; |
| 127 | class->alloc = PoolNoAlloc; | 128 | class->alloc = PoolNoAlloc; |
| @@ -194,6 +195,13 @@ void PoolTrivFinish(Pool pool) | |||
| 194 | NOOP; | 195 | NOOP; |
| 195 | } | 196 | } |
| 196 | 197 | ||
| 198 | void PoolTrivVarargs(ArgStruct args[], va_list varargs) | ||
| 199 | { | ||
| 200 | UNUSED(varargs); | ||
| 201 | args[0].key = MPS_KEY_ARGS_END; | ||
| 202 | AVER(ArgListCheck(args)); | ||
| 203 | } | ||
| 204 | |||
| 197 | Res PoolTrivInit(Pool pool, ArgList args) | 205 | Res PoolTrivInit(Pool pool, ArgList args) |
| 198 | { | 206 | { |
| 199 | AVERT(Pool, pool); | 207 | AVERT(Pool, pool); |
diff --git a/mps/code/poolamc.c b/mps/code/poolamc.c index 10679263343..d15404aad26 100644 --- a/mps/code/poolamc.c +++ b/mps/code/poolamc.c | |||
| @@ -928,6 +928,19 @@ static Bool amcNailRangeIsMarked(Seg seg, Addr base, Addr limit) | |||
| 928 | } | 928 | } |
| 929 | 929 | ||
| 930 | 930 | ||
| 931 | /* amcVarargs -- decode obsolete varargs */ | ||
| 932 | |||
| 933 | static void AMCVarargs(ArgStruct args[], va_list varargs) | ||
| 934 | { | ||
| 935 | args[0].key = MPS_KEY_FORMAT; | ||
| 936 | args[0].val.format = va_arg(varargs, Format); | ||
| 937 | args[1].key = MPS_KEY_CHAIN; | ||
| 938 | args[1].val.chain = va_arg(varargs, Chain); | ||
| 939 | args[2].key = MPS_KEY_ARGS_END; | ||
| 940 | AVER(ArgListCheck(args)); | ||
| 941 | } | ||
| 942 | |||
| 943 | |||
| 931 | /* amcInitComm -- initialize AMC/Z pool | 944 | /* amcInitComm -- initialize AMC/Z pool |
| 932 | * | 945 | * |
| 933 | * See <design/poolamc/#init>. | 946 | * See <design/poolamc/#init>. |
| @@ -2409,6 +2422,7 @@ DEFINE_POOL_CLASS(AMCPoolClass, this) | |||
| 2409 | this->size = sizeof(AMCStruct); | 2422 | this->size = sizeof(AMCStruct); |
| 2410 | this->offset = offsetof(AMCStruct, poolStruct); | 2423 | this->offset = offsetof(AMCStruct, poolStruct); |
| 2411 | this->attr |= AttrMOVINGGC; | 2424 | this->attr |= AttrMOVINGGC; |
| 2425 | this->varargs = AMCVarargs; | ||
| 2412 | this->init = AMCInit; | 2426 | this->init = AMCInit; |
| 2413 | this->finish = AMCFinish; | 2427 | this->finish = AMCFinish; |
| 2414 | this->bufferFill = AMCBufferFill; | 2428 | this->bufferFill = AMCBufferFill; |
diff --git a/mps/code/poolams.c b/mps/code/poolams.c index bc4b4606a3d..757e0a45d17 100644 --- a/mps/code/poolams.c +++ b/mps/code/poolams.c | |||
| @@ -728,6 +728,28 @@ static void AMSSegsDestroy(AMS ams) | |||
| 728 | } | 728 | } |
| 729 | 729 | ||
| 730 | 730 | ||
| 731 | /* AMSVarargs -- decode obsolete varargs */ | ||
| 732 | |||
| 733 | static void AMSVarargs(ArgStruct args[], va_list varargs) | ||
| 734 | { | ||
| 735 | args[0].key = MPS_KEY_FORMAT; | ||
| 736 | args[0].val.format = va_arg(varargs, Format); | ||
| 737 | args[1].key = MPS_KEY_CHAIN; | ||
| 738 | args[1].val.chain = va_arg(varargs, Chain); | ||
| 739 | args[2].key = MPS_KEY_AMS_SUPPORT_AMBIGUOUS; | ||
| 740 | args[2].val.b = va_arg(varargs, Bool); | ||
| 741 | args[3].key = MPS_KEY_ARGS_END; | ||
| 742 | AVER(ArgListCheck(args)); | ||
| 743 | } | ||
| 744 | |||
| 745 | static void AMSDebugVarargs(ArgStruct args[], va_list varargs) | ||
| 746 | { | ||
| 747 | args[0].key = MPS_KEY_POOL_DEBUG_OPTION; | ||
| 748 | args[0].val.pool_debug_option = va_arg(varargs, mps_pool_debug_option_s *); | ||
| 749 | AMSVarargs(args + 1, varargs); | ||
| 750 | } | ||
| 751 | |||
| 752 | |||
| 731 | /* AMSInit -- the pool class initialization method | 753 | /* AMSInit -- the pool class initialization method |
| 732 | * | 754 | * |
| 733 | * Takes one additional argument: the format of the objects | 755 | * Takes one additional argument: the format of the objects |
| @@ -1668,6 +1690,7 @@ DEFINE_CLASS(AMSPoolClass, this) | |||
| 1668 | this->name = "AMS"; | 1690 | this->name = "AMS"; |
| 1669 | this->size = sizeof(AMSStruct); | 1691 | this->size = sizeof(AMSStruct); |
| 1670 | this->offset = offsetof(AMSStruct, poolStruct); | 1692 | this->offset = offsetof(AMSStruct, poolStruct); |
| 1693 | this->varargs = AMSVarargs; | ||
| 1671 | this->init = AMSInit; | 1694 | this->init = AMSInit; |
| 1672 | this->finish = AMSFinish; | 1695 | this->finish = AMSFinish; |
| 1673 | this->bufferClass = RankBufClassGet; | 1696 | this->bufferClass = RankBufClassGet; |
| @@ -1706,6 +1729,7 @@ DEFINE_POOL_CLASS(AMSDebugPoolClass, this) | |||
| 1706 | PoolClassMixInDebug(this); | 1729 | PoolClassMixInDebug(this); |
| 1707 | this->name = "AMSDBG"; | 1730 | this->name = "AMSDBG"; |
| 1708 | this->size = sizeof(AMSDebugStruct); | 1731 | this->size = sizeof(AMSDebugStruct); |
| 1732 | this->varargs = AMSDebugVarargs; | ||
| 1709 | this->debugMixin = AMSDebugMixin; | 1733 | this->debugMixin = AMSDebugMixin; |
| 1710 | } | 1734 | } |
| 1711 | 1735 | ||
diff --git a/mps/code/poolawl.c b/mps/code/poolawl.c index 382105455ab..5321e164953 100644 --- a/mps/code/poolawl.c +++ b/mps/code/poolawl.c | |||
| @@ -509,6 +509,19 @@ static Bool AWLSegAlloc(Addr *baseReturn, Addr *limitReturn, | |||
| 509 | } | 509 | } |
| 510 | 510 | ||
| 511 | 511 | ||
| 512 | /* AWLVarargs -- decode obsolete varargs */ | ||
| 513 | |||
| 514 | static void AWLVarargs(ArgStruct args[], va_list varargs) | ||
| 515 | { | ||
| 516 | args[0].key = MPS_KEY_FORMAT; | ||
| 517 | args[0].val.format = va_arg(varargs, Format); | ||
| 518 | args[1].key = MPS_KEY_AWL_FIND_DEPENDENT; | ||
| 519 | args[1].val.addr_method = va_arg(varargs, mps_awl_find_dependent_t); | ||
| 520 | args[2].key = MPS_KEY_ARGS_END; | ||
| 521 | AVER(ArgListCheck(args)); | ||
| 522 | } | ||
| 523 | |||
| 524 | |||
| 512 | /* AWLInit -- initialize an AWL pool */ | 525 | /* AWLInit -- initialize an AWL pool */ |
| 513 | 526 | ||
| 514 | const KeyStruct _mps_key_awl_find_dependent = { | 527 | const KeyStruct _mps_key_awl_find_dependent = { |
| @@ -1258,6 +1271,7 @@ DEFINE_POOL_CLASS(AWLPoolClass, this) | |||
| 1258 | this->name = "AWL"; | 1271 | this->name = "AWL"; |
| 1259 | this->size = sizeof(AWLStruct); | 1272 | this->size = sizeof(AWLStruct); |
| 1260 | this->offset = offsetof(AWLStruct, poolStruct); | 1273 | this->offset = offsetof(AWLStruct, poolStruct); |
| 1274 | this->varargs = AWLVarargs; | ||
| 1261 | this->init = AWLInit; | 1275 | this->init = AWLInit; |
| 1262 | this->finish = AWLFinish; | 1276 | this->finish = AWLFinish; |
| 1263 | this->bufferClass = RankBufClassGet; | 1277 | this->bufferClass = RankBufClassGet; |
diff --git a/mps/code/poollo.c b/mps/code/poollo.c index 4e5aee2aac3..541f0901781 100644 --- a/mps/code/poollo.c +++ b/mps/code/poollo.c | |||
| @@ -467,6 +467,17 @@ static void LOWalk(Pool pool, Seg seg, | |||
| 467 | } | 467 | } |
| 468 | 468 | ||
| 469 | 469 | ||
| 470 | /* LOVarargs -- decode obsolete varargs */ | ||
| 471 | |||
| 472 | static void LOVarargs(ArgStruct args[], va_list varargs) | ||
| 473 | { | ||
| 474 | args[0].key = MPS_KEY_FORMAT; | ||
| 475 | args[0].val.format = va_arg(varargs, Format); | ||
| 476 | args[1].key = MPS_KEY_ARGS_END; | ||
| 477 | AVER(ArgListCheck(args)); | ||
| 478 | } | ||
| 479 | |||
| 480 | |||
| 470 | /* LOInit -- initialize an LO pool */ | 481 | /* LOInit -- initialize an LO pool */ |
| 471 | 482 | ||
| 472 | static Res LOInit(Pool pool, ArgList args) | 483 | static Res LOInit(Pool pool, ArgList args) |
| @@ -787,6 +798,7 @@ DEFINE_POOL_CLASS(LOPoolClass, this) | |||
| 787 | this->size = sizeof(LOStruct); | 798 | this->size = sizeof(LOStruct); |
| 788 | this->offset = offsetof(LOStruct, poolStruct); | 799 | this->offset = offsetof(LOStruct, poolStruct); |
| 789 | this->attr &= ~(AttrSCAN | AttrINCR_RB); | 800 | this->attr &= ~(AttrSCAN | AttrINCR_RB); |
| 801 | this->varargs = LOVarargs; | ||
| 790 | this->init = LOInit; | 802 | this->init = LOInit; |
| 791 | this->finish = LOFinish; | 803 | this->finish = LOFinish; |
| 792 | this->bufferFill = LOBufferFill; | 804 | this->bufferFill = LOBufferFill; |
diff --git a/mps/code/poolmfs.c b/mps/code/poolmfs.c index a103bea543c..8a9b3ff1c7d 100644 --- a/mps/code/poolmfs.c +++ b/mps/code/poolmfs.c | |||
| @@ -77,6 +77,19 @@ Pool (MFSPool)(MFS mfs) | |||
| 77 | } | 77 | } |
| 78 | 78 | ||
| 79 | 79 | ||
| 80 | /* MFSVarargs -- decode obsolete varargs */ | ||
| 81 | |||
| 82 | static void MFSVarargs(ArgStruct args[], va_list varargs) | ||
| 83 | { | ||
| 84 | args[0].key = MPS_KEY_MFS_EXTEND_BY; | ||
| 85 | args[0].val.size = va_arg(varargs, Size); | ||
| 86 | args[1].key = MPS_KEY_MFS_UNIT_SIZE; | ||
| 87 | args[1].val.size = va_arg(varargs, Size); | ||
| 88 | args[2].key = MPS_KEY_ARGS_END; | ||
| 89 | AVER(ArgListCheck(args)); | ||
| 90 | } | ||
| 91 | |||
| 92 | |||
| 80 | const KeyStruct _mps_mfs_extend_by = {KeySig, "MFS_EXTEND_BY", ArgCheckCant}; | 93 | const KeyStruct _mps_mfs_extend_by = {KeySig, "MFS_EXTEND_BY", ArgCheckCant}; |
| 81 | const KeyStruct _mps_mfs_unit_size = {KeySig, "MFS_UNIT_SIZE", ArgCheckCant}; | 94 | const KeyStruct _mps_mfs_unit_size = {KeySig, "MFS_UNIT_SIZE", ArgCheckCant}; |
| 82 | 95 | ||
| @@ -289,6 +302,7 @@ DEFINE_POOL_CLASS(MFSPoolClass, this) | |||
| 289 | this->name = "MFS"; | 302 | this->name = "MFS"; |
| 290 | this->size = sizeof(MFSStruct); | 303 | this->size = sizeof(MFSStruct); |
| 291 | this->offset = offsetof(MFSStruct, poolStruct); | 304 | this->offset = offsetof(MFSStruct, poolStruct); |
| 305 | this->varargs = MFSVarargs; | ||
| 292 | this->init = MFSInit; | 306 | this->init = MFSInit; |
| 293 | this->finish = MFSFinish; | 307 | this->finish = MFSFinish; |
| 294 | this->alloc = MFSAlloc; | 308 | this->alloc = MFSAlloc; |
diff --git a/mps/code/poolmv.c b/mps/code/poolmv.c index b9b5470b9a6..fc37530390c 100644 --- a/mps/code/poolmv.c +++ b/mps/code/poolmv.c | |||
| @@ -182,6 +182,28 @@ static Bool MVSpanCheck(MVSpan span) | |||
| 182 | } | 182 | } |
| 183 | 183 | ||
| 184 | 184 | ||
| 185 | /* MVVarargs -- decode obsolete varargs */ | ||
| 186 | |||
| 187 | static void MVVarargs(ArgStruct args[], va_list varargs) | ||
| 188 | { | ||
| 189 | args[0].key = MPS_KEY_MV_EXTEND_BY; | ||
| 190 | args[0].val.size = va_arg(varargs, Size); | ||
| 191 | args[1].key = MPS_KEY_MV_AVG_SIZE; | ||
| 192 | args[1].val.size = va_arg(varargs, Size); | ||
| 193 | args[2].key = MPS_KEY_MV_MAX_SIZE; | ||
| 194 | args[2].val.size = va_arg(varargs, Size); | ||
| 195 | args[3].key = MPS_KEY_ARGS_END; | ||
| 196 | AVER(ArgListCheck(args)); | ||
| 197 | } | ||
| 198 | |||
| 199 | static void MVDebugVarargs(ArgStruct args[], va_list varargs) | ||
| 200 | { | ||
| 201 | args[0].key = MPS_KEY_POOL_DEBUG_OPTION; | ||
| 202 | args[0].val.pool_debug_option = va_arg(varargs, mps_pool_debug_option_s *); | ||
| 203 | MVVarargs(args + 1, varargs); | ||
| 204 | } | ||
| 205 | |||
| 206 | |||
| 185 | /* MVInit -- init method for class MV */ | 207 | /* MVInit -- init method for class MV */ |
| 186 | 208 | ||
| 187 | const KeyStruct _mps_key_mv_extend_by = {KeySig, "MV_EXTEND_BY", ArgCheckCant}; | 209 | const KeyStruct _mps_key_mv_extend_by = {KeySig, "MV_EXTEND_BY", ArgCheckCant}; |
| @@ -771,6 +793,7 @@ DEFINE_POOL_CLASS(MVPoolClass, this) | |||
| 771 | this->name = "MV"; | 793 | this->name = "MV"; |
| 772 | this->size = sizeof(MVStruct); | 794 | this->size = sizeof(MVStruct); |
| 773 | this->offset = offsetof(MVStruct, poolStruct); | 795 | this->offset = offsetof(MVStruct, poolStruct); |
| 796 | this->varargs = MVVarargs; | ||
| 774 | this->init = MVInit; | 797 | this->init = MVInit; |
| 775 | this->finish = MVFinish; | 798 | this->finish = MVFinish; |
| 776 | this->alloc = MVAlloc; | 799 | this->alloc = MVAlloc; |
| @@ -793,6 +816,7 @@ DEFINE_POOL_CLASS(MVDebugPoolClass, this) | |||
| 793 | PoolClassMixInDebug(this); | 816 | PoolClassMixInDebug(this); |
| 794 | this->name = "MVDBG"; | 817 | this->name = "MVDBG"; |
| 795 | this->size = sizeof(MVDebugStruct); | 818 | this->size = sizeof(MVDebugStruct); |
| 819 | this->varargs = MVDebugVarargs; | ||
| 796 | this->debugMixin = MVDebugMixin; | 820 | this->debugMixin = MVDebugMixin; |
| 797 | } | 821 | } |
| 798 | 822 | ||
diff --git a/mps/code/poolmv2.c b/mps/code/poolmv2.c index 9c537171ff0..f2c0cc38f32 100644 --- a/mps/code/poolmv2.c +++ b/mps/code/poolmv2.c | |||
| @@ -27,6 +27,7 @@ SRCID(poolmv2, "$Id$"); | |||
| 27 | /* Private prototypes */ | 27 | /* Private prototypes */ |
| 28 | 28 | ||
| 29 | typedef struct MVTStruct *MVT; | 29 | typedef struct MVTStruct *MVT; |
| 30 | static void MVTVarargs(ArgStruct args[], va_list varargs); | ||
| 30 | static Res MVTInit(Pool pool, ArgList arg); | 31 | static Res MVTInit(Pool pool, ArgList arg); |
| 31 | static Bool MVTCheck(MVT mvt); | 32 | static Bool MVTCheck(MVT mvt); |
| 32 | static void MVTFinish(Pool pool); | 33 | static void MVTFinish(Pool pool); |
| @@ -139,6 +140,7 @@ DEFINE_POOL_CLASS(MVTPoolClass, this) | |||
| 139 | this->size = sizeof(MVTStruct); | 140 | this->size = sizeof(MVTStruct); |
| 140 | this->offset = offsetof(MVTStruct, poolStruct); | 141 | this->offset = offsetof(MVTStruct, poolStruct); |
| 141 | this->attr |= AttrFREE; | 142 | this->attr |= AttrFREE; |
| 143 | this->varargs = MVTVarargs; | ||
| 142 | this->init = MVTInit; | 144 | this->init = MVTInit; |
| 143 | this->finish = MVTFinish; | 145 | this->finish = MVTFinish; |
| 144 | this->free = MVTFree; | 146 | this->free = MVTFree; |
| @@ -189,16 +191,47 @@ static SegPref MVTSegPref(MVT mvt) | |||
| 189 | /* Methods */ | 191 | /* Methods */ |
| 190 | 192 | ||
| 191 | 193 | ||
| 194 | /* MVTVarargs -- decode obsolete varargs */ | ||
| 195 | |||
| 196 | static void MVTVarargs(ArgStruct args[], va_list varargs) | ||
| 197 | { | ||
| 198 | args[0].key = MPS_KEY_MVT_MIN_SIZE; | ||
| 199 | args[0].val.size = va_arg(varargs, Size); | ||
| 200 | args[1].key = MPS_KEY_MVT_MEAN_SIZE; | ||
| 201 | args[1].val.size = va_arg(varargs, Size); | ||
| 202 | args[2].key = MPS_KEY_MVT_MAX_SIZE; | ||
| 203 | args[2].val.size = va_arg(varargs, Size); | ||
| 204 | args[3].key = MPS_KEY_MVT_RESERVE_DEPTH; | ||
| 205 | args[3].val.count = va_arg(varargs, Count); | ||
| 206 | args[4].key = MPS_KEY_MVT_FRAG_LIMIT; | ||
| 207 | args[4].val.count = va_arg(varargs, Count); | ||
| 208 | args[5].key = MPS_KEY_ARGS_END; | ||
| 209 | AVER(ArgListCheck(args)); | ||
| 210 | } | ||
| 211 | |||
| 212 | |||
| 192 | /* MVTInit -- initialize an MVT pool | 213 | /* MVTInit -- initialize an MVT pool |
| 193 | * | 214 | * |
| 194 | * Parameters are: | 215 | * Parameters are: |
| 195 | * minSize, meanSize, maxSize, reserveDepth, fragLimit | 216 | * minSize, meanSize, maxSize, reserveDepth, fragLimit |
| 196 | */ | 217 | */ |
| 218 | |||
| 219 | const KeyStruct _mps_key_mvt_min_size = {KeySig, "MVT_MIN_SIZE", ArgCheckCant}; | ||
| 220 | const KeyStruct _mps_key_mvt_mean_size = {KeySig, "MVT_MEAN_SIZE", ArgCheckCant}; | ||
| 221 | const KeyStruct _mps_key_mvt_max_size = {KeySig, "MVT_MAX_SIZE", ArgCheckCant}; | ||
| 222 | const KeyStruct _mps_key_mvt_reserve_depth = {KeySig, "MVT_RESERVE_DEPTH", ArgCheckCant}; | ||
| 223 | const KeyStruct _mps_key_mvt_frag_limit = {KeySig, "MVT_FRAG_LIMIT", ArgCheckCant}; | ||
| 224 | |||
| 197 | static Res MVTInit(Pool pool, ArgList args) | 225 | static Res MVTInit(Pool pool, ArgList args) |
| 198 | { | 226 | { |
| 199 | Arena arena; | 227 | Arena arena; |
| 200 | Size minSize, meanSize, maxSize, reuseSize, fillSize; | 228 | Size minSize = MVT_MIN_SIZE_DEFAULT; |
| 201 | Count reserveDepth, abqDepth, fragLimit; | 229 | Size meanSize = MVT_MEAN_SIZE_DEFAULT; |
| 230 | Size maxSize = MVT_MAX_SIZE_DEFAULT; | ||
| 231 | Count reserveDepth = MVT_RESERVE_DEPTH_DEFAULT; | ||
| 232 | Count fragLimit = MVT_FRAG_LIMIT_DEFAULT; | ||
| 233 | Size reuseSize, fillSize; | ||
| 234 | Count abqDepth; | ||
| 202 | MVT mvt; | 235 | MVT mvt; |
| 203 | Res res; | 236 | Res res; |
| 204 | ArgStruct arg; | 237 | ArgStruct arg; |
| @@ -209,30 +242,35 @@ static Res MVTInit(Pool pool, ArgList args) | |||
| 209 | arena = PoolArena(pool); | 242 | arena = PoolArena(pool); |
| 210 | AVERT(Arena, arena); | 243 | AVERT(Arena, arena); |
| 211 | 244 | ||
| 212 | if (ArgPick(&arg, args, MPS_KEY_VARARGS)) { | 245 | |
| 213 | /* FIXME: Inconsistent reporting of bad arguments. Elsewhere we assert or return ResPARAM. */ | 246 | /* FIXME: Inconsistent reporting of bad arguments. Elsewhere we assert or return ResPARAM. */ |
| 214 | /* --- Should there be a ResBADARG ? */ | 247 | /* --- Should there be a ResBADARG ? */ |
| 215 | minSize = va_arg(arg.val.varargs, Size); | 248 | if (ArgPick(&arg, args, MPS_KEY_MVT_MIN_SIZE)) { |
| 249 | minSize = arg.val.size; | ||
| 216 | unless (minSize > 0) | 250 | unless (minSize > 0) |
| 217 | return ResLIMIT; | 251 | return ResLIMIT; |
| 218 | meanSize = va_arg(arg.val.varargs, Size); | 252 | } |
| 253 | if (ArgPick(&arg, args, MPS_KEY_MVT_MEAN_SIZE)) { | ||
| 254 | meanSize = arg.val.size; | ||
| 219 | unless (meanSize >= minSize) | 255 | unless (meanSize >= minSize) |
| 220 | return ResLIMIT; | 256 | return ResLIMIT; |
| 221 | maxSize = va_arg(arg.val.varargs, Size); | 257 | } |
| 258 | if (ArgPick(&arg, args, MPS_KEY_MVT_MAX_SIZE)) { | ||
| 259 | maxSize = arg.val.size; | ||
| 222 | unless (maxSize >= meanSize) | 260 | unless (maxSize >= meanSize) |
| 223 | return ResLIMIT; | 261 | return ResLIMIT; |
| 262 | } | ||
| 263 | if (ArgPick(&arg, args, MPS_KEY_MVT_RESERVE_DEPTH)) { | ||
| 224 | /* --- check that maxSize is not too large */ | 264 | /* --- check that maxSize is not too large */ |
| 225 | reserveDepth = va_arg(arg.val.varargs, Count); | 265 | reserveDepth = arg.val.count; |
| 226 | unless (reserveDepth > 0) | 266 | unless (reserveDepth > 0) |
| 227 | return ResLIMIT; | 267 | return ResLIMIT; |
| 268 | } | ||
| 269 | if (ArgPick(&arg, args, MPS_KEY_MVT_FRAG_LIMIT)) { | ||
| 228 | /* --- check that reserveDepth is not too large or small */ | 270 | /* --- check that reserveDepth is not too large or small */ |
| 229 | fragLimit = va_arg(arg.val.varargs, Count); | 271 | fragLimit = arg.val.count; |
| 230 | unless (fragLimit <= 100) | 272 | unless (fragLimit <= 100) |
| 231 | return ResLIMIT; | 273 | return ResLIMIT; |
| 232 | } else { | ||
| 233 | /* FIXME: Keywords not yet supported. */ | ||
| 234 | res = ResPARAM; | ||
| 235 | goto failParam; | ||
| 236 | } | 274 | } |
| 237 | 275 | ||
| 238 | /* see <design/poolmvt/#arch.parameters> */ | 276 | /* see <design/poolmvt/#arch.parameters> */ |
| @@ -327,7 +365,6 @@ static Res MVTInit(Pool pool, ArgList args) | |||
| 327 | failABQ: | 365 | failABQ: |
| 328 | CBSFinish(MVTCBS(mvt)); | 366 | CBSFinish(MVTCBS(mvt)); |
| 329 | failCBS: | 367 | failCBS: |
| 330 | failParam: | ||
| 331 | AVER(res != ResOK); | 368 | AVER(res != ResOK); |
| 332 | return res; | 369 | return res; |
| 333 | } | 370 | } |
diff --git a/mps/code/poolmvff.c b/mps/code/poolmvff.c index 9b17dc7252e..8cc31a5e45c 100644 --- a/mps/code/poolmvff.c +++ b/mps/code/poolmvff.c | |||
| @@ -407,14 +407,42 @@ static void MVFFBufferEmpty(Pool pool, Buffer buffer, | |||
| 407 | } | 407 | } |
| 408 | 408 | ||
| 409 | 409 | ||
| 410 | /* MVFFVarargs -- decode obsolete varargs */ | ||
| 411 | |||
| 412 | static void MVFFVarargs(ArgStruct args[], va_list varargs) | ||
| 413 | { | ||
| 414 | args[0].key = MPS_KEY_MVFF_EXTEND_BY; | ||
| 415 | args[0].val.size = va_arg(varargs, Size); | ||
| 416 | args[1].key = MPS_KEY_MVFF_AVG_SIZE; | ||
| 417 | args[1].val.size = va_arg(varargs, Size); | ||
| 418 | args[2].key = MPS_KEY_MVFF_ALIGN; | ||
| 419 | args[2].val.align = va_arg(varargs, Size); /* promoted type */ | ||
| 420 | args[3].key = MPS_KEY_MVFF_SLOT_HIGH; | ||
| 421 | args[3].val.b = va_arg(varargs, Bool); | ||
| 422 | args[4].key = MPS_KEY_MVFF_ARENA_HIGH; | ||
| 423 | args[4].val.b = va_arg(varargs, Bool); | ||
| 424 | args[5].key = MPS_KEY_MVFF_FIRST_FIT; | ||
| 425 | args[5].val.b = va_arg(varargs, Bool); | ||
| 426 | args[6].key = MPS_KEY_ARGS_END; | ||
| 427 | AVER(ArgListCheck(args)); | ||
| 428 | } | ||
| 429 | |||
| 430 | static void MVFFDebugVarargs(ArgStruct args[], va_list varargs) | ||
| 431 | { | ||
| 432 | args[0].key = MPS_KEY_POOL_DEBUG_OPTION; | ||
| 433 | args[0].val.pool_debug_option = va_arg(varargs, mps_pool_debug_option_s *); | ||
| 434 | MVFFVarargs(args + 1, varargs); | ||
| 435 | } | ||
| 436 | |||
| 437 | |||
| 410 | /* MVFFInit -- initialize method for MVFF */ | 438 | /* MVFFInit -- initialize method for MVFF */ |
| 411 | 439 | ||
| 412 | const KeyStruct _mps_key_mvff_extend_by = {KeySig, "EXTEND_BY", ArgCheckCant}; | 440 | const KeyStruct _mps_key_mvff_extend_by = {KeySig, "MVFF_EXTEND_BY", ArgCheckCant}; |
| 413 | const KeyStruct _mps_key_mvff_avg_size = {KeySig, "AVG_SIZE", ArgCheckCant}; | 441 | const KeyStruct _mps_key_mvff_avg_size = {KeySig, "MVFF_AVG_SIZE", ArgCheckCant}; |
| 414 | const KeyStruct _mps_key_mvff_align = {KeySig, "ALIGN", ArgCheckCant}; /* FIXME: ArgCheckAlign */ | 442 | const KeyStruct _mps_key_mvff_align = {KeySig, "MVFF_ALIGN", ArgCheckCant}; /* FIXME: ArgCheckAlign */ |
| 415 | const KeyStruct _mps_key_mvff_slot_high = {KeySig, "SLOT_HIGH", ArgCheckCant}; /* FIXME: ArgCheckBool */ | 443 | const KeyStruct _mps_key_mvff_slot_high = {KeySig, "MVFF_SLOT_HIGH", ArgCheckCant}; /* FIXME: ArgCheckBool */ |
| 416 | const KeyStruct _mps_key_mvff_arena_high = {KeySig, "ARENA_HIGH", ArgCheckCant}; /* FIXME: ArgCheckBool */ | 444 | const KeyStruct _mps_key_mvff_arena_high = {KeySig, "MVFF_ARENA_HIGH", ArgCheckCant}; /* FIXME: ArgCheckBool */ |
| 417 | const KeyStruct _mps_key_mvff_first_fit = {KeySig, "FIRST_FIT", ArgCheckCant}; /* FIXME: ArgCheckBool */ | 445 | const KeyStruct _mps_key_mvff_first_fit = {KeySig, "MVFF_FIRST_FIT", ArgCheckCant}; /* FIXME: ArgCheckBool */ |
| 418 | 446 | ||
| 419 | static Res MVFFInit(Pool pool, ArgList args) | 447 | static Res MVFFInit(Pool pool, ArgList args) |
| 420 | { | 448 | { |
| @@ -597,6 +625,7 @@ DEFINE_POOL_CLASS(MVFFPoolClass, this) | |||
| 597 | this->name = "MVFF"; | 625 | this->name = "MVFF"; |
| 598 | this->size = sizeof(MVFFStruct); | 626 | this->size = sizeof(MVFFStruct); |
| 599 | this->offset = offsetof(MVFFStruct, poolStruct); | 627 | this->offset = offsetof(MVFFStruct, poolStruct); |
| 628 | this->varargs = MVFFVarargs; | ||
| 600 | this->init = MVFFInit; | 629 | this->init = MVFFInit; |
| 601 | this->finish = MVFFFinish; | 630 | this->finish = MVFFFinish; |
| 602 | this->alloc = MVFFAlloc; | 631 | this->alloc = MVFFAlloc; |
| @@ -621,6 +650,7 @@ DEFINE_POOL_CLASS(MVFFDebugPoolClass, this) | |||
| 621 | PoolClassMixInDebug(this); | 650 | PoolClassMixInDebug(this); |
| 622 | this->name = "MVFFDBG"; | 651 | this->name = "MVFFDBG"; |
| 623 | this->size = sizeof(MVFFDebugStruct); | 652 | this->size = sizeof(MVFFDebugStruct); |
| 653 | this->varargs = MVFFDebugVarargs; | ||
| 624 | this->debugMixin = MVFFDebugMixin; | 654 | this->debugMixin = MVFFDebugMixin; |
| 625 | } | 655 | } |
| 626 | 656 | ||