Tcl Source Code

Check-in [aebc5a42cc]
Login

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

Overview
Comment:simpler initialization
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | mig-alloc-reform
Files: files | file ages | folders
SHA1: aebc5a42ccda5a31b8dc96412fc6f1b1fde361bc
User & Date: mig 2011-03-21 16:37:44
Context
2011-03-22
11:01
merge trunk to feature branch check-in: 2963951bab user: mig tags: mig-alloc-reform
2011-03-21
16:37
simpler initialization check-in: aebc5a42cc user: mig tags: mig-alloc-reform
14:38
fix last commit check-in: 54811e2ece user: mig tags: mig-alloc-reform
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to generic/tclAlloc.c.

306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353

static void	LockBucket(Cache *cachePtr, int bucket);
static void	UnlockBucket(Cache *cachePtr, int bucket);
static void	PutBlocks(Cache *cachePtr, int bucket, int numMove);

#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();	\
	if ((cachePtr) == NULL) {		\
	    (cachePtr) = GetCache();		\
	}					\
    } while (0)
#endif
#else /* NOT THREADS! */

static int allocInitialized = 0;

#define TclpSetAllocCache()
#define PutBlocks(cachePtr, bucket, numMove) 
#define firstCachePtr sharedCachePtr

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

static void *
TclpGetAllocCache(void)
{
    if (!allocInitialized) {
	allocInitialized = 1;







<



|
<
|














<
<






|
<


|







306
307
308
309
310
311
312

313
314
315
316

317
318
319
320
321
322
323
324
325
326
327
328
329
330
331


332
333
334
335
336
337
338

339
340
341
342
343
344
345
346
347
348

static void	LockBucket(Cache *cachePtr, int bucket);
static void	UnlockBucket(Cache *cachePtr, int bucket);
static void	PutBlocks(Cache *cachePtr, int bucket, int numMove);

#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();	\
	if ((cachePtr) == NULL) {		\
	    (cachePtr) = GetCache();		\
	}					\
    } while (0)
#endif
#else /* NOT THREADS! */



#define TclpSetAllocCache()
#define PutBlocks(cachePtr, bucket, numMove) 
#define firstCachePtr sharedCachePtr

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

	    GetCache();				\
	}					\
	(cachePtr) = sharedPtr;			\
    } while (0)

static void *
TclpGetAllocCache(void)
{
    if (!allocInitialized) {
	allocInitialized = 1;