diff options
author | Miguel Sofer <miguel.sofer@gmail.com> | 2008-07-31 14:43:35 (GMT) |
---|---|---|
committer | Miguel Sofer <miguel.sofer@gmail.com> | 2008-07-31 14:43:35 (GMT) |
commit | 53bc9e6c6a1e6f0cfa6ad54e6c95be54753e3b49 (patch) | |
tree | 6c96fbd692f683a13fbe376d5e0fb3f7aec3a3b5 | |
parent | 8b4bd2bb9a913d76dbb65ca98921a537bce251fd (diff) | |
download | tcl-53bc9e6c6a1e6f0cfa6ad54e6c95be54753e3b49.zip tcl-53bc9e6c6a1e6f0cfa6ad54e6c95be54753e3b49.tar.gz tcl-53bc9e6c6a1e6f0cfa6ad54e6c95be54753e3b49.tar.bz2 |
Dumped tclNRE.h's contents into tclInt.h. The file is now empty and
unrefernced everywhere but in macosx/Tcl.xcodeproj/project.pbxproj: some
knowledgeable maintainer please remove tclNRE.h after making sure it
doesn't break the build on macosx
-rw-r--r-- | ChangeLog | 15 | ||||
-rw-r--r-- | generic/tclBasic.c | 8 | ||||
-rw-r--r-- | generic/tclDictObj.c | 3 | ||||
-rw-r--r-- | generic/tclExecute.c | 14 | ||||
-rw-r--r-- | generic/tclInt.h | 67 | ||||
-rw-r--r-- | generic/tclInterp.c | 3 | ||||
-rw-r--r-- | generic/tclNRE.h | 91 | ||||
-rw-r--r-- | generic/tclNamesp.c | 3 | ||||
-rw-r--r-- | generic/tclOOBasic.c | 7 | ||||
-rw-r--r-- | generic/tclOOInt.h | 3 | ||||
-rw-r--r-- | generic/tclProc.c | 3 | ||||
-rw-r--r-- | generic/tclTest.c | 3 | ||||
-rw-r--r-- | unix/Makefile.in | 4 |
13 files changed, 106 insertions, 118 deletions
@@ -1,5 +1,20 @@ 2008-07-30 Miguel Sofer <msofer@users.sf.net> + * generic/tclBasic.c: Moved the few remaining defs from + * generic/tclDictObj.c: tclNRE.h to tclInt.h, eliminated + * generic/tclExecute.c: inclusion of tclNRE.h everywhere. + * generic/tclInt.h: + * generic/tclInterp.c: The file remains empty; I did not + * generic/tclNRE.h: remove it from CVS as it is referenced + * generic/tclNamesp.c: in macosx/Tcl.xcodeproj/project.pbxproj + * generic/tclOOBasic.c: and I fear to break the build on macosx. + * generic/tclOOInt.h: As soon as that is fixed, the file can + * generic/tclProc.c: be removed. + * generic/tclTest.c: + * unix/Makefile.in: + +2008-07-30 Miguel Sofer <msofer@users.sf.net> + * generic/tclBasic.c: Improved tailcalls. * generic/tclCompile.h: * generic/tclExecute.c: diff --git a/generic/tclBasic.c b/generic/tclBasic.c index b9d7efe..8ffdcef 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -16,7 +16,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclBasic.c,v 1.341 2008/07/31 03:42:15 msofer Exp $ + * RCS: @(#) $Id: tclBasic.c,v 1.342 2008/07/31 14:43:43 msofer Exp $ */ #include "tclInt.h" @@ -26,7 +26,10 @@ #include <limits.h> #include <math.h> #include "tommath.h" -#include "tclNRE.h" + +#if NRE_ENABLE_ASSERTS +#include <assert.h> +#endif /* * Determine whether we're using IEEE floating point @@ -7875,7 +7878,6 @@ TclTailcallObjCmd( Interp *iPtr = (Interp *) interp; Tcl_Obj *listPtr; Namespace *nsPtr = iPtr->varFramePtr->nsPtr; - int count; if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "command ?arg ...?"); diff --git a/generic/tclDictObj.c b/generic/tclDictObj.c index eb56e4a..9531f22 100644 --- a/generic/tclDictObj.c +++ b/generic/tclDictObj.c @@ -9,12 +9,11 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclDictObj.c,v 1.66 2008/07/20 17:55:50 dkf Exp $ + * RCS: @(#) $Id: tclDictObj.c,v 1.67 2008/07/31 14:43:44 msofer Exp $ */ #include "tclInt.h" #include "tommath.h" -#include "tclNRE.h" /* * Forward declaration. diff --git a/generic/tclExecute.c b/generic/tclExecute.c index 9ee7ec0..0645d53 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -14,17 +14,20 @@ * 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.392 2008/07/31 03:42:15 msofer Exp $ + * RCS: @(#) $Id: tclExecute.c,v 1.393 2008/07/31 14:43:44 msofer Exp $ */ #include "tclInt.h" #include "tclCompile.h" #include "tommath.h" -#include "tclNRE.h" #include <math.h> #include <float.h> +#if NRE_ENABLE_ASSERTS +#include <assert.h> +#endif + /* * Hack to determine whether we may expect IEEE floating point. The hack is * formally incorrect in that non-IEEE platforms might have the same precision @@ -1808,8 +1811,8 @@ TclExecuteByteCode( Tcl_NRPostProc *procPtr = callbackPtr->procPtr; ByteCode *newCodePtr = callbackPtr->data[0]; - assert((result==TCL_OK)); - assert((callbackPtr != bottomPtr->rootPtr)); + NRE_ASSERT(result==TCL_OK); + NRE_ASSERT(callbackPtr != bottomPtr->rootPtr); TOP_CB(interp) = callbackPtr->nextPtr; TCLNR_FREE(interp, callbackPtr); @@ -2662,7 +2665,7 @@ TclExecuteByteCode( CACHE_STACK_INFO(); if (TOP_CB(interp) != bottomPtr->rootPtr) { - assert ((result == TCL_OK)); + NRE_ASSERT(result == TCL_OK); pc += pcAdjustment; goto nonRecursiveCallStart; } @@ -7707,6 +7710,7 @@ TclExecuteByteCode( * Start the new bytecode. */ + NRE_ASSERT(result == TCL_OK); goto nonRecursiveCallStart; } Tcl_Panic("TEBC: TRCB sent us a callback we cannot handle! (2)"); diff --git a/generic/tclInt.h b/generic/tclInt.h index fb77ec5..a098b5f 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -10,11 +10,12 @@ * Copyright (c) 2001, 2002 by Kevin B. Kenny. All rights reserved. * Copyright (c) 2007 Daniel A. Steffen <das@users.sourceforge.net> * Copyright (c) 2006-2008 by Joe Mistachkin. All rights reserved. + * Copyright (c) 2008 by Miguel Sofer. All rights reserved. * * 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.381 2008/07/29 18:19:12 msofer Exp $ + * RCS: @(#) $Id: tclInt.h,v 1.382 2008/07/31 14:43:45 msofer Exp $ */ #ifndef _TCLINT @@ -2527,6 +2528,8 @@ MODULE_SCOPE char tclEmptyString; MODULE_SCOPE Tcl_ObjCmdProc TclNRNamespaceObjCmd; MODULE_SCOPE Tcl_ObjCmdProc TclNRApplyObjCmd; MODULE_SCOPE Tcl_ObjCmdProc TclNRUplevelObjCmd; +MODULE_SCOPE Tcl_ObjCmdProc TclTailcallObjCmd; + MODULE_SCOPE int TclNREvalCmd(Tcl_Interp * interp, Tcl_Obj * objPtr, int flags); @@ -4006,6 +4009,7 @@ MODULE_SCOPE void TclBNInitBignumFromWideUInt(mp_int *bignum, * size is dynamic, a panic will be compiled in for the wrong case. * * DO NOT LET THEM CROSS THREAD BOUNDARIES + *---------------------------------------------------------------- */ #define TclSmallAlloc(nbytes, memPtr) \ @@ -4059,6 +4063,67 @@ MODULE_SCOPE void TclBNInitBignumFromWideUInt(mp_int *bignum, } #endif /* TCL_MEM_DEBUG */ +/* + *---------------------------------------------------------------- + * Parameters, structs and macros for the non-recursive engine (NRE) + *---------------------------------------------------------------- + */ + +#define NRE_USE_SMALL_ALLOC 1 /* Only turn off for debugging purposes. */ +#define NRE_ENABLE_ASSERTS 1 + +/* + * This is the main data struct for representing NR commands. It is designed + * to fit in sizeof(Tcl_Obj) in order to exploit the fastest memory allocator + * available. + */ + +typedef struct TEOV_callback { + Tcl_NRPostProc *procPtr; + ClientData data[4]; + struct TEOV_callback *nextPtr; +} TEOV_callback; + +#define TOP_CB(iPtr) (((Interp *)(iPtr))->execEnvPtr->callbackPtr) + +/* + * Inline version of Tcl_NRAddCallback + */ + +#define TclNRAddCallback( \ + interp, \ + postProcPtr, \ + data0, \ + data1, \ + data2, \ + data3) \ + { \ + TEOV_callback *callbackPtr; \ + TCLNR_ALLOC((interp), (callbackPtr)); \ + callbackPtr->procPtr = (postProcPtr); \ + callbackPtr->data[0] = (data0); \ + callbackPtr->data[1] = (data1); \ + callbackPtr->data[2] = (data2); \ + callbackPtr->data[3] = (data3); \ + callbackPtr->nextPtr = TOP_CB(interp); \ + TOP_CB(interp) = callbackPtr; \ + } + +#if NRE_USE_SMALL_ALLOC +#define TCLNR_ALLOC(interp, ptr) TclSmallAllocEx(interp, sizeof(TEOV_callback), (ptr)) +#define TCLNR_FREE(interp, ptr) TclSmallFreeEx((interp), (ptr)) +#else +#define TCLNR_ALLOC(interp, ptr) (ptr = ((ClientData) ckalloc(sizeof(TEOV_callback)))) +#define TCLNR_FREE(interp, ptr) ckfree((char *) (ptr)) +#endif + +#if NRE_ENABLE_ASSERTS +#define NRE_ASSERT(expr) assert((expr)) +#else +#define NRE_ASSERT(expr) +#endif + + #include "tclPort.h" #include "tclIntDecls.h" diff --git a/generic/tclInterp.c b/generic/tclInterp.c index d5736c3..daa705b 100644 --- a/generic/tclInterp.c +++ b/generic/tclInterp.c @@ -10,11 +10,10 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclInterp.c,v 1.94 2008/07/29 05:30:35 msofer Exp $ + * RCS: @(#) $Id: tclInterp.c,v 1.95 2008/07/31 14:43:46 msofer Exp $ */ #include "tclInt.h" -#include "tclNRE.h" /* * A pointer to a string that holds an initialization script that if non-NULL diff --git a/generic/tclNRE.h b/generic/tclNRE.h index 3a5af55..e69de29 100644 --- a/generic/tclNRE.h +++ b/generic/tclNRE.h @@ -1,91 +0,0 @@ -/* - * tclNRE.h -- - * - * This file contains declarations for the infrastructure for - * non-recursive commands. Contents may or may not migrate to tcl.h, - * tcl.decls, tclInt.h and/or tclInt.decls - * - * Copyright (c) 2008 by Miguel Sofer - * - * See the file "license.terms" for information on usage and redistribution of - * this file, and for a DISCLAIMER OF ALL WARRANTIES. - * - * // FIXME: RCS numbering? - * RCS: @(#) $Id: tclNRE.h,v 1.10 2008/07/29 20:53:22 msofer Exp $ - */ - - -#ifndef _TCLNONREC -#define _TCLNONREC - -/***************************************************************************** - * Stuff during devel - *****************************************************************************/ - -#define ENABLE_ASSERTS 0 -#define USE_SMALL_ALLOC 1 /* Only turn off for debugging purposes. */ - -/* - * TEOV_callback - - * - * Main data struct for representing NR commands. It is designed to fit in - * sizeof(Tcl_Obj) in order to exploit the fastest memory allocator available. - */ - -typedef struct TEOV_callback { - Tcl_NRPostProc *procPtr; - ClientData data[4]; - struct TEOV_callback *nextPtr; -} TEOV_callback; - -#define TOP_CB(iPtr) (((Interp *)(iPtr))->execEnvPtr->callbackPtr) - -/* - * Inline version of Tcl_NRAddCallback - */ - -#define TclNRAddCallback( \ - interp, \ - postProcPtr, \ - data0, \ - data1, \ - data2, \ - data3) \ - { \ - TEOV_callback *callbackPtr; \ - TCLNR_ALLOC((interp), (callbackPtr)); \ - callbackPtr->procPtr = (postProcPtr); \ - callbackPtr->data[0] = (data0); \ - callbackPtr->data[1] = (data1); \ - callbackPtr->data[2] = (data2); \ - callbackPtr->data[3] = (data3); \ - callbackPtr->nextPtr = TOP_CB(interp); \ - TOP_CB(interp) = callbackPtr; \ - } - -/* - * Tailcalls! - */ - -MODULE_SCOPE Tcl_ObjCmdProc TclTailcallObjCmd; - - -/***************************************************************************** - * Stuff that goes away: temp during devel - *****************************************************************************/ - -#if USE_SMALL_ALLOC -#define TCLNR_ALLOC(interp, ptr) TclSmallAllocEx(interp, sizeof(TEOV_callback), (ptr)) -#define TCLNR_FREE(interp, ptr) TclSmallFreeEx((interp), (ptr)) -#else -#define TCLNR_ALLOC(interp, ptr) (ptr = ((ClientData) ckalloc(sizeof(TEOV_callback)))) -#define TCLNR_FREE(interp, ptr) ckfree((char *) (ptr)) -#endif - -#if ENABLE_ASSERTS -#include <assert.h> -#else -#define assert(expr) -#endif - -#endif /* _TCLNONREC */ diff --git a/generic/tclNamesp.c b/generic/tclNamesp.c index ff56db7..bad1fc7 100644 --- a/generic/tclNamesp.c +++ b/generic/tclNamesp.c @@ -23,11 +23,10 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclNamesp.c,v 1.172 2008/07/29 05:30:36 msofer Exp $ + * RCS: @(#) $Id: tclNamesp.c,v 1.173 2008/07/31 14:43:47 msofer Exp $ */ #include "tclInt.h" -#include "tclNRE.h" /* * Thread-local storage used to avoid having a global lock on data that is not diff --git a/generic/tclOOBasic.c b/generic/tclOOBasic.c index 1e9bd11..28033cd 100644 --- a/generic/tclOOBasic.c +++ b/generic/tclOOBasic.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: tclOOBasic.c,v 1.8 2008/07/29 05:30:37 msofer Exp $ + * RCS: @(#) $Id: tclOOBasic.c,v 1.9 2008/07/31 14:43:47 msofer Exp $ */ #ifdef HAVE_CONFIG_H @@ -17,7 +17,6 @@ #endif #include "tclInt.h" #include "tclOOInt.h" -#include "tclNRE.h" static inline Tcl_Object *AddConstructionFinalizer(Tcl_Interp *interp); static int FinalizeConstruction(ClientData data[], @@ -39,8 +38,8 @@ static int RestoreFrame(ClientData data[], * createWithNamespace, new). * * Note that this is the only code in this file (or, indeed, the whole of - * TclOO) that uses tclNRE.h; it is the only code that does non-standard - * poking in the NRE guts. + * TclOO) that uses NRE internals; it is the only code that does + * non-standard poking in the NRE guts. * * ---------------------------------------------------------------------- */ diff --git a/generic/tclOOInt.h b/generic/tclOOInt.h index fa7d80e..6b10a40 100644 --- a/generic/tclOOInt.h +++ b/generic/tclOOInt.h @@ -9,12 +9,11 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclOOInt.h,v 1.5 2008/07/18 23:29:44 msofer Exp $ + * RCS: @(#) $Id: tclOOInt.h,v 1.6 2008/07/31 14:43:47 msofer Exp $ */ #include <tclInt.h> #include "tclOO.h" -#include "tclNRE.h" /* * Forward declarations. diff --git a/generic/tclProc.c b/generic/tclProc.c index ea5f617..0cc9ae4 100644 --- a/generic/tclProc.c +++ b/generic/tclProc.c @@ -12,12 +12,11 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclProc.c,v 1.153 2008/07/29 05:30:37 msofer Exp $ + * RCS: @(#) $Id: tclProc.c,v 1.154 2008/07/31 14:43:47 msofer Exp $ */ #include "tclInt.h" #include "tclCompile.h" -#include "tclNRE.h" /* * Variables that are part of the [apply] command implementation and which diff --git a/generic/tclTest.c b/generic/tclTest.c index 1cb6714..60f15a8 100644 --- a/generic/tclTest.c +++ b/generic/tclTest.c @@ -14,12 +14,11 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclTest.c,v 1.120 2008/07/31 00:43:10 msofer Exp $ + * RCS: @(#) $Id: tclTest.c,v 1.121 2008/07/31 14:43:48 msofer Exp $ */ #define TCL_TEST #include "tclInt.h" -#include "tclNRE.h" /* * Required for Testregexp*Cmd diff --git a/unix/Makefile.in b/unix/Makefile.in index a9d2211..adb897f 100644 --- a/unix/Makefile.in +++ b/unix/Makefile.in @@ -4,7 +4,7 @@ # "./configure", which is a configuration script generated by the "autoconf" # program (constructs like "@foo@" will get replaced in the actual Makefile. # -# RCS: @(#) $Id: Makefile.in,v 1.241 2008/07/13 09:03:37 msofer Exp $ +# RCS: @(#) $Id: Makefile.in,v 1.242 2008/07/31 14:43:49 msofer Exp $ VERSION = @TCL_VERSION@ MAJOR_VERSION = @TCL_MAJOR_VERSION@ @@ -957,7 +957,7 @@ COMPILEHDR=$(GENERIC_DIR)/tclCompile.h FSHDR=$(GENERIC_DIR)/tclFileSystem.h IOHDR=$(GENERIC_DIR)/tclIO.h MATHHDRS=$(GENERIC_DIR)/tommath.h $(GENERIC_DIR)/tclTomMath.h -NREHDR=$(GENERIC_DIR)/tclNRE.h +NREHDR=$(GENERIC_DIR)/tclInt.h regcomp.o: $(REGHDRS) $(GENERIC_DIR)/regcomp.c $(GENERIC_DIR)/regc_lex.c \ $(GENERIC_DIR)/regc_color.c $(GENERIC_DIR)/regc_locale.c \ |