Index: generic/nsf.c =================================================================== diff -u -r40bdea07b98d57764934341d86f4e734bc0c0c9a -rc209eaaec1fd3c37443ef858b0071be626bc1123 --- generic/nsf.c (.../nsf.c) (revision 40bdea07b98d57764934341d86f4e734bc0c0c9a) +++ generic/nsf.c (.../nsf.c) (revision c209eaaec1fd3c37443ef858b0071be626bc1123) @@ -957,6 +957,35 @@ return result; } +/* + * Support for variable hash tables + */ +static NSF_INLINE Var *VarHashCreateVar(TclVarHashTable *tablePtr, Tcl_Obj *key, int *newPtr) nonnull(1) nonnull(2); + +static NSF_INLINE Var * +VarHashCreateVar(TclVarHashTable *tablePtr, Tcl_Obj *key, int *newPtr) { + Var *varPtr = NULL; + Tcl_HashEntry *hPtr; + + assert(tablePtr); + assert(key); + + hPtr = Tcl_CreateHashEntry((Tcl_HashTable *) tablePtr, + (char *) key, newPtr); + if (likely(hPtr != NULL)) { + varPtr = TclVarHashGetValue(hPtr); + } + return varPtr; +} + +static NSF_INLINE TclVarHashTable * +VarHashTableCreate() { + TclVarHashTable *varTablePtr = (TclVarHashTable *) ckalloc(sizeof(TclVarHashTable)); + TclInitVarHashTable(varTablePtr, NULL); + return varTablePtr; +} + +#include "nsfCmdPtr.c" #include "nsfStack.c" /*********************************************************************** @@ -14619,8 +14648,7 @@ * * The conversion is just needed, when resultObj differs from the actual * value in the output vector. Otherwise the conversion and the value - * increment happened already before (and is already recorded in the - * parse context). + * increment happened already before (and is already recorded in the parse context). */ resultObj = Tcl_GetObjResult(interp); @@ -15909,11 +15937,15 @@ } Tcl_PushCallFrame(interp, (Tcl_CallFrame *)framePtr, nsPtr, 0); - /* create the method in the provided namespace */ + /* + * Create the method in the provided namespace. + */ result = Tcl_ProcObjCmd(NULL, interp, 4, ov); + if (likely(result == TCL_OK)) { /* retrieve the defined proc */ Proc *procPtr = FindProcMethod(nsPtr, methodName); + if (procPtr) { /* modify the cmd of the proc to set the current namespace for the body */ if (withInner_namespace) { Index: generic/nsfAccessInt.h =================================================================== diff -u -r884a4e033f0d9d93bf1e151dfe1be8cb074dad0f -rc209eaaec1fd3c37443ef858b0071be626bc1123 --- generic/nsfAccessInt.h (.../nsfAccessInt.h) (revision 884a4e033f0d9d93bf1e151dfe1be8cb074dad0f) +++ generic/nsfAccessInt.h (.../nsfAccessInt.h) (revision c209eaaec1fd3c37443ef858b0071be626bc1123) @@ -90,70 +90,6 @@ # define Tcl_HashSize(tablePtr) ((tablePtr)->numEntries) #endif -static NSF_INLINE NsfObject*NsfGetObjectFromCmdPtr(Tcl_Command cmd) nonnull(1); -static NSF_INLINE NsfClass*NsfGetClassFromCmdPtr(Tcl_Command cmd) nonnull(1); -static NSF_INLINE ClientData NsfGetClientDataFromCmdPtr(Tcl_Command cmd) nonnull(1); -static NSF_INLINE Var *VarHashCreateVar(TclVarHashTable *tablePtr, Tcl_Obj *key, int *newPtr) nonnull(1) nonnull(2); -static NSF_INLINE Var * -VarHashCreateVar(TclVarHashTable *tablePtr, Tcl_Obj *key, int *newPtr) { - Var *varPtr = NULL; - Tcl_HashEntry *hPtr; - assert(tablePtr); - assert(key); - hPtr = Tcl_CreateHashEntry((Tcl_HashTable *) tablePtr, - (char *) key, newPtr); - if (likely(hPtr != NULL)) { - varPtr = TclVarHashGetValue(hPtr); - } - return varPtr; -} - -static NSF_INLINE TclVarHashTable * -VarHashTableCreate() { - TclVarHashTable *varTablePtr = (TclVarHashTable *) ckalloc(sizeof(TclVarHashTable)); - TclInitVarHashTable(varTablePtr, NULL); - return varTablePtr; -} - -/* - * Conversion from CmdPtr to Class / Object - */ - -static NSF_INLINE ClientData -NsfGetClientDataFromCmdPtr(Tcl_Command cmd) { - assert(cmd); - /*fprintf(stderr, "objProc=%p %p\n", Tcl_Command_objProc(cmd),NsfObjDispatch);*/ - if (likely(Tcl_Command_objProc(cmd) == NsfObjDispatch)) - return Tcl_Command_objClientData(cmd); - else { - cmd = TclGetOriginalCommand(cmd); - if (likely(cmd != NULL) && unlikely(Tcl_Command_objProc(cmd) == NsfObjDispatch)) { - /*fprintf(stderr, "???? got cmd right in 2nd round\n");*/ - return Tcl_Command_objClientData(cmd); - } - return NULL; - } -} - -static NSF_INLINE NsfClass* -NsfGetClassFromCmdPtr(Tcl_Command cmd) { - ClientData cd = NsfGetClientDataFromCmdPtr(cmd); - assert(cmd); - /*fprintf(stderr, "cd=%p\n",cd);*/ - if (likely(cd != NULL)) { - return NsfObjectToClass(cd); - } else { - return NULL; - } -} - -static NSF_INLINE NsfObject* -NsfGetObjectFromCmdPtr(Tcl_Command cmd) { - assert(cmd); - return (NsfObject*) NsfGetClientDataFromCmdPtr(cmd); -} - - Index: generic/nsfCmdPtr.c =================================================================== diff -u --- generic/nsfCmdPtr.c (revision 0) +++ generic/nsfCmdPtr.c (revision c209eaaec1fd3c37443ef858b0071be626bc1123) @@ -0,0 +1,41 @@ +/* + * Conversion from CmdPtr to Class / Object + */ + +static NSF_INLINE NsfObject*NsfGetObjectFromCmdPtr(Tcl_Command cmd) nonnull(1); +static NSF_INLINE NsfClass*NsfGetClassFromCmdPtr(Tcl_Command cmd) nonnull(1); +static NSF_INLINE ClientData NsfGetClientDataFromCmdPtr(Tcl_Command cmd) nonnull(1); + +static NSF_INLINE ClientData +NsfGetClientDataFromCmdPtr(Tcl_Command cmd) { + assert(cmd); + /*fprintf(stderr, "objProc=%p %p\n", Tcl_Command_objProc(cmd),NsfObjDispatch);*/ + if (likely(Tcl_Command_objProc(cmd) == NsfObjDispatch)) + return Tcl_Command_objClientData(cmd); + else { + cmd = TclGetOriginalCommand(cmd); + if (likely(cmd != NULL) && unlikely(Tcl_Command_objProc(cmd) == NsfObjDispatch)) { + /*fprintf(stderr, "???? got cmd right in 2nd round\n");*/ + return Tcl_Command_objClientData(cmd); + } + return NULL; + } +} + +static NSF_INLINE NsfClass* +NsfGetClassFromCmdPtr(Tcl_Command cmd) { + ClientData cd = NsfGetClientDataFromCmdPtr(cmd); + assert(cmd); + /*fprintf(stderr, "cd=%p\n",cd);*/ + if (likely(cd != NULL)) { + return NsfObjectToClass(cd); + } else { + return NULL; + } +} + +static NSF_INLINE NsfObject* +NsfGetObjectFromCmdPtr(Tcl_Command cmd) { + assert(cmd); + return (NsfObject*) NsfGetClientDataFromCmdPtr(cmd); +} Index: generic/nsfPointer.c =================================================================== diff -u -r42d2240c0949a258303e3213574aa96fd0ef4e1a -rc209eaaec1fd3c37443ef858b0071be626bc1123 --- generic/nsfPointer.c (.../nsfPointer.c) (revision 42d2240c0949a258303e3213574aa96fd0ef4e1a) +++ generic/nsfPointer.c (.../nsfPointer.c) (revision c209eaaec1fd3c37443ef858b0071be626bc1123) @@ -345,7 +345,7 @@ } pointerTableRefCount++; - //fprintf(stderr, "Nsf_PointerInit pointerTableRefCount == %d\n", pointerTableRefCount); + /* fprintf(stderr, "Nsf_PointerInit pointerTableRefCount == %d\n", pointerTableRefCount);*/ NsfMutexUnlock(&pointerMutex); @@ -394,7 +394,7 @@ Tcl_DeleteHashTable(pointerHashTablePtr); } - //fprintf(stderr, "Nsf_PointerExit pointerTableRefCount == %d\n", pointerTableRefCount); + /*fprintf(stderr, "Nsf_PointerExit pointerTableRefCount == %d\n", pointerTableRefCount);*/ NsfMutexUnlock(&pointerMutex); } Index: generic/nsfShadow.c =================================================================== diff -u -r97b643b1f8f0d1cb74d8bf1508b29d4b7fdb05c1 -rc209eaaec1fd3c37443ef858b0071be626bc1123 --- generic/nsfShadow.c (.../nsfShadow.c) (revision 97b643b1f8f0d1cb74d8bf1508b29d4b7fdb05c1) +++ generic/nsfShadow.c (.../nsfShadow.c) (revision c209eaaec1fd3c37443ef858b0071be626bc1123) @@ -25,9 +25,9 @@ * DEALINGS IN THE SOFTWARE. */ - #include "nsfInt.h" #include "nsfAccessInt.h" +#include "nsfCmdPtr.c" /* *---------------------------------------------------------------------- Index: generic/nsfStack.c =================================================================== diff -u -r4344f09a497442a67dd503dcdce348a376491749 -rc209eaaec1fd3c37443ef858b0071be626bc1123 --- generic/nsfStack.c (.../nsfStack.c) (revision 4344f09a497442a67dd503dcdce348a376491749) +++ generic/nsfStack.c (.../nsfStack.c) (revision c209eaaec1fd3c37443ef858b0071be626bc1123) @@ -827,9 +827,6 @@ if (elements == 0 && (cscPtr->flags & NSF_CM_ENSEMBLE_UNKNOWN) && (cscPtr->flags & NSF_CSC_CALL_IS_NEXT)) break; - /* Do not record any INACTIVE frames in the method path */ - //if ((cscPtr->frameType & NSF_CSC_TYPE_INACTIVE)) continue; - Tcl_ListObjAppendElement(interp, methodPathObj, Tcl_NewStringObj(Tcl_GetCommandName(interp, cscPtr->cmdPtr), -1)); elements++;