diff options
author | Steve Bennett <steveb@workware.net.au> | 2012-02-28 12:48:22 +1000 |
---|---|---|
committer | Steve Bennett <steveb@workware.net.au> | 2012-02-28 12:48:45 +1000 |
commit | 601a8201e0eae95d40c844eba2b3341536f521b3 (patch) | |
tree | e35fd40dc2009475cda47da06400477cbbc07b6b | |
parent | 24d2bf6e60b45392b28a709193169bb105c81a4e (diff) | |
download | jimtcl-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.c | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -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); |