diff options
| author | mig <mig> | 2013-01-12 10:49:25 (GMT) |
|---|---|---|
| committer | mig <mig> | 2013-01-12 10:49:25 (GMT) |
| commit | 7715309bee8a77c9b2e05ebd0876e57a065b219c (patch) | |
| tree | bea188b5c35d6731fea8206e385cbf5f3a0e62cd | |
| parent | b4e2d9a5f7e53570486237c461dd8416510e5e20 (diff) | |
| download | tcl-7715309bee8a77c9b2e05ebd0876e57a065b219c.zip tcl-7715309bee8a77c9b2e05ebd0876e57a065b219c.tar.gz tcl-7715309bee8a77c9b2e05ebd0876e57a065b219c.tar.bz2 | |
discouraging the compiler from re-reading *pc in the peephole loop
| -rw-r--r-- | generic/tclExecute.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/generic/tclExecute.c b/generic/tclExecute.c index 4d758f6..5bf0e79 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -2084,7 +2084,8 @@ TEBCresume( Tcl_Obj **tosPtr; /* Cached pointer to top of evaluation * stack. */ const unsigned char *pc; /* The current program counter. */ - + unsigned char inst; /* The currently running instruction */ + /* * Transfer variables - needed only between opcodes, but not while * executing an instruction. @@ -2290,6 +2291,8 @@ TEBCresume( * reduces total obj size. */ + inst = *pc; + peepholeStart: #ifdef TCL_COMPILE_STATS iPtr->stats.instructionCount[*pc]++; @@ -2310,18 +2313,18 @@ TEBCresume( TCL_DTRACE_INST_NEXT(); - if (*pc == INST_LOAD_SCALAR1) { + if (inst == INST_LOAD_SCALAR1) { goto instLoadScalar1; } - if (*pc == INST_PUSH1) { + if (inst == INST_PUSH1) { PUSH_OBJECT(codePtr->objArrayPtr[TclGetUInt1AtPtr(pc+1)]); TRACE_WITH_OBJ(("%u => ", TclGetInt1AtPtr(pc+1)), OBJ_AT_TOS); - pc += 2; + inst = *(pc += 2); goto peepholeStart; } - if (*pc == INST_START_CMD) { + if (inst == INST_START_CMD) { /* * Peephole: do not run INST_START_CMD, just skip it */ @@ -2334,11 +2337,11 @@ TEBCresume( goto instStartCmdFailed; } } - pc += 9; + inst = *(pc += 9); goto peepholeStart; } - switch (*pc) { + switch (inst) { case INST_SYNTAX: case INST_RETURN_IMM: { int code = TclGetInt4AtPtr(pc+1); |
