aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Bennett <steveb@workware.net.au>2012-02-28 12:48:22 +1000
committerSteve Bennett <steveb@workware.net.au>2012-02-28 12:48:45 +1000
commit601a8201e0eae95d40c844eba2b3341536f521b3 (patch)
treee35fd40dc2009475cda47da06400477cbbc07b6b
parent24d2bf6e60b45392b28a709193169bb105c81a4e (diff)
downloadjimtcl-601a8201e0eae95d40c844eba2b3341536f521b3.zip
jimtcl-601a8201e0eae95d40c844eba2b3341536f521b3.tar.gz
jimtcl-601a8201e0eae95d40c844eba2b3341536f521b3.tar.bz2
Optimise calls to a proc with an empty body
Note that even white space will defeat this optimisation Signed-off-by: Steve Bennett <steveb@workware.net.au>
-rw-r--r--jim.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/jim.c b/jim.c
index 0931fa8..b24b805 100644
--- a/jim.c
+++ b/jim.c
@@ -10500,6 +10500,11 @@ static int JimCallProcedure(Jim_Interp *interp, Jim_Cmd *cmd, int argc, Jim_Obj
return JIM_ERR;
}
+ if (Jim_Length(cmd->u.proc.bodyObjPtr) == 0) {
+ /* Optimise for procedure with no body - useful for optional debugging */
+ return JIM_OK;
+ }
+
/* Check if there are too nested calls */
if (interp->framePtr->level == interp->maxCallFrameDepth) {
Jim_SetResultString(interp, "Too many nested calls. Infinite recursion?", -1);