Index: generic/nsf.c =================================================================== diff -u -r74b7a4066526ff5f5a8080ed907f71c9ed5c7700 -r657e7e3b20ca1ad11c75634ecb04aeebb8edef97 --- generic/nsf.c (.../nsf.c) (revision 74b7a4066526ff5f5a8080ed907f71c9ed5c7700) +++ generic/nsf.c (.../nsf.c) (revision 657e7e3b20ca1ad11c75634ecb04aeebb8edef97) @@ -22342,10 +22342,16 @@ * creating objects of this class. */ - if (likely(class && class->parsedParamPtr)) { + if (likely(class && class->parsedParamPtr) +#if defined(PER_OBJECT_PARAMETER_CACHING) + && class->classParamPtrEpoch == RUNTIME_STATE(interp)->classParamPtrEpoch +#endif + ) { NsfParsedParam *clParsedParamPtr = class->parsedParamPtr; parsedParamPtr->paramDefs = clParsedParamPtr->paramDefs; parsedParamPtr->possibleUnknowns = clParsedParamPtr->possibleUnknowns; + /* fprintf(stderr, "reuse class param for class %p %s paramPtr %p\n", + class, ClassName(class), clParsedParamPtr);*/ result = TCL_OK; #if defined(PER_OBJECT_PARAMETER_CACHING) @@ -22391,8 +22397,14 @@ ppDefPtr->paramDefs = parsedParamPtr->paramDefs; ppDefPtr->possibleUnknowns = parsedParamPtr->possibleUnknowns; if (class) { - class->parsedParamPtr = ppDefPtr; #if defined(PER_OBJECT_PARAMETER_CACHING) + if (class->parsedParamPtr) { + NsfParameterInvalidateClassCacheCmd(interp, class); + } + class->classParamPtrEpoch = RUNTIME_STATE(interp)->classParamPtrEpoch; +#endif + class->parsedParamPtr = ppDefPtr; +#if defined(PER_OBJECT_PARAMETER_CACHING) } else { NsfObjectOpt *opt = NsfRequireObjectOpt(object); if (object->opt->parsedParamPtr) { Index: generic/nsfInt.h =================================================================== diff -u -r7401c1c91b67a9adc5b3c1a9049a37a9d8e13c93 -r657e7e3b20ca1ad11c75634ecb04aeebb8edef97 --- generic/nsfInt.h (.../nsfInt.h) (revision 7401c1c91b67a9adc5b3c1a9049a37a9d8e13c93) +++ generic/nsfInt.h (.../nsfInt.h) (revision 657e7e3b20ca1ad11c75634ecb04aeebb8edef97) @@ -535,6 +535,9 @@ Tcl_HashTable instances; Tcl_Namespace *nsPtr; NsfParsedParam *parsedParamPtr; +#if defined(PER_OBJECT_PARAMETER_CACHING) + int classParamPtrEpoch; +#endif NsfClassOpt *opt; short color; } NsfClass;