Tcl Source Code

Check-in [03f3ae79e3]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Merge to feature branch
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | dkf-notifier-poll
Files: files | file ages | folders
SHA1: 03f3ae79e36fed80d83121ef98801fab6748ee7f
User & Date: dkf 2011-03-22 11:21:09
Context
2011-03-24
06:23
Merge to feature branch check-in: 6968a9adbd user: dkf tags: dkf-notifier-poll
2011-03-22
11:21
Merge to feature branch check-in: 03f3ae79e3 user: dkf tags: dkf-notifier-poll
11:20
Restore build-ability and fix mixed up ordering assumptions. check-in: 2870a0fa35 user: dkf tags: dkf-notifier-poll
10:52
simpler initialization of Cache under HAVE_FAST_TSD, from mig-alloc-reform. check-in: 46389c7b91 user: mig tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to ChangeLog.

















1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
















2011-03-20  Miguel Sofer  <[email protected]>

	* generic/tclThreadAlloc.c: imported HAVE_FAST_TSD support from
	mig-alloc-reform. The feature has to be enabled by hand: no
	autoconf support has been added. It is not clear how universal
	a build using this will be: it also requires some loader support.

2011-03-17  Donal K. Fellows  <[email protected]>

	* generic/tclCompExpr.c (ParseExpr): Generate errorCode information on
	failure to parse expressions.

2011-03-17  Jan Nijtmans  <[email protected]>

	* generic/tkMain.c: [Patch 3124683]: Reorganize the platform-specific
	stuff in (tcl|tk)Main.c.

2011-03-16  Jan Nijtmans  <[email protected]>

	* generic/tclCkalloc.c: [Bug 3197864]: Pointer truncation on Win64
	TCL_MEM_DEBUG builds.

>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>














|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
2011-03-22  Miguel Sofer  <[email protected]>

	* generic/tclThreadAlloc.c: simpler initialization of Cache
	under HAVE_FAST_TSD, from mig-alloc-reform.

