Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | peephole INST_START_CMD before entering the big switch in tebc |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
832a1994c7a338d7e4e75085ee8cba0a |
User & Date: | mig 2013-01-15 19:37:30 |
References
2013-05-13
| ||
16:51 | Fixed bug in parent revision [832a1994c7] unpredictably breaking the execution of precompiled byteco... Closed-Leaf check-in: 461dc8b0cc user: andreask tags: bugfix-832a1994c7-for-precompiled-bc | |
Context
2013-05-13
| ||
16:51 | Fixed bug in parent revision [832a1994c7] unpredictably breaking the execution of precompiled byteco... Closed-Leaf check-in: 461dc8b0cc user: andreask tags: bugfix-832a1994c7-for-precompiled-bc | |
2013-01-17
| ||
16:32 | merge trunk check-in: 3c4edc83aa user: dgp tags: novem | |
2013-01-15
| ||
21:06 | [Bug 3598300]: unix: tcl.h does not include sys/stat.h check-in: 71141a7657 user: jan.nijtmans tags: trunk | |
19:46 | merge trunk check-in: ece0938d6c user: mig tags: mig-no280 | |
19:37 | peephole INST_START_CMD before entering the big switch in tebc check-in: 832a1994c7 user: mig tags: trunk | |
19:35 | merge trunk Closed-Leaf check-in: 9842555cd9 user: mig tags: ISC-peephole | |
19:26 | remove [4522b11989], it breaks the build on linux check-in: f00093f08c user: mig tags: trunk | |
Changes
Changes to generic/tclExecute.c.
︙ | ︙ | |||
2080 2081 2082 2083 2084 2085 2086 | /* * Globals: variables that store state, must remain valid at all times. */ Tcl_Obj **tosPtr; /* Cached pointer to top of evaluation * stack. */ const unsigned char *pc; /* The current program counter. */ | > | | 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 | /* * Globals: variables that store state, must remain valid at all times. */ 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. */ int cleanup = 0; Tcl_Obj *objResultPtr; |
︙ | ︙ | |||
2246 2247 2248 2249 2250 2251 2252 | * compilers (SunPro CC). */ break; } cleanup0: | < < < < < < < < < < < < < < < < < | 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 | * compilers (SunPro CC). */ break; } cleanup0: /* * Check for asynchronous handlers [Bug 746722]; we do the check every * ASYNC_CHECK_COUNT_MASK instruction, of the form (2**n-1). */ if ((instructionCount++ & ASYNC_CHECK_COUNT_MASK) == 0) { DECACHE_STACK_INFO(); |
︙ | ︙ | |||
2294 2295 2296 2297 2298 2299 2300 | CACHE_STACK_INFO(); goto gotError; } } CACHE_STACK_INFO(); } | < < > > > > > > > > > > > > > > > > > > > > > > | | > > > > > > > > > > > > > > | | | > > > > | | 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 | CACHE_STACK_INFO(); goto gotError; } } CACHE_STACK_INFO(); } /* * These two instructions account for 26% of all instructions (according * to measurements on tclbench by Ben Vitale * [http://www.cs.toronto.edu/syslab/pubs/tcl2005-vitale-zaleski.pdf] * Resolving them before the switch reduces the cost of branch * mispredictions, seems to improve runtime by 5% to 15%, and (amazingly!) * reduces total obj size. */ inst = *pc; peepholeStart: #ifdef TCL_COMPILE_STATS iPtr->stats.instructionCount[*pc]++; #endif #ifdef TCL_COMPILE_DEBUG /* * Skip the stack depth check if an expansion is in progress. */ CHECK_STACK(); if (traceInstructions) { fprintf(stdout, "%2d: %2d ", iPtr->numLevels, (int) CURR_DEPTH); TclPrintInstruction(codePtr, pc); fflush(stdout); } #endif /* TCL_COMPILE_DEBUG */ TCL_DTRACE_INST_NEXT(); if (inst == INST_LOAD_SCALAR1) { goto instLoadScalar1; } else if (inst == INST_PUSH1) { PUSH_OBJECT(codePtr->objArrayPtr[TclGetUInt1AtPtr(pc+1)]); TRACE_WITH_OBJ(("%u => ", TclGetInt1AtPtr(pc+1)), OBJ_AT_TOS); inst = *(pc += 2); goto peepholeStart; } else if (inst == INST_START_CMD) { /* * Peephole: do not run INST_START_CMD, just skip it */ iPtr->cmdCount += TclGetUInt4AtPtr(pc+5); if (checkInterp) { checkInterp = 0; if ((codePtr->compileEpoch != iPtr->compileEpoch) || (codePtr->nsEpoch != iPtr->varFramePtr->nsPtr->resolverEpoch)) { goto instStartCmdFailed; } } inst = *(pc += 9); goto peepholeStart; } switch (inst) { case INST_SYNTAX: case INST_RETURN_IMM: { int code = TclGetInt4AtPtr(pc+1); int level = TclGetUInt4AtPtr(pc+5); /* * OBJ_AT_TOS is returnOpts, OBJ_UNDER_TOS is resultObjPtr. |
︙ | ︙ | |||
2461 2462 2463 2464 2465 2466 2467 | } #endif goto checkForCatch; } (void) POP_OBJECT(); goto abnormalReturn; | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | | < < < < < < < < < < < < < < < < < < | < < < < < < < < < < < < < < < < < < < < < < < < < < | 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 | } #endif goto checkForCatch; } (void) POP_OBJECT(); goto abnormalReturn; case INST_PUSH4: objResultPtr = codePtr->objArrayPtr[TclGetUInt4AtPtr(pc+1)]; TRACE_WITH_OBJ(("%u => ", TclGetUInt4AtPtr(pc+1)), objResultPtr); NEXT_INST_F(5, 0, 1); case INST_POP: TRACE_WITH_OBJ(("=> discarding "), OBJ_AT_TOS); objPtr = POP_OBJECT(); TclDecrRefCount(objPtr); NEXT_INST_F(1, 0, 0); case INST_NOP: NEXT_INST_F(1, 0, 0); case INST_DUP: objResultPtr = OBJ_AT_TOS; TRACE_WITH_OBJ(("=> "), objResultPtr); NEXT_INST_F(1, 0, 1); case INST_OVER: |
︙ | ︙ | |||
7098 7099 7100 7101 7102 7103 7104 7105 7106 7107 7108 7109 7110 7111 | iPtr->cmdFramePtr = bcFramePtr->nextPtr; if (--codePtr->refCount <= 0) { TclCleanupByteCode(codePtr); } TclStackFree(interp, TD); /* free my stack */ return result; } #undef codePtr #undef iPtr #undef bcFramePtr #undef initCatchTop #undef initTosPtr | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 7045 7046 7047 7048 7049 7050 7051 7052 7053 7054 7055 7056 7057 7058 7059 7060 7061 7062 7063 7064 7065 7066 7067 7068 7069 7070 7071 7072 7073 7074 7075 7076 7077 7078 7079 7080 7081 7082 7083 7084 7085 7086 7087 7088 7089 7090 7091 7092 7093 7094 7095 | iPtr->cmdFramePtr = bcFramePtr->nextPtr; if (--codePtr->refCount <= 0) { TclCleanupByteCode(codePtr); } TclStackFree(interp, TD); /* free my stack */ return result; /* * INST_START_CMD failure case removed where it doesn't bother that much * * Remark that if the interpreter is marked for deletion its * compileEpoch is modified, so that the epoch check also verifies * that the interp is not deleted. If no outside call has been made * since the last check, it is safe to omit the check. * case INST_START_CMD: */ instStartCmdFailed: { const char *bytes; checkInterp = 1; length = 0; /* * We used to switch to direct eval; for NRE-awareness we now * compile and eval the command so that this evaluation does not * add a new TEBC instance. [Bug 2910748] */ if (TclInterpReady(interp) == TCL_ERROR) { goto gotError; } codePtr->flags |= TCL_BYTECODE_RECOMPILE; bytes = GetSrcInfoForPc(pc, codePtr, &length, NULL); opnd = TclGetUInt4AtPtr(pc+1); pc += (opnd-1); PUSH_OBJECT(Tcl_NewStringObj(bytes, length)); goto instEvalStk; NEXT_INST_F(9, 0, 0); } } #undef codePtr #undef iPtr #undef bcFramePtr #undef initCatchTop #undef initTosPtr |
︙ | ︙ |