From db8435f4f6d903ab177a991ed393676493928b77 Mon Sep 17 00:00:00 2001 From: das Date: Sat, 10 Nov 2007 20:49:42 +0000 Subject: * unix/tclUnixTime.c (TclpWideClicksToNanoseconds): fix issues with * generic/tclInt.h: int64_t overflow. --- ChangeLog | 55 +++++++++++++++++++++++++++++------------------------- generic/tclInt.h | 4 ++-- unix/tclUnixTime.c | 10 +++++----- 3 files changed, 37 insertions(+), 32 deletions(-) diff --git a/ChangeLog b/ChangeLog index a3f6358..46cf11a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,36 +1,41 @@ +2007-11-11 Daniel Steffen + + * unix/tclUnixTime.c (TclpWideClicksToNanoseconds): fix issues with + * generic/tclInt.h: int64_t overflow. + 2007-11-10 Miguel Sofer * generic/tclBasic.c: * generic/tclInt.h: - * tests/interp.test ( + * tests/interp.test: * unix/tclUnixInit.c: - * win/tclWin32Dll.c: restore simpler behaviour for stack checking, - not adaptive to stack size changes after a thread is - launched. Consensus is that "nobody does that", and so it is not - worth the cost. Improved failure comments (mistachkin). + * win/tclWin32Dll.c: restore simpler behaviour for stack checking, not + adaptive to stack size changes after a thread is launched. Consensus + is that "nobody does that", and so it is not worth the cost. Improved + failure comments (mistachkin). 2007-11-10 Kevin Kenny - * win/tclWin32Dll.c: Rewrote the Windows stack checking algorithm - to use information from VirtualQuery to determine the bound of the - stack. This change fixes a bug where the guard page of the stack - was never restored after an overflow. It also eliminates a nasty - piece of assembly code for structured exception handling on - mingw. It introduces an assumption that the stack is a single - memory arena returned from VirtualAlloc, but the code in MSVCRT - makes the same assumption, so it should be fairly safe. - + * win/tclWin32Dll.c: Rewrote the Windows stack checking algorithm to + use information from VirtualQuery to determine the bound of the stack. + This change fixes a bug where the guard page of the stack was never + restored after an overflow. It also eliminates a nasty piece of + assembly code for structured exception handling on mingw. It + introduces an assumption that the stack is a single memory arena + returned from VirtualAlloc, but the code in MSVCRT makes the same + assumption, so it should be fairly safe. + 2007-11-10 Miguel Sofer * generic/tclBasic.c: * generic/tclInt.h: * unix/tclUnixInit.c: * unix/tclUnixPort.h: - * win/tclWin32Dll.c: modify the stack checking algorithm to - recheck in case of failure. The working assumptions are now that - (a) a thread's stack is never moved, and (b) a thread's stack can - grow but not shrink. Port to windows - could be more efficient, - but is already cheaper than it was. + * win/tclWin32Dll.c: modify the stack checking algorithm to recheck in + case of failure. The working assumptions are now that (a) a thread's + stack is never moved, and (b) a thread's stack can grow but not + shrink. Port to windows - could be more efficient, but is already + cheaper than it was. 2007-11-09 Miguel Sofer @@ -41,10 +46,10 @@ * generic/tclExecute.c: * generic/tclInt.h: * generic/tclUnixInit.c: - * generic/tclUnixPort.h: new fields in interp (ekeko!) to cache - TSD data that is accessed at each command invocation, access - macros to replace Tcl_AsyncReady and TclpCheckStackSpace by much - faster variants [Patch 1829248] + * generic/tclUnixPort.h: new fields in interp (ekeko!) to cache TSD + data that is accessed at each command invocation, access macros to + replace Tcl_AsyncReady and TclpCheckStackSpace by much faster + variants. [Patch 1829248] 2007-11-09 Jeff Hobbs @@ -54,7 +59,7 @@ For INST_STR_MATCH, ignore pattern type for TclByteArrayMatch case. * generic/tclBinary.c (Tcl_GetByteArrayFromObj): check type before - func jump (perf) + func jump (perf). 2007-11-07 Jeff Hobbs @@ -76,7 +81,7 @@ handler that is faster (functions to do the encoding know exactly what they're doing instead of pulling it from a table, though the table itself has to be retained for use by shift encodings that depend on - iso8859-1.) [Patch 1826906], committing for dkf. + iso8859-1). [Patch 1826906], committing for dkf. 2007-11-05 Andreas Kupries diff --git a/generic/tclInt.h b/generic/tclInt.h index 6a72767..48e20b2 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -13,7 +13,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclInt.h,v 1.340 2007/11/10 19:01:35 msofer Exp $ + * RCS: @(#) $Id: tclInt.h,v 1.341 2007/11/10 20:49:43 das Exp $ */ #ifndef _TCLINT @@ -2602,7 +2602,7 @@ MODULE_SCOPE void TclpFinalizeThreadDataThread(void); MODULE_SCOPE void TclFinalizeThreadStorage(void); #ifdef TCL_WIDE_CLICKS MODULE_SCOPE Tcl_WideInt TclpGetWideClicks(void); -MODULE_SCOPE Tcl_WideInt TclpWideClicksToNanoseconds(Tcl_WideInt clicks); +MODULE_SCOPE double TclpWideClicksToNanoseconds(Tcl_WideInt clicks); #endif MODULE_SCOPE Tcl_Obj * TclDisassembleByteCodeObj(Tcl_Obj *objPtr); diff --git a/unix/tclUnixTime.c b/unix/tclUnixTime.c index 770f904..2fb1782 100644 --- a/unix/tclUnixTime.c +++ b/unix/tclUnixTime.c @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclUnixTime.c,v 1.31 2007/08/03 13:51:41 dkf Exp $ + * RCS: @(#) $Id: tclUnixTime.c,v 1.32 2007/11/10 20:49:43 das Exp $ */ #include "tclInt.h" @@ -192,11 +192,11 @@ TclpGetWideClicks(void) *----------------------------------------------------------------------------- */ -Tcl_WideInt +double TclpWideClicksToNanoseconds( Tcl_WideInt clicks) { - Tcl_WideInt nsec; + double nsec; if (tclGetTimeProcPtr != NativeGetTime) { nsec = clicks * 1000; @@ -210,9 +210,9 @@ TclpWideClicksToNanoseconds( maxClicksForUInt64 = UINT64_MAX / tb.numer; } if ((uint64_t) clicks < maxClicksForUInt64) { - nsec = (Tcl_WideInt) ((uint64_t) clicks * tb.numer / tb.denom); + nsec = ((uint64_t) clicks) * tb.numer / tb.denom; } else { - nsec = (Tcl_WideInt) ((long double) clicks * tb.numer / tb.denom); + nsec = ((long double) (uint64_t) clicks) * tb.numer / tb.denom; } #else #error Wide high-resolution clicks not implemented on this platform -- cgit v0.12