2011-03-21  Jan Nijtmans  <[email protected]>

	* unix/tclLoadDl.c:    [Bug #3216070] Loading extension libraries
	* unix/tclLoadDyld.c:  from embedded Tcl applications.

2011-03-21  Miguel Sofer  <[email protected]>

	* generic/tclCkAlloc.c:
	* generic/tclInt.h: remove one level of allocator indirection in
	non memdebug builds, imported from mig-alloc-reform.

2011-03-20  Miguel Sofer  <[email protected]>

	* generic/tclThreadAlloc.c: imported HAVE_FAST_TSD support from
	mig-alloc-reform. The feature has to be enabled by hand: no
	autoconf support has been added. It is not clear how universal
	a build using this will be: it also requires some loader support.

2011-03-17  Donal K. Fellows  <[email protected]>

	* generic/tclCompExpr.c (ParseExpr): Generate errorCode information on
	failure to parse expressions.

2011-03-17  Jan Nijtmans  <[email protected]>

	* generic/tclMain.c: [Patch 3124683]: Reorganize the platform-specific
	stuff in (tcl|tk)Main.c.

2011-03-16  Jan Nijtmans  <[email protected]>

	* generic/tclCkalloc.c: [Bug 3197864]: Pointer truncation on Win64
	TCL_MEM_DEBUG builds.

Changes to generic/tclCkalloc.c.

16
17
18
19
20
21
22






23
24
25
26
27
28
29
 */

#include "tclInt.h"

#define FALSE	0
#define TRUE	1







#ifdef TCL_MEM_DEBUG

/*
 * One of the following structures is allocated each time the
 * "memory tag" command is invoked, to hold the current tag.
 */








>
>
>
>
>
>







16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
 */

#include "tclInt.h"

#define FALSE	0
#define TRUE	1

#undef Tcl_Alloc
#undef Tcl_Free
#undef Tcl_Realloc
#undef Tcl_AttemptAlloc
#undef Tcl_AttemptRealloc

#ifdef TCL_MEM_DEBUG

/*
 * One of the following structures is allocated each time the
 * "memory tag" command is invoked, to hold the current tag.
 */

732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
 *
 * Side effects:
 *	Same as the debug versions.
 *
 *----------------------------------------------------------------------
 */

#undef Tcl_Alloc
#undef Tcl_Free
#undef Tcl_Realloc
#undef Tcl_AttemptAlloc
#undef Tcl_AttemptRealloc

char *
Tcl_Alloc(
    unsigned int size)
{
    return Tcl_DbCkalloc(size, "unknown", 0);
}








<
<
<
<
<
<







738
739
740
741
742
743
744






745
746
747
748
749
750
751
 *
 * Side effects:
 *	Same as the debug versions.
 *
 *----------------------------------------------------------------------
 */







char *
Tcl_Alloc(
    unsigned int size)
{
    return Tcl_DbCkalloc(size, "unknown", 0);
}

Changes to generic/tclInt.h.

4623
4624
4625
4626
4627
4628
4629






4630
4631
4632
4633
4634
4635
4636
#else
#define NRE_ASSERT(expr)
#endif

#include "tclIntDecls.h"
#include "tclIntPlatDecls.h"
#include "tclTomMathDecls.h"







#endif /* _TCLINT */

/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4







>
>
>
>
>
>







4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
#else
#define NRE_ASSERT(expr)
#endif

#include "tclIntDecls.h"
#include "tclIntPlatDecls.h"
#include "tclTomMathDecls.h"

#if !defined(USE_TCL_STUBS) && !defined(TCL_MEM_DEBUG)
#define Tcl_AttemptAlloc(size)        TclpAlloc(size)
#define Tcl_AttemptRealloc(ptr, size) TclpRealloc((ptr), (size))
#define Tcl_Free(ptr)                 TclpFree(ptr)
#endif

#endif /* _TCLINT */

/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4

Changes to generic/tclThreadAlloc.c.

144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
static Tcl_Mutex *objLockPtr;
static Cache sharedCache;
static Cache *sharedPtr = &sharedCache;
static Cache *firstCachePtr = &sharedCache;

#if defined(HAVE_FAST_TSD)
static __thread Cache *tcachePtr;
static __thread int allocInitialized = 0;

# define GETCACHE(cachePtr)			\
    do {					\
	if (!allocInitialized) {		\
	    allocInitialized = 1;		\
	    tcachePtr = GetCache();				\
	}					\
	(cachePtr) = tcachePtr;			\
    } while (0)
#else
# define GETCACHE(cachePtr)			\
    do {					\
	(cachePtr) = TclpGetAllocCache();	\







<



|
<
|







144
145
146
147
148
149
150

151
152
153
154

155
156
157
158
159
160
161
162
static Tcl_Mutex *objLockPtr;
static Cache sharedCache;
static Cache *sharedPtr = &sharedCache;
static Cache *firstCachePtr = &sharedCache;

#if defined(HAVE_FAST_TSD)
static __thread Cache *tcachePtr;


# define GETCACHE(cachePtr)			\
    do {					\
	if (!tcachePtr) {			\

	    tcachePtr = GetCache();		\
	}					\
	(cachePtr) = tcachePtr;			\
    } while (0)
#else
# define GETCACHE(cachePtr)			\
    do {					\
	(cachePtr) = TclpGetAllocCache();	\

Changes to unix/tclLoadDl.c.

15
16
17
18
19
20
21
22
23
24

25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#   include "../compat/dlfcn.h"
#else
#   include <dlfcn.h>
#endif

/*
 * In some systems, like SunOS 4.1.3, the RTLD_NOW flag isn't defined and this
 * argument to dlopen must always be 1. The RTLD_GLOBAL flag is needed on some
 * systems (e.g. SCO and UnixWare) but doesn't exist on others; if it doesn't
 * exist, set it to 0 so it has no effect.

 */

#ifndef RTLD_NOW
#   define RTLD_NOW 1
#endif

#ifndef RTLD_GLOBAL
#   define RTLD_GLOBAL 0
#endif

/*
 * Static procedures defined within this file.
 */

static void *		FindSymbol(Tcl_Interp *interp,







|
<
|
>






|
|







15
16
17
18
19
20
21
22

23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#   include "../compat/dlfcn.h"
#else
#   include <dlfcn.h>
#endif

/*
 * In some systems, like SunOS 4.1.3, the RTLD_NOW flag isn't defined and this
 * argument to dlopen must always be 1. The RTLD_LOCAL flag doesn't exist on

 * some platforms; if it doesn't exist, set it to 0 so it has no effect.
 * See [Bug #3216070]
 */

#ifndef RTLD_NOW
#   define RTLD_NOW 1
#endif

#ifndef RTLD_LOCAL
#   define RTLD_LOCAL 0
#endif

/*
 * Static procedures defined within this file.
 */

static void *		FindSymbol(Tcl_Interp *interp,
78
79
80
81
82
83
84



85
86
87
88
89
90
91
92
93
94
95
96



97
98
99
100
101
102
103
104
    /*
     * First try the full path the user gave us. This is particularly
     * important if the cwd is inside a vfs, and we are trying to load using a
     * relative path.
     */

    native = Tcl_FSGetNativePath(pathPtr);



    handle = dlopen(native, RTLD_NOW | RTLD_GLOBAL);
    if (handle == NULL) {
	/*
	 * Let the OS loader examine the binary search path for whatever
	 * string the user gave us which hopefully refers to a file on the
	 * binary path.
	 */

	Tcl_DString ds;
	const char *fileName = Tcl_GetString(pathPtr);

	native = Tcl_UtfToExternalDString(NULL, fileName, -1, &ds);



	handle = dlopen(native, RTLD_NOW | RTLD_GLOBAL);
	Tcl_DStringFree(&ds);
    }

    if (handle == NULL) {
	/*
	 * Write the string to a variable first to work around a compiler bug
	 * in the Sun Forte 6 compiler. [Bug 1503729]







>
>
>
|











>
>
>
|







78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
    /*
     * First try the full path the user gave us. This is particularly
     * important if the cwd is inside a vfs, and we are trying to load using a
     * relative path.
     */

    native = Tcl_FSGetNativePath(pathPtr);
    /*
     * Use (RTLD_NOW|RTLD_LOCAL) always, see [Bug #3216070]
     */
    handle = dlopen(native, RTLD_NOW | RTLD_LOCAL);
    if (handle == NULL) {
	/*
	 * Let the OS loader examine the binary search path for whatever
	 * string the user gave us which hopefully refers to a file on the
	 * binary path.
	 */

	Tcl_DString ds;
	const char *fileName = Tcl_GetString(pathPtr);

	native = Tcl_UtfToExternalDString(NULL, fileName, -1, &ds);
	/*
	 * Use (RTLD_NOW|RTLD_LOCAL) always, see [Bug #3216070]
	 */
	handle = dlopen(native, RTLD_NOW | RTLD_LOCAL);
	Tcl_DStringFree(&ds);
    }

    if (handle == NULL) {
	/*
	 * Write the string to a variable first to work around a compiler bug
	 * in the Sun Forte 6 compiler. [Bug 1503729]

Changes to unix/tclLoadDyld.c.

203
204
205
206
207
208
209



210
211
212
213
214
215
216
217
218
219



220
221
222
223
224
225
226
227
    nativePath = Tcl_FSGetNativePath(pathPtr);

#if TCL_DYLD_USE_DLFCN
#if MAC_OS_X_VERSION_MIN_REQUIRED < 1040
    if (tclMacOSXDarwinRelease >= 8)
#endif
    {



	dlHandle = dlopen(nativePath, RTLD_NOW | RTLD_GLOBAL);
	if (!dlHandle) {
	    /*
	     * Let the OS loader examine the binary search path for whatever
	     * string the user gave us which hopefully refers to a file on the
	     * binary path.
	     */

	    fileName = Tcl_GetString(pathPtr);
	    nativeFileName = Tcl_UtfToExternalDString(NULL, fileName, -1, &ds);



	    dlHandle = dlopen(nativeFileName, RTLD_NOW | RTLD_GLOBAL);
	}
	if (dlHandle) {
	    TclLoadDbgMsg("dlopen() successful");
	} else {
	    errMsg = dlerror();
	    TclLoadDbgMsg("dlopen() failed: %s", errMsg);
	}







>
>
>
|









>
>
>
|







203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
    nativePath = Tcl_FSGetNativePath(pathPtr);

#if TCL_DYLD_USE_DLFCN
#if MAC_OS_X_VERSION_MIN_REQUIRED < 1040
    if (tclMacOSXDarwinRelease >= 8)
#endif
    {
    /*
     * Use (RTLD_NOW|RTLD_LOCAL) always, see [Bug #3216070]
     */
	dlHandle = dlopen(nativePath, RTLD_NOW | RTLD_LOCAL);
	if (!dlHandle) {
	    /*
	     * Let the OS loader examine the binary search path for whatever
	     * string the user gave us which hopefully refers to a file on the
	     * binary path.
	     */

	    fileName = Tcl_GetString(pathPtr);
	    nativeFileName = Tcl_UtfToExternalDString(NULL, fileName, -1, &ds);
	    /*
	     * Use (RTLD_NOW|RTLD_LOCAL) always, see [Bug #3216070]
	     */
	    dlHandle = dlopen(nativeFileName, RTLD_NOW | RTLD_LOCAL);
	}
	if (dlHandle) {
	    TclLoadDbgMsg("dlopen() successful");
	} else {
	    errMsg = dlerror();
	    TclLoadDbgMsg("dlopen() failed: %s", errMsg);
	}