Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | [kennykb-numerics-branch] * generic/tclExecute.c: Updated TclIncrObj() to more efficiently add native long integers. Also updated IllegalExprOperandType and the INST_UMINUS, INST_UPLUS, INST_BITNOT, and INST_TRY_CVT_TO_NUMERIC sections for performance. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | kennykb-numerics-branch |
Files: | files | file ages | folders |
SHA1: |
8d4c5bb62b42586697bc5151e19be0ae |
User & Date: | dgp 2005-10-04 21:02:29.000 |
Context
2005-10-05
| ||
16:28 |
[kennykb-numerics-branch] * generic/tclExecute.c: Improved performance INST_MULT an...check-in: 4ab5ab7388 user: dgp tags: kennykb-numerics-branch | |
2005-10-04
| ||
21:02 |
[kennykb-numerics-branch] * generic/tclExecute.c: Updated TclIncrObj() to more effi...check-in: 8d4c5bb62b user: dgp tags: kennykb-numerics-branch | |
18:33 |
[kennykb-numerics-branch] * generic/tclExecute.c: Updated TclIncrObj() to more effi...check-in: 53add32158 user: dgp tags: kennykb-numerics-branch | |
Changes
Changes to ChangeLog.
1 2 3 4 5 6 | 2005-10-04 Don Porter <[email protected]> [kennykb-numerics-branch] * generic/tclExecute.c: Updated TclIncrObj() to more efficiently add native long integers. Also updated IllegalExprOperandType | > | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | 2005-10-04 Don Porter <[email protected]> [kennykb-numerics-branch] * generic/tclExecute.c: Updated TclIncrObj() to more efficiently add native long integers. Also updated IllegalExprOperandType and the INST_UMINUS, INST_UPLUS, INST_BITNOT, and INST_TRY_CVT_TO_NUMERIC sections for performance. * generic/tclBasic.c: Updated more callers to make use of TclGetNumberFromObj. Removed some dead code. 2005-10-03 Don Porter <[email protected]> [kennykb-numerics-branch] |
︙ | ︙ |
Changes to generic/tclExecute.c.
︙ | ︙ | |||
8 9 10 11 12 13 14 | * Copyright (c) 2001 by Kevin B. Kenny. All rights reserved. * Copyright (c) 2002-2005 by Miguel Sofer. * Copyright (c) 2005 by Donal K. Fellows. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * | | | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | * Copyright (c) 2001 by Kevin B. Kenny. All rights reserved. * Copyright (c) 2002-2005 by Miguel Sofer. * Copyright (c) 2005 by Donal K. Fellows. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * * RCS: @(#) $Id: tclExecute.c,v 1.167.2.45 2005/10/04 21:02:30 dgp Exp $ */ #include "tclInt.h" #include "tclCompile.h" #include "tommath.h" #include <math.h> |
︙ | ︙ | |||
5296 5297 5298 5299 5300 5301 5302 | case INST_TRY_CVT_TO_NUMERIC: { /* * Try to convert the topmost stack object to numeric object. * This is done in order to support [expr]'s policy of interpreting * operands if at all possible as numbers first, then strings. */ | < | < < < < < < | | < < < < < < < < < < < < < < < < < < < < | | < < < < < | < < < < < < < < < | | < < | < < < < < < < < < < < < < < < < < < < < | < < < < | < < < < < < < | < < < < < < | > | < < < < | | < < < < < > > > | > > > > > | > | | < < > | | | | | | | | | | | | | | | | | | | | | | | | | | < | | < < < < < < < < < < < < < < < | 5296 5297 5298 5299 5300 5301 5302 5303 5304 5305 5306 5307 5308 5309 5310 5311 5312 5313 5314 5315 5316 5317 5318 5319 5320 5321 5322 5323 5324 5325 5326 5327 5328 5329 5330 5331 5332 5333 5334 5335 5336 5337 5338 5339 5340 5341 5342 5343 5344 5345 5346 5347 5348 5349 5350 5351 5352 5353 5354 5355 5356 5357 5358 5359 5360 5361 5362 5363 5364 5365 5366 5367 5368 5369 5370 5371 5372 5373 | case INST_TRY_CVT_TO_NUMERIC: { /* * Try to convert the topmost stack object to numeric object. * This is done in order to support [expr]'s policy of interpreting * operands if at all possible as numbers first, then strings. */ ClientData ptr; int type; Tcl_Obj *valuePtr = *tosPtr; if (TclGetNumberFromObj(NULL, valuePtr, &ptr, &type) != TCL_OK) { if (*pc == INST_UPLUS) { /* ... +$NonNumeric => raise an error */ result = TCL_ERROR; TRACE(("\"%.20s\" => ILLEGAL TYPE %s \n", O2S(valuePtr), (valuePtr->typePtr? valuePtr->typePtr->name : "null"))); IllegalExprOperandType(interp, pc, valuePtr); goto checkForCatch; } else { /* ... TryConvertToNumeric($NonNumeric) is acceptable */ TRACE(("\"%.20s\" => not numeric\n", O2S(valuePtr))); NEXT_INST_F(1, 0, 0); } } #ifndef ACCEPT_NAN if (type == TCL_NUMBER_NAN) { result = TCL_ERROR; if (*pc == INST_UPLUS) { /* ... +$NonNumeric => raise an error */ TRACE(("\"%.20s\" => ILLEGAL TYPE %s \n", O2S(valuePtr), (valuePtr->typePtr? valuePtr->typePtr->name : "null"))); IllegalExprOperandType(interp, pc, valuePtr); } else { /* Numeric conversion of NaN -> error */ TRACE(("\"%.20s\" => IEEE FLOATING PT ERROR\n", O2S(objResultPtr))); TclExprFloatError(interp, *((CONST double *)ptr)); } goto checkForCatch; } #endif /* * Ensure that the numeric value has a string rep the same as * the formatted version of its internal rep. This is used, e.g., * to make sure that "expr {0001}" yields "1", not "0001". * We implement this by _discarding_ the string rep since we * know it will be regenerated, if needed later, by formatting * the internal rep's value. */ if (valuePtr->bytes == NULL) { TRACE(("\"%.20s\" => numeric, same Tcl_Obj\n", O2S(valuePtr))); NEXT_INST_F(1, 0, 0); } if (Tcl_IsShared(valuePtr)) { /* * Here we do some surgery within the Tcl_Obj internals. * We want to copy the intrep, but not the string, so we * temporarily hide the string so we do not copy it. */ char *savedString = valuePtr->bytes; valuePtr->bytes = NULL; objResultPtr = Tcl_DuplicateObj(valuePtr); valuePtr->bytes = savedString; TRACE(("\"%.20s\" => numeric, new Tcl_Obj\n", O2S(valuePtr))); NEXT_INST_F(1, 1, 1); } TclInvalidateStringRep(valuePtr); TRACE(("\"%.20s\" => numeric, same Tcl_Obj\n", O2S(valuePtr))); NEXT_INST_F(1, 0, 0); } case INST_BREAK: DECACHE_STACK_INFO(); Tcl_ResetResult(interp); CACHE_STACK_INFO(); result = TCL_BREAK; |
︙ | ︙ |