summaryrefslogtreecommitdiffstats
path: root/generic/tclProc.c
diff options
context:
space:
mode:
authordah <dunnie@gmail.com>2016-12-18 15:04:34 (GMT)
committerdah <dunnie@gmail.com>2016-12-18 15:04:34 (GMT)
commit6127d0ae1c48c00e21584b66a79c21727291ca52 (patch)
tree027c2ded2df229a44ec5a3a89786171eab2e6090 /generic/tclProc.c
parent6e4bc775a32492b2994a525aec7ff0183252e0b8 (diff)
downloadtcl-6127d0ae1c48c00e21584b66a79c21727291ca52.zip
tcl-6127d0ae1c48c00e21584b66a79c21727291ca52.tar.gz
tcl-6127d0ae1c48c00e21584b66a79c21727291ca52.tar.bz2
More tests, frame lookup tweak and attempt to take advantage of a branch prediction.
Diffstat (limited to 'generic/tclProc.c')
-rw-r--r--generic/tclProc.c57
1 files changed, 29 insertions, 28 deletions
diff --git a/generic/tclProc.c b/generic/tclProc.c
index 49ca8eb..615515b 100644
--- a/generic/tclProc.c
+++ b/generic/tclProc.c
@@ -1596,15 +1596,22 @@ InitArgsAndLocals(
int numArgVars = procPtr->numArgsCompiledLocals;
if (numArgVars > numArgs) {
- CallFrame *upFramePtr = NULL;
+ CallFrame *upFramePtr;
Var *otherPtr, *arrayPtr;
+ /*
+ * If we got here, assume we'll be resolving links.
+ */
+
+ if (TclObjGetFrame(interp, NULL, &upFramePtr) == -1) {
+ i = -1; /* Tell incorrectArgs we set the error */
+ goto incorrectArgs;
+ }
+
defPtr++; /* Here, defPtr cannot be NULL */
for(i = numArgs; i < numArgVars; i++, varPtr++, defPtr++) {
-
if (TclIsVarLink(defPtr)) {
int argIndex;
- Tcl_Obj *objPtr;
/*
* Something went horribly wrong if this comes to a Panic.
@@ -1614,35 +1621,29 @@ InitArgsAndLocals(
&argIndex))
|| (argIndex < 0 || argIndex > numArgs - 1)) {
Tcl_Panic("Link variable points to an invalid local index.");
- }
-
- objPtr = argObjs[argIndex];
- if (upFramePtr == NULL) {
- if (TclObjGetFrame(interp, NULL, &upFramePtr) == -1) {
+ } else {
+ Tcl_Obj *objPtr = argObjs[argIndex];
+
+ /*
+ * Locate the other variable.
+ */
+
+ ((Interp *)interp)->varFramePtr = upFramePtr;
+ otherPtr = TclObjLookupVarEx(interp, objPtr, NULL,
+ TCL_LEAVE_ERR_MSG, "access", /*createPart1*/ 1,
+ /*createPart2*/ 1, &arrayPtr);
+ ((Interp *)interp)->varFramePtr = framePtr;
+ if (otherPtr == NULL) {
i = -1; /* Tell incorrectArgs we set the error */
goto incorrectArgs;
}
- }
-
- /*
- * Locate the other variable.
- */
- ((Interp *)interp)->varFramePtr = upFramePtr;
- otherPtr = TclObjLookupVarEx(interp, objPtr, NULL,
- TCL_LEAVE_ERR_MSG, "access", /*createPart1*/ 1,
- /*createPart2*/ 1, &arrayPtr);
- ((Interp *)interp)->varFramePtr = framePtr;
- if (otherPtr == NULL) {
- i = -1; /* Tell incorrectArgs we set the error */
- goto incorrectArgs;
- }
-
- varPtr->flags = VAR_LINK;
- varPtr->value.linkPtr = otherPtr;
- if (TclIsVarInHash(otherPtr)) {
- VarHashRefCount(otherPtr)++;
- }
+ varPtr->flags = VAR_LINK;
+ varPtr->value.linkPtr = otherPtr;
+ if (TclIsVarInHash(otherPtr)) {
+ VarHashRefCount(otherPtr)++;
+ }
+ }
}
}
}