Index: /proiecte/swift/trunk/CMakeLists.txt
===================================================================
--- /proiecte/swift/trunk/CMakeLists.txt	(revision 176)
+++ /proiecte/swift/trunk/CMakeLists.txt	(revision 176)
@@ -0,0 +1,16 @@
+cmake_minimum_required (VERSION 2.6) 
+project (SWIFT)
+
+add_definitions ("-Wall -pedantic -fno-strict-aliasing -O2")
+set (CMAKE_C_FLAGS "-std=c99")
+
+#add_definitions(-DSWIFT_USE_CUSTOM_ALLOCATOR)
+#add_definitions(-DSWIFT_USE_CUSTOM_THREAD_ALLOCATOR)
+#add_definitions(-DLOGGING_ON)
+
+if( CMAKE_COMPILER_IS_GNUC OR CMAKE_COMPILER_IS_GNUCXX )
+    add_definitions(-DGNU_COMPILER)
+endif ()
+
+add_subdirectory (src)
+add_subdirectory (test)
Index: /proiecte/swift/trunk/README
===================================================================
--- /proiecte/swift/trunk/README	(revision 176)
+++ /proiecte/swift/trunk/README	(revision 176)
@@ -0,0 +1,4 @@
+
+  SWIFT Parallel Workstealing Scheduler
+  
+  (c) 2009 Ionut Rosoiu <ionut.rosoiu@gmail.com>
Index: /proiecte/swift/trunk/bin/test_fibo.sh
===================================================================
--- /proiecte/swift/trunk/bin/test_fibo.sh	(revision 176)
+++ /proiecte/swift/trunk/bin/test_fibo.sh	(revision 176)
@@ -0,0 +1,17 @@
+#!/bin/bash
+
+if test $# -lt 2; then
+	echo "usage: $0 N NTHREADS"
+	exit 0
+fi
+
+N=$1
+NTHREADS=$2
+TIME=/usr/bin/time
+
+echo "N=$N NTHREADS=$NTHREADS"
+
+$TIME -f "Time for   serial: real=%e user=%U sys=%S" ./test/fibo_serial $N
+$TIME -f "Time for parallel (3 spawns): real=%e user=%U sys=%S" ./test/fibo $NTHREADS $N
+$TIME -f "Time for parallel (2 spawns): real=%e user=%U sys=%s" ./test/fibo_2spawn $NTHREADS $N
+
Index: /proiecte/swift/trunk/bin/test_stack_fibo.sh
===================================================================
--- /proiecte/swift/trunk/bin/test_stack_fibo.sh	(revision 176)
+++ /proiecte/swift/trunk/bin/test_stack_fibo.sh	(revision 176)
@@ -0,0 +1,22 @@
+#!/bin/bash
+
+#
+# Tests for fibo() with stack allocation for the frames and private data
+# have a modified swift_scheduler -> swift_free() where no deallocation
+# occurs because we had stack allocation
+#
+
+if test $# -lt 2; then
+	echo "usage: $0 N NTHREADS"
+	exit 0
+fi
+
+N=$1
+NTHREADS=$2
+TIME=/usr/bin/time
+
+echo "N=$N NTHREADS=$NTHREADS"
+
+$TIME -f "Time for   serial: real=%e user=%U sys=%S" ./test/fibo_serial $N
+$TIME -f "Time for parallel (2 spawns on stack): real=%e user=%U sys=%S" ./test/fibo_stack_2spawns $NTHREADS $N
+
Index: /proiecte/swift/trunk/include/swift.h
===================================================================
--- /proiecte/swift/trunk/include/swift.h	(revision 176)
+++ /proiecte/swift/trunk/include/swift.h	(revision 176)
@@ -0,0 +1,23 @@
+/*
+ * swift.h
+ *
+ * (c) 2009 Ionut Rosoiu <ionut.rosoiu@gmail.com>
+ *
+ */
+
+#ifndef SWIFT_H_
+#define SWIFT_H_
+
+#include "swift_allocator.h"
+#include "swift_assert.h"
+#include "swift_atomic.h"
+#include "swift_backoff.h"
+#include "swift_common.h"
+#include "swift_context.h"
+#include "swift_deque.h"
+#include "swift_dfg.h"
+#include "swift_log.h"
+#include "swift_scheduler.h"
+#include "swift_thread.h"
+
+#endif /* SWIFT_H_ */
Index: /proiecte/swift/trunk/include/swift_allocator.h
===================================================================
--- /proiecte/swift/trunk/include/swift_allocator.h	(revision 176)
+++ /proiecte/swift/trunk/include/swift_allocator.h	(revision 176)
@@ -0,0 +1,41 @@
+/*
+ * swift_allocator.h
+ *
+ * (c) 2009 Ionut Rosoiu <ionut.rosoiu@gmail.com>
+ *
+ */
+
+#ifndef SWIFT_ALLOCATOR_H_
+#define SWIFT_ALLOCATOR_H_
+
+#include <stdlib.h>
+#include "swift_common.h"
+#include "swift_thread.h"
+#include "swift_dfg.h"
+
+/* The address of malloc/realloc is 8 byte alligned */
+#define SWIFT_MALLOC_ALIGN 	8
+
+/* The bucket count (i.e. the number of bites for the platform) */
+#define SWIFT_BUCKET_COUNT	32
+
+#define SWIFT_MEM_ALIGN(size)	\
+	( ((swift_size_t)(size) + (SWIFT_MALLOC_ALIGN) - 1) & (~((SWIFT_MALLOC_ALIGN) - 1)) )
+
+struct swift_allocator_list {
+	void *aligned_addr;
+	void *next;
+};
+
+void* swift_malloc_system(size_t size);
+
+void swift_free_system(void *addr);
+
+void* swift_malloc(swift_thread_t *thread, size_t size);
+
+void swift_free(swift_thread_t *thread, void *addr);
+
+void swift_retire_frame(swift_thread_t *thread, swift_frame_t *frame);
+
+
+#endif /* SWIFT_ALLOCATOR_H_ */
Index: /proiecte/swift/trunk/include/swift_assert.h
===================================================================
--- /proiecte/swift/trunk/include/swift_assert.h	(revision 176)
+++ /proiecte/swift/trunk/include/swift_assert.h	(revision 176)
@@ -0,0 +1,22 @@
+/*
+ * swift_assert.h
+ *
+ * (c) 2009 Ionut Rosoiu <ionut.rosoiu@gmail.com>
+ *
+ */
+
+#ifndef SWIFT_ASSERT_H_
+#define SWIFT_ASSERT_H_
+
+#include <stdio.h>
+
+#define swift_assert(cond)	\
+	do {																\
+		if (!(cond)) {													\
+			printf("Assertion failed: %s:%d\n", __FILE__, __LINE__);		\
+			exit(-1);													\
+		}																\
+	} while(0)
+
+
+#endif /* SWIFT_ASSERT_H_ */
Index: /proiecte/swift/trunk/include/swift_atomic.h
===================================================================
--- /proiecte/swift/trunk/include/swift_atomic.h	(revision 176)
+++ /proiecte/swift/trunk/include/swift_atomic.h	(revision 176)
@@ -0,0 +1,26 @@
+/*
+ * swift_atomic.h
+ *
+ * (c) 2009 Ionut Rosoiu <ionut.rosoiu@gmail.com>
+ *
+ */
+
+#ifndef SWIFT_ATOMIC_H_
+#define SWIFT_ATOMIC_H_
+
+#define SWIFT_ATOMIC_READ(x)	\
+	(x)
+
+#define SWIFT_ATOMIC_WRITE(x, val)	\
+	(x) = (val)
+
+#define SWIFT_ATOMIC_INCR(x)	\
+	__sync_add_and_fetch(&(x), 1)
+
+#define SWIFT_ATOMIC_DECR(x)	\
+	__sync_sub_and_fetch(&(x), 1)
+
+#define SWIFT_CAS(x, comp, val)	\
+	__sync_bool_compare_and_swap((int*)&(x), (comp), (val))
+
+#endif /* SWIFT_ATOMIC_H_ */
Index: /proiecte/swift/trunk/include/swift_backoff.h
===================================================================
--- /proiecte/swift/trunk/include/swift_backoff.h	(revision 176)
+++ /proiecte/swift/trunk/include/swift_backoff.h	(revision 176)
@@ -0,0 +1,17 @@
+/*
+ * swift_backoff.h
+ *
+ * (c) 2009 Ionut Rosoiu <ionut.rosoiu@gmail.com>
+ *
+ */
+
+#ifndef SWIFT_BACKOFF_H_
+#define SWIFT_BACKOFF_H_
+
+#include "swift_common.h"
+#include "swift_thread.h"
+
+void swift_backoff(swift_thread_t *thread);
+
+
+#endif /* SWIFT_BACKOFF_H_ */
Index: /proiecte/swift/trunk/include/swift_common.h
===================================================================
--- /proiecte/swift/trunk/include/swift_common.h	(revision 176)
+++ /proiecte/swift/trunk/include/swift_common.h	(revision 176)
@@ -0,0 +1,56 @@
+/*
+ * swift_common.h
+ *
+ * (c) 2009 Ionut Rosoiu <ionut.rosoiu@gmail.com>
+ *
+ */
+
+#ifndef SWIFT_COMMON_H_
+#define SWIFT_COMMON_H_
+
+#define SWIFT_SUCCESS  			 0
+#define SWIFT_FAILURE 			-1
+#define SWIFT_INVALID_PARAM 	-2
+#define SWIFT_LAST_STATUS_NO 	SWIFT_INVALID_PARAM
+
+typedef int 				swift_status_t;
+typedef unsigned int 		swift_size_t;
+typedef unsigned char 		swift_id_t;
+
+/*
+#define SWIFT_USE_CUSTOM_ALLOCATOR 	1
+#undef SWIFT_USE_CUSTOM_ALLOCATOR
+
+#define SWIFT_USE_CUSTOM_THREAD_ALLOCATOR 1
+#undef SWIFT_USE_CUSTOM_THREAD_ALLOCATOR
+
+#define LOGGING_ON 1
+#undef LOGGING_ON
+*/
+
+#define SWIFT_KB					1024
+#define SWIFT_MB					(SWIFT_KB * SWIFT_KB)
+#define SWIFT_HEAP_SIZE				(100 * SWIFT_MB)
+
+typedef swift_size_t		swift_word_t;
+typedef unsigned long long 	swift_dword_t;
+
+#define SWIFT_CHECK(cond, exec) \
+	do {						\
+		if (!(cond)) { exec; }	\
+	} while (0)
+
+#define SWIFT_RETURN_WITH_STATUS(val)	\
+	do {								\
+		*status = val;					\
+		return;							\
+	} while (0)
+
+#define SWIFT_CHECK_SUCCESS()	\
+	SWIFT_CHECK(SWIFT_SUCCESS == *status, return)
+
+#define SWIFT_CHECK_SUCCESS_RETURN(val) \
+	SWIFT_CHECK(SWIFT_SUCCESS == *status, SWIFT_RETURN_WITH_STATUS(val))
+
+
+#endif /* SWIFT_COMMON_H_ */
Index: /proiecte/swift/trunk/include/swift_compiler.h
===================================================================
--- /proiecte/swift/trunk/include/swift_compiler.h	(revision 176)
+++ /proiecte/swift/trunk/include/swift_compiler.h	(revision 176)
@@ -0,0 +1,19 @@
+/*
+ * swift_compiler.h
+ *
+ * (c) 2009 Ionut Rosoiu <ionut.rosoiu@gmail.com>
+ *
+ */
+
+#ifndef SWIFT_COMPILER_H_
+#define SWIFT_COMPILER_H_
+
+#ifdef GNU_COMPILER
+	#define NO_INLINE __attribute__((noinline))
+	#define HOT __attribute__((hot))
+#else
+	#define NO_INLINE
+	#define HOT
+#endif
+
+#endif /* SWIFT_COMPILER_H_ */
Index: /proiecte/swift/trunk/include/swift_context.h
===================================================================
--- /proiecte/swift/trunk/include/swift_context.h	(revision 176)
+++ /proiecte/swift/trunk/include/swift_context.h	(revision 176)
@@ -0,0 +1,30 @@
+/*
+ * swift_context.h
+ *
+ * (c) 2009 Ionut Rosoiu <ionut.rosoiu@gmail.com>
+ *
+ */
+
+#ifndef SWIFT_CONTEXT_H_
+#define SWIFT_CONTEXT_H_
+
+#include "swift_common.h"
+#include "swift_assert.h"
+#include "swift_declarations.h"
+#include "swift_allocator.h"
+#include "swift_deque.h"
+#include "swift_declarations.h"
+#include "swift_thread.h"
+
+struct swift_context {
+	volatile int parallel_finished; /*< true if the parallel region finished */
+	swift_size_t thread_num;		/*< the number of threads */
+	swift_thread_t *threads;		/*< the threads */
+};
+
+void swift_context_init(swift_context_t *context, swift_size_t nprocs);
+
+void swift_context_destroy(swift_context_t *context);
+
+
+#endif /* SWIFT_CONTEXT_H_ */
Index: /proiecte/swift/trunk/include/swift_declarations.h
===================================================================
--- /proiecte/swift/trunk/include/swift_declarations.h	(revision 176)
+++ /proiecte/swift/trunk/include/swift_declarations.h	(revision 176)
@@ -0,0 +1,26 @@
+/*
+ * swift_declarations.h
+ *
+ * (c) 2009 Ionut Rosoiu <ionut.rosoiu@gmail.com>
+ *
+ */
+
+#ifndef SWIFT_DECLARATIONS_H_
+#define SWIFT_DECLARATIONS_H_
+
+struct swift_thread;
+typedef struct swift_thread swift_thread_t;
+
+struct swift_context;
+typedef struct swift_context swift_context_t;
+
+struct swift_deque;
+typedef struct swift_deque swift_deque_t;
+
+struct swift_frame;
+typedef struct swift_frame swift_frame_t;
+
+struct swift_allocator_list;
+typedef struct swift_allocator_list swift_allocator_list_t;
+
+#endif /* SWIFT_DECLARATIONS_H_ */
Index: /proiecte/swift/trunk/include/swift_deque.h
===================================================================
--- /proiecte/swift/trunk/include/swift_deque.h	(revision 176)
+++ /proiecte/swift/trunk/include/swift_deque.h	(revision 176)
@@ -0,0 +1,79 @@
+/*
+ * swift_deque.h
+ *
+ * (c) 2009 Ionut Rosoiu <ionut.rosoiu@gmail.com>
+ *
+ */
+
+#ifndef SWIFT_DEQUE_H_
+#define SWIFT_DEQUE_H_
+
+#include "swift_atomic.h"
+#include "swift_common.h"
+#include "swift_dfg.h"
+#include "swift_declarations.h"
+#include "swift_memory.h"
+
+#define SWIFT_DEQUE_EMPTY	(SWIFT_LAST_STATUS_NO - 1)
+#define SWIFT_DEQUE_FULL	(SWIFT_DEQUE_EMPTY - 1)
+#define SWIFT_DEQUE_ABORT	(SWIFT_DEQUE_EMPTY - 2)
+
+#define SWIFT_DEQUE_SIZE 30000
+//9128
+
+struct swift_deque {
+	swift_size_t size;				/*< the real size */
+	char _pad1[SWIFT_CACHE_LINE_SIZE - sizeof(swift_size_t)];
+
+	swift_size_t size_mask; 		/*< size-1 used for calculating faster the modulo size */
+	char _pad2[SWIFT_CACHE_LINE_SIZE - sizeof(swift_size_t)];
+
+	volatile swift_dword_t top;		/*< top index (only incremented; written only by the owner) */
+	char _pad3[SWIFT_CACHE_LINE_SIZE - sizeof(swift_dword_t)];
+
+	volatile swift_dword_t top_cached; /*< cached value for the top (top bound) */
+	char _pad4[SWIFT_CACHE_LINE_SIZE - sizeof(swift_dword_t)];
+
+	volatile swift_dword_t bottom;	/*< bottom index */
+	char _pad5[SWIFT_CACHE_LINE_SIZE - sizeof(swift_dword_t)];
+
+	swift_frame_t **elements;		/*< the circular array of frames */
+	char _pad6[SWIFT_CACHE_LINE_SIZE - sizeof(swift_frame_t **)];
+};
+
+#include "swift_allocator.h"
+
+
+/**
+ * Initializes the deque
+ */
+void swift_deque_init(swift_thread_t *thread,
+					  swift_deque_t *q,
+					  swift_size_t size);
+
+/**
+ * Push a frame at the bottom of the deque
+ * @returns status == FULL when queue is full
+ */
+void swift_deque_push(swift_deque_t *q,
+					  swift_frame_t *frame,
+					  swift_status_t *status);
+
+/**
+ * Pop a frame from the bottom of the deque
+ * @returns The pushed frame or NULL in case of failure (status == EMPTY)
+ */
+swift_frame_t* swift_deque_pop(swift_deque_t *q,
+							   swift_status_t *status);
+
+/**
+ * Steal a frame from the top of the deque
+ * @returns The frame stolen or NULL in case of failure (status == (EMPTY || ABORT))
+ */
+swift_frame_t* swift_deque_steal(swift_deque_t *q,
+								 swift_status_t *status);
+
+void swift_deque_destroy(swift_thread_t *thread,
+						 swift_deque_t *q);
+
+#endif /* SWIFT_DEQUE_H_ */
Index: /proiecte/swift/trunk/include/swift_dfg.h
===================================================================
--- /proiecte/swift/trunk/include/swift_dfg.h	(revision 176)
+++ /proiecte/swift/trunk/include/swift_dfg.h	(revision 176)
@@ -0,0 +1,79 @@
+/*
+ * swift_dfg.h
+ *
+ * (c) 2009 Ionut Rosoiu <ionut.rosoiu@gmail.com>
+ *
+ */
+
+#ifndef SWIFT_DFG_H_
+#define SWIFT_DFG_H_
+
+#include "swift_declarations.h"
+#include "swift_common.h"
+
+#define SWIFT_FRAME_END_PARALLEL 0x01  /*< by ending this frame the parallel region has finished */
+
+#define SWIFT_FRAME_SET_END_PARALLEL(frame) \
+	((frame)->flags |= SWIFT_FRAME_END_PARALLEL)
+
+#define SWIFT_FRAME_IS_END_PARALLEL(frame) \
+	((frame)->flags & SWIFT_FRAME_END_PARALLEL)
+
+#define SWIFT_FRAME_ID_MASK		0x0000FFFF
+#define SWIFT_FRAME_ID_OFFSET	0
+#define SWIFT_FRAME_NAME_MASK	0x00FF0000
+#define SWIFT_FRAME_NAME_OFFSET	16
+#define SWIFT_PROC_MASK			0xFF000000
+#define SWIFT_PROC_OFFSET		24
+
+#define SWIFT_FRAME_ID(v)		   ((v) & SWIFT_FRAME_ID_MASK) >> SWIFT_FRAME_ID_OFFSET
+#define SWIFT_FRAME_NAME(v)	(char)(((v) & SWIFT_FRAME_NAME_MASK) >> SWIFT_FRAME_NAME_OFFSET)
+#define SWIFT_PROC(v)			   ((v) & SWIFT_PROC_MASK) >> SWIFT_PROC_OFFSET
+
+#if LOGGING_ON
+#define SWIFT_WRITE_FRAME_INFO(frame, proc, name, id)							\
+	frame->info = ((proc << SWIFT_PROC_OFFSET) & SWIFT_PROC_MASK) |				\
+				  ((name << SWIFT_FRAME_NAME_OFFSET) & SWIFT_FRAME_NAME_MASK) |	\
+				  ((id << SWIFT_FRAME_ID_OFFSET) & SWIFT_FRAME_ID_MASK)
+#else
+#define SWIFT_WRITE_FRAME_INFO(frame, proc, name, id)
+#endif
+
+/**
+ * The closure for this frame
+ */
+typedef void (*swift_closure_handler)(swift_thread_t *thread, struct swift_frame* frame);
+
+/**
+ * The handler to be executed when the frame is finished
+ */
+typedef void (*swift_frame_finished_handler)(swift_thread_t *thread, struct swift_frame* frame);
+
+struct swift_frame {
+	volatile int flags;						/*< frame flags */
+
+#ifdef LOGGING_ON
+	volatile int info;						/*< TODO: frame info (temporary, for debug) */
+	int dbg;
+	swift_id_t creator_id;					/*< the id of the initial creator for the frame */
+#endif
+
+	swift_closure_handler closure;			/*< the closure for this frame */
+
+	volatile int dependencies_no; 			/*< the number of unavailable variables */
+	struct swift_frame *dependencies_frame;	/*< the frame that awaits the unavailable data */
+
+	// closure-dependent data
+	void *private_data;						/*< private data related to each specific closure
+												this gets deallocated when the frame is retired
+											    */
+
+	swift_size_t *sync_frames_remaining;	/*< the number to decrement when finishing execution of this frame */
+
+	// doubly-linked list
+	struct swift_frame *prev;
+	struct swift_frame *next;
+};
+
+
+#endif /* SWIFT_DFG_H_ */
Index: /proiecte/swift/trunk/include/swift_log.h
===================================================================
--- /proiecte/swift/trunk/include/swift_log.h	(revision 176)
+++ /proiecte/swift/trunk/include/swift_log.h	(revision 176)
@@ -0,0 +1,50 @@
+/*
+ * swift_log.h
+ *
+ * (c) 2009 Ionut Rosoiu <ionut.rosoiu@gmail.com>
+ *
+ */
+
+#ifndef SWIFT_LOG_H_
+#define SWIFT_LOG_H_
+
+#include <stdio.h>
+#include "swift_dfg.h"
+
+typedef enum swift_log_level {
+	NONE,
+	FATAL,
+	WARN,
+	INFO,
+	DEBUG
+} swift_log_level_t;
+
+#if LOGGING_ON
+#define SWIFT_LOG(level, ...) 			 \
+	do {								 \
+		fprintf(stderr, __VA_ARGS__);	 \
+		fflush(stderr);					 \
+	} while(0)
+#else
+#define SWIFT_LOG(level, ...)
+#endif
+
+#define SWIFT_LOG_FRAME_INFO(t, f)				\
+	SWIFT_LOG(INFO, "[%d] c=%d f=%c.%d (%d)\n",	\
+			t->id,								\
+			SWIFT_PROC(f->info),				\
+			SWIFT_FRAME_NAME(f->info),			\
+			f->dbg,								\
+			SWIFT_FRAME_ID(f->info))
+
+#define SWIFT_LOG_FRAME_INFO_STR(s, t, f)				\
+	SWIFT_LOG(INFO, "[%d] %s - c=%d f=%c.%d (%d)\n", 	\
+				t->id,									\
+				s,										\
+				SWIFT_PROC(f->info),					\
+				SWIFT_FRAME_NAME(f->info),				\
+				f->dbg,									\
+				SWIFT_FRAME_ID(f->info))
+
+
+#endif /* SWIFT_LOG_H_ */
Index: /proiecte/swift/trunk/include/swift_memory.h
===================================================================
--- /proiecte/swift/trunk/include/swift_memory.h	(revision 176)
+++ /proiecte/swift/trunk/include/swift_memory.h	(revision 176)
@@ -0,0 +1,24 @@
+/*
+ * swift_memory.h
+ *
+ * (c) 2009 Ionut Rosoiu <ionut.rosoiu@gmail.com>
+ *
+ */
+
+#ifndef SWIFT_MEMORY_H_
+#define SWIFT_MEMORY_H_
+
+/* 64b cache line size */
+#define SWIFT_CACHE_LINE_SIZE 64
+
+#define swift_memory_read_barrier() \
+	__asm__ __volatile__ ("" : : : "memory");
+
+#define swift_memory_write_barrier() \
+	__asm__ __volatile__ ("" : : : "memory");
+
+#define swift_memory_barrier() \
+	__asm__ __volatile__ ("" : : : "memory");
+
+
+#endif /* SWIFT_MEMORY_H_ */
Index: /proiecte/swift/trunk/include/swift_scheduler.h
===================================================================
--- /proiecte/swift/trunk/include/swift_scheduler.h	(revision 176)
+++ /proiecte/swift/trunk/include/swift_scheduler.h	(revision 176)
@@ -0,0 +1,47 @@
+/*
+ * swift_scheduler.h
+ *
+ * (c) 2009 Ionut Rosoiu <ionut.rosoiu@gmail.com>
+ *
+ */
+
+#ifndef SWIFT_SCHEDULER_H_
+#define SWIFT_SCHEDULER_H_
+
+#include "swift_common.h"
+#include "swift_backoff.h"
+#include "swift_context.h"
+#include "swift_thread.h"
+#include "swift_deque.h"
+#include "swift_log.h"
+#include "swift_compiler.h"
+
+/**
+ * Try to get a frame either from own workque or from another thread
+ */
+swift_frame_t* swift_get_frame(swift_context_t *context, swift_thread_t *thread);
+
+/**
+ * Get the steal target according to the current steal strategy
+ */
+swift_thread_t* swift_get_steal_target(swift_context_t *context, swift_thread_t* thread);
+
+/**
+ * Try to execute some work either by removing frames from own workqueue, or by stealing
+ */
+void swift_scheduler_execute(swift_thread_t *thread);
+
+/**
+ * Signal the finish of this frame (i.e. decrement the sync number and the data dependencies)
+ */
+void swift_signal_frame_done(swift_thread_t *thread, swift_frame_t *frame);
+
+/**
+ * Retire the frame to the pool
+ * If this is the frame that started the parallel computation, end it
+ */
+void swift_frame_done(swift_context_t *context,
+					  swift_thread_t *thread,
+					  swift_frame_t *frame);
+
+#endif /* SWIFT_SCHEDULER_H_ */
Index: /proiecte/swift/trunk/include/swift_thread.h
===================================================================
--- /proiecte/swift/trunk/include/swift_thread.h	(revision 176)
+++ /proiecte/swift/trunk/include/swift_thread.h	(revision 176)
@@ -0,0 +1,54 @@
+/*
+ * swift_thread.h
+ *
+ * (c) 2009 Ionut Rosoiu <ionut.rosoiu@gmail.com>
+ *
+ */
+
+#ifndef SWIFT_THREAD_H_
+#define SWIFT_THREAD_H_
+
+#include "swift_common.h"
+#include "swift_allocator.h"
+#include "swift_declarations.h"
+#include "swift_context.h"
+#include "swift_deque.h"
+#include <pthread.h>
+
+#define SWIFT_THREAD_RUNNING	0
+#define SWIFT_THREAD_WAITING	1
+
+struct swift_thread {
+	struct swift_context *context;		/*< global info (related to the other threads) */
+	volatile int state;					/*< the state of the thread */
+	volatile int stop;					/*< true if the thread must stop */
+
+	int stats;							/*< thread statistics */
+
+	swift_id_t 	id;						/*< the id of the thread */
+	swift_deque_t workque;				/*< the workqueue */
+
+#ifdef SWIFT_USE_CUSTOM_ALLOCATOR
+	void *heap;							/*< base for the thread's heap */
+	void *heap_top;						/*< the top of the thread's heap */
+	void *heap_limit;					/*< the limit for the thread's heap */
+	swift_allocator_list_t **buckets;	/*< the allocator's buckets */
+#endif
+
+	swift_size_t last_sleep_time;		/*< used by the backoff algorithm (in ns) */
+	swift_size_t round_robin_id;		/*< the last target in a round robin steal search */
+	swift_size_t frame_no;				/*< the number of frames this thread has spawned */
+
+	pthread_t thread;					/*< system-level thread */
+};
+
+typedef void* (*swift_entrypoint_t) (void*);
+
+void swift_thread_start(swift_thread_t *thread,
+						swift_entrypoint_t func);
+
+void swift_thread_wait(swift_thread_t *thread);
+
+
+
+#endif /* SWIFT_THREAD_H_ */
Index: /proiecte/swift/trunk/lib/hoard-371/AUTHORS
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/AUTHORS	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/AUTHORS	(revision 176)
@@ -0,0 +1,1 @@
+Emery Berger <emery@cs.umass.edu>
Index: /proiecte/swift/trunk/lib/hoard-371/COPYING
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/COPYING	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/COPYING	(revision 176)
@@ -0,0 +1,346 @@
+		    GNU GENERAL PUBLIC LICENSE
+		       Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+                       59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+			    Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users.  This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it.  (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.)  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+  To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have.  You must make sure that they, too, receive or can get the
+source code.  And you must show them these terms so they know their
+rights.
+
+  We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+  Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software.  If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+  Finally, any free program is threatened constantly by software
+patents.  We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary.  To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+
+
+		    GNU GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License.  The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language.  (Hereinafter, translation is included without limitation in
+the term "modification".)  Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+  1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+  2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) You must cause the modified files to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    b) You must cause any work that you distribute or publish, that in
+    whole or in part contains or is derived from the Program or any
+    part thereof, to be licensed as a whole at no charge to all third
+    parties under the terms of this License.
+
+    c) If the modified program normally reads commands interactively
+    when run, you must cause it, when started running for such
+    interactive use in the most ordinary way, to print or display an
+    announcement including an appropriate copyright notice and a
+    notice that there is no warranty (or else, saying that you provide
+    a warranty) and that users may redistribute the program under
+    these conditions, and telling the user how to view a copy of this
+    License.  (Exception: if the Program itself is interactive but
+    does not normally print such an announcement, your work based on
+    the Program is not required to print an announcement.)
+
+
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+    a) Accompany it with the complete corresponding machine-readable
+    source code, which must be distributed under the terms of Sections
+    1 and 2 above on a medium customarily used for software interchange; or,
+
+    b) Accompany it with a written offer, valid for at least three
+    years, to give any third party, for a charge no more than your
+    cost of physically performing source distribution, a complete
+    machine-readable copy of the corresponding source code, to be
+    distributed under the terms of Sections 1 and 2 above on a medium
+    customarily used for software interchange; or,
+
+    c) Accompany it with the information you received as to the offer
+    to distribute corresponding source code.  (This alternative is
+    allowed only for noncommercial distribution and only if you
+    received the program in object code or executable form with such
+    an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it.  For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable.  However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+
+  4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License.  Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+  5. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Program or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+  6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+  7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+
+  8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded.  In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+  9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time.  Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation.  If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+  10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission.  For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this.  Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+			    NO WARRANTY
+
+  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+		     END OF TERMS AND CONDITIONS
+
+
+	    How to Apply These Terms to Your New Programs
+
+  If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+  To do so, attach the following notices to the program.  It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the program's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+    Gnomovision version 69, Copyright (C) year name of author
+    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+    This is free software, and you are welcome to redistribute it
+    under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License.  Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary.  Here is a sample; alter the names:
+
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+  `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+  <signature of Ty Coon>, 1 April 1989
+  Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs.  If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library.  If this is what you want to do, use the GNU Library General
+Public License instead of this License.
+
Index: /proiecte/swift/trunk/lib/hoard-371/NEWS
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/NEWS	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/NEWS	(revision 176)
@@ -0,0 +1,268 @@
+
+	      The Hoard Multiprocessor Memory Allocator
+			<http://www.hoard.org>
+
+			 Version Information
+			 -------------------
+
+version 3.7.1:
+	* Fixed a serious bug for Windows in thread reclamation.
+	* Fixed a small memory leak in thread creation.
+	* Initial port to Windows 64.
+
+version 3.7:
+	* Streamlined fast path for allocation, speeding 32 and 64-bit code.
+	* Use pthread_* based thread-specific data for x86-64, where it's faster.
+
+version 3.6.2:
+	* Fixed build for Mac OS X (Darwin).
+	* Fixed to support older versions of Sun compilers.
+	* Added FreeBSD ("freebsd") as a target.
+
+version 3.6.1:
+	* Added x86-64 target for Linux/gcc.
+	* Added support for posix_memalign (for Unix systems).
+	* Added static library build option for Linux.
+
+version 3.6:
+	* Improved performance, especially from thread-specific heap allocation.
+	* Revised algorithm for large objects to reduce mmap fragmentation.
+	* Added support for Solaris x86 (32 and 64 bit).
+	* Fixed a problem for 64-bit builds.
+	* Removed support for Detours.
+	* Restored to top-level status (moved heaplayers to a directory).
+	* Changed thread-specific data for Windows to support use in DLLs.
+	* Build now fully supports Mac OS X (Darwin).
+
+version 3.5.1:
+	* Eliminated a (rare) memory error.
+
+version 3.5.0:
+	* Resolved some cross-platform memory leaks, notably
+        for Windows due to surprising VirtualFree API
+	(which doesn't reclaim memory unless size argument is 0).
+
+version 3.4.0:
+
+        * Added support for X86-64, Apple OS-X,
+	  and Microsoft's Visual Studio 2005.
+
+	* Restored Detours version, but with thread-specific local heaps disabled.
+
+	* Removed all dependencies on STL.
+
+version 3.3.0:
+
+        * Added thread-specific local heaps, which substantially
+	  improve performance by eliminating most atomic operations.
+
+version 3.2.3:
+
+	* Bug fix for Unix platforms, now allowing calls to
+	  pthread_create with a NULL attribute.
+
+	* Added support for ARM architectures.
+
+version 3.2.2:
+
+	* Reduces memory consumption for large objects (Windows).
+
+version 3.2.1:
+
+	* Maintenance release: fixes a bug for 64-bit versions
+	  and changes the Windows build (for winhoard) slightly.
+
+version 3.2:
+
+	* An improved Windows build (see NOTES.windows).
+	* An algorithmic change (essentially a variant of thread-local
+	  allocation buffers) that boosts performance by avoiding atomic
+	  operations.
+
+version 3.1:
+
+	* Several performance optimizations.
+	* A minor bug fix for non-Windows platforms.
+
+version 3:
+
+	* Switched over to Heap Layers-based implementation.
+	* Added single-threaded optimization (if no threads spawned, no locks).
+
+version 2.1.2:
+
+	* Made the code 64-bit clean.
+	* Fixed a bug in recycling free memory on uniprocessors.
+
+version 2.1.1:
+
+	* Added Debian distribution support.
+	* Fixed a Linux compilation bug in a benchmark.
+        * Added automake-produced Makefiles for all benchmarks.
+	* Added pthread_atfork handlers to avoid deadlocks when
+	using fork().
+
+version 2.1.0:
+
+	* Now ships as a DLL for Windows.
+	* Reduced internal fragmentation for small objects.
+	* A variety of performance improvements.
+	* Patched to work on 64-bit Solaris.
+	* Removed BeOS support.
+	* Simplified user-level locking.
+	* Incorporated Doug Lea's malloc as a faster backing store
+	  than mmap(), for non-Windows execution.
+
+version 2.0.6:
+
+	* Fix to allow Hoard to work with MFC under Windows.
+
+version 2.0.5:
+
+	* Fix to work with the new Sun WorkShop compiler.
+
+version 2.0.4:
+
+	* Fix to allow Hoard to work with Debug builds under Windows.
+
+version 2.0.3:
+
+	* Added a fix for better fragmentation on uniprocessors,
+	added a "winprojects" directory for easier building on Windows
+	under Visual Studio, improved realloc performance, and fixed a bug
+	for out-of-memory conditions.
+
+version 2.0.2:
+
+	* Fixed a memory leak for SGI.
+
+version 2.0.1:
+
+	* Fixed compilation on AIX with xlC (IBM).
+
+version 2.0:
+
+	* Added very aggressive superblock recycling. Now an empty
+	superblock is immediately available for reuse for another size
+	class. This can dramatically reduce fragmentation.
+
+	* We now preferentially allocate from recently-touched
+	superblocks to improve page locality.
+
+	* Incorporated a protocol to guarantee swift superblock
+	'acquisition' by free().
+
+version 1.5.3: (not generally released)
+
+	* Miscellaneous bug fixes.
+
+version 1.5.2:
+
+	* Fixed a problem on some Linux systems that caused
+	many large allocations to fail.
+	* Fixed a call to VirtualFree which didn't actually
+	release memory back to the system.
+
+
+version 1.5.1:
+
+	* Changed initialization of the process heap to fix
+	a problem with Visual C++.
+
+version 1.5:
+
+	* Large blocks (> 4K) are now immediately returned to
+	the system when they are freed.
+
+	* Made a number of improvements to the algorithm that ensure
+        O(1) cost for malloc & free and guarantee low contention for
+	free's. (These will be discussed in a paper currently in
+	progress.) Also added a method that further reduces the number
+	of system calls when allocating memory.
+
+	* Added superblock recycling to reduce fragmentation.
+
+	* Hoard now compiles with Sun's Workshop compilers (version 5.0)
+	on SPARCs. (Thanks to Ganesan Rajagopal of Novell for the
+	undocumented .il trick for inlining assembly.)
+
+	* Ported to AIX (IBM, PowerPC-based).
+
+version 1.4.2:
+
+	* A bug fix -- corrects a subtle problem with memalign.
+	Hoard now successfully passes Wolfram Gloger's
+	malloc-test (included with the distribution).
+
+version 1.4.1:
+
+	* A few fixes for backward compatibility with Solaris 2.6.
+
+version 1.4:
+
+	* Doubled the speed of calls to free().
+	* Further improved scalability, especially on Solaris.
+	* Reduced memory consumption and improved performance on
+	uniprocessors.
+	* Changed the lock implementation for Windows from spin to
+	spin-yield, as in the UNIX implementations (thanks to Paul
+	Larson of Microsoft Research for pointing out how to do this).
+	* Removed the shbench benchmark from the distribution, per
+	request from MicroQuill, Inc.
+
+version 1.3.3:
+
+	* Changed some casts of pointers to unsigned longs
+	to allow Hoard to work on 64-bit machines (read: SGI O2K).
+
+version 1.3.2:
+
+	* Minor modifications for the Windows NT port,
+	along with workspace and project files for Visual C++
+	(thanks to Arnd Bohm).
+
+version 1.3.1:
+
+	* Included a customized version of 'atexit' for Linux,
+	since the newest version of libc (2.1.2) caused Hoard to
+	deadlock (it called malloc internally).
+
+version 1.3:
+
+	* Ported to the BeOS (thanks to Trey Boudreau of Be).
+	* Replaced the per-sizeclass locks with per-heap locks,
+	since this has no impact on scalability and reduces Hoard's
+	static footprint.
+
+version 1.2:
+
+	* Dramatically improved performance with fast user-level locks
+ 	for SPARC, x86, and the SGI.
+	* Added sproc support (for the SGI).
+	* Hoard can now be built under Visual C++ (thanks to John
+	Hickin).
+
+version 1.1:
+
+	* Added autoconf and automake scripts to facilitate compilation
+	and installation (including shared libraries).
+	(thanks to Ganesan Rajagopal of Novell for submitting the scripts)
+
+version 1.0.3:
+
+	* Hoard now scales on OS's besides Linux and Solaris.
+	(the thread ID hash function was pathological for other OS's)
+
+version 1.0.2:
+
+	* Ported to Windows NT.
+	* Added in the benchmark suite (larson, linux-scalability, shbench).
+
+version 1.0.1:
+
+	* Fixed a build problem.
+
+version 1.0:
+
+	* Initial release.
+
Index: /proiecte/swift/trunk/lib/hoard-371/README
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/README	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/README	(revision 176)
@@ -0,0 +1,62 @@
+The Hoard Memory Allocator
+Copyright (C) 1999-2007 by Emery Berger
+
+ <http://www.hoard.org>
+ <http://www.cs.umass.edu/~emery>
+ <mailto:emery@cs.umass.edu>
+
+Building Hoard (Unix)
+---------------------
+
+To build Hoard on non-Windows platforms, change into the src/
+directory and run "make" followed by the appropriate target. If you
+type "make", it will present a list of available targets. These
+include linux-gcc-x86, solaris-sunw-sparc, etc.
+
+You can then use Hoard by linking it with your executable, or
+by setting the LD_PRELOAD environment variable, as in
+
+  % export LD_PRELOAD=/path/to/libhoard.so
+
+in Solaris:
+
+  % export LD_PRELOAD="/path/to/libhoard_32.so:/usr/lib/libCrun.so.1"
+  (32-bit version)
+
+  % export LD_PRELOAD="/path/to/libhoard_64.so:/usr/lib/64/libCrun.so.1"
+  (64-bit version)
+
+or, in Mac OS X:
+
+  % export DYLD_FORCE_FLAT_NAMESPACE=YES
+  % export DYLD_INSERT_LIBRARIES=/path/to/libhoard.dylib
+
+Building Hoard (Windows)
+------------------------
+
+There are two options for using Hoard with Windows, in decreasing
+order of preference:
+
+(1) Use winhoard.dll
+    (when you have all object files)
+
+  - Go to the src/ directory.
+  - Run 'compile-winhoard.cmd'.
+  - Link your executable with 'usewinhoard.cpp' and 'winhoard.lib'.
+    You *must* use the /MD flag.
+
+(2) Use libhoard.dll
+    (when you have all sources)
+
+  - Go to the src/ directory.
+  - Run 'compile-dll.cmd'.
+  - Add 'libhoard.lib' to your project.
+
+  - You may need to add the link command: "/FORCE:MULTIPLE". This
+    option forces a link even when multiply defined symbols exist.
+
+  - Make sure that you dynamically link the executable (i.e., don't
+    generate a Multithreaded version, but rather Multithreaded DLL),
+    as in /MD. This linkage will ensure that you completely
+    replace every memory allocation call.
+
Index: /proiecte/swift/trunk/lib/hoard-371/THANKS
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/THANKS	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/THANKS	(revision 176)
@@ -0,0 +1,20 @@
+I'd like to thank the following people for their contributions to
+Hoard, which have improved Hoard's quality and portability.
+
+-----
+Martin Bachtold
+Trey Boudreau
+John Calcote
+Robert Fleischman
+Bo Granlund
+John Hickin
+Paul Larson
+Maged Michael
+Kevin Mills
+Ganesan Rajagopal
+Benoit Rignault
+-----
+
+-- Emery Berger
+
+
Index: /proiecte/swift/trunk/lib/hoard-371/doc/README
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/doc/README	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/doc/README	(revision 176)
@@ -0,0 +1,67 @@
+
+This directory contains documentation on Hoard, and article on Heap
+Layers and four technical papers describing Heap Layers and related
+memory allocators.
+
+The documentation on Hoard can be read by pointing your browser to
+index.html.
+
+The article, in heaplayers-article-cuj.htm, is from the C/C++ Users
+Journal (www.cuj.com), by Andrei Alexandrescu (with some help from
+Emery Berger). It's a good overview of Heap Layers.
+
+The technical articles first describe a previous version of Hoard,
+which has now been rewritten in terms of Heap Layers
+(berger-asplos2000.pdf). The second (berger-pldi2001.pdf) presents the
+Heap Layers framework itself along with some uniprocessor allocators
+written using the framework, while the third (berger-oopsla2002.pdf)
+presents an empirical study of custom memory allocators and "reaps", a
+hybrid of regions of heaps. The fourth (feng-msp2005.pdf) presents a
+locality-improving dynamic allocator called "Vam", built with Heap
+Layers.
+
+The following are BibTeX entries, included for citing convenience.
+
+berger-asplos2000.pdf:
+
+@inproceedings{berger00hoard,
+  author = {Emery D. Berger and Kathryn S. McKinley and Robert D. Blumofe and Paul R. Wilson},
+  title = "Hoard: A Scalable Memory Allocator for Multithreaded Applications",
+  month = {November},
+  year = 2000,
+  pages = "117--128",
+  booktitle =  "International Conference on Architectural Support for Programming Languages and Operating Systems (ASPLOS-IX)",
+  address = "Cambridge, MA",
+  url = "citeseer.nj.nec.com/berger00hoard.html"
+}
+
+berger-pldi2001.pdf:
+
+  @inproceedings{ berger01composing,
+    author = "Emery D. Berger and Benjamin G. Zorn and Kathryn S. McKinley",
+    title = "Composing High-Performance Memory Allocators",
+    booktitle = "{SIGPLAN} Conference on Programming Language Design and Implementation",
+    pages = "114-124",
+    year = "2001",
+    url = "citeseer.nj.nec.com/berger01composing.html" }
+
+berger-oopsla2002.pdf:
+
+  @inproceedings{ berger01reconsidering,
+    author = "Emery D. Berger and Benjamin G. Zorn and Kathryn S. McKinley",
+    title = "Reconsidering Custom Memory Allocation",
+    booktitle = "Proceedings of the Conference on Object-Oriented Programming: Systems, Languages, and Applications (OOPSLA) 2002",
+    address = "Seattle, Washington",
+    month = Nov,
+    year = "2002",
+    url = "citeseer.nj.nec.com/berger01reconsidering.html" }
+
+feng-msp2005.pdf:
+
+  @inproceedings{ feng05locality,
+     author = "Yi Feng and Emery D. Berger",
+     title = "{A Locality-Improving Dynamic Memory Allocator}",
+     booktitle = "Proceedings of the 2005 Workshop on Memory System Performance",
+     address = "Chicago, Illinois",
+     month = Jun,
+     year = 2005}
Index: /proiecte/swift/trunk/lib/hoard-371/doc/building.html
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/doc/building.html	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/doc/building.html	(revision 176)
@@ -0,0 +1,219 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="Apache Forrest" name="Generator">
+<meta name="Forrest-version" content="0.6">
+<meta name="Forrest-skin-name" content="pelt">
+<title>Building Hoard</title>
+<link type="text/css" href="skin/basic.css" rel="stylesheet">
+<link media="screen" type="text/css" href="skin/screen.css" rel="stylesheet">
+<link media="print" type="text/css" href="skin/print.css" rel="stylesheet">
+<link type="text/css" href="skin/profile.css" rel="stylesheet">
+<script src="skin/getBlank.js" language="javascript" type="text/javascript"></script><script src="skin/getMenu.js" language="javascript" type="text/javascript"></script><script src="skin/fontsize.js" language="javascript" type="text/javascript"></script>
+<link rel="shortcut icon" href="">
+</head>
+<body onload="init()">
+<script type="text/javascript">ndeSetTextSize();</script>
+<div id="top">
+<!--+
+    |header
+    +-->
+<div class="header">
+<!--+
+    |start group logo
+    +-->
+<div class="grouplogo">
+<a href="http://www.hoard.org"><img class="logoImage" alt="Hoard" src="images/hoard-logo.jpg" title="The Hoard Multiprocessor Memory Allocator"></a>
+</div>
+<!--+
+    |end group logo
+    +-->
+<!--+
+    |start Project Logo
+    +-->
+<div class="projectlogoA1">
+<a href=""></a>
+</div>
+<!--+
+    |end Project Logo
+    +-->
+<!--+
+    |start Tabs
+    +-->
+<ul id="tabs"></ul>
+<!--+
+    |end Tabs
+    +-->
+</div>
+</div>
+<div id="main">
+<div id="publishedStrip">
+<!--+
+    |start Subtabs
+    +-->
+<div id="level2tabs"></div>
+<!--+
+    |end Endtabs
+    +-->
+<script type="text/javascript" language="JavaScript"><!--
+              document.write("Published: " + document.lastModified);
+              //  --></script>
+</div>
+<!--+
+    |breadtrail
+    +-->
+<div class="breadtrail">
+             
+             &nbsp;
+           </div>
+<!--+
+    |start Menu, mainarea
+    +-->
+<!--+
+    |start Menu
+    +-->
+<div id="menu">
+<div onclick="SwitchMenu('menu_selected_1.1', 'skin/')" id="menu_selected_1.1Title" class="menutitle" style="background-image: url('skin/images/chapter_open.gif');">Table of Contents</div>
+<div id="menu_selected_1.1" class="selectedmenuitemgroup" style="display: block;">
+<div class="menuitem">
+<a title="Welcome to Hoard" href="index.html">Home</a>
+</div>
+<div class="menuitem">
+<a title="Download Hoard" href="download.html">Download</a>
+</div>
+<div class="menuitem">
+<a title="Screenshots" href="screenshot.html">Screenshots</a>
+</div>
+<div class="menuitem">
+<a title="How to Use Hoard" href="using.html">Using Hoard</a>
+</div>
+<div class="menupage">
+<div class="menupagetitle">Building Hoard</div>
+</div>
+<div class="menuitem">
+<a title="FAQs" href="faqs.html">FAQs</a>
+</div>
+<div class="menuitem">
+<a title="License Info" href="licensing.html">Licensing Info</a>
+</div>
+</div>
+<div id="credit"></div>
+<div id="roundbottom">
+<img style="display: none" class="corner" height="15" width="15" alt="" src="skin/images/rc-b-l-15-1body-2menu-3menu.png"></div>
+<!--+
+  |alternative credits
+  +-->
+</div>
+<!--+
+    |end Menu
+    +-->
+<!--+
+    |start content
+    +-->
+<div id="content">
+<div id="skinconf-txtlink"></div>
+<h1>Building Hoard</h1>
+<div id="minitoc-area">
+<ul class="minitoc">
+<li>
+<a href="#Linux+and+Solaris+Builds">Linux and Solaris Builds</a>
+</li>
+<li>
+<a href="#Windows+Builds">Windows Builds</a>
+</li>
+</ul>
+</div>
+
+
+<p>
+You can use the available pre-built binaries or build Hoard
+yourself. Hoard is written to work on Windows and any variant of UNIX
+that supports threads, and should compile out of the box. Rather than
+using Makefiles or configure scripts, Hoard includes custom scripts
+that all start with the prefix compile.
+</p>
+
+  
+<a name="N1000F"></a><a name="Linux+and+Solaris+Builds"></a>
+<h2 class="boxed">Linux and Solaris Builds</h2>
+<div class="section">
+<p>
+You can compile Hoard out of the box for Linux and Solaris using the
+GNU compilers (g++) just by running the compile
+script:
+</p>
+<pre class="code">
+./compile
+</pre>
+</div>
+
+  
+<a name="N1001D"></a><a name="Windows+Builds"></a>
+<h2 class="boxed">Windows Builds</h2>
+<div class="section">
+<p>
+There are two alternative ways of using Hoard with Windows.
+</p>
+<ol>
+
+<li>
+
+<p>
+The first approach builds a DLL, libhoard.dll and
+its associated library libhoard.lib.
+</p>
+
+
+<pre class="code">
+.\compile-dll
+</pre>
+
+</li>
+
+
+<li>
+
+<p>
+The second and preferred approach generates winhoard, which replaces
+malloc/new calls in your program and any DLLs it might use.
+  </p>
+
+
+<pre class="code">
+.\compile-winhoard
+</pre>
+  
+</li>
+  
+</ol>
+</div>
+
+
+</div>
+<!--+
+    |end content
+    +-->
+<div class="clearboth">&nbsp;</div>
+</div>
+<div id="footer">
+<!--+
+    |start bottomstrip
+    +-->
+<div class="lastmodified">
+<script type="text/javascript"><!--
+document.write("Last Published: " + document.lastModified);
+//  --></script>
+</div>
+<div class="copyright">
+ Copyright &copy; 2005 Emery Berger.</div>
+<div id="feedback">
+    Send feedback about the website to:
+  <a id="feedbackto" href="mailto:emery@cs.umass.edu?subject=Feedback,building.html">emery@cs.umass.edu</a>
+</div>
+<!--+
+    |end bottomstrip
+    +-->
+</div>
+</body>
+</html>
Index: /proiecte/swift/trunk/lib/hoard-371/doc/download.html
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/doc/download.html	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/doc/download.html	(revision 176)
@@ -0,0 +1,240 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="Apache Forrest" name="Generator">
+<meta name="Forrest-version" content="0.6">
+<meta name="Forrest-skin-name" content="pelt">
+<title>Download Hoard</title>
+<link type="text/css" href="skin/basic.css" rel="stylesheet">
+<link media="screen" type="text/css" href="skin/screen.css" rel="stylesheet">
+<link media="print" type="text/css" href="skin/print.css" rel="stylesheet">
+<link type="text/css" href="skin/profile.css" rel="stylesheet">
+<script src="skin/getBlank.js" language="javascript" type="text/javascript"></script><script src="skin/getMenu.js" language="javascript" type="text/javascript"></script><script src="skin/fontsize.js" language="javascript" type="text/javascript"></script>
+<link rel="shortcut icon" href="">
+</head>
+<body onload="init()">
+<script type="text/javascript">ndeSetTextSize();</script>
+<div id="top">
+<!--+
+    |header
+    +-->
+<div class="header">
+<!--+
+    |start group logo
+    +-->
+<div class="grouplogo">
+<a href="http://www.hoard.org"><img class="logoImage" alt="Hoard" src="images/hoard-logo.jpg" title="The Hoard Multiprocessor Memory Allocator"></a>
+</div>
+<!--+
+    |end group logo
+    +-->
+<!--+
+    |start Project Logo
+    +-->
+<div class="projectlogoA1">
+<a href=""></a>
+</div>
+<!--+
+    |end Project Logo
+    +-->
+<!--+
+    |start Tabs
+    +-->
+<ul id="tabs"></ul>
+<!--+
+    |end Tabs
+    +-->
+</div>
+</div>
+<div id="main">
+<div id="publishedStrip">
+<!--+
+    |start Subtabs
+    +-->
+<div id="level2tabs"></div>
+<!--+
+    |end Endtabs
+    +-->
+<script type="text/javascript" language="JavaScript"><!--
+              document.write("Published: " + document.lastModified);
+              //  --></script>
+</div>
+<!--+
+    |breadtrail
+    +-->
+<div class="breadtrail">
+             
+             &nbsp;
+           </div>
+<!--+
+    |start Menu, mainarea
+    +-->
+<!--+
+    |start Menu
+    +-->
+<div id="menu">
+<div onclick="SwitchMenu('menu_selected_1.1', 'skin/')" id="menu_selected_1.1Title" class="menutitle" style="background-image: url('skin/images/chapter_open.gif');">Table of Contents</div>
+<div id="menu_selected_1.1" class="selectedmenuitemgroup" style="display: block;">
+<div class="menuitem">
+<a title="Welcome to Hoard" href="index.html">Home</a>
+</div>
+<div class="menupage">
+<div class="menupagetitle">Download</div>
+</div>
+<div class="menuitem">
+<a title="Screenshots" href="screenshot.html">Screenshots</a>
+</div>
+<div class="menuitem">
+<a title="How to Use Hoard" href="using.html">Using Hoard</a>
+</div>
+<div class="menuitem">
+<a title="How to Build Hoard" href="building.html">Building Hoard</a>
+</div>
+<div class="menuitem">
+<a title="FAQs" href="faqs.html">FAQs</a>
+</div>
+<div class="menuitem">
+<a title="License Info" href="licensing.html">Licensing Info</a>
+</div>
+</div>
+<div id="credit"></div>
+<div id="roundbottom">
+<img style="display: none" class="corner" height="15" width="15" alt="" src="skin/images/rc-b-l-15-1body-2menu-3menu.png"></div>
+<!--+
+  |alternative credits
+  +-->
+</div>
+<!--+
+    |end Menu
+    +-->
+<!--+
+    |start content
+    +-->
+<div id="content">
+<div id="skinconf-txtlink"></div>
+<h1>Download Hoard</h1>
+<div id="minitoc-area">
+<ul class="minitoc">
+<li>
+<a href="#Available+Versions">Available Versions</a>
+<ul class="minitoc">
+<li>
+<a href="#%0AHoard+%28libhoard%29+3.5.1%2C+released+May+22%2C+2006%0A">
+Hoard (libhoard) 3.5.1, released May 22, 2006
+</a>
+<ul class="minitoc">
+<li>
+<a href="#Source+code">Source code</a>
+</li>
+<li>
+<a href="#Binaries">Binaries</a>
+</li>
+</ul>
+</li>
+<li>
+<a href="#Previous+Versions">Previous Versions</a>
+<ul class="minitoc">
+<li>
+<a href="#Hoard+3.4.0+%28December+28%2C+2005%29">Hoard 3.4.0 (December 28, 2005)</a>
+</li>
+<li>
+<a href="#Hoard+3.3.0+%28May+27%2C+2005%29">Hoard 3.3.0 (May 27, 2005)</a>
+</li>
+<li>
+<a href="#Hoard+2.1.2d+%28April+7%2C+2003%29">Hoard 2.1.2d (April 7, 2003)</a>
+</li>
+<li>
+<a href="#Hoard+2.1.0+%28December+24%2C+2001%29">Hoard 2.1.0 (December 24, 2001)</a>
+</li>
+<li>
+<a href="#Hoard+2.0.6+%28July+10%2C+2001%29">Hoard 2.0.6 (July 10, 2001)</a>
+</li>
+</ul>
+</li>
+</ul>
+</li>
+</ul>
+</div>
+
+
+<a name="N1000C"></a><a name="Available+Versions"></a>
+<h2 class="boxed">Available Versions</h2>
+<div class="section">
+<a name="N10012"></a><a name="%0AHoard+%28libhoard%29+3.5.1%2C+released+May+22%2C+2006%0A"></a>
+<h3 class="boxed">
+Hoard (libhoard) 3.5.1, released May 22, 2006
+</h3>
+<a name="N10018"></a><a name="Source+code"></a>
+<h4>Source code</h4>
+<p>
+
+<a href="http://www.cs.umass.edu/~emery/hoard/hoard-3.5.1/heaplayers_3_5_1.tar.gz">gzipped tarball</a>, <a href="http://www.cs.umass.edu/~emery/hoard/hoard-3.5.1/heaplayers_3_5_1.zip">ZIP file</a>
+
+</p>
+<a name="N1002A"></a><a name="Binaries"></a>
+<h4>Binaries</h4>
+<p>
+
+<a href="http://www.cs.umass.edu/~emery/hoard/hoard-3.5.1/linux/libhoard.so">Linux</a>, <a href="http://www.cs.umass.edu/~emery/hoard/hoard-3.5.1/solaris/libhoard.so">Solaris (GNU)</a>, <a href="http://www.cs.umass.edu/~emery/hoard/hoard-3.5.1/solaris/libhoard_32.so">Solaris (Sun, 32-bit)</a>, <a href="http://www.cs.umass.edu/~emery/hoard/hoard-3.5.1/solaris/libhoard_64.so">Solaris (Sun, 64-bit)</a>, <a href="http://www.cs.umass.edu/~emery/hoard/hoard-3.5.1/windows/windows-binaries.zip">Windows</a>
+
+</p>
+<a name="N10049"></a><a name="Previous+Versions"></a>
+<h3 class="boxed">Previous Versions</h3>
+<a name="N1004F"></a><a name="Hoard+3.4.0+%28December+28%2C+2005%29"></a>
+<h4>Hoard 3.4.0 (December 28, 2005)</h4>
+<p>
+<a href="http://www.cs.umass.edu/~emery/hoard/hoard-3.4.0/heaplayers_3_4_0.tar.gz">gzipped tarball</a>, <a href="http://www.cs.umass.edu/~emery/hoard/hoard-3.4.0/heaplayers_3_4_0.zip">zip file</a>.
+</p>
+<a name="N10060"></a><a name="Hoard+3.3.0+%28May+27%2C+2005%29"></a>
+<h4>Hoard 3.3.0 (May 27, 2005)</h4>
+<p>
+<a href="http://www.cs.umass.edu/~emery/hoard/hoard-3.3.0/heaplayers_3_3_0.tar.gz">gzipped tarball</a>, <a href="http://www.cs.umass.edu/~emery/hoard/hoard-3.3.0/heaplayers_3_3_0.zip">zip file</a>.
+</p>
+<a name="N10071"></a><a name="Hoard+2.1.2d+%28April+7%2C+2003%29"></a>
+<h4>Hoard 2.1.2d (April 7, 2003)</h4>
+<p>
+<a href="http://www.cs.umass.edu/~emery/hoard/libhoard-2.1.2d.tar.gz">gzipped tarball</a>, <a href="http://www.cs.umass.edu/~emery/hoard/libhoard-2.1.2d.zip">zip file</a>.
+</p>
+<a name="N10082"></a><a name="Hoard+2.1.0+%28December+24%2C+2001%29"></a>
+<h4>Hoard 2.1.0 (December 24, 2001)</h4>
+<p>
+
+<a href="http://www.cs.umass.edu/~emery/hoard/libhoard-2.1.0.tar.gz">gzipped tarball</a>, <a href="http://www.cs.umass.edu/~emery/hoard/libhoard-2.1.0.zip">zip file</a>.
+</p>
+<a name="N10094"></a><a name="Hoard+2.0.6+%28July+10%2C+2001%29"></a>
+<h4>Hoard 2.0.6 (July 10, 2001)</h4>
+<p>
+
+<a href="http://www.cs.umass.edu/~emery/hoard/libhoard-2.0.6.tar.gz">gzipped tarball</a>.
+</p>
+</div>
+
+
+</div>
+<!--+
+    |end content
+    +-->
+<div class="clearboth">&nbsp;</div>
+</div>
+<div id="footer">
+<!--+
+    |start bottomstrip
+    +-->
+<div class="lastmodified">
+<script type="text/javascript"><!--
+document.write("Last Published: " + document.lastModified);
+//  --></script>
+</div>
+<div class="copyright">
+ Copyright &copy; 2005 Emery Berger.</div>
+<div id="feedback">
+    Send feedback about the website to:
+  <a id="feedbackto" href="mailto:emery@cs.umass.edu?subject=Feedback,download.html">emery@cs.umass.edu</a>
+</div>
+<!--+
+    |end bottomstrip
+    +-->
+</div>
+</body>
+</html>
Index: /proiecte/swift/trunk/lib/hoard-371/doc/faqs.html
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/doc/faqs.html	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/doc/faqs.html	(revision 176)
@@ -0,0 +1,295 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="Apache Forrest" name="Generator">
+<meta name="Forrest-version" content="0.6">
+<meta name="Forrest-skin-name" content="pelt">
+<title>Hoard Frequently Asked Questions</title>
+<link type="text/css" href="skin/basic.css" rel="stylesheet">
+<link media="screen" type="text/css" href="skin/screen.css" rel="stylesheet">
+<link media="print" type="text/css" href="skin/print.css" rel="stylesheet">
+<link type="text/css" href="skin/profile.css" rel="stylesheet">
+<script src="skin/getBlank.js" language="javascript" type="text/javascript"></script><script src="skin/getMenu.js" language="javascript" type="text/javascript"></script><script src="skin/fontsize.js" language="javascript" type="text/javascript"></script>
+<link rel="shortcut icon" href="">
+</head>
+<body onload="init()">
+<script type="text/javascript">ndeSetTextSize();</script>
+<div id="top">
+<!--+
+    |header
+    +-->
+<div class="header">
+<!--+
+    |start group logo
+    +-->
+<div class="grouplogo">
+<a href="http://www.hoard.org"><img class="logoImage" alt="Hoard" src="images/hoard-logo.jpg" title="The Hoard Multiprocessor Memory Allocator"></a>
+</div>
+<!--+
+    |end group logo
+    +-->
+<!--+
+    |start Project Logo
+    +-->
+<div class="projectlogoA1">
+<a href=""></a>
+</div>
+<!--+
+    |end Project Logo
+    +-->
+<!--+
+    |start Tabs
+    +-->
+<ul id="tabs"></ul>
+<!--+
+    |end Tabs
+    +-->
+</div>
+</div>
+<div id="main">
+<div id="publishedStrip">
+<!--+
+    |start Subtabs
+    +-->
+<div id="level2tabs"></div>
+<!--+
+    |end Endtabs
+    +-->
+<script type="text/javascript" language="JavaScript"><!--
+              document.write("Published: " + document.lastModified);
+              //  --></script>
+</div>
+<!--+
+    |breadtrail
+    +-->
+<div class="breadtrail">
+             
+             &nbsp;
+           </div>
+<!--+
+    |start Menu, mainarea
+    +-->
+<!--+
+    |start Menu
+    +-->
+<div id="menu">
+<div onclick="SwitchMenu('menu_selected_1.1', 'skin/')" id="menu_selected_1.1Title" class="menutitle" style="background-image: url('skin/images/chapter_open.gif');">Table of Contents</div>
+<div id="menu_selected_1.1" class="selectedmenuitemgroup" style="display: block;">
+<div class="menuitem">
+<a title="Welcome to Hoard" href="index.html">Home</a>
+</div>
+<div class="menuitem">
+<a title="Download Hoard" href="download.html">Download</a>
+</div>
+<div class="menuitem">
+<a title="Screenshots" href="screenshot.html">Screenshots</a>
+</div>
+<div class="menuitem">
+<a title="How to Use Hoard" href="using.html">Using Hoard</a>
+</div>
+<div class="menuitem">
+<a title="How to Build Hoard" href="building.html">Building Hoard</a>
+</div>
+<div class="menupage">
+<div class="menupagetitle">FAQs</div>
+</div>
+<div class="menuitem">
+<a title="License Info" href="licensing.html">Licensing Info</a>
+</div>
+</div>
+<div id="credit"></div>
+<div id="roundbottom">
+<img style="display: none" class="corner" height="15" width="15" alt="" src="skin/images/rc-b-l-15-1body-2menu-3menu.png"></div>
+<!--+
+  |alternative credits
+  +-->
+</div>
+<!--+
+    |end Menu
+    +-->
+<!--+
+    |start content
+    +-->
+<div id="content">
+<div id="skinconf-txtlink"></div>
+<h1>Hoard Frequently Asked Questions</h1>
+<div id="minitoc-area">
+<ul class="minitoc">
+<li>
+<a href="#%0AWhat+kind+of+applications+will+Hoard+speed+up%3F%0A">
+What kind of applications will Hoard speed up?
+</a>
+</li>
+<li>
+<a href="#%0A++I%27m+using+the+STL+but+not+seeing+any+performance+improvement.+Why+not%3F%0A++">
+  I'm using the STL but not seeing any performance improvement. Why not?
+  </a>
+</li>
+<li>
+<a href="#%0AWhat+systems+does+Hoard+work+on%3F%0A">
+What systems does Hoard work on?
+</a>
+</li>
+<li>
+<a href="#%0AHave+you+compared+Hoard+with+SmartHeap+SMP%3F%0A">
+Have you compared Hoard with SmartHeap SMP?
+</a>
+</li>
+<li>
+<a href="#%0A++++++Have+you+compared+Hoard+against+mtmalloc+or+libumem%3F%0A">
+      Have you compared Hoard against mtmalloc or libumem?
+</a>
+</li>
+<li>
+<a href="#%0ACan+I+use+Hoard+with+a+commercial+application%3F%0A">
+Can I use Hoard with a commercial application?
+</a>
+</li>
+</ul>
+</div>
+  
+<a name="N1000C"></a><a name="%0AWhat+kind+of+applications+will+Hoard+speed+up%3F%0A"></a>
+<h2 class="boxed">
+What kind of applications will Hoard speed up?
+</h2>
+<div class="section">
+<p>
+Hoard will always improve the performance of multithreaded programs
+running on multiprocessors that make frequent use of the heap (calls
+to malloc/free or new/delete, as well as many STL functions). Because
+Hoard avoids false sharing, Hoard also speeds up programs that only
+occasionally call heap functions but access these objects frequently.
+  </p>
+</div>
+
+
+  
+<a name="N10016"></a><a name="%0A++I%27m+using+the+STL+but+not+seeing+any+performance+improvement.+Why+not%3F%0A++"></a>
+<h2 class="boxed">
+  I'm using the STL but not seeing any performance improvement. Why not?
+  </h2>
+<div class="section">
+<p>
+In order to benefit from Hoard, you have to tell STL to use malloc instead of its internal custom memory allocator:
+      </p>
+<pre class="code">
+typedef list&lt;unsigned int, malloc_alloc&gt; mylist;
+</pre>
+</div>
+
+
+
+<a name="N10024"></a><a name="%0AWhat+systems+does+Hoard+work+on%3F%0A"></a>
+<h2 class="boxed">
+What systems does Hoard work on?
+</h2>
+<div class="section">
+<p>
+Hoard has been successfully tested on numerous Windows, Linux and
+Solaris systems, including a 4-processor x86 box running Windows
+NT/2000, a 4-processor x86 box running RedHat Linux 6.0 and 6.1, and a
+16-processor Sun Enterprise server running Solaris.
+  </p>
+</div>
+
+
+
+<a name="N1002D"></a><a name="%0AHave+you+compared+Hoard+with+SmartHeap+SMP%3F%0A"></a>
+<h2 class="boxed">
+Have you compared Hoard with SmartHeap SMP?
+</h2>
+<div class="section">
+<p>
+We tried SmartHeap SMP but it did not work on our Suns (due to an
+apparent race condition in the code).
+  </p>
+</div>
+
+
+  
+<a name="N10036"></a><a name="%0A++++++Have+you+compared+Hoard+against+mtmalloc+or+libumem%3F%0A"></a>
+<h2 class="boxed">
+      Have you compared Hoard against mtmalloc or libumem?
+</h2>
+<div class="section">
+<p>
+Yes. Hoard is much faster than either. For example, here's an
+execution of threadtest on Solaris:
+</p>
+<table class="ForrestTable" cellspacing="1" cellpadding="4">
+           
+<tr>
+             
+<td colspan="1" rowspan="1">Default:</td>
+ 	     <td colspan="1" rowspan="1">4.60 seconds</td>
+           
+</tr>
+           
+<tr>
+             
+<td colspan="1" rowspan="1">Libmtmalloc:</td>
+ 	     <td colspan="1" rowspan="1">6.23 seconds</td>
+           
+</tr>
+           
+<tr>
+             
+<td colspan="1" rowspan="1">Libumem:</td>
+             <td colspan="1" rowspan="1">5.47 seconds</td>
+           
+</tr>
+           
+<tr>
+             
+<td colspan="1" rowspan="1">Hoard 3.2:</td>
+ 	     <td colspan="1" rowspan="1">1.99 seconds</td>
+           
+</tr>
+     
+</table>
+</div>
+
+
+<a name="N10077"></a><a name="%0ACan+I+use+Hoard+with+a+commercial+application%3F%0A"></a>
+<h2 class="boxed">
+Can I use Hoard with a commercial application?
+</h2>
+<div class="section">
+<p>
+Yes. Hoard is available under two licenses. The first license is the
+GNU General Public License. That license is free, but it requires you
+to open-source your application. The second option is to purchase a
+license from the University of Texas at Austin. Click the "Licensing Info"
+link on the left for more information.
+</p>
+</div>
+
+
+</div>
+<!--+
+    |end content
+    +-->
+<div class="clearboth">&nbsp;</div>
+</div>
+<div id="footer">
+<!--+
+    |start bottomstrip
+    +-->
+<div class="lastmodified">
+<script type="text/javascript"><!--
+document.write("Last Published: " + document.lastModified);
+//  --></script>
+</div>
+<div class="copyright">
+ Copyright &copy; 2005 Emery Berger.</div>
+<div id="feedback">
+    Send feedback about the website to:
+  <a id="feedbackto" href="mailto:emery@cs.umass.edu?subject=Feedback,faqs.html">emery@cs.umass.edu</a>
+</div>
+<!--+
+    |end bottomstrip
+    +-->
+</div>
+</body>
+</html>
Index: /proiecte/swift/trunk/lib/hoard-371/doc/forrest.properties
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/doc/forrest.properties	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/doc/forrest.properties	(revision 176)
@@ -0,0 +1,105 @@
+# Copyright 2002-2004 The Apache Software Foundation
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+##############
+# Properties used by forrest.build.xml for building the website
+# These are the defaults, un-comment them if you need to change them.
+##############
+
+# Prints out a summary of Forrest settings for this project
+#forrest.echo=true 
+
+# Project name (used to name .war file)
+#project.name=my-project
+
+# Specifies name of Forrest skin to use
+#project.skin=tigris
+project.skin=pelt
+#project.skin=krysalis
+
+# comma separated list, file:// is supported
+#forrest.skins.descriptors=http://forrest.apache.org/skins/skins.xml,file:///c:/myskins/skins.xml
+
+##############
+# behavioural properties
+#project.menu-scheme=tab_attributes
+#project.menu-scheme=directories
+
+##############
+# layout properties
+
+# Properties that can be set to override the default locations
+#
+# Parent properties must be set. This usually means uncommenting
+# project.content-dir if any other property using it is uncommented
+
+#project.status=status.xml
+#project.content-dir=src/documentation
+#project.raw-content-dir=${project.content-dir}/content
+#project.conf-dir=${project.content-dir}/conf
+#project.sitemap-dir=${project.content-dir}
+#project.xdocs-dir=${project.content-dir}/content/xdocs
+#project.resources-dir=${project.content-dir}/resources
+#project.stylesheets-dir=${project.resources-dir}/stylesheets
+#project.images-dir=${project.resources-dir}/images
+#project.schema-dir=${project.resources-dir}/schema
+#project.skins-dir=${project.content-dir}/skins
+#project.skinconf=${project.content-dir}/skinconf.xml
+#project.lib-dir=${project.content-dir}/lib
+#project.classes-dir=${project.content-dir}/classes
+#project.translations-dir=${project.content-dir}/translations
+
+##############
+# validation properties
+
+# This set of properties determine if validation is performed
+# Values are inherited unless overridden.
+# e.g. if forrest.validate=false then all others are false unless set to true.
+#forrest.validate=true
+#forrest.validate.xdocs=${forrest.validate}
+#forrest.validate.skinconf=${forrest.validate}
+#forrest.validate.sitemap=${forrest.validate}
+#forrest.validate.stylesheets=${forrest.validate}
+#forrest.validate.skins=${forrest.validate}
+#forrest.validate.skins.stylesheets=${forrest.validate.skins}
+
+# *.failonerror=(true|false) - stop when an XML file is invalid
+#forrest.validate.failonerror=true
+
+# *.excludes=(pattern) - comma-separated list of path patterns to not validate
+# e.g.
+#forrest.validate.xdocs.excludes=samples/subdir/**, samples/faq.xml
+#forrest.validate.xdocs.excludes=
+
+
+##############
+# General Forrest properties
+
+# The URL to start crawling from
+#project.start-uri=linkmap.html
+# Set logging level for messages printed to the console
+# (DEBUG, INFO, WARN, ERROR, FATAL_ERROR)
+#project.debuglevel=ERROR
+# Max memory to allocate to Java
+#forrest.maxmemory=64m
+# Any other arguments to pass to the JVM. For example, to run on an X-less
+# server, set to -Djava.awt.headless=true
+#forrest.jvmargs=
+# The bugtracking URL - the issue number will be appended
+#project.bugtracking-url=http://issues.apache.org/bugzilla/show_bug.cgi?id=
+#project.bugtracking-url=http://issues.apache.org/jira/browse/
+# The issues list as rss
+#project.issues-rss-url=
+#I18n Property only works for the "forrest run" target.
+#project.i18n=true
Index: /proiecte/swift/trunk/lib/hoard-371/doc/heaplayers-article-cuj.htm
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/doc/heaplayers-article-cuj.htm	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/doc/heaplayers-article-cuj.htm	(revision 176)
@@ -0,0 +1,954 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<!-- saved from url=(0098)http://devnet.developerpipeline.com/documents/s=9843/q=1/cuj0512alexandrescu/0512alexandrescu.html -->
+<HTML><HEAD><TITLE>Developer::Pipelines | Policy-Based Memory Allocation</TITLE>
+<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
+<META content=NOARCHIVE name=GOOGLEBOT>
+<META http-equiv=Description 
+content="The way your application allocates memory can have a dramatic effect on its performance. Modern general-purpose memory allocators are pretty efficient, but there's always room for improvement."><LINK 
+rev=Stylesheet href="heaplayers-article-cuj_files/pipelines_fonts.css" 
+type=text/css rel=Stylesheet><LINK rev=Stylesheet 
+href="heaplayers-article-cuj_files/pipelines_layout.css" type=text/css 
+rel=Stylesheet><LINK rev=Stylesheet 
+href="heaplayers-article-cuj_files/shared.css" rel=Stylesheet><LINK 
+rev=Stylesheet href="heaplayers-article-cuj_files/topics.css" rel=Stylesheet>
+<SCRIPT language=JavaScript1.2 src="heaplayers-article-cuj_files/stm31.js" 
+type=text/javascript></SCRIPT>
+<!-- pop up openscript -->
+<SCRIPT type=text/javascript>
+ function openScript(url, width, height) {
+        var Win = window.open(url,"openScript",'width=' + width +
+',height=' + height +
+',resizable=1,scrollbars=yes,menubar=yes,status=yes' );
+}
+ </SCRIPT>
+
+<META content="MSHTML 6.00.2900.2802" name=GENERATOR></HEAD>
+<BODY vLink=#003366 link=#003366 bgColor=#ffffff leftMargin=0 topMargin=0 
+marginheight="0" marginwidth="0"><!-- SiteCatalyst code version: G.7.Copyright 1997-2004 Omniture, Inc. More info available athttp://www.omniture.com -->
+<SCRIPT language=JavaScript><!--/* You may give each page an identifying name, server, and channel onthe next lines. */
+var s_pageName="http://devnet.developerpipeline.com/cpp/cuj0512alexandrescu/"
+var s_server="devnet.developerpipeline.com"
+var s_channel="http://devnet.developerpipeline.com/cpp/"
+var s_pageType="/SDMG/Publications/CUJ|/SDMG/Languages/C++"
+var s_prop1="NO_USER"
+var s_prop2=""
+var s_prop3=""
+var s_prop4=""
+var s_prop5=""
+var s_prop6=""
+var s_prop7=""
+var s_prop8=""
+var s_prop9=""
+var s_prop10=""
+/* E-commerce Variables */
+var s_campaign=""
+var s_state=""
+var s_zip=""
+var s_events=""
+var s_products=""
+var s_purchaseID=""
+var s_eVar1=""
+var s_eVar2=""
+var s_eVar3=""
+var s_eVar4=""
+var s_eVar5=""
+var s_account="cmpdevnetdeveloperpipelinecom"
+/********* INSERT THE DOMAIN AND PATH TO YOUR CODE BELOW ************///--></SCRIPT>
+
+<SCRIPT language=JavaScript 
+src="heaplayers-article-cuj_files/s_code_remote.js"></SCRIPT>
+<!-- End SiteCatalyst code version: G.7. -->
+<DIV class=border>
+<TABLE cellSpacing=0 cellPadding=0 width=940 border=0>
+  <TBODY>
+  <TR>
+    <TD vAlign=top align=left><!-- top banner table -->
+      <TABLE cellSpacing=0 cellPadding=0 width=770 bgColor=#ffffff border=0>
+        <TBODY>
+        <TR>
+          <TD width=1 bgColor=#ffffff><IMG height=2 hspace=0 
+            src="heaplayers-article-cuj_files/blank.gif" width=1 border=0></TD>
+          <TD width=769 bgColor=#ffffff><IMG height=2 hspace=0 
+            src="heaplayers-article-cuj_files/blank.gif" width=769 
+        border=0></TD></TR>
+        <TR>
+          <TD width=1 bgColor=#ffffff><IMG height=94 hspace=0 
+            src="heaplayers-article-cuj_files/blank.gif" width=1 border=0></TD>
+          <TD align=middle width=769 bgColor=#ffffff><!-- TOP AD --><!-- AD: 'http://localhost:8085/html.ng/site=sdmg&affiliate=sdmgdeveloperpipeline&pagepos=top&catid=&site_section=9843&articleid=141768&target=cpp&country=&state=' --><!-- Sniffer Code for Flash version=60 -->
+            <SCRIPT language=JavaScript>
+<!--
+var swf_click = "http://as.cmpnet.com/event.ng/Type=click&FlightID=45537&AdID=80364&TargetID=4722&Segments=1411,3108,3448,4875,5817,5871&Targets=2625,2878,4667,4722&Values=34,46,51,63,77,83,90,100,140,203,442,645,646,657,944,945,1184,1311,1405,1412,1426,1716,1736,1767,1785,1935,1936,1944,1970,2310,2327,2352,2759,2767,2862,2878,2942,3067,3080&RawValues=&Redirect=http://www.intel.com/software/";
+var dcswf_click = escape(swf_click);
+var ShockMode = 0;
+var plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;
+
+if (plugin && parseInt(plugin.description.substring(plugin.description.indexOf(".")-1)) >= 6) 
+{
+ShockMode = 1;
+}
+else if (navigator.userAgent && navigator.userAgent.indexOf("MSIE")>=0 
+&& (navigator.userAgent.indexOf("Windows 95")>=0 || navigator.userAgent.indexOf("Windows 98")>=0 || navigator.userAgent.indexOf("Windows NT")>=0)) {
+document.write('<SCRIPT LANGUAGE=VBScript\> \n');
+document.write('on error resume next \n');
+document.write('ShockMode = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.6")))\n');
+document.write('<\/SCRIPT\> \n');
+}
+if ( ShockMode ) {
+document.write('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"');
+document.write(' codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"');
+document.write(' ID=flashad WIDTH=728 HEIGHT=90>');
+document.write(' <PARAM NAME=movie VALUE="http://i.cmpnet.com/ads/graphics/as5/cc/flash/banner_728x90c_1209.swf?clickTag='+dcswf_click+'"> '); 
+document.write(' <PARAM NAME=quality VALUE=high> ');
+document.write(' <PARAM NAME=wmode VALUE=opaque> ');
+document.write(' <EMBED SRC="http://i.cmpnet.com/ads/graphics/as5/cc/flash/banner_728x90c_1209.swf?clickTag='+dcswf_click+'" QUALITY=high WMODE=opaque '); 
+document.write(' NAME=flashad swLiveConnect=TRUE WIDTH=728 HEIGHT=90');
+document.write(' TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash">');
+document.write('</EMBED>');
+document.write('</OBJECT>');
+} else if (!(navigator.appName && navigator.appName.indexOf("Netscape")>=0 && navigator.appVersion.indexOf("2.")>=0)){
+document.write('<A HREF="http://as.cmpnet.com/event.ng/Type=click&FlightID=45537&AdID=80364&TargetID=4722&Segments=1411,3108,3448,4875,5817,5871&Targets=2625,2878,4667,4722&Values=34,46,51,63,77,83,90,100,140,203,442,645,646,657,944,945,1184,1311,1405,1412,1426,1716,1736,1767,1785,1935,1936,1944,1970,2310,2327,2352,2759,2767,2862,2878,2942,3067,3080&RawValues=&Redirect=http://www.intel.com/software/" target="_top"><IMG SRC="http://i.cmpnet.com/ads/graphics/as5/cc/banner_728x90c.gif" WIDTH=728 HEIGHT=90 BORDER=0></A>');
+}
+//-->
+</SCRIPT>
+            <NOEMBED><A 
+            href="http://as.cmpnet.com/event.ng/Type=click&amp;FlightID=45537&amp;AdID=80364&amp;TargetID=4722&amp;Segments=1411,3108,3448,4875,5817,5871&amp;Targets=2625,2878,4667,4722&amp;Values=34,46,51,63,77,83,90,100,140,203,442,645,646,657,944,945,1184,1311,1405,1412,1426,1716,1736,1767,1785,1935,1936,1944,1970,2310,2327,2352,2759,2767,2862,2878,2942,3067,3080&amp;RawValues=&amp;Redirect=http://www.intel.com/software/" 
+            target=_top><IMG height=90 
+            src="heaplayers-article-cuj_files/banner_728x90c.gif" width=728 
+            border=0></A> </NOEMBED><NOSCRIPT><A 
+            href="http://as.cmpnet.com/event.ng/Type=click&amp;FlightID=45537&amp;AdID=80364&amp;TargetID=4722&amp;Segments=1411,3108,3448,4875,5817,5871&amp;Targets=2625,2878,4667,4722&amp;Values=34,46,51,63,77,83,90,100,140,203,442,645,646,657,944,945,1184,1311,1405,1412,1426,1716,1736,1767,1785,1935,1936,1944,1970,2310,2327,2352,2759,2767,2862,2878,2942,3067,3080&amp;RawValues=&amp;Redirect=http://www.intel.com/software/" 
+            target=_top><IMG height=90 
+            src="heaplayers-article-cuj_files/banner_728x90c.gif" width=728 
+            border=0></A> </NOSCRIPT><IMG height=1 src="" width=1 border=0> </TD>
+        <TR>
+          <TD width=1 bgColor=#ffffff><IMG height=3 hspace=0 
+            src="heaplayers-article-cuj_files/blank.gif" width=1 border=0></TD>
+          <TD width=769 bgColor=#ffffff><IMG height=3 hspace=0 
+            src="heaplayers-article-cuj_files/blank.gif" width=769 
+        border=0></TD></TR>
+        <TR>
+          <TD width=770 bgColor=#000066 colSpan=2><IMG height=2 hspace=0 
+            src="heaplayers-article-cuj_files/blank.gif" width=770 
+        border=0></TD></TR></TBODY></TABLE><!-- end top banner table --><!-- header table --><MAP 
+      id=header name=header><AREA shape=RECT coords=149,22,489,67 
+        href="http://www.developerpipeline.com/"></MAP>
+      <TABLE cellSpacing=0 cellPadding=0 width=770 bgColor=#ffffff border=0>
+        <TBODY>
+        <TR height=69>
+          <TD vAlign=top width=68><A href="http://www.cmp.com/"><IMG height=69 
+            hspace=0 src="heaplayers-article-cuj_files/cmp_logo.gif" width=68 
+            border=0></A></TD>
+          <TD vAlign=top><IMG height=69 
+            src="heaplayers-article-cuj_files/top_header.jpg" width=702 
+            useMap=#header border=0></TD></TR></TBODY></TABLE><!-- end header table --><!-- search/utility nav table -->
+      <TABLE cellSpacing=0 cellPadding=0 width=770 bgColor=#ffffff border=0>
+        <TBODY>
+        <TR>
+          <TD bgColor=#000066><IMG height=1 hspace=0 
+            src="heaplayers-article-cuj_files/blank.gif" width=1 border=0></TD>
+          <TD width=1 bgColor=#000066><IMG height=1 hspace=0 
+            src="heaplayers-article-cuj_files/blank.gif" width=1 border=0></TD>
+          <TD width=1 bgColor=#ffffff><IMG height=1 hspace=0 
+            src="heaplayers-article-cuj_files/blank.gif" width=1 border=0></TD>
+          <TD width=1 bgColor=#000066><IMG height=1 hspace=0 
+            src="heaplayers-article-cuj_files/blank.gif" width=1 border=0></TD>
+          <TD bgColor=#000066><IMG height=1 hspace=0 
+            src="heaplayers-article-cuj_files/blank.gif" width=1 border=0></TD></TR>
+        <TR>
+          <TD><SPAN class=side><SPAN class=black12Bold>Developer Network 
+            Partners:</SPAN> <IMG height=1 hspace=0 
+            src="heaplayers-article-cuj_files/blank.gif" width=10 border=0> <A 
+            class=black12Bold href="http://www.cuj.com/">C/C++ Users Journal</A> 
+            <IMG height=8 hspace=0 src="heaplayers-article-cuj_files/blank.gif" 
+            width=10 border=0> <A class=black12Bold 
+            href="http://www.ddj.com/">Dr. Dobb's Journal</A> <IMG height=1 
+            hspace=0 src="heaplayers-article-cuj_files/blank.gif" width=10 
+            border=0> <A class=black12Bold 
+            href="http://www.sdmagazine.com/">Software Development</A> 
+</SPAN></TD>
+          <TD width=1 bgColor=#000066><IMG height=1 hspace=0 
+            src="heaplayers-article-cuj_files/blank.gif" width=1 border=0></TD>
+          <TD width=1 bgColor=#ffffff><IMG height=1 hspace=0 
+            src="heaplayers-article-cuj_files/blank.gif" width=1 border=0></TD>
+          <TD width=1 bgColor=#000066><IMG height=1 hspace=0 
+            src="heaplayers-article-cuj_files/blank.gif" width=1 border=0></TD><!-- UTILITY NAV -->
+          <TD align=middle><SPAN class=side><A class=black12Bold 
+            href="http://www.developerpipeline.com/contact.jhtml">Contact Us</A> 
+            <IMG height=8 hspace=0 src="heaplayers-article-cuj_files/blank.gif" 
+            width=18 border=0> <A class=black12Bold 
+            href="http://www.developerpipeline.com/about.jhtml">About Us</A> 
+            </SPAN></TD></TR></TBODY></TABLE><!-- end utility nav table --><!-- MAIN NAVIGATION TABS -->
+      <TABLE cellSpacing=0 cellPadding=0 width=770 bgColor=#ffffff border=0 
+      table_name="topNavigationTable">
+        <TBODY>
+        <TR>
+          <TD><A href="http://www.developerpipeline.com/news"><IMG height=29 
+            hspace=0 src="heaplayers-article-cuj_files/nav_news_dp.gif" 
+            border=0></A></TD>
+          <TD><A href="http://www.developerpipeline.com/trends"><IMG height=29 
+            hspace=0 src="heaplayers-article-cuj_files/nav_trends_dp.gif" 
+            border=0></A></TD>
+          <TD><A href="http://www.developerpipeline.com/howto"><IMG height=29 
+            hspace=0 src="heaplayers-article-cuj_files/nav_howto_dp.gif" 
+            border=0></A></TD>
+          <TD><A href="http://productfinder.developerpipeline.com/"><IMG 
+            height=29 hspace=0 
+            src="heaplayers-article-cuj_files/nav_productfinder_dp.gif" 
+            border=0></A></TD>
+          <TD><A href="http://www.developerpipeline.com/coding"><IMG height=29 
+            alt="Coding &amp; Scripting" hspace=0 
+            src="heaplayers-article-cuj_files/nav_coding_dp.gif" 
+border=0></A></TD>
+          <TD><A href="http://www.developerpipeline.com/design"><IMG height=29 
+            alt="Design &amp; Process" hspace=0 
+            src="heaplayers-article-cuj_files/nav_design_dp.gif" 
+border=0></A></TD>
+          <TD><A href="http://www.developerpipeline.com/tools"><IMG height=29 
+            alt=Tools hspace=0 
+            src="heaplayers-article-cuj_files/nav_tools_dp.gif" border=0></A></TD>
+          <TD><A href="http://www.developerpipeline.com/business"><IMG 
+            height=29 alt="Business &amp; Careers" hspace=0 
+            src="heaplayers-article-cuj_files/nav_business_dp.gif" 
+          border=0></A></TD></TR></TBODY></TABLE><!-- END MAIN NAVIGATION TABS --><!-- user notification table --><!--
+		 <br>
+		<table border="0" cellpadding="2" cellspacing="1" bgcolor="CC6600">
+  <tr>
+    <td bgcolor="FFD673">Some content requires registration to the CMP Developer Network.
+      Sign up today!.</td>
+  </tr>
+</table>
+--><!-- end user notification table --><!-- MAIN CONTENT TABLE -->
+      <TABLE cellSpacing=0 cellPadding=0 width=770 bgColor=#ffffff border=0>
+        <TBODY>
+        <TR>
+          <TD><IMG height=1 hspace=0 
+            src="heaplayers-article-cuj_files/blank.gif" width=1 border=0></TD></TR>
+        <TR>
+          <TD>
+            <TABLE cellSpacing=0 cellPadding=5 width="100%" border=0>
+              <TBODY>
+              <TR vAlign=top>
+                <TD><A 
+                  href="http://devnet.developerpipeline.com/">Developer::Pipelines</A> 
+                  &gt; <A 
+                  href="http://devnet.developerpipeline.com/cpp/">C++</A><BR><BR></TD>
+                <TD>&nbsp;</TD>
+                <TD align=right><!-- log in --><!--
+<a href='https://www.sdmediagroup.com/reg/?site=devnet.developerpipeline.com&content=http://devnet.developerpipeline.com/'><b>LOG IN</b></a> &#8226; 
+<a href=/resetpassword.html>Forgot password?</a> &#8226; 
+<a href=http://www.sdmediagroup.com/reg/faq.html>Registration FAQ</a> <br>
+--><!-- end log in --><!--
+<a href="javascript:openScript('http://www.sdmediagroup.com/reg/faq.html#compare',650,480)"><img src="/images/new/premium_bullet.gif" hspace="0" vspace="0" border="0"></a> Denotes content for All Access members only
+--></TD></TR></TBODY></TABLE></TD></TR>
+        <TR>
+          <TD vAlign=top align=left><!-- jumbobox ad --><!-- <table border="0" align="right" cellpadding="5" cellspacing="0">
+			  <tr>
+			  <td>
+			  <mpdoc:Ad group="sdmg" site="sdmgdeveloperpipeline" pagepos="jumbobox" documentsonly="true" spot="jumbobox">
+			  </td>
+			  </tr>
+			  </table>--><!-- end jumbobox ad --><!-- IMG height=40 hspace=5 src="java.gif" vspace=5 width=460 -->
+            <H1><FONT color=#5f92c7>Developer::</FONT>C++ Pipeline</H1><!-- -------- BEGIN Nav Anchors -->
+            <P><A class=header 
+            href="http://devnet.developerpipeline.com/cpp/index.html#articles">Articles</A> 
+            | <A class=header 
+            href="http://devnet.developerpipeline.com/cpp/index.html#books">Books</A> 
+            | <A class=header 
+            href="http://devnet.developerpipeline.com/cpp/index.html#showcase">Products</A> 
+            | <A class=header 
+            href="http://devnet.developerpipeline.com/cpp/index.html#papers">Whitepapers</A> 
+            | <A class=header 
+            href="http://devnet.developerpipeline.com/cpp/index.html#events">Training/Conferences</A> 
+            | <A class=header 
+            href="http://devnet.developerpipeline.com/cpp/index.html#forum">Discussion 
+            Forum</A> | <A class=header 
+            href="http://syndication.sdmediagroup.com/feeds/public/cmp_devnet_c++.xml">C++ 
+            RSS Feed </A></P><!-- -------- END Nav Anchors --><!-- -------- BEGIN Vendor --><!-- AD: 'http://localhost:8085/html.ng/site=sdmg&affiliate=sdmgdeveloperpipeline&pagepos=logo&catid=&site_section=9843&articleid=141768&target=cpp&country=&state=' --><A>This 
+            Pipeline Sponsored By:&nbsp;</A><A 
+            href="http://as.cmpnet.com/event.ng/Type=click&amp;FlightID=45541&amp;AdID=75588&amp;TargetID=4729&amp;Segments=1411,3108,3448,4875,5825,5867&amp;Targets=2625,2878,4729&amp;Values=34,46,51,63,77,83,90,100,140,442,618,645,646,657,944,945,1184,1311,1405,1412,1426,1716,1736,1767,1785,1935,1936,1944,1970,2310,2327,2352,2759,2767,2862,2878,2942,3067,3080&amp;RawValues=&amp;Redirect=http://www.intel.com/"><IMG 
+            src="heaplayers-article-cuj_files/intel_logo2.gif" align=middle 
+            border=0></A><IMG height=1 src="" width=1 border=0> 
+            <HR align=left noShade SIZE=1>
+<!-- ---------- End Vendor --><!-- jumbobox ad -->
+            <TABLE cellSpacing=0 cellPadding=5 align=right border=0>
+              <TBODY>
+              <TR>
+                <TD><!-- AD: 'http://localhost:8085/html.ng/site=sdmg&affiliate=sdmgdeveloperpipeline&pagepos=jumbobox&catid=&site_section=9843&articleid=141768&target=cpp&country=&state=' --><A 
+                  href="http://as.cmpnet.com/event.ng/Type=click&amp;FlightID=45540&amp;AdID=75586&amp;TargetID=4718&amp;Segments=1411,3108,3448,4569,4875,5819,5866&amp;Targets=2625,2878,3885,4665,4718&amp;Values=34,46,51,63,77,83,90,100,140,290,442,645,646,657,944,945,1184,1311,1405,1412,1426,1716,1736,1767,1785,1935,1936,1944,1970,2310,2327,2352,2759,2767,2862,2878,2942,3067,3080&amp;RawValues=IP,127.0.0.1,&amp;Redirect=http://" 
+                  target=_parent><IMG height=1 alt="" 
+                  src="C:\home\emery\projects\heaplayers\doc\heaplayers-article-cuj_files\blank(1).gif" 
+                  width=1 border=0></A><IMG height=1 src="" width=1 border=0> 
+              </TD></TR></TBODY></TABLE><!-- end jumbobox ad --><!--Copyright &#169; C/C++ Users Journal-->
+            <P><I>C/C++ Users Journal</I> December, 2005</P>
+            <H1>Policy-Based Memory Allocation</H1>
+            <H2>Fine-tuning your memory management</H2>
+            <H3>By Andrei Alexandrescu and Emery Berger</H3><I>Andrei 
+            Alexandrescu is a graduate student in Computer Science at the 
+            University of Washington and author of Modern C++ Design. He can be 
+            contacted at andrei@metalanguage.com.</I> 
+            <HR>
+
+            <P>One of the perks of doing hard work for next to no money, an 
+            activity also known as being a graduate student, is that you get to 
+            rub shoulders with researchers working on interesting problems. I've 
+            had the pleasure of meeting in person both Emery Berger and Kathryn 
+            McKinley, two of the authors (with Benjamin Zorn) of "Composing 
+            High-Performance Memory Allocators" [6], a paper that I found highly 
+            interesting for "I can't believe I didn't think of that" reasons. 
+            But let's start at the beginning.</P>
+            <P>One chapter of <I>Modern C++ Design</I> [2] is somewhat different 
+            than all the others. Actually, very different. While the book is 
+            dedicated to creating elegant, flexible, extensible designs, one 
+            chapter stands out like a sore thumb by actually describing one 
+            fixed, monolithic, rigid, awkward piece of software: Loki's small 
+            object allocator. Somehow, I thought that memory management was a 
+            low-level operation and, as such, didn't lend itself to the elegant 
+            exploits of policy-based design. At the same time, some of the 
+            compiler-provided <B>new</B>/<B>delete</B> implementations were 
+            pretty bad at dealing with small objects, so I felt there would be a 
+            need for something to fill the void. So I sat down and wrote an 
+            implementation that has portability as its only merit; other than 
+            that, it's not particularly performant, interesting, or original. 
+            The main problem with Loki's allocator, however, does not lie in its 
+            implementation (which, by the way, has been entirely rewritten by 
+            Rich Sposato, to the end of greatly improving its performance), but 
+            in its design, which is not configurable nor extensiblejust a few 
+            monolithic classes, much like what you'd expect in the bad ol' 
+            days.</P>
+            <P>However, at about the same time, Emery Berger and others were 
+            experimenting with a mixin-based memory allocator for C++ that is at 
+            the same time highly efficient (rivaling the best general-purpose 
+            allocators out there), highly customizable (rivaling the best 
+            special-purpose allocators, too), and highly portable by virtue of 
+            its customizable design! As soon as I became acquainted with that 
+            research, I realized what the chapter on memory allocation in 
+            <I>Modern C++ Design</I> should have looked like.</P>
+            <P>But before we delve into the fascinating topic of configurable 
+            memory allocation, let's tie a few knots with past comments received 
+            via e-mail.</P>
+            <H3>Mailcontainer</H3>
+            <P>I wrote the sidebar "Memory: More Than Just Any Resource" in the 
+            last Generic&lt;Programming&gt; installment with the serene 
+            resignation with which Galileo Galilei must have said his famous 
+            "Eppur si muove." "And yet, garbage is collectable," I mumbled into 
+            my three-days beard when submitting the article for publication. The 
+            expected outcome was that the opponents of garbage collection would 
+            exemplarily mortify me via an endless flow of angry e-mails. 
+            However, they must've chosen instead to boycott me, because I 
+            haven't gotten a single response in protest.</P>
+            <P>Ivan Godard sent me an e-mail on the subject of Observers [3, 4]. 
+            That message was so smart, and had me look up words in the 
+            dictionary so often, that I've decided to quote it almost in 
+            entirety, at the risk of blowing up the size of this article:</P>
+            <BLOCKQUOTE>Your difficulties with <B>attach</B> and <B>detach</B> 
+              while in the middle of notification are canonical concurrency 
+              problems, and can be dealt with in the usual way. The (only 
+              reasonable?) semantics for Observer is to see <B>subject</B>, 
+              <B>observer</B>, and <B>event</B> as three independent and 
+              asynchronous processes, with a time stream localized at 
+              <B>subject</B>. That is, an <B>observer</B> cannot directly 
+              determine the time relation between its attempt to attach and the 
+              occurrence of a particular event because the event is not within 
+              the observer's horizon. Only the <B>subject</B>, which receives 
+              both events and requests to <B>attach</B>, can time-order 
+              these.<BR><BR>Consequently a putative observer will see some 
+              sequence of events that (in the subject's time frame) begins some 
+              time after the attempt to attach and ends some time after the 
+              attempt to detach. The sequence is guaranteed to be ordered (in 
+              subject time) and dense, but where it starts and where it ends is 
+              not known. Of course, if the observer is itself a source of events 
+              and the channel between observer and subject is order-preserving, 
+              then the observer can enforce somewhat more stringent bounds on 
+              how far the observed sequence extends into the subject's past or 
+              subject's future by injecting an event just before the attach or 
+              just after the detach.<BR><BR>So much for relativity theory. In 
+              practice, this implements naturally by considering the attempt to 
+              attach and the attempt to detach as being themselves events. The 
+              subject enqueues an event (including an <B>attach</B>/ 
+              <B>detach</B>) on an action list, and walks the list of observers 
+              applying each event in turn to each observer. Both observers and 
+              events are timestamped; a simple counter will do. Events are 
+              discarded when there are no observers with lesser stamps. The 
+              observer list is preceded by an observer (the subject itself) that 
+              is watching for attach events and that adds the observer to the 
+              observer list. All observers are watching for their own detach 
+              events and remove themselves when the subject applies the 
+              corresponding detach event. [...]<BR><BR>Most of the difficulties 
+              you encountered appear to be a consequence of the assumption that 
+              attach and detach were somehow global and absolute, rather than 
+              just another event in the sequence of events encountered by the 
+              subject. Remove that mistaken idea and your invalidated-iterators 
+              problems disappear.<BR></BLOCKQUOTE>
+            <P>This view of attachment and detachment as simple events is very 
+            interesting. This generalization would, however, make it harder to 
+            define policies that lead to the simple implementations in the 
+            article. Let's admit, such simple solutions are widely used and have 
+            their place in spite of their risks and limitations. If anyone would 
+            like to embark on defining a policy-based design for such a 
+            "relativistic" Observer, and if the design does allow efficient 
+            simple implementations as well, I'd be highly interested. Contact 
+            Ivan at igodard@pacbell.net with questions.</P>
+            <P>Brian Wood comments on the "Walking Down Memory Lane" 
+article:</P>
+            <BLOCKQUOTE>While you introduce <B>auto_vector</B>, you didn't 
+              mention either of the <B>ptr_vector</B> implementations. Thorsten 
+              Ottosen has written an interesting article about <B>ptr_vector</B> 
+              in the October 2005 issue of <I>Dr. Dobb's Journal</I>. 
+              <B>auto_vector</B> and the <B>ptr_vector</B> by Ottosen are 
+              obviously closely related, but also have differences. Some mention 
+              to <B>ptr_vector</B> and the differences would have been helpful, 
+              I think.<BR><BR>Anyway, from my own experience, I agree with you 
+              that things like <B>auto_vector</B> and <B>ptr_vector</B> are 
+              often preferable to <B>vector&lt;shared_ptr&lt;T&gt; 
+            &gt;</B>.<BR></BLOCKQUOTE>
+            <P>Great, thanks Brianand readership, consider yourself tipped on 
+            where to look for more material related to scoped memory 
+            management.</P>
+            <H3>Memory Allocation: One Size Doesn't Fit ll</H3>
+            <P>Today's general-purpose memory allocators have reached reasonable 
+            speed and low fragmentation for a large category of programs. 
+            However, in the memory-allocation realm, a little information can go 
+            a long way. Application-specific information about allocation 
+            patterns helps to implement specialized memory allocators that 
+            heavily improve the bottom line of many high-performance 
+            applications. Sometimes, as little intel as "Blocks of size 80 are 
+            allocated more often than blocks of all other sizes," when properly 
+            used (as we'll discuss soon), can incredibly improve the bottom-line 
+            runtime of a program. (Caveat: Sometimes customized allocators are 
+            no better, and can be worse, than general-purpose allocatorssee the 
+            paper "Reconsidering Custom Memory Allocation" [7] for more 
+            details.) While general-purpose allocators have average overheads in 
+            the hundreds of cycles, a good customized memory allocator can 
+            require as few as half a dozen cycles.</P>
+            <P>That's why many high-profile, high-performance applications (GCC, 
+            Apache, and Microsoft's SQL Server to name just a few) implement 
+            their own memory allocator. A good idea, then, is to generalize such 
+            good specialized allocators and put them in a library. But 
+            "generalization" and "specialization" are in tension: Your 
+            application might have different allocation patterns that would 
+            require yet another behavior from your allocator. What to do?</P>
+            <P>But wait, there's more. If we do devise a method to easily create 
+            special-purpose memory allocators, we can go full-circle and define 
+            a general-purpose allocator as a combination of wisely chosen 
+            special-purpose allocators. If the resulting general-purpose 
+            allocator compares favorably with the existing monolithic 
+            general-purpose allocators, then the design is valid and useful.</P>
+            <P>Emery's team worked towards that idea, leading to their library 
+            HeapLayers (http://heaplayers.org/). To define configurable 
+            allocators, they used mixins (also known as Coplien's curiously 
+            recurring pattern in the C++ community): defining classes with a 
+            parameterized base. Each layer defines only two member functions, 
+            <B>malloc</B> and <B>free</B>:</P><PRE>template &lt;class T&gt;
+struct Allocator : public T {
+  void * malloc(size_t sz);
+  void free(void* p);
+  // system-dependent value
+  enum { Alignment = sizeof(double) };
+  // optional interface
+  size_t getSize(const void* p);
+};
+
+</PRE>
+            <P>Each layer implementation would get a crack on allocation and 
+            deallocation, possibly (and likely) requesting memory from its base 
+            class. A self-contained allocator sits at the very top of the 
+            hierarchyone that forwards requests straight to the system's 
+            <B>new</B> and <B>delete</B> operators, <B>malloc</B> and 
+            <B>free</B> functions, and the such. In HeapLayers terminology, 
+            these are the top heaps. To exemplify (careful with the 
+            qualifications so we don't enter infinite recursion):</P><PRE>struct MallocHeap {
+  void * malloc(size_t sz) {
+    return std::malloc(sz);
+  }
+  void free(void* p) {
+    return std::free(p);
+  }
+};
+
+</PRE>
+            <P>Top heaps can also be implemented around system calls for getting 
+            memory, such as UNIX's <B>sbrk</B> or <B>mmap</B>. This is necessary 
+            when you're completely replacing <B>malloc</B> and friends.</P>
+            <P>The <B>getSize</B> function has a special status. Not everybody 
+            is going to need it, so defining it is optional (if you combine the 
+            wrong layers, the compiler will tell you). If it does, all you have 
+            to do is insert a layer that stores the block size and offers the 
+            <B>getSize</B> primitive; see <A 
+            href="http://devnet.developerpipeline.com/documents/s=9843/q=1/cuj0512alexandrescu/0512alexandrescul1.html" 
+            target=_BLANK>Listing 1</A>.</P>
+            <P><B>SizeHeap</B> is the perfect illustration of how to implement a 
+            useful layer that hooks into its base's <B>malloc</B> and 
+            <B>free</B> functions, does something extra, and returns "doctored" 
+            results to the client. <B>SizeHeap</B> does its work by allocating 
+            extra memory to store the block size, with the appropriate cautions 
+            (the union) to stay as immune as possible to the alignment issue. 
+            The client gets access to the memory right next to that extra data. 
+            It's not hard to imagine building a debug heap that pads the memory 
+            block before and after with some bytes filled with a particular 
+            pattern, and then verify for overruns by checking whether the 
+            pattern has been preserved. In fact, that's exactly what HeapLayers' 
+            <B>DebugHeap</B> layer does. Pretty neat.</P>
+            <P>But wait, something's suboptimal here. Some systems already offer 
+            a primitive to compute the size of a <B>malloc</B>ated block. On 
+            those systems, <B>SizeHeap</B> would actually waste space. In that 
+            case (for example, on Microsoft Visual C++), you wouldn't need 
+            <B>SizeHeap</B> in conjunction with <B>MallocHeap</B>, because 
+            <B>MallocHeap</B> would implement <B>getSize</B> out of the box:</P><PRE>struct MallocHeap {
+  ... as above ...
+  size_t getSize(void* p) {
+    return _msize(p);
+  }
+};
+
+</PRE>
+            <P>But wait, something's still suboptimal here. Remember, we're 
+            counting cycles. What if a system's <B>malloc</B> documentation 
+            states that the block size is stored in a word prior to the actual 
+            block? In that case, <B>SizeHeap</B> would still waste memory by 
+            storing yet another word next to the one already planted by the 
+            system. What's needed is a layer that implements <B>getSize</B> just 
+            the way <B>SizeHeap</B> does, but doesn't hook <B>malloc</B> and 
+            <B>free</B>. That's why <B>HeapLayers</B> segregates the previously 
+            shown <B>SizeHeap</B> in two; see <A 
+            href="http://devnet.developerpipeline.com/documents/s=9843/q=1/cuj0512alexandrescu/0512alexandrescul2.html" 
+            target=_BLANK>Listing 2</A>.</P>
+            <P>Now <B>SizeHeap</B> always (correctly) adds the 
+            <B>UseSizeHeap</B> layer and exploits its <B>getSize</B> 
+            implementation, while <B>UseSizeHeap</B> can also be used in other 
+            configurationsa very elegant design.</P>
+            <H3>A Useful Example: FreelistHeap</H3>
+            <P>Let's face it, so far we have kind of set up the stage. We do 
+            have an architecture, but no clue on how to write an efficient 
+            specialized allocator using layers. A popular and "most bang for the 
+            buck" strategy is the following:</P>
+            <OL>
+              <LI>Collect stats about your application's allocation counts for 
+              each size. 
+              <LI>For the most often asked size (call it <B>S</B>), maintain a 
+              private, singly linked list. 
+              <LI>Memory allocations for <B>S</B> return memory from that list 
+              if possible, or else from the default allocator (in a layered 
+              architecture, from the superior layer). 
+              <LI>Memory deallocations for blocks of size <B>S</B> push the 
+              block into the list. </LI></OL>
+            <P>A refinement of the strategy would be to use the same free list 
+            for a range of sizes <B>S1</B> to <B>S2</B>, at the cost of some 
+            slack memory. The needed singly linked list operations are 
+            <B>O(1)</B> and actually only a few instructions. In addition, the 
+            pointer to the next item can be stored in the actual block (the 
+            block stores no useful datait's always a freed block!) so there's 
+            no extra memory required per block. Given that most applications' 
+            allocation size distribution is highly skewed, free lists are any 
+            allocator implementer's indispensable utensil.</P>
+            <P>Let's implement a layer that implements a free list for a range 
+            of statically known sizes <B>S1</B> to <B>S2</B>; see <A 
+            href="http://devnet.developerpipeline.com/documents/s=9843/q=1/cuj0512alexandrescu/0512alexandrescul3.html" 
+            target=_BLANK>Listing 3</A>.</P>
+            <P>Now you can define a custom heap like this:</P><PRE>typedef FLHeap&lt;
+  SizeHeap&lt;MallocHeap&gt;,
+  24,
+  32&gt;
+SmartoHeapo;
+
+</PRE>
+            <P><B>SmartoHeapo</B> will be superfast for allocation sizes between 
+            24 and 32, and pretty much the same for all other sizes.</P>
+            <H3>In-Place Resizing</H3>
+            <P>Many a C++ programmer has been dreaming for a standard primitive 
+            to reallocate memory in place. You see, C has <B>realloc</B>, which 
+            can do in-place reallocation if possible, or use <B>memcpy</B> when 
+            it comes about copying data around. But <B>memcpy</B> doesn't work 
+            for C++ objects, so <B>realloc</B> doesn't work for C++ objects,; 
+            therefore, any sort of renew primitive can't be implemented using 
+            the Standard C allocator. So C++ doesn't have renew [1].</P>
+            <P>To give you an idea of the improvements that in-place 
+            reallocation can bring to C++ code, consider:</P><PRE>const int n = 10000;
+Vec v;
+for (int i = 0; i &lt; n; ++i)
+  v.push_back(0);
+
+</PRE>
+            <P>Howard Hinnant of Metrowerks has been working on implementing 
+            in-place expansion for CodeWarrior's Standard Library 
+            implementation. In Howard's own words:</P>
+            <BLOCKQUOTE>I currently have a <B>vector&lt;T, 
+              malloc_allocator&lt;T&gt; &gt;</B> that does [...] expand-in-place 
+              based on N1085 [8]. It blows the doors off a built-in C-like 
+              array! :-) When <B>Vec</B> is a <B>vector&lt;int&gt;</B> without 
+              expand-in-place: <PRE>0.00095674 seconds</PRE>When <B>Vec</B> is a 
+              <B>vector&lt;int&gt;</B> with expand-in-place: <PRE>0.000416943 seconds</PRE>The timings should only be trusted 
+              to two significant digits. But rest assured, I've done the work to 
+              secure those two digits. We are not looking at an anomaly here. 
+            </BLOCKQUOTE><PRE></PRE>
+            <P>Given the benefits of in-place resizing and that each heap layer 
+            has control over its own allocation algorithms and data structures, 
+            let's augment the heap-layer interface:</P><PRE>template &lt;class T&gt;
+struct Allocator : public T {
+  void * malloc(size_t sz);
+  void free(void* p);
+  size_t expand(void* p, size_t min, size_t max);
+};
+
+</PRE>
+            <P>The semantics of expand is, try to expand the block pointed to by 
+            <B>p</B> to the largest size possible between <B>min</B> and 
+            <B>max</B>. Then return whatever size you could expand the memory 
+            to, or zero if no expansion was possible. Fortunately, things can be 
+            arranged such that a layer doesn't have to fuss about the expand 
+            routine unless it wants to. That works if all top allocators inherit 
+            the following little class:</P><PRE>struct TopHeap {
+  size_t expand(void*, size_t, size_t) {
+    return 0;
+  }
+  // not intended for standalone usage
+protected:
+  ~TopHeap() {}
+};
+
+</PRE>
+            <H3>Conclusion</H3>
+            <P>Configurable memory allocation is, as Emery's research has shown, 
+            a practical, all-in-one alternative to both specialized and 
+            general-purpose allocators. Emery's numbers (refer to the paper [6] 
+            for details) consistently show that allocators created with 
+            HeapLayers perform just as well as, or better than, monolithic 
+            allocators, be they general-purpose or specialized. Moreover, 
+            HeapLayers' layered architecture encourages easier experimentation, 
+            simpler debugging, and unparalleled extensibility. Instead of being 
+            an oddball chapter of <I>Modern C++ Design</I>, memory allocation 
+            should have been one of the best success stories of policy-based 
+            design.</P>
+            <P><A 
+            href="http://devnet.developerpipeline.com/documents/s=9843/q=1/cuj0512alexandrescu/0512alexandrescut1.html" 
+            target=_BLANK>Table 1</A> shows a relevant subset of the layers 
+            implemented in HeapLayers. There would be a lot of goodies to 
+            discuss, such as the locked heaps for multithreaded operations, the 
+            STL adapter, the various utility heaps, or how the layers can be 
+            combined to create a general-purpose allocator. But conventional 
+            wisdom warns us that "The mind can only enjoy what the butt can 
+            endure," so it's about time to shut downwithout forgetting to 
+            release the memory in destructors. Happy coding.</P>
+            <H3>References</H3>
+            <OL>
+              <LI>Alexandrescu, Andrei. "Generic&lt;Programming&gt;: Typed 
+              Buffers (III)," <I>C++ Experts Online</I>, December 2001. 
+              Available at http://erdani.org/ publications/cuj-12-2001.html. 
+              <LI>Alexandrescu, Andrei. <I>Modern C++ Design</I>, Addison-Wesley 
+              Longman, 2001. 
+              <LI>Alexandrescu, Andrei. "Generic&lt;Programming&gt;: Prying 
+              Eyes: A Policy-Based Observer (I)," <I>C++ Users Journal</I>, 
+              April 2005. 
+              <LI>Alexandrescu, Andrei. "Generic&lt;Programming&gt;: Prying 
+              Eyes: A Policy-Based Observer (II)," <I>C++ Users Journal</I>, 
+              June 2005. 
+              <LI>Berger, Emery D., Kathryn S. McKinley, Robert D. Blumofe, and 
+              Paul R. Wilson. "Hoard: A scalable memory allocator for 
+              multithreaded applications. In International Conference on 
+              Architectural Support for Programming Languages and Operating 
+              Systems (ASPLOS-IX), pp. 117-128. Cambridge, MA, November 2000; 
+              http://citeseer.ist.psu.edu/berger00hoard.html. 
+              <LI>Berger, Emery D., Benjamin G. Zorn, and Kathryn S. McKinley. 
+              "Composing High-Performance Memory Allocators," in SIGPLAN 
+              Conference on Programming Language Design and Implementation, pp. 
+              114-124, 2001; http://citeseer.ist.psu.edu/berger01composing.html. 
+
+              <LI>Berger, Emery D., Benjamin G. Zorn, and Kathryn S. McKinley. 
+              "Reconsidering custom memory allocation," in Proceedings of the 
+              Conference on Object-Oriented Programming Systems, Languages, and 
+              Applications (OOPSLA) 2002. Seattle, Washington, November 2002; 
+              http://citeseer.ist.psu.edu/berger02reconsidering.html. 
+              <LI>Hinnant, Howard. Proposal to augment the interface of 
+              malloc/free/realloc/calloc. See 
+              http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1085.htm.</LI></OL>
+            <H5>CUJ</H5>
+            <P>&nbsp;</P>
+            <TABLE cellSpacing=1 cellPadding=5 width="100%" bgColor=#000000 
+            border=0>
+              <TBODY>
+              <TR vAlign=top bgColor=#ffffff>
+                <TD width="50%"><!-- -------------------- BEGIN Forum --><A 
+                  class=header name=forum>From our C Discussion Forum</A><BR><A 
+                  href="http://devnet.developerpipeline.com/forums/thread.html?forumid=64&amp;threadid=23245">Serial 
+                  USB support and code</A><BR><!MESSAGE!><BR><A 
+                  href="http://devnet.developerpipeline.com/forums/thread.html?forumid=64&amp;threadid=23242">ATA 
+                  PC Card Identify Drive</A><BR><!MESSAGE!><BR><A 
+                  href="http://devnet.developerpipeline.com/forums/thread.html?forumid=64&amp;threadid=23239">need 
+                  Mathematic lib source code </A><BR><!MESSAGE!><BR><A 
+                  href="http://devnet.developerpipeline.com/forums/forum.html?forumid=64">Visit 
+                  the C Forum</A> <!-- -------------------- END Forum --></TD>
+                <TD width="50%"><A class=header>C++ related Articles</A> 
+                  <BR><B><A 
+                  href="http://devnet.developerpipeline.com/documents/s=9843/q=1/ddj050820pc/ddj050820pc.mp3">Eclipse 
+                  CDT 3.0 Released</A></B><BR><BR></TD></TR></TBODY></TABLE></TD><!-- divider columns --></TR>
+        <TR>
+          <TD vAlign=top align=left height=10><IMG height=10 hspace=0 
+            src="heaplayers-article-cuj_files/blank.gif" width=770 
+        border=0></TD></TR></TBODY></TABLE><!-- END MAIN CONTENT TABLE --><!-- BOTTOM NAVIGATION -->
+      <TABLE cellSpacing=0 cellPadding=0 width=770 bgColor=#ffffff border=0 
+      table_name="footerTable">
+        <TBODY>
+        <TR>
+          <TD align=middle bgColor=#999999><IMG height=2 hspace=0 
+            src="heaplayers-article-cuj_files/blank.gif" width=770 
+        border=0></TD></TR>
+        <TR>
+          <TD>
+            <DIV class=BOTnav><A class=blacknavigation 
+            href="http://www.developerpipeline.comnews/">News</A> <IMG height=11 
+            hspace=5 src="heaplayers-article-cuj_files/orangeline.gif" width=2 
+            border=0 valign="absbottom"> <A class=blacknavigation 
+            href="http://www.developerpipeline.com/trends">Trends</A> <IMG 
+            height=11 hspace=5 src="heaplayers-article-cuj_files/orangeline.gif" 
+            width=2 border=0 valign="absbottom"> <A class=blacknavigation 
+            href="http://productfinder.developerpipeline.com/">Product 
+            Finder</A> <IMG height=11 hspace=5 
+            src="heaplayers-article-cuj_files/orangeline.gif" width=2 border=0 
+            valign="absbottom"> <A class=blacknavigation 
+            href="http://www.developerpipeline.com/howto">How-To</A> <IMG 
+            height=11 hspace=5 src="heaplayers-article-cuj_files/orangeline.gif" 
+            width=2 border=0 valign="absbottom"> <A class=blacknavigation 
+            href="http://www.developerpipeline.com/coding">Coding &amp; 
+            Scripting</A> <IMG height=11 hspace=5 
+            src="heaplayers-article-cuj_files/orangeline.gif" width=2 border=0 
+            valign="absbottom"> <A class=blacknavigation 
+            href="http://www.developerpipeline.com/design">Design &amp; 
+            Process</A> <IMG height=11 hspace=5 
+            src="heaplayers-article-cuj_files/orangeline.gif" width=2 border=0 
+            valign="absbottom"> <A class=blacknavigation 
+            href="http://www.developerpipeline.com/tools">Tools</A> <IMG 
+            height=11 hspace=5 src="heaplayers-article-cuj_files/orangeline.gif" 
+            width=2 border=0 valign="absbottom"> <A class=blacknavigation 
+            href="http://www.developerpipeline.com/business">Business &amp; 
+            Careers</A> <BR><A class=blacknavigation 
+            href="http://www.developerpipeline.com/newsletter.jhtml">Free 
+            Newsletters</A> <IMG height=11 hspace=5 
+            src="heaplayers-article-cuj_files/orangeline.gif" width=2 border=0 
+            valign="absbottom"> <A class=blacknavigation 
+            href="http://www.developerpipeline.com/glossary.jhtml">Developer 
+            Glossary</A> <IMG height=11 hspace=5 
+            src="heaplayers-article-cuj_files/orangeline.gif" width=2 border=0 
+            valign="absbottom"> <A class=blacknavigation 
+            href="http://www.developerpipeline.com/contact.jhtml">Contact Us</A> 
+            <IMG height=11 hspace=5 
+            src="heaplayers-article-cuj_files/orangeline.gif" width=2 border=0 
+            valign="absbottom"> <A class=blacknavigation 
+            href="http://www.developerpipeline.com/about.jhtml">About Us</A> 
+            <IMG height=11 hspace=5 
+            src="heaplayers-article-cuj_files/orangeline.gif" width=2 border=0 
+            valign="absbottom"> <A class=blacknavigation 
+            href="http://www.cmp.com/delivery/privacy.html">Privacy</A> <IMG 
+            height=11 hspace=5 src="heaplayers-article-cuj_files/orangeline.gif" 
+            width=2 border=0 valign="absbottom"> <A class=blacknavigation 
+            href="http://www.cmp.com/delivery/privacy.html#california">Your 
+            California Privacy Rights</A> </DIV></TD></TR>
+        <TR>
+          <TD align=middle bgColor=#999999><IMG height=1 hspace=0 
+            src="heaplayers-article-cuj_files/blank.gif" width=770 
+        border=0></TD></TR>
+        <TR>
+          <TD><!-- indusrty brains table -->
+            <TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
+              <TBODY>
+              <TR>
+                <TD vAlign=center align=middle><BR><BR><!-- indusrty brains --><SPAN 
+                  id=nointelliTXT>
+                  <TABLE cellSpacing=2 cellPadding=0 width="90%" bgColor=#223378 
+                  border=0>
+                    <TBODY>
+                    <TR>
+                      <TD>
+                        <TABLE class=txtBlk_small cellSpacing=0 cellPadding=5 
+                        width="100%" bgColor=#efefef border=0>
+                          <TBODY>
+                          <TR>
+                            <TD>
+                              <DIV align=center><SPAN 
+                              class=txtBlk_small><B>MarketPlace</B></SPAN></DIV><BR>
+                              <DIV align=center><A 
+                              href="http://www.industrybrains.com/cmpsd">Wanna 
+                              see your ad 
+                    here?</A></DIV></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></SPAN><!-- end IB --></TD></TR></TBODY></TABLE><BR><!-- end indusrty brains table-->
+            <DIV class=BOTnav><A class=orange11 
+            href="http://www.internetweek.com/"></A>Developer Network Websites: 
+            <A class=orange11 href="http://www.byte.com/" 
+            target=_blank>BYTE.com</A>, <A class=orange11 
+            href="http://www.cuj.com/" target=_blank>C/C++ Users Journal</A>, <A 
+            class=orange11 href="http://developerpipeline.com/" 
+            target=_blank>Developer Pipeline</A>, <A class=orange11 
+            href="http://www.ddj.com/" target=_blank>Dr. Dobb's Journal</A>, <A 
+            class=orange11 href="http://www.dotnetjunkies.com/" 
+            target=_blank>DotNetJunkies</A>, <A class=orange11 
+            href="http://msdn.microsoft.com/msdnmag/" target=_blank>MSDN 
+            Magazine</A>, <A class=orange11 href="http://www.samag.com/" 
+            target=_blank>Sys Admin</A>, <A class=orange11 
+            href="http://www.sdexpo.com/" target=_blank>SD Expo</A>, <A 
+            class=orange11 href="http://www.sdmagazine.com/" 
+            target=_blank>Software Development Magazine</A>, <A class=orange11 
+            href="http://www.sqljunkies.com/" target=_blank>SqlJunkies</A>, <A 
+            class=orange11 href="http://www.unixreview.com/" 
+            target=_blank>Unixreview</A>, <A class=orange11 
+            href="http://www.windevnet.com/" target=_blank>Windows Developer 
+            Network</A>, <A class=orange11 
+            href="http://www.newarchitectmag.com/" target=_blank>New 
+            Architect</A> </DIV></TD></TR>
+        <TR>
+          <TD align=middle bgColor=#cccccc>
+            <DIV class=BOTnavgrey><SPAN class=grey9><A class=grey9 
+            href="http://www.cmp.com/delivery/copyright.html">Copyright</A> © 
+            2005<A class=grey9 href="http://www.cmp.com/">CMP Media LLC.</A> | 
+            DEVELOPER PIPELINE All rights reserved. <A class=grey9 
+            href="http://www.cmp.com/delivery/privacy.html">Privacy Policy</A> | 
+            <A href="http://www.cmp.com/delivery/privacy.html#california">Your 
+            California Privacy Rights</A> | <A class=grey9 
+            href="http://www.cmp.com/delivery/terms.html">Terms of Service</A> 
+            </SPAN></DIV></TD></TR>
+        <TR>
+          <TD align=middle bgColor=#e7e7e7><IMG height=2 hspace=0 
+            src="heaplayers-article-cuj_files/blank.gif" width=770 
+        border=0></TD></TR></TBODY></TABLE><!-- END BOTTOM NAVIGATION --><!-- bottom ad -->
+      <DIV align=center><BR><BR><!-- AD: 'http://localhost:8085/html.ng/site=sdmg&affiliate=sdmgdeveloperpipeline&pagepos=bottom&catid=&site_section=9843&articleid=141768&target=cpp&country=&state=' --><!-- Sniffer Code for Flash version=60 -->
+      <SCRIPT language=JavaScript>
+<!--
+var swf_click = "http://as.cmpnet.com/event.ng/Type=click&FlightID=45538&AdID=80366&TargetID=4721&Segments=1411,3108,3448,4875,5818,5864&Targets=2625,2878,4666,4721&Values=34,46,51,63,77,83,90,100,140,204,442,645,646,657,944,945,1184,1311,1405,1412,1426,1716,1736,1767,1785,1935,1936,1944,1970,2310,2327,2352,2759,2767,2862,2878,2942,3067,3080&RawValues=&Redirect=http://www.intel.com/software/";
+var dcswf_click = escape(swf_click);
+var ShockMode = 0;
+var plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;
+
+if (plugin && parseInt(plugin.description.substring(plugin.description.indexOf(".")-1)) >= 6) 
+{
+ShockMode = 1;
+}
+else if (navigator.userAgent && navigator.userAgent.indexOf("MSIE")>=0 
+&& (navigator.userAgent.indexOf("Windows 95")>=0 || navigator.userAgent.indexOf("Windows 98")>=0 || navigator.userAgent.indexOf("Windows NT")>=0)) {
+document.write('<SCRIPT LANGUAGE=VBScript\> \n');
+document.write('on error resume next \n');
+document.write('ShockMode = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.6")))\n');
+document.write('<\/SCRIPT\> \n');
+}
+if ( ShockMode ) {
+document.write('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"');
+document.write(' codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"');
+document.write(' ID=flashad WIDTH=728 HEIGHT=90>');
+document.write(' <PARAM NAME=movie VALUE="http://i.cmpnet.com/ads/graphics/as5/cc/flash/banner_728x90c_1209.swf?clickTag='+dcswf_click+'"> '); 
+document.write(' <PARAM NAME=quality VALUE=high> ');
+document.write(' <PARAM NAME=wmode VALUE=opaque> ');
+document.write(' <EMBED SRC="http://i.cmpnet.com/ads/graphics/as5/cc/flash/banner_728x90c_1209.swf?clickTag='+dcswf_click+'" QUALITY=high WMODE=opaque '); 
+document.write(' NAME=flashad swLiveConnect=TRUE WIDTH=728 HEIGHT=90');
+document.write(' TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash">');
+document.write('</EMBED>');
+document.write('</OBJECT>');
+} else if (!(navigator.appName && navigator.appName.indexOf("Netscape")>=0 && navigator.appVersion.indexOf("2.")>=0)){
+document.write('<A HREF="http://as.cmpnet.com/event.ng/Type=click&FlightID=45538&AdID=80366&TargetID=4721&Segments=1411,3108,3448,4875,5818,5864&Targets=2625,2878,4666,4721&Values=34,46,51,63,77,83,90,100,140,204,442,645,646,657,944,945,1184,1311,1405,1412,1426,1716,1736,1767,1785,1935,1936,1944,1970,2310,2327,2352,2759,2767,2862,2878,2942,3067,3080&RawValues=&Redirect=http://www.intel.com/software/" target="_top"><IMG SRC="http://i.cmpnet.com/ads/graphics/as5/cc/banner_728x90c.gif" WIDTH=728 HEIGHT=90 BORDER=0></A>');
+}
+//-->
+</SCRIPT>
+      <NOEMBED><A 
+      href="http://as.cmpnet.com/event.ng/Type=click&amp;FlightID=45538&amp;AdID=80366&amp;TargetID=4721&amp;Segments=1411,3108,3448,4875,5818,5864&amp;Targets=2625,2878,4666,4721&amp;Values=34,46,51,63,77,83,90,100,140,204,442,645,646,657,944,945,1184,1311,1405,1412,1426,1716,1736,1767,1785,1935,1936,1944,1970,2310,2327,2352,2759,2767,2862,2878,2942,3067,3080&amp;RawValues=&amp;Redirect=http://www.intel.com/software/" 
+      target=_top><IMG height=90 
+      src="heaplayers-article-cuj_files/banner_728x90c.gif" width=728 
+      border=0></A> </NOEMBED><NOSCRIPT><A 
+      href="http://as.cmpnet.com/event.ng/Type=click&amp;FlightID=45538&amp;AdID=80366&amp;TargetID=4721&amp;Segments=1411,3108,3448,4875,5818,5864&amp;Targets=2625,2878,4666,4721&amp;Values=34,46,51,63,77,83,90,100,140,204,442,645,646,657,944,945,1184,1311,1405,1412,1426,1716,1736,1767,1785,1935,1936,1944,1970,2310,2327,2352,2759,2767,2862,2878,2942,3067,3080&amp;RawValues=&amp;Redirect=http://www.intel.com/software/" 
+      target=_top><IMG height=90 
+      src="heaplayers-article-cuj_files/banner_728x90c.gif" width=728 
+      border=0></A> </NOSCRIPT><IMG height=1 src="" width=1 border=0> </DIV><!-- end bottom ad --><BR><FONT size=-1>web2 </FONT></TD>
+    <TD vAlign=top align=right width=170><!-- right column -->
+      <TABLE cellSpacing=0 cellPadding=0 width=160 border=0>
+        <TBODY>
+        <TR>
+          <TD><!-- streaming media -->
+            <DIV style="MARGIN-TOP: 170px">
+            <TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
+              <TBODY>
+              <TR>
+                <TD>
+                  <TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
+                    <TBODY>
+                    <TR>
+                      <TD bgColor=#cc6600>
+                        <TABLE cellSpacing=0 cellPadding=3 width="100%" 
+border=0>
+                          <TBODY>
+                          <TR>
+                            <TD><FONT color=#ffffff><STRONG>DevNet 
+                              Podcasts</STRONG></FONT> 
+</TD></TR></TBODY></TABLE></TD></TR>
+                    <TR>
+                      <TD bgColor=#ffd673 height=2></TD></TR></TBODY></TABLE>
+                  <TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
+                    <TBODY>
+                    <TR>
+                      <TD width=1 bgColor=#999999><IMG height=1 hspace=0 
+                        src="C:\home\emery\projects\heaplayers\doc\heaplayers-article-cuj_files\blank(2).gif" 
+                        width=1 border=0></TD>
+                      <TD bgColor=#ffffff>
+                        <TABLE cellSpacing=0 cellPadding=5 width="100%" 
+border=0>
+                          <TBODY>
+                          <TR>
+                            <TD>
+                              <P><STRONG>Introducing Dobbscast Audio 
+                              Blogs</STRONG></P>
+                              <P align=left><A 
+                              href="http://syndication.sdmediagroup.com/feeds/public/cmp_podcast_ddj.xml">Get 
+                              the Dobbscast feed<BR><IMG alt="" 
+                              src="heaplayers-article-cuj_files/rss_podcast.gif" 
+                              border=0></A></P></TD></TR></TBODY></TABLE></TD>
+                      <TD width=1 bgColor=#999999><IMG height=1 hspace=0 
+                        src="C:\home\emery\projects\heaplayers\doc\heaplayers-article-cuj_files\blank(2).gif" 
+                        width=1 border=0></TD></TR>
+                    <TR>
+                      <TD bgColor=#999999><IMG height=1 hspace=0 
+                        src="C:\home\emery\projects\heaplayers\doc\heaplayers-article-cuj_files\blank(2).gif" 
+                        width=1 border=0></TD>
+                      <TD bgColor=#999999><IMG height=1 hspace=0 
+                        src="C:\home\emery\projects\heaplayers\doc\heaplayers-article-cuj_files\blank(2).gif" 
+                        width=1 border=0></TD>
+                      <TD bgColor=#999999><IMG height=1 hspace=0 
+                        src="C:\home\emery\projects\heaplayers\doc\heaplayers-article-cuj_files\blank(2).gif" 
+                        width=1 
+            border=0></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></DIV><!-- end streaming media --><!-- skyscraper ad --><BR>
+            <DIV align=center><!-- AD: 'http://localhost:8085/html.ng/site=sdmg&affiliate=sdmgdeveloperpipeline&pagepos=sky&catid=&site_section=9843&articleid=141768&target=cpp&country=&state=' --><!-- Sniffer Code for Flash version=60 -->
+            <SCRIPT language=JavaScript>
+<!--
+var swf_click = "http://as.cmpnet.com/event.ng/Type=click&FlightID=45539&AdID=80365&TargetID=4720&Segments=1411,3108,3219,3448,4875,5820,5869&Targets=2625,2781,2878,4664,4720&Values=34,46,51,63,77,83,90,100,140,206,442,645,646,657,944,945,1184,1311,1405,1412,1426,1716,1736,1767,1785,1935,1936,1944,1970,2310,2327,2352,2759,2767,2862,2878,2942,3067,3080&RawValues=&Redirect=http://www.intel.com/software/products/";
+var dcswf_click = escape(swf_click);
+var ShockMode = 0;
+var plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;
+
+if (plugin && parseInt(plugin.description.substring(plugin.description.indexOf(".")-1)) >= 6) 
+{
+ShockMode = 1;
+}
+else if (navigator.userAgent && navigator.userAgent.indexOf("MSIE")>=0 
+&& (navigator.userAgent.indexOf("Windows 95")>=0 || navigator.userAgent.indexOf("Windows 98")>=0 || navigator.userAgent.indexOf("Windows NT")>=0)) {
+document.write('<SCRIPT LANGUAGE=VBScript\> \n');
+document.write('on error resume next \n');
+document.write('ShockMode = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.6")))\n');
+document.write('<\/SCRIPT\> \n');
+}
+if ( ShockMode ) {
+document.write('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"');
+document.write(' codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"');
+document.write(' ID=flashad WIDTH=125 HEIGHT=600>');
+document.write(' <PARAM NAME=movie VALUE="http://i.cmpnet.com/ads/graphics/as5/cc/flash/banner_125x600a_1209.swf?clickTag='+dcswf_click+'"> '); 
+document.write(' <PARAM NAME=quality VALUE=high> ');
+document.write(' <PARAM NAME=wmode VALUE=opaque> ');
+document.write(' <EMBED SRC="http://i.cmpnet.com/ads/graphics/as5/cc/flash/banner_125x600a_1209.swf?clickTag='+dcswf_click+'" QUALITY=high WMODE=opaque '); 
+document.write(' NAME=flashad swLiveConnect=TRUE WIDTH=125 HEIGHT=600');
+document.write(' TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash">');
+document.write('</EMBED>');
+document.write('</OBJECT>');
+} else if (!(navigator.appName && navigator.appName.indexOf("Netscape")>=0 && navigator.appVersion.indexOf("2.")>=0)){
+document.write('<A HREF="http://as.cmpnet.com/event.ng/Type=click&FlightID=45539&AdID=80365&TargetID=4720&Segments=1411,3108,3219,3448,4875,5820,5869&Targets=2625,2781,2878,4664,4720&Values=34,46,51,63,77,83,90,100,140,206,442,645,646,657,944,945,1184,1311,1405,1412,1426,1716,1736,1767,1785,1935,1936,1944,1970,2310,2327,2352,2759,2767,2862,2878,2942,3067,3080&RawValues=&Redirect=http://www.intel.com/software/products/" target="_top"><IMG SRC="http://i.cmpnet.com/ads/graphics/as5/cc/banner_125x600a.gif" WIDTH=125 HEIGHT=600 BORDER=0></A>');
+}
+//-->
+</SCRIPT>
+            <NOEMBED><A 
+            href="http://as.cmpnet.com/event.ng/Type=click&amp;FlightID=45539&amp;AdID=80365&amp;TargetID=4720&amp;Segments=1411,3108,3219,3448,4875,5820,5869&amp;Targets=2625,2781,2878,4664,4720&amp;Values=34,46,51,63,77,83,90,100,140,206,442,645,646,657,944,945,1184,1311,1405,1412,1426,1716,1736,1767,1785,1935,1936,1944,1970,2310,2327,2352,2759,2767,2862,2878,2942,3067,3080&amp;RawValues=&amp;Redirect=http://www.intel.com/software/products/" 
+            target=_top><IMG height=600 
+            src="heaplayers-article-cuj_files/banner_125x600a.gif" width=125 
+            border=0></A> </NOEMBED><NOSCRIPT><A 
+            href="http://as.cmpnet.com/event.ng/Type=click&amp;FlightID=45539&amp;AdID=80365&amp;TargetID=4720&amp;Segments=1411,3108,3219,3448,4875,5820,5869&amp;Targets=2625,2781,2878,4664,4720&amp;Values=34,46,51,63,77,83,90,100,140,206,442,645,646,657,944,945,1184,1311,1405,1412,1426,1716,1736,1767,1785,1935,1936,1944,1970,2310,2327,2352,2759,2767,2862,2878,2942,3067,3080&amp;RawValues=&amp;Redirect=http://www.intel.com/software/products/" 
+            target=_top><IMG height=600 
+            src="heaplayers-article-cuj_files/banner_125x600a.gif" width=125 
+            border=0></A> </NOSCRIPT><IMG height=1 src="" width=1 border=0> 
+            </DIV><!-- end skyscraper --></TD></TR></TBODY></TABLE><!-- end right column --></TD></TR></TBODY></TABLE></DIV></BODY></HTML>
Index: /proiecte/swift/trunk/lib/hoard-371/doc/heaplayers-article-cuj_files/pipelines_fonts.css
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/doc/heaplayers-article-cuj_files/pipelines_fonts.css	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/doc/heaplayers-article-cuj_files/pipelines_fonts.css	(revision 176)
@@ -0,0 +1,324 @@
+BODY {
+	FONT-SIZE: 12px; FONT-FAMILY: geneva, arial, helvetica
+}
+DIV {
+	FONT-SIZE: 12px; FONT-FAMILY: geneva, arial, helvetica
+}
+FORM {
+	FONT-SIZE: 12px; FONT-FAMILY: geneva, arial, helvetica
+}
+INPUT {
+	FONT-SIZE: 12px; FONT-FAMILY: geneva, arial, helvetica
+}
+P {
+	FONT-SIZE: 12px; FONT-FAMILY: geneva, arial, helvetica
+}
+TABLE {
+	FONT-SIZE: 12px; FONT-FAMILY: geneva, arial, helvetica
+}
+TR {
+	FONT-SIZE: 12px; FONT-FAMILY: geneva, arial, helvetica
+}
+TR {
+	FONT-SIZE: 12px; FONT-FAMILY: geneva, arial, helvetica
+}
+SPAN {
+	FONT-SIZE: 12px; FONT-FAMILY: geneva, arial, helvetica
+}
+A {
+	FONT-SIZE: 12px; FONT-FAMILY: geneva, arial, helvetica
+}
+.storyCopy {
+	FONT-SIZE: 12px; FONT-FAMILY: geneva, arial, helvetica
+}
+.BOLD {
+	FONT-WEIGHT: bold
+}
+.eight {
+	FONT-SIZE: 8px
+}
+.eightBOLD {
+	FONT-WEIGHT: bold; FONT-SIZE: 8px
+}
+.nine {
+	FONT-SIZE: 9px
+}
+.nineBOLD {
+	FONT-WEIGHT: bold; FONT-SIZE: 9px
+}
+.ten {
+	FONT-SIZE: 10px
+}
+.tenBOLD {
+	FONT-WEIGHT: bold; FONT-SIZE: 12px
+}
+.eleven {
+	FONT-SIZE: 11px
+}
+.elevenBOLD {
+	FONT-WEIGHT: bold; FONT-SIZE: 11px
+}
+.twelve {
+	FONT-SIZE: 12px
+}
+.twelveBOLD {
+	FONT-WEIGHT: bold; FONT-SIZE: 12px
+}
+.thirteen {
+	FONT-SIZE: 13px
+}
+.thirteenBOLD {
+	FONT-WEIGHT: bold; FONT-SIZE: 13px
+}
+.fourteen {
+	FONT-SIZE: 14px
+}
+.fourteenBOLD {
+	FONT-WEIGHT: bold; FONT-SIZE: 14px
+}
+.fifteen {
+	FONT-SIZE: 15px
+}
+.fifteenBOLD {
+	FONT-WEIGHT: bold; FONT-SIZE: 15px
+}
+.sixteen {
+	FONT-SIZE: 16px
+}
+.sixteenBOLD {
+	FONT-WEIGHT: bold; FONT-SIZE: 16px
+}
+.seventeen {
+	FONT-SIZE: 17px
+}
+.seventeenBOLD {
+	FONT-WEIGHT: bold; FONT-SIZE: 17px
+}
+.eighteen {
+	FONT-SIZE: 18px
+}
+.eighteenBOLD {
+	FONT-WEIGHT: bold; FONT-SIZE: 18px
+}
+.blue8 {
+	FONT-SIZE: 8px; COLOR: #003366
+}
+.blue9 {
+	FONT-SIZE: 9px; COLOR: #003366
+}
+.blue10 {
+	FONT-SIZE: 10px; COLOR: #003366; LINE-HEIGHT: 15px
+}
+.blue10BOLD {
+	FONT-WEIGHT: bold; FONT-SIZE: 10px; COLOR: #003366; LINE-HEIGHT: 15px
+}
+.customblue10 {
+	FONT-SIZE: 10px; COLOR: #003366; LINE-HEIGHT: 18px
+}
+.blue11 {
+	FONT-SIZE: 11px; COLOR: #003366
+}
+.blue12 {
+	FONT-SIZE: 12px; COLOR: #003366; LINE-HEIGHT: 14px
+}
+A.blue12BOLD {
+	FONT-WEIGHT: bold; FONT-SIZE: 12px; COLOR: #003366; LINE-HEIGHT: 14px
+}
+.blue12BOLD {
+	FONT-WEIGHT: bold; FONT-SIZE: 12px; COLOR: #003366; LINE-HEIGHT: 14px
+}
+.blue13BOLD {
+	FONT-WEIGHT: bold; FONT-SIZE: 13px; COLOR: #003366
+}
+.blue14BOLD {
+	FONT-WEIGHT: bold; FONT-SIZE: 14px; COLOR: #003366; LINE-HEIGHT: 18px
+}
+.blue14 {
+	FONT-SIZE: 14px; COLOR: #003366; LINE-HEIGHT: 16px
+}
+.blue16 {
+	FONT-SIZE: 16px; COLOR: #003366; LINE-HEIGHT: 18px
+}
+.blue16BOLD {
+	FONT-WEIGHT: bold; FONT-SIZE: 16px; COLOR: #003366; LINE-HEIGHT: 18px
+}
+.orange10 {
+	FONT-SIZE: 10px; COLOR: #cc6600; LINE-HEIGHT: 18px
+}
+.orange15BOLD {
+	FONT-WEIGHT: bold; FONT-SIZE: 15px; COLOR: #cc6600
+}
+.orange10BOLD {
+	FONT-WEIGHT: bold; FONT-SIZE: 10px; COLOR: #cc6600; LINE-HEIGHT: 18px
+}
+.orange11 {
+	FONT-SIZE: 11px; COLOR: #cc6600
+}
+.orange11BOLD {
+	FONT-WEIGHT: bold; FONT-SIZE: 11px; COLOR: #cc6600
+}
+.orange12 {
+	FONT-SIZE: 12px; COLOR: #cc6600
+}
+.orange12BOLD {
+	FONT-WEIGHT: bold; FONT-SIZE: 12px; COLOR: #cc6600
+}
+.orange13BOLD {
+	FONT-WEIGHT: bold; FONT-SIZE: 13px; COLOR: #cc6600
+}
+.green12BOLD {
+	FONT-WEIGHT: bold; FONT-SIZE: 12px; COLOR: #006600
+}
+.green16BOLD {
+	FONT-WEIGHT: bold; FONT-SIZE: 16px; COLOR: #006600
+}
+.black9Bold {
+	FONT-WEIGHT: bold; FONT-SIZE: 9px; COLOR: #000000
+}
+.black9 {
+	FONT-SIZE: 9px; COLOR: #000000
+}
+A.black10 {
+	FONT-SIZE: 10px; COLOR: #000000
+}
+.black10 {
+	FONT-SIZE: 10px; COLOR: #000000
+}
+.black10Bold {
+	FONT-WEIGHT: bold; FONT-SIZE: 10px; COLOR: #000000
+}
+.black11 {
+	FONT-SIZE: 11px; COLOR: #000000
+}
+.blacknavigation {
+	FONT-WEIGHT: bold; FONT-SIZE: 11px; COLOR: #000000; LINE-HEIGHT: 18px
+}
+.black12 {
+	FONT-WEIGHT: bold; FONT-SIZE: 12px; COLOR: #000000
+}
+.black12Bold {
+	FONT-WEIGHT: bold; FONT-SIZE: 12px; COLOR: #000000
+}
+.black13Bold {
+	FONT-WEIGHT: bold; FONT-SIZE: 13px; COLOR: #000000
+}
+.black16BOLD {
+	FONT-WEIGHT: bold; FONT-SIZE: 16px; COLOR: #000000
+}
+.grey9 {
+	FONT-SIZE: 9px; COLOR: #666666
+}
+.GreyTEN {
+	FONT-SIZE: 10px; COLOR: #666666
+}
+.GreyTENBold {
+	FONT-WEIGHT: bold; FONT-SIZE: 10px; COLOR: #666666
+}
+.grey11 {
+	FONT-SIZE: 11px; COLOR: #666666
+}
+.Grey11Bold {
+	FONT-WEIGHT: bold; FONT-SIZE: 11px; COLOR: #666666
+}
+.grey12 {
+	FONT-SIZE: 12px; COLOR: #666666
+}
+.grey12BOLD {
+	FONT-WEIGHT: bold; FONT-SIZE: 12px; COLOR: #666666
+}
+.grey13BOLD {
+	FONT-WEIGHT: bold; FONT-SIZE: 13px; COLOR: #666666
+}
+.grey13 {
+	FONT-SIZE: 13px; COLOR: #666666
+}
+.grey14BOLD {
+	FONT-WEIGHT: bold; FONT-SIZE: 14px; COLOR: #666666
+}
+.grey14 {
+	FONT-SIZE: 14px; COLOR: #666666
+}
+.grey16BOLD {
+	FONT-WEIGHT: bold; FONT-SIZE: 16px; COLOR: #666666
+}
+.grey16 {
+	FONT-SIZE: 16px; COLOR: #666666
+}
+.grey18BOLD {
+	FONT-WEIGHT: bold; FONT-SIZE: 18px; COLOR: #666666
+}
+.grey18 {
+	FONT-SIZE: 18px; COLOR: #666666
+}
+.grey10 {
+	FONT-SIZE: 10px; COLOR: #cccccc; LINE-HEIGHT: 19px
+}
+.Darkgrey10 {
+	FONT-SIZE: 10px; COLOR: #999999; LINE-HEIGHT: 19px
+}
+.byline {
+	FONT-WEIGHT: bold; FONT-SIZE: 12px; COLOR: #666666; LINE-HEIGHT: 18px
+}
+.white10 {
+	FONT-SIZE: 10px; COLOR: #ffffff
+}
+.white11 {
+	FONT-SIZE: 11px; COLOR: #ffffff
+}
+.white12 {
+	FONT-SIZE: 12px; COLOR: #ffffff
+}
+.white10BOLD {
+	FONT-WEIGHT: bold; FONT-SIZE: 10px; COLOR: #ffffff
+}
+.white11BOLD {
+	FONT-WEIGHT: bold; FONT-SIZE: 11px; COLOR: #ffffff
+}
+.white12BOLD {
+	FONT-WEIGHT: bold; FONT-SIZE: 12px; COLOR: #ffffff
+}
+.displayHeader {
+	FONT-WEIGHT: bold; FONT-SIZE: 24px; COLOR: #000000
+}
+.displaySubHeader {
+	FONT-WEIGHT: bold; FONT-SIZE: 20px; COLOR: #000000
+}
+.storyHEADLINE {
+	FONT-WEIGHT: bold; FONT-SIZE: 18px; COLOR: #000000; LINE-HEIGHT: 20px
+}
+.purple16BOLD {
+	FONT-WEIGHT: bold; FONT-SIZE: 16px; COLOR: #663366; LINE-HEIGHT: 18px
+}
+.PageNumberBlue {
+	FONT-WEIGHT: bold; FONT-SIZE: 11px; COLOR: #336699
+}
+.PageNumberactive {
+	FONT-SIZE: 11px; COLOR: #336699
+}
+.newsletter {
+	FONT-SIZE: 11px; COLOR: #000000
+}
+.new_subnav {
+	PADDING-RIGHT: 10px; PADDING-LEFT: 10px; FONT-SIZE: 11px; BACKGROUND: #4c6e90; PADDING-BOTTOM: 5px; COLOR: #003366; PADDING-TOP: 3px; FONT-FAMILY: Verdana
+}
+.new_subnav STRONG {
+	COLOR: #cccccc
+}
+.new_subnav A {
+	COLOR: #ffffff; TEXT-DECORATION: none
+}
+.new_subnav A:hover {
+	TEXT-DECORATION: underline
+}
+.side A:link {
+	COLOR: #000000; TEXT-DECORATION: none
+}
+.side A:visited {
+	COLOR: #000000; TEXT-DECORATION: none
+}
+.side A:hover {
+	COLOR: #000000; TEXT-DECORATION: underline
+}
+.side A:active {
+	COLOR: #000000; TEXT-DECORATION: none
+}
Index: /proiecte/swift/trunk/lib/hoard-371/doc/heaplayers-article-cuj_files/pipelines_layout.css
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/doc/heaplayers-article-cuj_files/pipelines_layout.css	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/doc/heaplayers-article-cuj_files/pipelines_layout.css	(revision 176)
@@ -0,0 +1,78 @@
+TABLE.elfixo {
+	TABLE-LAYOUT: fixed
+}
+.border {
+	MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px; MARGIN-LEFT: 5px
+}
+.market1 {
+	MARGIN-TOP: 5px; MARGIN-BOTTOM: 5px; MARGIN-LEFT: 25px
+}
+.market2 {
+	MARGIN: 10px 80px
+}
+.customBox {
+	MARGIN-TOP: 3px; MARGIN-BOTTOM: 10px
+}
+.searchChunk {
+	MARGIN-TOP: 3px; MARGIN-LEFT: 25px
+}
+.utilityNAV {
+	MARGIN-TOP: 4px; MARGIN-BOTTOM: 3px
+}
+.newsletterBlock {
+	MARGIN: 5px 6px 5px 5px
+}
+.textBlock {
+	MARGIN: 5px 6px 12px 5px
+}
+.textBlock2 {
+	MARGIN-BOTTOM: 12px; MARGIN-LEFT: 5px; MARGIN-RIGHT: 6px
+}
+.textBlock3 {
+	MARGIN: 5px 6px 12px 9px
+}
+.list {
+	MARGIN-BOTTOM: 8px
+}
+.list2 {
+	MARGIN-BOTTOM: 10px
+}
+.BOTnav {
+	MARGIN-TOP: 6px; MARGIN-BOTTOM: 6px
+}
+.BOTnavgrey {
+	MARGIN-TOP: 10px; MARGIN-BOTTOM: 10px
+}
+.eyebrows {
+	MARGIN-TOP: 2px; MARGIN-BOTTOM: 10px; MARGIN-LEFT: 8px
+}
+.mainTABLE {
+	MARGIN-TOP: 15px; MARGIN-LEFT: 10px; MARGIN-RIGHT: 7px
+}
+.featureBOX {
+	MARGIN: 4px 7px 10px 5px
+}
+.topstoryBOX {
+	MARGIN-TOP: 4px; MARGIN-LEFT: 5px; MARGIN-RIGHT: 7px
+}
+.topstoryBlueLink {
+	MARGIN-BOTTOM: 9px
+}
+.coreTABLE {
+	MARGIN-TOP: 5px; MARGIN-LEFT: 10px; MARGIN-RIGHT: 7px
+}
+.utilityBOXES {
+	MARGIN: 10px 10px 10px 16px
+}
+.moreTABLE {
+	MARGIN: 25px 7px 25px 10px
+}
+.moreBOX {
+	MARGIN: 10px 10px 5px 0px
+}
+.bottomNAVtable {
+	MARGIN: 10px 10px 5px
+}
+.bottomNAVbox {
+	MARGIN-TOP: 15px; MARGIN-BOTTOM: 15px
+}
Index: /proiecte/swift/trunk/lib/hoard-371/doc/heaplayers-article-cuj_files/s_code_remote.js
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/doc/heaplayers-article-cuj_files/s_code_remote.js	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/doc/heaplayers-article-cuj_files/s_code_remote.js	(revision 176)
@@ -0,0 +1,258 @@
+/************************ ADDITIONAL FEATURES ************************
+     Plugins
+*/
+/************************** CONFIG SECTION **************************/
+/* You may add or alter any code config here.                       */
+/* Specify the Report Suite ID(s) to track here */
+/* E-commerce Config */
+var s_currencyCode="USD"
+var s_eVarCFG=""
+/* Link Tracking Config */
+var s_trackDownloadLinks=true
+var s_trackExternalLinks=true
+var s_trackInlineStats=true
+var s_linkDownloadFileTypes="exe,zip,wav,mp3,mov,mpg,avi,wmv,doc,pdf,xls"
+var s_linkInternalFilters="javascript:,."
+var s_linkLeaveQueryString=false
+var s_linkTrackVars="None"
+var s_linkTrackEvents="None"
+/* Plugin Config */
+var s_usePlugins=true
+function s_doPlugins() {
+	/* Add calls to plugins here */
+	/* plugin code created October 17, 2004 by Ryan Filimoehala--Omniture IE */
+	s_vpr('s_server',document.domain.toLowerCase()) // set s_server variable to page domain
+	var hrefArray=location.href.split('/')
+	var dirStruct="" // declare directory structure variable
+	for(i=0;i<hrefArray.length-1;i++) {
+		if(i>1 && // include domain name in value
+		   i<hrefArray.length) {
+			dirStruct+=hrefArray[i]+'/'
+		}
+	}
+	
+	s_vpr('s_channel',dirStruct) // set s_channel to directory structure	
+	s_vp_getCGI('s_campaign','cid') // set s_campaign from query string
+}
+
+/************************** PLUGINS SECTION *************************/
+/* You may insert any plugins you wish to use here.                 */
+/*
+ * Plugin: Get Query String CGI Variable Value
+ */
+function s_vp_getCGI(vs,k)
+	{var v='';if(k&&s_wd.location.search){var q=s_wd.location.search,
+	qq=q.indexOf('?');q=qq<0?q:q.substring(qq+1);v=s_pt(q,'&',s_cgif,
+	k)}s_vpr(vs,v)}function s_cgif(t,k){if(t){var te=t.indexOf('='),
+	sk=te<0?t:t.substring(0,te),sv=te<0?'True':t.substring(te+1);if(
+	sk==k)return s_epa(sv)}return ''}
+/*
+ * Plugin Utilities v2.0 (Required For All Plugins)
+ */
+function s_vpr(vs,v){if(s_wd[vs])s_wd[vs]=s_wd[vs];else s_wd[vs]=''
+if(vs.substring(0,2) == 's_')vs=vs.substring(2);s_wd['s_vpv_'+vs]=v
+s_wd['s_vpm_'+vs]=1}function s_dt(tz,t){var d=new Date;if(t)d.setTime(
+t);d=new Date(d.getTime()+(d.getTimezoneOffset()*60*1000))
+return new Date(Math.floor(d.getTime()+(tz*60*60*1000)))}
+function s_vh_gt(k,v){var vh='|'+s_c_r('s_vh_'+k),vi=vh.indexOf('|'+v
++'='),ti=vi<0?vi:vi+2+v.length,pi=vh.indexOf('|',ti),t=ti<0?'':
+vh.substring(ti,pi<0?vh.length:pi);return t}function s_vh_gl(k){var
+vh=s_c_r('s_vh_'+k),e=vh?vh.indexOf('='):0;return vh?(vh.substring(0,
+e?e:vh.length)):''}function s_vh_s(k,v){if(k&&v){var e=new Date,st=
+e.getTime(),y=e.getYear(),c='s_vh_'+k,vh='|'+s_c_r(c)+'|',t=s_vh_gt(k,
+v);e.setYear((y<1900?y+1900:y)+5);if(t)vh=s_rep(vh,'|'+v+'='+t+'|','|'
+);if(vh.substring(0,1)=='|')vh=vh.substring(1);if(vh.substring(
+vh.length-1,vh.length)=='|')vh=vh.substring(0,vh.length-1);vh=v
++'=[PCC]'+(vh?'|'+vh:'');s_c_w(c,vh,e);if(s_vh_gt(k,v)!='[PCC]')
+return 0;vh=s_rep(vh,'[PCC]',st);s_c_w(c,vh,e)}return 1}
+
+/************* DO NOT ALTER ANYTHING BELOW THIS LINE ! **************/
+var s_un,s_ios=0,s_q='',s_code='',code='',s_bcr=0,s_lnk='',s_eo='',
+s_vb,s_pl,s_tfs=0,s_etfs=0,s_wd=window,s_d=s_wd.document,s_ssl=(
+s_wd.location.protocol.toLowerCase().indexOf('https')>=0),s_n=
+navigator,s_u=s_n.userAgent,s_apn=s_n.appName,s_v=s_n.appVersion,
+s_apv,s_i,s_ie=s_v.indexOf('MSIE '),s_ns6=s_u.indexOf('Netscape6/')
+if(s_v.indexOf('Opera')>=0||s_u.indexOf('Opera')>=0)s_apn='Opera';var
+s_isie=(s_apn=='Microsoft Internet Explorer'),s_isns=(s_apn==
+'Netscape'),s_isopera=(s_apn=='Opera'),s_ismac=(s_u.indexOf('Mac')>=0)
+if(s_ie>0){s_apv=parseInt(s_i=s_v.substring(s_ie+5));if(s_apv>3)s_apv=
+parseFloat(s_i)}else if(s_ns6>0)s_apv=parseFloat(s_u.substring(s_ns6
++10));else s_apv=parseFloat(s_v);function s_fl(s,l){return (s+''
+).substring(0,l)}function s_co(o){if(!o)return o;var n=new Object,x
+for(x in o)if(x.indexOf("select")<0&&x.indexOf("filter")<0)n[x]=o[x]
+return n}function s_num(x){var s=x.toString(),g='0123456789',p,d
+for(p=0;p<s.length;p++){d=s.substring(p,p+1);if(g.indexOf(d)<0)
+return 0}return 1}function s_rep(s,o,n){var i=s.indexOf(o),l=n.length>
+0?n.length:1;while(s&&i>=0){s=s.substring(0,i)+n+s.substring(i
++o.length);i=s.indexOf(o,i+l)}return s}function s_ape(s){return s?
+s_rep(escape(''+s),'+','%2B'):s}function s_epa(s){return s?unescape(
+s_rep(''+s,'+',' ')):s}function s_pt(s,d,f,a){var t=s,x=0,y,r;while(t)
+{y=t.indexOf(d);y=y<0?t.length:y;t=t.substring(0,y);r=f(t,a);if(r)
+return r;x+=y+d.length;t=s.substring(x,s.length);t=x<s.length?t:''}
+return ''}function s_isf(t,a){if(t.substring(0,2)=='s_')t=t.substring(
+2);return (t!=''&&t==a)}function s_fsf(t,a){if(s_pt(a,',',s_isf,t))
+s_fsg+=(s_fsg!=''?',':'')+t;return 0}var s_fsg;function s_fs(s,f){
+s_fsg='';s_pt(s,',',s_fsf,f);return s_fsg}var s_c_d=''
+function s_c_gdf(t,a){if(!s_num(t))return 1;return 0}function s_c_gd()
+{var d=s_wd.location.hostname,n=s_gg('cookieDomainPeriods'),p;if(d&&
+!s_c_d){n=n?parseInt(n):2;n=n>2?n:2;p=d.lastIndexOf('.');while(p>=0&&
+n>1){p=d.lastIndexOf('.',p-1);n--}s_c_d=p>0&&s_pt(d,'.',s_c_gdf,0)?
+d.substring(p):''}return s_c_d}function s_c_r(k){k=s_ape(k);var c=' '
++s_d.cookie,s=c.indexOf(' '+k+'='),e=s<0?s:c.indexOf(';',s),v=s<0?'':
+s_epa(c.substring(s+2+k.length,e<0?c.length:e));return v!='[[B]]'?v:''
+}function s_c_w(k,v,e){var d=s_c_gd(),l=s_gg('cookieLifetime'),s;v=''
++v;l=l?(''+l).toUpperCase():'';if(e&&l!='SESSION'&&l!='NONE'){s=(v!=
+''?parseInt(l?l:0):-60);if(s){e=new Date;e.setTime(e.getTime()+(s*1000
+))}}if(k&&l!='NONE'){s_d.cookie=k+'='+s_ape(v!=''?v:'[[B]]')+'; '
++'path=/;'+(e&&l!='SESSION'?' expires='+e.toGMTString()+';':'')+(d?
+' domain='+d+';':'');return s_c_r(k)==v}return 0}function s_cet(f,a,
+et,oe,fb){var r,d=0
+/*@cc_on@if(@_jscript_version>=5){try{return f(a)}catch(e){return et(e)}d=1}@end@*/
+if(!d){if(s_ismac&&s_u.indexOf('MSIE 4')>=0)return fb(a);else{
+s_wd.s_oe=s_wd.onerror;s_wd.onerror=oe;r=f(a);s_wd.onerror=s_wd.s_oe
+return r}}}function s_gtfset(e){return s_tfs}function s_gtfsoe(e){
+s_wd.onerror=s_wd.s_oe;s_etfs=1;var code=s_gs(s_un);if(code)s_d.write(
+code);s_etfs=0;return true}function s_gtfsfb(a){return s_wd}
+function s_gtfsf(w){var p=w.parent,l=w.location;s_tfs=w;if(p&&
+p.location!=l&&p.location.host==l.host){s_tfs=p;return s_gtfsf(s_tfs)}
+return s_tfs}function s_gtfs(){if(!s_tfs){s_tfs=s_wd;if(!s_etfs)s_tfs=
+s_cet(s_gtfsf,s_tfs,s_gtfset,s_gtfsoe,s_gtfsfb)}return s_tfs}
+function s_ca(un){un=un.toLowerCase();var ci=un.indexOf(','),fun=ci<0?
+un:un.substring(0,ci),imn='s_i_'+fun;if(s_d.images&&s_apv>=3&&
+!s_isopera&&(s_ns6<0||s_apv>=6.1)){s_ios=1;if(!s_d.images[imn]&&(
+!s_isns||(s_apv<4||s_apv>=5))){s_d.write('<im'+'g name="'+imn
++'" height=1 width=1 border=0 alt="">');if(!s_d.images[imn])s_ios=0}}}
+function s_it(un){s_ca(un)}function s_mr(un,sess,q,ta){un=
+un.toLowerCase();var ci=un.indexOf(','),fun=ci<0?un:un.substring(0,ci
+),unc=s_rep(fun,'_','-'),imn='s_i_'+fun,im,b,e,rs='http'+(s_ssl?'s':''
+)+'://'+(s_ssl?'102':unc)+'.112.2O7.net/b/ss/'+un+'/1/G.7-Pd-R/'
++sess+'?[AQB]&ndh=1'+(q?q:'')+(s_q?s_q:'')+'&[AQE]';if(s_ios){im=s_wd[
+imn]?s_wd[imn]:s_d.images[imn];if(!im)im=s_wd[imn]=new Image;im.src=rs
+if(rs.indexOf('&pe=')>=0&&(!ta||ta=='_self'||ta=='_top'||(s_wd.name&&
+ta==s_wd.name))){b=e=new Date;while(e.getTime()-b.getTime()<500)e=
+new Date}return ''}return '<im'+'g sr'+'c="'+rs
++'" width=1 height=1 border=0 alt="">'}function s_gg(v){var g='s_'+v
+return s_wd[g]||s_wd.s_disableLegacyVars?s_wd[g]:s_wd[v]}var s_qav=''
+function s_havf(t,a){var b=t.substring(0,4),s=t.substring(4),n=
+parseInt(s),k='s_g_'+t,m='s_vpm_'+t,q=t,v=s_gg('linkTrackVars'),e=
+s_gg('linkTrackEvents');if(!s_wd['s_'+t])s_wd['s_'+t]='';s_wd[k]=s_wd[
+m]?s_wd['s_vpv_'+t]:s_gg(t);if(s_lnk||s_eo){v=v?v+',pageName,pageURL,'
++'referrer,charSet,cookieDomainPeriods,cookieLifetime,currencyCode,pu'
++'rchaseID':'';if(v&&!s_pt(v,',',s_isf,t))s_wd[k]='';if(t=='events'&&e
+)s_wd[k]=s_fs(s_wd[k],e)}s_wd[m]=0;if(t=='pageURL')q='g';else if(t==
+'referrer')q='r';else if(t=='charSet')q='ce';else if(t==
+'cookieDomainPeriods')q='cdp';else if(t=='cookieLifetime')q='cl'
+else if(t=='currencyCode')q='cc';else if(t=='channel')q='ch';else if(
+t=='campaign')q='v0';else if(s_num(s)){if(b=='prop')q='c'+n;else if(
+b=='eVar')q='v'+n;else if(b=='hier')q='h'+n}if(s_wd[k]&&t!=
+'linkName'&&t!='linkType')s_qav+='&'+q+'='+s_ape(s_wd[k]);return ''}
+function s_hav(){var n,av='charSet,cookieDomainPeriods,cookieLifetime'
++',pageName,pageURL,referrer,channel,server,pageType,campaign,state,z'
++'ip,events,products,currencyCode,purchaseID,linkName,linkType'
+for(n=1;n<26;n++)av+=',prop'+n+',eVar'+n+',hier'+n;s_qav='';s_pt(av,
+',',s_havf,0);return s_qav}function s_lnf(t,h){t=t?t.toLowerCase():''
+h=h?h.toLowerCase():'';var te=t.indexOf('=');if(t&&te>0&&h.indexOf(
+t.substring(te+1))>=0)return t.substring(0,te);return ''}
+function s_ln(h){if(s_gg('linkNames'))return s_pt(s_gg('linkNames'),
+',',s_lnf,h);return ''}function s_ltdf(t,h){t=t?t.toLowerCase():'';h=
+h?h.toLowerCase():'';var qi=h.indexOf('?');h=qi>=0?h.substring(0,qi):h
+if(t&&h.substring(h.length-(t.length+1))=='.'+t)return 1;return 0}
+function s_ltef(t,h){t=t?t.toLowerCase():'';h=h?h.toLowerCase():'';if(
+t&&h.indexOf(t)>=0)return 1;return 0}function s_lt(h){var lft=s_gg(
+'linkDownloadFileTypes'),lef=s_gg('linkExternalFilters'),lif=s_gg(
+'linkInternalFilters')?s_gg('linkInternalFilters'):
+s_wd.location.hostname;h=h.toLowerCase();if(s_gg('trackDownloadLinks'
+)&&lft&&s_pt(lft,',',s_ltdf,h))return 'd';if(s_gg('trackExternalLinks'
+)&&(lef||lif)&&(!lef||s_pt(lef,',',s_ltef,h))&&(!lif||!s_pt(lif,',',
+s_ltef,h)))return 'e';return ''}function s_lc(e){s_lnk=s_co(this)
+s_gs('');s_lnk='';if(this.s_oc)return this.s_oc(e);return true}
+function s_ls(){var l,ln,oc;for(ln=0;ln<s_d.links.length;ln++){l=
+s_d.links[ln];oc=l.onclick?l.onclick.toString():'';if(oc.indexOf(
+"s_gs(")<0&&oc.indexOf("s_lc(")<0){l.s_oc=l.onclick;l.onclick=s_lc}}}
+function s_bc(e){s_eo=e.srcElement?e.srcElement:e.target;s_gs('')
+s_eo=''}function s_ot(o){var a=o.type,b=o.tagName;return (a&&
+a.toUpperCase?a:b&&b.toUpperCase?b:o.href?'A':'').toUpperCase()}
+function s_oid(o){var t=s_ot(o),p=o.protocol,c=o.onclick,n='',x=0;if(
+!o.s_oid){if(o.href&&(t=='A'||t=='AREA')&&(!c||!p||p.toLowerCase(
+).indexOf('javascript')<0))n=o.href;else if(c){n=s_rep(s_rep(s_rep(
+s_rep(c.toString(),"\r",''),"\n",''),"\t",''),' ','');x=2}else if(
+o.value&&(t=='INPUT'||t=='SUBMIT')){n=o.value;x=3}else if(o.src&&t==
+'IMAGE')n=o.src;if(n){o.s_oid=s_fl(n,100);o.s_oidt=x}}return o.s_oid}
+function s_rqf(t,un){var e=t.indexOf('='),u=e>=0?','+t.substring(0,e)
++',':'';return u&&u.indexOf(','+un+',')>=0?s_epa(t.substring(e+1)):''}
+function s_rq(un){var c=un.indexOf(','),v=s_c_r('s_sq'),q='';if(c<0)
+return s_pt(v,'&',s_rqf,un);return s_pt(un,',',s_rq,0)}var s_sqq,s_squ
+function s_sqp(t,a){var e=t.indexOf('='),q=e<0?'':s_epa(t.substring(e
++1));s_sqq[q]='';if(e>=0)s_pt(t.substring(0,e),',',s_sqs,q);return 0}
+function s_sqs(un,q){s_squ[un]=q;return 0}function s_sq(un,q){s_sqq=
+new Object;s_squ=new Object;s_sqq[q]='';var k='s_sq',v=s_c_r(k),x,c=0
+s_pt(v,'&',s_sqp,0);s_pt(un,',',s_sqs,q);v='';for(x in s_squ)s_sqq[
+s_squ[x]]+=(s_sqq[s_squ[x]]?',':'')+x;for(x in s_sqq)if(x&&s_sqq[x]&&(
+x==q||c<2)){v+=(v?'&':'')+s_sqq[x]+'='+s_ape(x);c++}return s_c_w(k,v,0
+)}function s_wdl(e){s_wd.s_wd_l=1;var r=true;if(s_wd.s_ol)r=s_wd.s_ol(
+e);if(s_wd.s_ls)s_wd.s_ls();return r}function s_wds(un){un=
+un.toLowerCase();s_wd.s_wd_l=1;if(s_apv>3&&(!s_isie||!s_ismac||s_apv>=
+5)){s_wd.s_wd_l=0;if(!s_wd.s_unl)s_wd.s_unl=new Array;s_wd.s_unl[
+s_wd.s_unl.length]=un;if(s_d.body&&s_d.body.attachEvent){if(
+!s_wd.s_bcr&&s_d.body.attachEvent('onclick',s_bc))s_wd.s_bcr=1}
+else if(s_d.body&&s_d.body.addEventListener){if(!s_wd.s_bcr&&
+s_d.body.addEventListener('click',s_bc,false))s_wd.s_bcr=1}else{var
+ol=s_wd.onload?s_wd.onload.toString():'';if(ol.indexOf("s_wdl(")<0){
+s_wd.s_ol=s_wd.onload;s_wd.onload=s_wdl}}}}function s_iepf(i,a){if(
+i.substring(0,1)!='{')i='{'+i+'}';if(s_d.body.isComponentInstalled(i,
+'ComponentID')){var n=s_pl.length;s_pl[n]=new Object;s_pl[n].name=i
++':'+s_d.body.getComponentVersion(i,'ComponentID')}return 0}
+function s_vs(un,x){var s=s_gg('visitorSampling'),g=s_gg(
+'visitorSamplingGroup'),k='s_vsn_'+un+(g?'_'+g:''),n=s_c_r(k),e=
+new Date,y=e.getYear();e.setYear(y+10+(y<1900?1900:0));if(s){s*=100
+if(!n){if(!s_c_w(k,x,e))return 0;n=x}if(n%10000>s)return 0}return 1}
+function s_gs(un){un=un.toLowerCase()
+s_un=un;var trk=1,tm=new Date,sed=Math&&Math.random?Math.floor(
+Math.random()*10000000000000):tm.getTime(),sess='s'+Math.floor(
+tm.getTime()/10800000)%10+sed,yr=tm.getYear(),tfs=s_gtfs(),t,ta='',q=
+'',qs='';yr=yr<1900?yr+1900:yr;t=tm.getDate()+'/'+tm.getMonth()+'/'+yr
++' '+tm.getHours()+':'+tm.getMinutes()+':'+tm.getSeconds()+' '
++tm.getDay()+' '+tm.getTimezoneOffset();if(!s_q){var tl=tfs.location,
+s='',c='',v='',p='',bw='',bh='',j='1.0',k=s_c_w('s_cc','true',0)?'Y':
+'N',hp='',ct='',iepl=s_gg('iePlugins'),pn=0,ps;if(s_apv>=4)s=
+screen.width+'x'+screen.height;if(s_isns||s_isopera){if(s_apv>=3){j=
+'1.1';v=s_n.javaEnabled()?'Y':'N';if(s_apv>=4){j='1.2';c=
+screen.pixelDepth;bw=s_wd.innerWidth;bh=s_wd.innerHeight;if(s_apv>=
+4.06)j='1.3'}}s_pl=s_n.plugins}else if(s_isie){if(s_apv>=4){v=
+s_n.javaEnabled()?'Y':'N';j='1.2';c=screen.colorDepth;if(s_apv>=5){bw=
+s_d.documentElement.offsetWidth;bh=s_d.documentElement.offsetHeight;j=
+'1.3';if(!s_ismac&&s_d.body){s_d.body.addBehavior("#default#homePage")
+hp=s_d.body.isHomePage(tl)?"Y":"N";s_d.body.addBehavior(
+"#default#clientCaps");ct=s_d.body.connectionType;if(iepl){s_pl=
+new Array;s_pt(iepl,',',s_iepf,'');}}}}else r='';if(!s_pl&&iepl)s_pl=
+s_n.plugins}if(s_pl)while(pn<s_pl.length&&pn<30){ps=s_fl(s_pl[pn
+].name,100)+';';if(p.indexOf(ps)<0)p+=ps;pn++}s_q=(s?'&s='+s_ape(s):''
+)+(c?'&c='+s_ape(c):'')+(j?'&j='+j:'')+(v?'&v='+v:'')+(k?'&k='+k:'')+(
+bw?'&bw='+bw:'')+(bh?'&bh='+bh:'')+(ct?'&ct='+s_ape(ct):'')+(hp?'&hp='
++hp:'')+(s_vb?'&vb='+s_vb:'')+(p?'&p='+s_ape(p):'')}if(s_gg(
+'usePlugins'))s_wd.s_doPlugins();var l=s_wd.location,r=
+tfs.document.referrer;if(!s_gg("pageURL"))s_wd.s_pageURL=s_fl(l?l:'',
+255);if(!s_gg("referrer"))s_wd.s_referrer=s_fl(r?r:'',255);q+=(t?'&t='
++s_ape(t):'')+s_hav();if(s_lnk||s_eo){var o=s_eo?s_eo:s_lnk;if(!o)
+return '';var p=s_wd.s_g_pageName,w=1,t=s_ot(o),n=s_oid(o),x=o.s_oidt,
+h,l,i,oc;if(s_eo&&o==s_eo){while(o&&!n&&t!='BODY'){o=o.parentElement?
+o.parentElement:o.parentNode;if(!o)return '';t=s_ot(o);n=s_oid(o);x=
+o.s_oidt}oc=o.onclick?o.onclick.toString():'';if(oc.indexOf("s_gs(")>=
+0)return ''}ta=o.target;h=o.href?o.href:'';i=h.indexOf('?');h=s_gg(
+'linkLeaveQueryString')||i<0?h:h.substring(0,i);l=s_gg('linkName')?
+s_gg('linkName'):s_ln(h);t=s_gg('linkType')?s_gg('linkType'
+).toLowerCase():s_lt(h);if(t&&(h||l))q+='&pe=lnk_'+(t=='d'||t=='e'?
+s_ape(t):'o')+(h?'&pev1='+s_ape(h):'')+(l?'&pev2='+s_ape(l):'');else
+trk=0;if(s_gg('trackInlineStats')){if(!p){p=s_wd.s_g_pageURL;w=0}t=
+s_ot(o);i=o.sourceIndex;if(s_gg('objectID')){n=s_gg('objectID');x=1;i=
+1}if(p&&n&&t)qs='&pid='+s_ape(s_fl(p,255))+(w?'&pidt='+w:'')+'&oid='
++s_ape(s_fl(n,100))+(x?'&oidt='+x:'')+'&ot='+s_ape(t)+(i?'&oi='+i:'')}
+s_wd.s_linkName=s_wd.s_linkType=s_wd.s_objectID=s_lnk=s_eo='';if(
+!s_wd.s_disableLegacyVars)s_wd.linkName=s_wd.linkType=s_wd.objectID=''
+}if(!trk&&!qs)return '';var code='';if(un){if(trk&&s_vs(un,sed))code+=
+s_mr(un,sess,q+(qs?qs:s_rq(un)),ta);s_sq(un,trk?'':qs)}else if(
+s_wd.s_unl)for(var unn=0;unn<s_wd.s_unl.length;unn++){un=s_wd.s_unl[
+unn];if(trk&&s_vs(un,sed))code+=s_mr(un,sess,q+(qs?qs:s_rq(un)),ta)
+s_sq(un,trk?'':qs)}return code}function s_dc(un){un=un.toLowerCase()
+s_wds(un);s_ca(un);return s_gs(un)}
+s_code=s_dc(s_account);if(s_code)s_d.write(s_code)
Index: /proiecte/swift/trunk/lib/hoard-371/doc/heaplayers-article-cuj_files/shared.css
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/doc/heaplayers-article-cuj_files/shared.css	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/doc/heaplayers-article-cuj_files/shared.css	(revision 176)
@@ -0,0 +1,63 @@
+BODY {
+	FONT-SIZE: 12px; FONT-FAMILY: geneva, arial, helvetica
+}
+DIV {
+	FONT-SIZE: 12px; FONT-FAMILY: geneva, arial, helvetica
+}
+SPAN {
+	FONT-SIZE: 12px; FONT-FAMILY: geneva, arial, helvetica
+}
+P {
+	FONT-SIZE: 12px; FONT-FAMILY: geneva, arial, helvetica
+}
+FORM {
+	FONT-SIZE: 12px; FONT-FAMILY: geneva, arial, helvetica
+}
+TD {
+	FONT-SIZE: 12px; FONT-FAMILY: geneva, arial, helvetica
+}
+INPUT {
+	FONT-SIZE: 12px; FONT-FAMILY: geneva, arial, helvetica
+}
+SELECT {
+	FONT-SIZE: 12px; FONT-FAMILY: geneva, arial, helvetica
+}
+INPUT.font {
+	FONT-SIZE: 12px; FONT-FAMILY: geneva, arial, helvetica
+}
+.topNav {
+	FONT-SIZE: 12px; FONT-FAMILY: geneva, arial, helvetica
+}
+.copy {
+	FONT-SIZE: 12px; FONT-FAMILY: geneva, arial, helvetica
+}
+TABLE.elfixo {
+	TABLE-LAYOUT: fixed
+}
+.TWcastpromoBOX {
+	MARGIN-TOP: 5px; MARGIN-BOTTOM: 5px; MARGIN-LEFT: 5px
+}
+.minipromoBOX {
+	MARGIN-TOP: 3px; MARGIN-BOTTOM: 4px; MARGIN-LEFT: 3px
+}
+.PurpPromo {
+	FONT-WEIGHT: bold; FONT-SIZE: 11px; COLOR: #663399
+}
+.GreenPromo {
+	FONT-WEIGHT: bold; FONT-SIZE: 11px; COLOR: #003300
+}
+.OrangePromo {
+	FONT-WEIGHT: bold; FONT-SIZE: 11px; COLOR: #cc6600
+}
+.BluePromo {
+	FONT-WEIGHT: bold; FONT-SIZE: 11px; COLOR: #333366
+}
+.Font10 {
+	FONT-SIZE: 10px; LINE-HEIGHT: 12px
+}
+.HEADBAR {
+	MARGIN-TOP: 2px; MARGIN-BOTTOM: 2px; MARGIN-LEFT: 6px
+}
+.micro12RED {
+	FONT-WEIGHT: bold; FONT-SIZE: 12px; COLOR: #cc0000
+}
Index: /proiecte/swift/trunk/lib/hoard-371/doc/heaplayers-article-cuj_files/stm31.js
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/doc/heaplayers-article-cuj_files/stm31.js	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/doc/heaplayers-article-cuj_files/stm31.js	(revision 176)
@@ -0,0 +1,125 @@
+// Ver: 4.4.40517
+if(typeof(st_js)=="undefined"){
+stAHCM=0;// 0
+stAHWS=1;// 1
+stSMSC=1;// 1
+stSCSP=0;// 0
+stCFSP=0;// 0
+stBIMG=1;// 1
+stILOC=0;// 0
+stILNK=0;// 0
+stDF55=0;// 0
+stMMSZ=10;// 10
+nOP=nOP5=nIE=nIE4=nIE5=nNN=nNN4=nNN6=nKQ=nKQ2=nMAC=nIEM=nIEW=nDM=nVER=st_delb=st_addb=st_scd=0,stmozb=0;stnav();st_reg=!(nIEW&&nVER>=5.5&&nVER<6&&stDF55);
+st_ttb=nIE;stHAL=["left","center","right"];stVAL=["top","middle","bottom"];stREP=["no-repeat","repeat-x","repeat-y","repeat"];stBDS=["none","solid","double","dotted","dashed","groove","ridge"];
+st_gc=st_rl=st_cl=st_ct=st_cw=st_ch=st_cm=st_cp=st_ci=st_load=st_scr=0;st_ht="";st_ims=[];st_ms=[];stusrld=[];
+if(nNN4){stitovn=stevfn("stitov",1);stitoun=stevfn("stitou",1);stitckn=stevfn("stitck",1);stppovn=stevfn("stppov",0);stppoun=stevfn("stppou",0);}
+if(nIE4||nNN4)onerror=function(m,u,l){if(!confirm("Java Script Error\n"+"\nDescription:"+m+"\nSource:"+u+"\nLine:"+l+"\n\nSee more details?"))onerror=null;}
+if(nIEM||nOP5)onunload=function(){for(var j=0;j<st_ms.length;++j)st_ms[j].cfrm=0;return true;}
+if(nDM&&!nNN4)
+{
+	var s="<STYLE>\n.st_tbcss,.st_tdcss,.st_divcss,.st_ftcss{border:none;padding:0px;margin:0px}\nA.st_acss,A.st_acss:link,A.st_acss:visited,A.st_acss:active,A.st_acss:hover{background-color:transparent}\n</STYLE>";
+	for(var j=0;j<stMMSZ;++j)
+		s+="<FONT ID=st_gl"+j+"></FONT>";
+	if(nIEW&&nVER>=5&&document.body)
+		document.body.insertAdjacentHTML("AfterBegin",s);
+	else
+		document.write(s);
+}st_js=1;}
+function stm_bm(a){var w=a[2]&&a[2].charAt(a[2].length-1)!='/'?a[2]+'/':a[2];var p=a.length>15?a[15]&&a[15].charAt(a[15].length-1)!='/'?a[15]+'/':a[15]:"";st_ms[st_cm]={ps:[],mscm:[0,0],mei:st_cm,ids:"Stm"+st_cm+"p",hdid:0,cked:0,cfrm:0,tfrm:window,sfrm:window,mcff:"",mcfd:0,mcfn:0,mcfb:1,mcfx:0,mcfy:0,mnam:a[0],mver:a[1],mweb:w,mbnk:stbuf(w+a[3]),mtyp:a[4],mcox:a[5],mcoy:a[6],maln:stHAL[a[7]],mcks:a[8],msdv:a[9],msdh:a[10],mhdd:nNN4?Math.max(100,a[11]):a[11],mhds:a[12],mhdo:a[13],mhdi:a[14],mpre:p,args:a.slice(0),mwid:a.length>16?a[16]:"",midn:(a.length>17?a[17]:0)};}
+function stm_bp(l,a){var m=st_ms[st_cm],p,i=m.ps.length?m.ps[st_cp].is[st_ci]:0;st_cp=m.ps.length;st_ci=0;m.ps[st_cp]=p={is:[],mei:st_cm,ppi:st_cp,ids:"Stm"+st_cm+"p"+st_cp+"i",par:i,tmid:0,cuit:0,issh:0,isst:!st_cp&&!m.mtyp,isck:!st_cp&&(m.mcks&1),exed:0,pver:a[0],pdir:a[1],poffx:a[2],poffy:a[3],pspc:a[4],ppad:a[5],plmw:a[6],prmw:a[7],popc:a[8],pstp:a[14],psds:nIEW?a[15]:0,pscl:a[16],pbgc:a[17],pbgi:stbuf(stgsrc(a[18],0)),pbgr:stREP[a[19]],pbds:stBDS[a[20]],ipbw:a[21],pbdc:(!nDM||nNN4)?a[22].split(/\s/gi)[0]:a[22],args:a.slice(0)};p.peff=[stgeff(a[9],a[10],a[13],p),stgeff(a[11],a[12],a[13],p)];if(st_cp)	p.par.sub=p;p.zind=!st_cp?1000:stgpar(p.par).zind+1;p.pbgd=stgbg(p.pbgc,p.pbgi,p.pbgr);if(nIEW)p.effn=[p.peff[0]?p.peff[0].split(" ").length:0,p.peff[1]?p.peff[1].split(" ").length:0];eval(l+"=p");}
+function stm_bpx(l,r,a){var p=eval(r);stm_bp(l,(a.length?a.concat(p.args.slice(a.length)):p.args));}
+function stm_ai(l,a){st_ci=st_ms[st_cm].ps[st_cp].is.length;var m=st_ms[st_cm],p=m.ps[st_cp],i;if(a[0]==6)i={ssiz:a[1],ibgc:[a[2]],simg:stbuf(stgsrc(a[3],1)),simw:a[4],simh:a[5],simb:a[6],args:a.slice(0)};else i={itex:a[0]?a[1]:a[1].replace(/ /g,"&nbsp;"),iimg:[stbuf(stgsrc(a[2],0)),stbuf(stgsrc(a[3],0))],iimw:a[4],iimh:a[5],iimb:a[6],iurl:(!a[7]||stabs(a[7])?(a[7].toLowerCase().indexOf("javascript:")?a[7]:a[7]+";void(0);"):m.mpre+a[7]),itgt:a[8]?a[8]:"_self",istt:a[9],itip:a[10].replace(/"/g,"&quot;"),iicn:[stbuf(stgsrc(a[11],1)),stbuf(stgsrc(a[12],1))],iicw:a[13],iich:a[14],iicb:a[15],iarr:[stbuf(stgsrc(a[16],1)),stbuf(stgsrc(a[17],1))],iarw:a[18],iarh:a[19],iarb:a[20],ihal:stHAL[a[21]],ival:stVAL[a[22]],ibgc:nOP5&&nVER<7&&a[24]&&a[26]?["transparent","transparent"]:[nOP5&&nVER<7||!a[24]?a[23]:"transparent",nOP5&&nVER<7||!a[26]?a[25]:"transparent"],ibgi:[stbuf(stgsrc(a[27],a[28]&&!nNN4)),stbuf(stgsrc(a[28],a[27]&&!nNN4))],ibgr:[stREP[a[29]],stREP[a[30]]],ibds:stBDS[a[31]],ipbw:a[32],ibdc:(!nDM||nNN4)?[a[33].split(/\s/gi)[0],a[34].split(/\s/gi)[0]]:[a[33],a[34]],itxc:[a[35],a[36]],itxf:[a[37],a[38]],itxd:[stgdec(a[39]),stgdec(a[40])],args:a.slice(0)};p.is[st_ci]=i;i.ityp=a[0];i.mei=st_cm;i.ppi=st_cp;i.iti=st_ci;i.ids=p.ids+st_ci+"e";i.sub=0;i.tmid=0;i.iwd=0;i.iht=0;i.cstt=0;i.lock=0;if(m.midn&1)sthili(m,i);eval(l+"=i");}
+function stm_aix(l,r,a){var i=eval(r);stm_ai(l,(a.length?a.concat(i.args.slice(a.length)):i.args))}
+function stm_ep(){var m=st_ms[st_cm],p=m.ps[st_cp],i=p.par;if(i)st_cm=i.mei,st_cp=i.ppi,st_ci=i.iti;if(!p.is.length){m.ps.length--;if(i){i.sub=0;i.iarr=[m.mbnk,m.mbnk];}}}
+function stm_em(){if(!st_cm)stsetld();var m=st_ms[st_cm];if(!m.ps.length){--st_ms.length;return;}var mh="",mc="<STYLE TYPE='text/css'>\n";for(var n=nDM?m.ps.length:1,j=0;j<n;++j){var p=m.ps[j],ph=(p.isst&&m.maln!="left"?"<TABLE STYLE='border:none;padding:0px' CELLPADDING=0 CELLSPACING=0 ALIGN="+m.maln+"><TD class=st_tdcss>":"")+stpbtx(p);if(!p.pver)ph+="<TR ID="+p.ids+"TRR>";if(stissc(p))ph+=stsctx(p,0);for(var k=0;k<p.is.length;++k){var i=p.is[k];if(i.ityp!=6)i.ibgd=[stgbg(i.ibgc[0],i.ibgi[0],i.ibgr[0]),stgbg(i.ibgc[1],i.ibgi[1],i.ibgr[1])];ph+=p.pver?"<TR ID="+p.ids+i.iti+"TRR>"+stittx(i)+"</TR>":stittx(i);if(i.ityp!=6)mc+="."+i.ids+"TX0{"+sttcss(i,0)+"}\n."+i.ids+"TX1{"+sttcss(i,1)+"}\n";}if(stissc(p))ph+=stsctx(p,1);if(!p.pver)ph+="</TR>";ph+=stpetx(p);if(p.isst&&m.maln!="left")ph+="</TD></TABLE>";if(p.isst||nNN||nKQ2||!nDM)mh+=ph;else st_ht+=ph;}mc+="</STYLE>";if(!nDM||nNN4)document.write(mc);if(mh)document.write(mh);if(nOP5||nIEW&&nVER>=5){if(st_ht){var o=stgobj("st_gl"+st_gc);if(nOP)o.document.write(st_ht);else if(nIE)o.insertAdjacentHTML("BeforeEnd",st_ht);st_gc++;st_ht="";}if(nIE)stpre(m);}st_cm++;st_cp=0;st_ci=0;}
+function stpbtx(p){with(p){if(nNN4||!nDM)return (isst?"<ILAYER":"<LAYER LEFT=0 TOP=0")+" VISIBILITY=hide ID="+ids+" Z-INDEX="+zind+"><LAYER><TABLE BORDER=0 CELLSPACING=0 CELLPADDING="+pspc+" BACKGROUND='"+pbgi+"' BGCOLOR="+(pbgi||pbgc=="transparent"?"''":pbgc)+">";var s=(st_ttb||nOP&&isst?"<TABLE class=st_tbcss CELLPADDING=0 CELLSPACING=0":"<DIV class=st_divcss");s+=stppev(p)+" ID="+ids+" STYLE='"+(nIEM?"width:1px;":"")+(nIEW?"filter:"+stfcss(p)+";":"")+"position:"+(p.isst?"static":"absolute;"+(nOP&&nVER<7?"":"left:-9999px;top:-9999px"))+";z-index:"+zind+";visibility:hidden;'>";s+=(st_ttb||nOP&&isst?"<TD NOWRAP class=st_tdcss ID="+ids+"TTD>":"");if(nNN)s+="<TABLE class=st_tbcss cellpadding=0 cellspacing=0 style='"+stpcss(p)+"' ID="+ids+"TB><td class=st_tdcss><TABLE class=st_tbcss CELLSPACING="+(stissc(p)?0:pspc)+" CELLPADDING=0 ID="+ids+"TA>";else s+="<TABLE class=st_tbcss CELLSPACING="+(stissc(p)?0:pspc)+" CELLPADDING=0 style='"+stpcss(p)+"' ID="+ids+"TB><TBODY ID="+ids+"TBDB>";return s;}}
+function stpetx(p){return "</TBODY></TABLE>"+(nNN4||!nDM?"</LAYER></LAYER>":(nNN?"</TD></TABLE>":"")+(st_ttb||nOP&&p.isst?"</TD></TABLE>":"</DIV>"));}
+function stittx(i){var s="",p=stgpar(i);with(i)if(nNN4||!nDM){s+="<TD WIDTH=1 NOWRAP><FONT STYLE='font-size:1pt;'><ILAYER ID="+ids+"><LAYER";if(ityp!=6&&ipbw)s+=" BGCOLOR="+ibdc[0];s+=">";for(var n=0;n<(nNN4?2:1);++n){if(ityp==6&&n)break;s+="<LAYER Z-INDEX=10 VISIBILITY="+(n?"HIDE":"SHOW");if(ityp!=6)s+=" LEFT="+ipbw+" TOP="+ipbw;s+="><TABLE ALIGN=LEFT WIDTH="+(iwd&&ityp!=6?iwd-2*p.ppad+i.ipbw:"100%")+(iht&&(ityp!=6||!p.pver)?" HEIGHT="+(ityp!=6?iht+i.ipbw:iht):"")+" BORDER=0 CELLSPACING=0 CELLPADDING="+(ityp==6?0:p.ppad);if(ityp==6)s+=" BACKGROUND='' BGCOLOR='"+(ibgc[n]=="transparent"?"":ibgc[n])+"'";else s+=" BACKGROUND='"+ibgi[n]+"' BGCOLOR="+(ibgi[n]||ibgc[n]=="transparent"?"''":ibgc[n]);s+=">";if(ityp==6)s+="<TD NOWRAP VALIGN=TOP HEIGHT="+(p.pver?ssiz:"100%")+" WIDTH="+(p.pver?"100%":ssiz)+" STYLE='font-size:0pt;'>"+stgimg(simg,ids+"LINE",simw,simh,0,-1)+"</TD>";else{if(p.pver&&p.plmw||!p.pver&&iicw)s+="<TD ALIGN=CENTER VALIGN=MIDDLE"+stgiws(i)+">"+stgimg(iicn[n],"",iicw,iich,iicb,1)+"</TD>";s+="<TD WIDTH=100% NOWRAP ALIGN="+ihal+" VALIGN="+ival+"><A "+(nNN4?"":stgurl(i,1))+" CLASS='"+(ids+"TX"+n)+"'>";if(ityp==2)s+=stgimg(iimg[n],ids+"IMG",iimw,iimh,iimb,-1);else s+="<IMG SRC='"+stgme(i).mbnk+"' WIDTH=1 HEIGHT=1 BORDER=0 ALIGN=ABSMIDDLE>"+itex;s+="</A></TD>";if(p.pver&&p.prmw||!p.pver&&iarw)s+="<TD ALIGN=CENTER VALIGN=MIDDLE"+stgaws(i)+">"+stgimg(iarr[n],"",iarw,iarh,iarb,1)+"</TD>";}s+="</TABLE>";if(ityp!=6&&ipbw)s+="<BR CLEAR=ALL><SPACER HEIGHT=1 WIDTH="+ipbw+"></SPACER><SPACER WIDTH=1 HEIGHT="+ipbw+"></SPACER>";s+="</LAYER>";}if(ityp!=6)s+="<LAYER Z-INDEX=20></LAYER>";s+="</LAYER></ILAYER></FONT></TD>";}else{s+="<TD class=st_tdcss ID="+i.ids+stitev(i);if(ityp!=6)s+=" TITLE="+stquo(itip)+(iwd?" WIDTH="+iwd:"")+(iht?" HEIGHT="+iht:"")+" VALIGN="+ival;s+=" STYLE='";if(!(ityp!=6&&stmozb)&&(ityp!=6||!(nOP&&nVER<6&&p.pver)))s+=sticss(i,0);s+="'>";if(ityp==6){s+="<table class=st_tbcss cellpadding=0 cellspacing=0 width=100% ID="+i.ids+"SA><td class=st_tdcss NOWRAP align=center valign=middle"+(p.pver?" width=100% STYLE='"+sticss(i,0)+"' height=":" width=")+ssiz+" ID="+i.ids+"SB>";s+=stgimg(simg,ids+"LINE",simw,simh,0,-1);s+="</td></table>";}else{var s1=nNN||nKQ2?"<DIV CLASS=st_divcss "+(stmozb?" STYLE='"+sticss(i,0)+"'":"")+" ID="+i.ids+"DR>":"";s+=nKQ2?s1:"";s+="<A class=st_acss ID="+i.ids+"HR STYLE='text-decoration:none;"+(nIEW?"cursor:"+stgcur(i):"")+"' "+stgurl(i,0)+">";s+=nNN?s1:"";s+="<TABLE class=st_tbcss CELLSPACING=0 CELLPADDING=0 WIDTH=100% ID="+ids+"TB>";if(p.pver&&p.plmw||!p.pver&&iicw)s+="<TD class=st_tdcss NOWRAP ALIGN=CENTER VALIGN=MIDDLE STYLE='padding:"+p.ppad+"px' ID="+ids+"LTD"+stgiws(i)+">"+stgimg(iicn[0],ids+"ICON",iicw,iich,iicb,1)+"</TD>";else if(nIEW)s+="<TD class=st_tdcss></TD>";s+="<TD CLASS=st_tdcss VALIGN="+ival+" NOWRAP STYLE='text-align:"+ihal+";color:"+itxc[0]+";padding:"+p.ppad+"px;' ID="+ids+"MTD>";s+="<FONT CLASS=st_ftcss ID="+ids+"TX STYLE=\""+sttcss(i,0)+"\">";if(ityp==2)s+=stgimg(iimg[0],ids+"IMG",iimw,iimh,iimb,-1);else if(itex)s+=itex;else s+=stgimg(stgme(i).mbnk,ids+"IMG",1,1,0,1);s+="</FONT>";s+="</TD>";if(p.pver&&p.prmw||!p.pver&&iarw)s+="<TD class=st_tdcss NOWRAP ALIGN=CENTER VALIGN=MIDDLE STYLE='padding:"+p.ppad+"px' ID="+ids+"RTD"+stgaws(i)+">"+stgimg(iarr[0],ids+"ARROW",iarw,iarh,iarb,1)+"</TD>";else if(nIEW)s+="<TD class=st_tdcss></TD>";s+="</TABLE>";s+=nNN?"</DIV>":"";s+="</A>";s+=nKQ2?"</DIV>":"";}s+="</TD>";}return s;}
+function stpcss(p){with(p)return "border-style:"+pbds+";border-width:"+ipbw+"px;border-color:"+pbdc+";"+(nIE?"background:"+pbgd+";":"background-color:"+pbgc+";"+(pbgi?"background-image:url("+pbgi+");background-repeat:"+pbgr+";":""))+(nIEW?"margin:"+psds+"px;":";");}
+function stfcss(p){var s="";with(p)if(nIEW&&(nVER>=5||!isst)){s+=peff[0]+" ";s+=peff[1]+" ";if(nIE5||popc!=100)s+="Alpha(opacity="+popc+") ";if(psds)s+=pstp==1?"dropshadow(color="+pscl+",offx="+psds+",offy="+psds+",positive=1) ":"Shadow(color="+pscl+",direction=135,strength="+psds+") ";}return s;}
+function sticss(i,n){with(i)return (ityp!=6?"border-style:"+ibds+";border-width:"+ipbw+"px;border-color:"+ibdc[n]+";"+(!nIEM&&ibgi[n]?"background-image:url("+ibgi[n]+");background-repeat:"+ibgr[n]+";":""):"")+(nIEM&&ityp!=6?"background:"+ibgd[n]+";":"background-color:"+ibgc[n]+";")+"cursor:"+(nIEM?"default":stgcur(i))+";font-size:1px;";}
+function sttcss(i,n){with(i)return "cursor:"+stgcur(i)+";font:"+itxf[n]+";text-decoration:"+itxd[n]+";"+(!nDM||nNN4||nIE5?"background-color:transparent;color:"+itxc[n]:"");}
+function stgtm(m,w){if(w&&w!=window&&stdmld(w)){var t=w.stmenu(m.mnam);if(t){t.sfrm=window;if(t.mhdd<1000)	t.mhdd=1000;}return t;}return m;}
+function stitov(e,o,i){var p=stgpar(i);if(!p.issh||o&&nIE&&e.fromElement&&o.contains(e.fromElement)||nOP&&e.fromElement&&e.fromElement.id&&e.fromElement.id.indexOf(i.ids)>=0)return;if(nNN4)stglay(i).document.layers[0].captureEvents(Event.CLICK);var m=stgme(i),t=m,w=window;if(!p.par){w=stgfrm(m);t=stgtm(m,w);}if(!p.isck||m.cked){if(p.cuit&&p.cuit!=i){var c=p.cuit;sthdit(c);if(t!=m&&t)w.sthdit(t.ps[c.ppi].is[c.iti]);}if(typeof(i.myitov)!="undefined"&&i.myitov(e))return;stshpx(t,m,i,w);stshst(i,1);stgpar(i).cuit=i;}else if(t.mcks&2)stshst(i,1);if(nNN4&&i.istt)stcstt(i);}
+function stitou(e,o,i){var p=stgpar(i);if(!p.issh||nIE&&e.toElement&&o.contains(e.toElement)||nOP&&e.toElement&&e.toElement.id&&e.toElement.id.indexOf(i.ids)>=0)return;if(nNN4)stglay(i).document.layers[0].releaseEvents(Event.CLICK);var m=stgme(i),t=m,w=window;if(!p.par){w=stgfrm(m);t=stgtm(m,w);}if(typeof(i.myitou)!="undefined"&&i.myitou(e))return;p=i.sub;var tp=t!=m&&t?t.ps[i.ppi].is[i.iti].sub:0;if(p&&p.issh&&!p.exed)sthdpp(p);if(tp&&tp.issh&&!tp.exed)w.sthdpp(tp);if(!(p&&p.issh||tp&&tp.issh)){stshst(i,0);stgpar(i).cuit=0;}if(nNN4&&i.istt)status="";}
+function stitck(e,o,i){if(i.lock||nNN4&&e.which!=1)return;if(typeof(i.myitck)!="undefined"&&i.myitck(e))return;var m=stgme(i),t=m,w=window;if(!stgpar(i).par){w=stgfrm(m);t=stgtm(m,w);}var p=stgpar(i);if(p.isck){m.cked=!m.cked;var p=i.sub;if(p){if(m.cked&&!p.issh)stshpx(t,m,i,w);else if(!m.cked&&p.issh){var tp=t!=m&&t?t.ps[i.ppi].is[i.iti].sub:0;if(tp)w.sthdpp(tp);sthdpp(p);}}if(!(t.mcks&2))stshst(i,m.cked?1:0);stgpar(i).cuit=m.cked?i:0;}if(i.iurl&&m.sfrm!=window)sthdalx(m,0);if(nKQ2&&i.iurl){window.open(i.iurl,i.itgt);}if(nIEW&&i.iurl){var a=stgobj(i.ids+"HR");i.lock=1;if(e.shiftKey)a.target='_blank';a.click();a.target=i.itgt;i.lock=0;}}
+function stppov(e,o,p){if(!p.issh||nIE&&e.fromElement&&o.contains(e.fromElement)||nOP&&e.fromElement&&e.fromElement.id&&e.fromElement.id.indexOf(p.ids)>=0)return;var m=stgme(p),w=m.sfrm;if(p.par&&w!=window){if(stdmld(w))m=w.stmenu(m.mnam);else return;}if(m.hdid){w.clearTimeout(m.hdid);m.hdid=0;}}
+function stppou(e,o,p){if(!p.issh||nIE&&e.toElement&&o.contains(e.toElement)||nOP&&e.toElement&&e.toElement.id&&e.toElement.id.indexOf(p.ids)>=0)return;var m=stgme(p),w=m.sfrm;if(p.par&&w!=window){if(stdmld(w))m=w.stmenu(m.mnam);else{sthdalx(m,0);return;}}if(m.hdid)w.clearTimeout(m.hdid);m.hdid=w.setTimeout("sthdall(st_ms['"+m.mei+"'],0);",m.mhdd);}
+function stshst(i,n){if(i.cstt==n)return;if(typeof(i.myshst)!="undefined"&&i.myshst(n))return;i.cstt=n;with(i)if(nNN4){var ls=stgstlay(i);ls[n].parentLayer.bgColor=ibdc[n];ls[n].visibility="show";ls[1-n].visibility="hide";}else{var o=stmozb?stgobj(i.ids+"DR"):stglay(i),s=o.style;if(nIEM){if(ibgd[0]!=ibgd[1])	s.background=ibgd[n];}else{if(ibgc[0]!=ibgc[1]){if(nOP&&nVER<6)s.background=ibgc[n];else s.backgroundColor=ibgc[n];}if(ibgi[0]!=ibgi[1])	s.backgroundImage="url("+(ibgi[n]?ibgi[n]:stgme(i).mbnk)+")";s.backgroundRepeat=ibgr[n];}if(ibdc[0]!=ibdc[1])	s.borderColor=ibdc[n];var t;if(iicn[0]!=iicn[1]){t=nIE?o.all[ids+"ICON"]:stgobj(ids+"ICON");if(t)	t.src=iicn[n];}if(iarr[0]!=iarr[1]){t=nIE?o.all[ids+"ARROW"]:stgobj(ids+"ARROW");if(t)	t.src=iarr[n];}if(ityp==2&&iimg[0]!=iimg[1]){t=nIE?o.all[ids+"IMG"]:stgobj(ids+"IMG");if(t)	t.src=iimg[n];}if(!i.txstyle)	i.txstyle=(nIE?o.all[ids+"TX"]:stgobj(ids+"TX")).style;t=txstyle;if(itxf[0]!=itxf[1])t.font=itxf[n];if(itxd[0]!=itxd[1])t.textDecoration=itxd[n];if(nOP)	stgobj(ids+"MTD").style.color=itxc[n];else	t.color=itxc[n];if(nOP&&nVER>7)with(stglay(stgpar(i)).style){var v=visibility;visibility="hidden";visibility=v;}}}
+function stshpp(p){if(typeof(p.myshpp)!="undefined"&&p.myshpp())return;stshow(p);}
+function stshpx(t,m,i,w){if(t==m){var p=i.sub;if(p&&!p.issh&&!(!i.ppi&&m.mcff&&!m.mcfn))stshpp(p);}else if(t){var p=t.ps[i.ppi].is[i.iti].sub;if(p&&!p.issh)w.stshpp(p);}}
+function sthdpp(p){if(typeof(p.myhdpp)!="undefined"&&p.myhdpp())return;if(p.cuit){var t=p.cuit.sub;if(t&&t.issh)sthdpp(t);stshst(p.cuit,0);p.cuit=0;}sthide(p);}
+function stshit(i){var p=i.sub;if(p&&!p.issh)stshpp(p);stshst(i,1);stgpar(i).cuit=i;}
+function sthdit(i){var p=i.sub;if(p&&p.issh)sthdpp(p);stshst(i,0);stgpar(i).cuit=0;}
+function stshow(p){var d=p.par&&stgpar(p.par).pver?stgme(p).msdv:stgme(p).msdh;p.exed=0;if(typeof(p.rc)=="undefined")stgxy(p);if(p.tmid){clearTimeout(p.tmid);p.tmid=0;stwels(1,p)}if(d>0)p.tmid=setTimeout(stsdstr(p,1),d);p.issh=1;if(d<=0)eval(stsdstr(p,1));}
+function sthide(p){if(p.tmid){clearTimeout(p.tmid);p.tmid=0;}if(p.issh&&!p.exed){p.exed=0;p.issh=0;}else{p.exed=0;p.issh=0;eval(stsdstr(p,0));}}
+function stshx(p){if(nNN4){stnshx(p);return;}var l=stglay(p);l.style.visibility="visible";if(nIE5)l.filters["Alpha"].opacity=p.popc;}
+function stnshx(p){var l=stglay(p);l.visibility="show";if(!p.fixed){l.resizeBy(p.ipbw*2,p.ipbw*2);l=l.document.layers[0];l.moveTo(p.ipbw,p.ipbw);l.onmouseover=stppovn;l.onmouseout=stppoun;for(var j=p.is.length-1;j>=0;--j){var i=p.is[j];if(i.ityp!=6){var ls=stgstlay(i);if(i.ityp!=1||i.iurl)ls[2].resizeTo(ls[0].parentLayer.clip.width,ls[0].parentLayer.clip.height);if(i.iurl){with(ls[2].document){open();write("<A "+stgurl(i,0)+"><IMG BORDER=0 SRC='"+stgme(i).mbnk+"' WIDTH="+ls[2].clip.width+" HEIGHT="+ls[2].clip.height+"></A>");close();}}ls[0].resizeBy(-i.ipbw,-i.ipbw);ls[1].resizeBy(-i.ipbw,-i.ipbw);l=stglay(i).document.layers[0];l.onmouseover=stitovn;l.onmouseout=stitoun;l.onclick=stitckn;}}if(p.ipbw)setTimeout("var p=st_ms["+p.mei+"].ps["+p.ppi+"];stglay(p).bgColor=p.pbdc;",1);p.fixed=1;}}
+function sthdx(p){var l=stglay(p);if(nNN4)l.visibility="hide";else{if(nIE5)l.filters["Alpha"].opacity=0;l.style.visibility="hidden";}}
+function stcls(){for(var i=0;i<st_ms.length;++i)sthdalx(st_ms[i],0);}
+function sthdalx(m,f){var w=m.sfrm;if(w!=window){if(stdmld(w)){var t=w.stmenu(m.mnam);if(t)w.sthdall(t,f);}else{for(var i=0;i<m.ps[0].is.length;++i){var p=m.ps[0].is[i].sub;if(p&&p.issh){sthdpp(p);break;}}}}else sthdall(m,f);}
+function sthdall(m,f){var t=m,w;if(m.mcff){w=stgfrm(m);if(w&&w!=window&&stdmld(w)){t=w.stmenu(m.mnam);if(typeof(t)=="object"&&t)t.sfrm=window;}}if(m.hdid){clearTimeout(m.hdid);m.hdid=0;}m.cked=0;var p=m.ps[0];if(p.issh){var i=p.cuit;if(p.cuit){sthdit(i);if(t!=m){var p=t.ps[i.ppi].is[i.iti].sub;if(p&&p.issh)w.sthdpp(p);}} if(m.mtyp==2&&(f||stAHCM))sthide(p);}}
+function stgeff(f,i,s,p){return nVER<5.5?(!p.isst||nVER>=5)&&i<24&&i>=0?"revealTrans(Transition="+i+",Duration="+((110-s)/100)+")":"":f=="Normal"?"":f;}
+function stftsh(p){if(nIEW&&nVER>=5.5)eval("try{stshfx(p);}catch(e){st_reg=0;stshfx(p);}");else stshfx(p);}
+function stfthd(p){if(nIEW&&nVER>=5.5)eval("try{sthdfx(p);}catch(e){st_reg=0;sthdfx(p);}");else sthdfx(p);}
+function stshfx(p){var xy=stgxy(p);if(stissc(p))stssc(xy[2],p);stmvto(xy,p);stwels(-1,p);if(nIEW&&st_reg){var ts=stglay(p).filters;for(var i=0,j=i+p.effn[0];i<j;++i){if(ts[i].status)ts[i].stop();ts[i].apply();}}stshx(p);if(nIEW&&st_reg){var ts=stglay(p).filters;for(var i=0,j=i+p.effn[0];i<j;++i)ts[i].play();}}
+function sthdfx(p){if(nIEW&&st_reg){var ts=stglay(p).filters;for(var i=p.effn[0],j=i+p.effn[1];i<j;++i){if(ts[i].status)ts[i].stop();ts[i].apply();}}sthdx(p);stwels(1,p);if(nIEW&&st_reg){var ts=stglay(p).filters;for(var i=p.effn[0],j=i+p.effn[1];i<j;++i)ts[i].play();}}
+function ststxy(m,xy){m.mcox=xy[0];m.mcoy=xy[1];}
+function stnav(){var v=navigator.appVersion,a=navigator.userAgent;nMAC=v.indexOf("Mac")>=0;if((nKQ=(typeof(navigator.product)!="undefined"&&navigator.product=="Konqueror/khtml"))){nVER=parseFloat(v);nKQ2=1;stmozb=1;}else if((nOP=a.indexOf("Opera")>=0)){nVER=parseFloat(a.substring(Math.max(a.indexOf("Opera/"),a.indexOf("Opera "))+6,a.length));nOP5=nVER>=5;}else if((nIE=document.all?1:0)){nIE4=(eval(v.substring(0,1)>=4));nVER=parseFloat(a.substring(a.indexOf("MSIE ")+5,a.length));nIE5=nVER>=5&&nVER<5.5&&!nMAC;nIEM=nIE4&&nMAC;nIEW=nIE4&&!nMAC;}else if((nNN4=navigator.appName.toLowerCase()=="netscape"&&v.substring(0,1)=="4")){nVER=parseFloat(v);}else if((nNN6=(document.getElementsByTagName("*")&&a.indexOf("Gecko")!=-1))){nVER=parseInt(navigator.productSub);if(a.indexOf("Netscape")>=0){st_delb=nVER<=20001108;st_addb=nVER>=20020512;}else{stmozb=nVER<20010505&&nVER>20001205;st_delb=nVER<=20010628;st_addb=nVER>=20011221&&nVER<20021016;}}nNN=nNN4||nNN6;nDM=nOP5||nIE4||nNN||nKQ2;}
+function stckpg(){st_rl=0;var w=st_cw,h=st_ch,l=st_cl,t=st_ct;st_cw=stgcw();st_ch=stgch();st_cl=stgcl();st_ct=stgct();st_scd=st_cl-l||st_ct-t;if((st_cw-w||st_ch-h)&&(nOP&&nVER<7||nNN4))document.location.reload();else{if(!nIEM)stscr();st_rl=setTimeout("stckpg();",25);}}
+function st_onload(){if(st_load)	return;if(nIEM||nOP5||nNN||nKQ2||nIEW&&nVER<5){if(st_ht)document.body.insertAdjacentHTML("BeforeEnd",st_ht);for(var j=0;j<st_ms.length;++j)stpre(st_ms[j]);}st_load=1;for(var i=stusrld.length-1;i>=0;--i){stusrld[i]();}stusrld.length=0;for(var j=0;j<st_ms.length;++j){var m=st_ms[j];for(var k=0;k<m.ps.length;++k){var p=m.ps[k];if(p.issh&&p.exed)stwels(-1,p);}if(typeof(m.myload)!="undefined")m.myload();}}
+function stpre(m){var p=m.ps[m.ps.length-1],i=p.is[p.is.length-1];while(1)if(stglay(i)) break;if(!nNN4)stfix(m);if(m.mtyp!=2)stshow(m.ps[0]);if(nIEM)onscroll=onresize=new Function("if(st_scr)clearTimeout(st_scr);st_scr=setTimeout('stscr();',500);");else if(!st_rl){st_cw=stgcw();st_ch=stgch();st_cl=stgcl();st_ct=stgct();st_rl=setTimeout("stckpg();",25);}m.ready=1;}
+function stfix(m){for(var j=0;j<m.ps.length;++j){var p=m.ps[j],l=stglay(p);if(!p.isst&&(nOP&&nVER>=7||nNN6))document.body.appendChild(l);if(nOP&&nVER<6)l.style.pixelWidth=parseInt(stgobj(p.ids+"TB").style.pixelWidth);if(nIE5)l.style.width=l.offsetWidth;}}
+function stgsp(sp,d){var i=0,s=5;if(d<s||nIEM||!stSMSC)return d;d=(d-d%s)/s;while(d>0)d-=++i;return Math.min(Math.min(i*s,sp+s),100*s);}
+function stscr(){for(var j=0;j<st_ms.length;++j){var m=st_ms[j];if(m.mtyp==1){var p=m.ps[0],o=stgobj(p),xy=stgxy(p),rc=stgrc(p);if(typeof(p.scxs)=='undefined')p.scxs=0;if(typeof(p.scys)=='undefined')p.scys=0;var dx=xy[0]-rc[0],dy=xy[1]-rc[1];if(dx||dy){if(stAHWS)	sthdall(m,0);stwels(1,p);p.scxs=stgsp(p.scxs,Math.abs(dx));p.scys=stgsp(p.scys,Math.abs(dy));var x=dx>0?rc[0]+p.scxs:rc[0]-p.scxs,y=dy>0?rc[1]+p.scys:rc[1]-p.scys;stmvto([x,y],p);if(stissc(p))stssc(stgsc(x,y,p),p);stwels(-1,p);}else{p.scxs=p.scys=0;if(stissc(p)){stwels(1,p);stssc(stgsc(xy[0],xy[1],p),p);stwels(-1,p);}}}else if(st_scd&&stAHWS&&m.sfrm!=window)sthdalx(m,0);}}
+function stmvto(xy,p){if(xy&&(p.par||stgme(p).mtyp)){var l=stglay(p);if(nNN4)l.moveToAbsolute(xy[0],xy[1]);else if(nOP){var s=l.style;s.pixelLeft=xy[0];s.pixelTop=xy[1];}else{var s=l.style;s.left=xy[0]+"px";s.top=xy[1]+"px";}p.rc=[xy[0],xy[1],p.rc[2],p.rc[3]];}}
+function stsdstr(p,s){return	"var p=st_ms["+p.mei+"].ps["+p.ppi+"];p.tmid=0;"+(s?"stftsh(":"stfthd(")+"p);p.exed=1;";}
+function stevfn(n,i){return new Function("e","var r=/Stm(\\d*)p(\\d*)i"+(i?"(\\d*)e":"")+"/;r.exec(this.parentLayer.id);var m=RegExp.$1;var p=parseInt(RegExp.$2);"+(i?"var i=parseInt(RegExp.$3);":"")+"return "+n+"(e,this,st_ms[m].ps[p]"+(i?".is[i]":"")+");");}
+function stppev(p){return " onMouseOver='stppov(event,this,st_ms["+p.mei+"].ps["+p.ppi+"]);' onMouseOut='stppou(event,this,st_ms["+p.mei+"].ps["+p.ppi+"]);'";}
+function stitev(i){with(i)return ityp==6?"":" onMouseOver='stitov(event,this,st_ms["+mei+"].ps["+ppi+"].is["+iti+"]);' onMouseOut='stitou(event,this,st_ms["+mei+"].ps["+ppi+"].is["+iti+"]);' onClick='stitck(event,this,st_ms["+mei+"].ps["+ppi+"].is["+iti+"]);'";}
+function stquo(n){return "\""+n+"\"";}
+function stgurl(i,f){with(i)return (iurl||f?"HREF="+stquo(iurl?iurl.replace(/"/g,"&quot;").replace(/'/g,"&#39;"):"#")+(iurl&&itgt?" TARGET="+stquo(itgt):""):"")+(istt?" onMouseOver='return stcstt(st_ms["+mei+"].ps["+ppi+"].is["+iti+"]);' onMouseOut=\"top.status=\'\';return true;\"":"");}
+function stcstt(i){top.status=i.istt;return true;}
+function stgdec(v){return v?(v&1?"underline ":"")+(v&2?"line-through ":"")+(v&4?"overline":""):"none";}
+function stgimg(src,id,w,h,b,f){var x=w?w:f,y=h?h:f;return "<IMG SRC="+stquo(src)+(id?" ID="+id:"")+(w>0?" WIDTH="+w:"")+(h>0?" HEIGHT="+h:"")+" BORDER="+b+">";}
+function stgbg(c,i,r){return i?c+" url("+i+") "+r:c;}
+function stgcur(i){return i.ityp!=6&&(i.iurl||stgpar(i).isck&&i.sub)?(nNN6||nKQ2?"pointer":"hand"):"default";}
+function stgiws(i){var p=stgpar(i);return p.pver?(p.plmw>0?" WIDTH="+(p.plmw+2):""):(i.iicw>0?" WIDTH="+(i.iicw+2):"");}
+function stgaws(i){var p=stgpar(i);return p.pver?(p.prmw>0?" WIDTH="+(p.prmw+2):""):(i.iarw>0?" WIDTH="+(i.iarw+2):"");}
+function stgme(ip){var p=st_ms[ip.mei].ps[ip.ppi];while(p.par)p=stgpar(p.par);return st_ms[p.mei];}
+function stgpar(ip){return st_ms[ip.mei].ps[ip.ppi];}
+function stgcl(){return nIE?(nIEW&&document.compatMode=="CSS1Compat"?document.documentElement:document.body).scrollLeft:pageXOffset;}
+function stgct(){return nIE?(nIEW&&document.compatMode=="CSS1Compat"?document.documentElement:document.body).scrollTop:pageYOffset;}
+function stgcw(){return nIE?(nIEW&&document.compatMode=="CSS1Compat"?document.documentElement:document.body).clientWidth:innerWidth;}
+function stgch(){return nIE?(nIEW&&document.compatMode=="CSS1Compat"?document.documentElement:document.body).clientHeight:innerHeight;}
+function stgobj(id){with(document)return nIE&&nVER<5?all[id]:nNN4?layers[id]:getElementById(id);}
+function stglay(ip){if(!ip.layer)ip.layer=!stisit(ip)||nNN6||nKQ2||nOP5?stgobj(ip.ids):nNN4?stglay(stgpar(ip)).document.layers[0].document.layers[ip.ids]:stglay(stgpar(ip)).all.tags("td")[ip.ids];return ip.layer;}
+function stgstlay(i){return stglay(i).document.layers[0].document.layers;}
+function stgrc(ip){var ly=stglay(ip);if(nNN4)return [ly.pageX,ly.pageY,ly.clip.width,ly.clip.height];else{var l=0,t=0,w=typeof(ip.rc)=="undefined"?parseInt(nOP&&nVER<7?ly.style.pixelWidth:ly.offsetWidth):ip.rc[2],h=typeof(ip.rc)=="undefined"?parseInt(nOP&&nVER<7?ly.style.pixelHeight:ly.offsetHeight):ip.rc[3];while(ly){l+=parseInt(ly.offsetLeft);t+=parseInt(ly.offsetTop);if(nIEW&&stisit(ip)&&ly.id==stgpar(ip).ids+"SC"){l-=ly.scrollLeft;t-=ly.scrollTop;}ly=(nKQ2||navigator.appVersion.indexOf("Safari")>=0)&&ly.style&&ly.style.position&&ly.style.position.toLowerCase()=="absolute"?0:ly.offsetParent;}if(nIEM)l+=parseInt(document.body.leftMargin);if(stisit(ip)){var p=stgpar(ip);if(st_delb){l-=ip.ipbw;t-=ip.ipbw;}if(st_addb){var w=p.ipbw;l+=w;t+=w;}if(nIEM){for(var ly=stgobj((p.pver?p.ids+ip.iti:p.ids)+"TRR"),t=0;ly;ly=ly.offsetParent)t+=parseInt(ly.offsetTop);}else if(nNN&&p.pver)w=parseInt(stgobj(ip.ids+"DR").offsetWidth)+2*ip.ipbw;}else if(nIEM)w=parseInt(stglay(ip).offsetWidth)-ip.ipbw;return [l,t,w,h];}}
+function stgxy(p){var sr=stgrc(p),ss=0;p.rc=sr.slice(0);if(stissc(p)){var sc=stgobj(p.ids+"SC");sr[p.pver?3:2]=ss=(p.pver?sc.scrollHeight:sc.scrollWidth)+2*p.ipbw+2*p.psds;}if(!p.par){var m=stgme(p),x,y;if(m.mtyp){x=eval(m.mcox+"");y=eval(m.mcoy+"");}else{x=sr[0];y=sr[1];}if(nIEW){x-=p.psds;y-=p.psds;}return stissc(p)?[x,y,stgsc(x,y,p)]:[x,y];}var ir=stgirc(p.par),l=stgcl()-p.psds+stgspc(p,2),t=stgct()-p.psds+stgspc(p,0),r=stgcl()+stgcw()-stgspc(p,3),b=stgct()+stgch()-stgspc(p,1),x=p.poffx+ir[0],y=p.poffy+ir[1];x-=p.pdir==1?sr[2]:p.pdir==2?p.psds-ir[2]:p.psds;y-=p.pdir==3?sr[3]:p.pdir==4?p.psds-ir[3]:p.psds;if(stissc(p)&&!p.pver){var ms=p.pdir==1?(x=Math.max(Math.min(Math.min(r,ir[0]+p.poffx)-sr[2],x),l),Math.min(ir[0]+p.poffx,r)-x):(x=p.pdir==2?Math.max(x,l):Math.max(Math.min(r-sr[2],x),l),r-x);ss=ss>ms?ms:0 }else x=Math.max(Math.min(r-sr[2],x),l);if(stissc(p)&&p.pver){var ms=p.pdir==3?(y=Math.max(Math.min(Math.min(b,ir[1]+p.poffy)-sr[3],y),t),Math.min(ir[1]+p.poffy,b)-y):(y=p.pdir==4?Math.max(y,t):Math.max(Math.min(b-sr[3],y),t),b-y);ss=ss>ms?ms:0 }else y=Math.max(Math.min(b-sr[3],y),t);return [x,y,ss];}
+function stbuf(s){if(s&&stBIMG){var i=new Image();st_ims[st_ims.length]=i;i.src=s;}return s;}
+function stabs(s){var t=s.toLowerCase();return t.indexOf(":")==1&&t.charCodeAt()>="a"&&t.charCodeAt()<="z"||!t.indexOf("http:")||!t.indexOf("https:")||!t.indexOf("file:")||!t.indexOf("ftp:")||!t.indexOf("/")||!t.indexOf("javascript:")||!t.indexOf("mailto:")||!t.indexOf("about:")||!t.indexOf("gopher:")||!t.indexOf("news:")||!t.indexOf("telnet:")||!t.indexOf("wais:");}
+function stgsrc(s,f){var m=st_ms[st_cm];return s?stabs(s)?s:m.mweb+s:f?m.mbnk:s;}
+function showFloatMenuAt(n,x,y){if(nDM){var m=stmenu(n);if(m&&typeof(m.ready)!="undefined"&&m.mtyp==2&&m.ps.length&&!m.ps[0].issh){ststxy(m,[x,y]);stshow(m.ps[0]);}}}
+function hideMenu(n){var m=stmenu(n);sthdall(m,1);}
+function stmenu(n){for(var j=st_ms.length-1;j>=0;--j)if(st_ms[j].mnam==n)return st_ms[j];return 0;}
+function stgirc(i){var m=stgme(i),w=m.sfrm;if(stgpar(i).par||w==window)return stgrc(i);m=w.stmenu(m.mnam);var rc=w.stgrc(m.ps[0].is[i.iti]),x=rc[0]-w.stgcl(),y=rc[1]-w.stgct();i.sub.pdir=4-m.mcfd;switch(m.mcfd){case 0:y-=w.stgch();break;case 1:y+=stgch();break;case 2:x-=w.stgcw();break;case 3:x+=stgcw();break;}return [x+stgcl()+m.mcfx,y+stgct()+m.mcfy,rc[2],rc[3]];}
+function stisit(ip){return typeof(ip.iti)!="undefined";}
+function stgtgt(i){var t=i.itgt;if(t=="_self")return window;else if(t=="_parent")return parent;else if(t=="_top")return top;else for(var co=window;co!=co.parent;co=co.parent)if(typeof(co.parent.frames[t])!="undefined")return co.parent.frames[t];return 0;}
+function stgfrm(m){if(!m.mcff)	return window;if(m.mhdd<1000)	m.mhdd=1000;var a=m.mcff.split("."),w="parent";for(var j=0;j<a.length;++j){w+="."+a[j];if(typeof(eval(w))=="undefined")return 0;}return eval("parent."+m.mcff);}
+function stgspc(p,d){var m=stgme(p),w=m.sfrm;return p.par&&!p.par.ppi&&w!=window&&stdmld(w)&&w.stmenu(m.mnam).mcfd==d?stCFSP:stSCSP;}
+function stsetld(){if(nDM){if(typeof(onload)!="undefined"&&onload!=st_onload&&onload)stusrld[stusrld.length]=onload;onload=st_onload;}}
+function stdmld(w){return typeof(w.st_load)!="undefined"&&w.st_load;}
+function stissc(p){return nIEW&&nVER>=5&&p.ppi&&stgme(p).mscm[p.pver];}
+function stm_sc(n,a){if(nIEW&&nVER>=5)st_ms[st_cm].mscm[n]={sbgc:[a[0],a[1]],sbgi:[stbuf(stgsrc(a[2],0)),stbuf(stgsrc(a[3],0))],sbgr:[stREP[a[4]],stREP[a[5]]],sbds:stBDS[a[6]],sbdw:a[7],sbdc:[a[8],a[9]],simg:[[stbuf(stgsrc(a[10],0)),stbuf(stgsrc(a[11],0))],[stbuf(stgsrc(a[15],0)),stbuf(stgsrc(a[16],0))]],simw:[a[12],a[17]],simh:[a[13],a[18]],simb:[a[14],a[19]]};}
+function stsctx(p,d){with(p)with(stgme(p).mscm[p.pver])return (d?"</table></div></td>"+(pver?"</tr>":""):"")+(pver?"<tr style='display:none'><td":"<td height=100% style='display:none'")+" class=st_tbcss style='padding:"+pspc+"px'><table onmouseover='stscev(st_ms["+mei+"].ps["+ppi+"],"+d+",1)' onmouseout='stscev(st_ms["+mei+"].ps["+ppi+"],"+d+",0)' id="+ids+(d?"SN":"SP")+" height=100% width=100% class=st_tbcss cellpadding=0 cellspacing=0 style='cursor:default;border-style:"+sbds+";border-width:"+sbdw+"px;border-color:"+sbdc[0]+";background-color:"+sbgc[0]+(sbgi[0]?";background-image:url("+sbgi[0]+")":"")+";background-repeat:"+sbgr[0]+";'><td nowrap height=100% class=st_tdcss style='padding:"+ppad+"px;' align=center><img src='"+simg[d][0]+"' align=absmiddle border="+simb[d]+(simw[d]>=0?" width="+simw[d]:"")+(simh[d]>=0?" height="+simh[d]:"")+"></td></table></td>"+(d?(pver?"</tr>":""):(pver?"</tr><tr>":"")+"<td class=st_tbcss><div id="+ids+"SC class=st_divcss style='width:;height:;overflow:hidden;'><table class=st_tbcss cellpadding=0 cellspacing="+pspc+" border=0>");}
+function stscev(p,d,v){p.scpx=d?v?4:0:v?-4:0;with(stgme(p).mscm[p.pver]){var o=stgobj(p.ids+(d?"SN":"SP")).style;if(sbdc[0]!=sbdc[1])o.borderColor=sbdc[v];if(sbgc[0]!=sbgc[1])o.backgroundColor=sbgc[v];if(sbgi[0]!=sbgi[1])o.backgroundImage=sbgi[v]?"url("+sbgi[v]+")":"none";o.backgroundRepeat=sbgr[v];}if(!p.scid)p.scid=setTimeout("stscit(st_ms["+p.mei+"].ps["+p.ppi+"]);",10);}
+function stscit(p){var d=p.scpx;p.scid=0;with(stgme(p).mscm[p.pver])if(d){var sp=stgobj(p.ids+"SP"),sn=stgobj(p.ids+"SN"),sc=stgobj(p.ids+"SC"),st=p.pver?sc.scrollTop:sc.scrollLeft,mx=p.pver?sc.scrollHeight-sc.offsetHeight:sc.scrollWidth-sc.offsetWidth;if(st==0&&d<0||st==mx&&d>0)return;if(st==(d>0?0:mx))(d>0?sp:sn).rows[0].cells[0].childNodes[0].src=simg[d>0?0:1][1];st+=d;if(d>0?(st>=mx):(st<=0)){(d>0?sn:sp).rows[0].cells[0].childNodes[0].src=simg[d>0?1:0][0];st=d>0?mx:0;}else p.scid=setTimeout("stscit(st_ms["+p.mei+"].ps["+p.ppi+"]);",10);p.pver?(sc.scrollTop=st):(sc.scrollLeft=st);}}
+function stgsc(x,y,p){var sc=stgobj(p.ids+"SC"),ms=p.pver?stgct()+stgch()-y-stgspc(p,1):stgcl()+stgcw()-x-stgspc(p,3);return (p.pver?sc.scrollHeight:sc.scrollWidth)+2*p.ipbw>ms?ms:0;}
+function stssc(s,p){if(s>=0){if(typeof(p.scid)=="undefined")p.scid=0,p.scsu=0,p.scsd=1;var l=stglay(p),sp=stgobj(p.ids+"SP"),sn=stgobj(p.ids+"SN"),sc=stgobj(p.ids+"SC");(p.pver?sp.parentNode:sp).parentNode.style.display=(p.pver?sn.parentNode:sn).parentNode.style.display=s?'':'none';sc.style.overflow=s?"hidden":"";if(s)s=Math.max(s-(p.pver?sp.offsetHeight+sn.offsetHeight:sp.offsetWidth+sn.offsetWidth)-2*p.ipbw-2*p.psds-4*p.pspc,1);if((p.pver?sc.style.height:sc.style.width)==(s?s+'px':''))	return;p.pver?(sc.style.height=s?s+'px':''):(sc.style.width=s?s+'px':'');with(stgme(p).mscm[p.pver])if(s){sp.rows[0].cells[0].childNodes[0].src=simg[0][(p.pver?sc.scrollTop:sc.scrollLeft)?1:0];sn.rows[0].cells[0].childNodes[0].src=simg[1][(p.pver?sc.scrollTop!=sc.scrollHeight-sc.offsetHeight:sc.scrollLeft!=sc.scrollWidth-sc.offsetWidth)?1:0];}}}
+function stwels(c,p){var m=stgme(p);if(!st_load||nNN4||nOP||p.isst)	return;if(m.mhds&&!nIEM)	stwtag("SELECT",c,p);if(m.mhdo&&(nIE4||navigator.appVersion.indexOf("Safari")>=0))	{stwtag("OBJECT",c,p);if(nIE4)stwtag("APPLET",c,p);}if(m.mhdi&&(nIEM||nIEW&&nVER<5.5))	stwtag("IFRAME",c,p);}
+function stwtag(tg,c,p){var es=nIE?document.all.tags(tg):document.getElementsByTagName(tg);for(var j=0;j<es.length;++j){var f=0,e=es.item(j);for(var t=e.offsetParent;t;t=t.offsetParent)if(t.id&&t.id.indexOf("Stm")>=0)f=1;if(f)continue;else if(stwover(e,p)){if(e.visLevel)e.visLevel+=c;else e.visLevel=c;if(e.visLevel==-1){if(typeof(e.visSave)=="undefined")e.visSave=e.style.visibility;e.style.visibility="hidden";if(typeof(mywehd)!='undefined'&&mywehd(e))return;}else if(!e.visLevel){if(typeof(mywesh)!='undefined'&&mywesh(e))return;e.style.visibility=e.visSave;}}}}
+function stwover(e,p){var l=0,t=0,w=e.offsetWidth,h=e.offsetHeight;w?(e._wd=w):(w=e._wd);h?(e._ht=h):(h=e._ht);while(e)l+=e.offsetLeft,t+=e.offsetTop,e=e.offsetParent;return l<p.rc[2]+p.rc[0]&&l+w>p.rc[0]&&t<p.rc[3]+p.rc[1]&&t+h>p.rc[1];}
+function sthili(m,i){with(m)if(i.ityp!=6&&stcurl(i,midn&0x02000000)){if(midn&0x01000000)i.iurl="";do{if(midn&2)i.itxc[0]=i.itxc[1];if(midn&4){i.itxf[0]=i.itxf[1];i.itxd[0]=i.itxd[1];}if(midn&8)i.ibgc[0]=i.ibgc[1];if(midn&16){i.ibgi[0]=i.ibgi[1];i.ibgr[0]=i.ibgr[1];}if(midn&32)i.ibdc[0]=i.ibdc[1];if(midn&64)i.iicn[0]=i.iicn[1];if(midn&128)i.iimg[0]=i.iimg[1];if(midn&256)i.iarr[0]=i.iarr[1];i=stgpar(i).par;}while(i&&(midn&0x04000000));}}
+function stcurl(i,c){var t=stgtgt(i);var u=t?t.location.href:"",h=i.iurl;if(!c){u=u.toLowerCase();h=h.toLowerCase();}if(u&&h){if(!h.indexOf("file:////"))h=h.replace(/[\/]{4,}/,"//");else if(h.charAt(0)=="/"){var re=/(file:\/{2,}[^\/]+\/|http:\/\/[^\/]+\/|https:\/\/[^\/]+\/)/;re.exec(u);var s=RegExp.$1,n,r;r=s&&!u.indexOf(s)?s.substr(0,s.length-1):"";h=r?r+h:"";}else if(!stabs(h)){h=u.substr(0,u.lastIndexOf("/")+1)+h;}}while(h.indexOf("/./")>0)h=h.replace(/\/\.\//,"/");while(h.indexOf("/../")>0)h=h.replace(/[^\/]*\/\.\.\//,"");return u&&h&&(u==h||u==h+"/"||stILNK&&u==h.substr(0,Math.max(0,h.indexOf("?")))||stILOC&&h==u.substr(0,Math.max(0,u.indexOf("?"))));}
Index: /proiecte/swift/trunk/lib/hoard-371/doc/heaplayers-article-cuj_files/topics.css
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/doc/heaplayers-article-cuj_files/topics.css	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/doc/heaplayers-article-cuj_files/topics.css	(revision 176)
@@ -0,0 +1,18 @@
+H1 {
+	FONT-WEIGHT: bold; FONT-SIZE: large; LINE-HEIGHT: normal; FONT-STYLE: normal; FONT-VARIANT: normal
+}
+H2 {
+	FONT-WEIGHT: bold; FONT-SIZE: medium; LINE-HEIGHT: normal; FONT-STYLE: normal; FONT-VARIANT: normal
+}
+H3 {
+	FONT-WEIGHT: bold; FONT-SIZE: small; LINE-HEIGHT: normal; FONT-STYLE: normal; FONT-VARIANT: normal
+}
+H4 {
+	FONT-WEIGHT: bold; FONT-SIZE: x-small; LINE-HEIGHT: normal; FONT-STYLE: normal; FONT-VARIANT: normal
+}
+H5 {
+	FONT-WEIGHT: bold; FONT-SIZE: xx-small; LINE-HEIGHT: normal; FONT-STYLE: normal; FONT-VARIANT: normal
+}
+.header {
+	COLOR: #cc6600
+}
Index: /proiecte/swift/trunk/lib/hoard-371/doc/hoard-documentation.xml
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/doc/hoard-documentation.xml	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/doc/hoard-documentation.xml	(revision 176)
@@ -0,0 +1,534 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.0//EN"  "http://www.oasis-open.org/docbook/xml/4.0/docbookx.dtd">
+
+<article>
+  <title>The Hoard Memory Allocator</title>
+
+  <articleinfo>
+    <author>
+  	<firstname>Emery</firstname>
+  	<surname>Berger</surname>
+  	<affiliation>University of Massachusetts Amherst</affiliation>
+  	<street>Department of Computer Science</street>
+  	<city>Amherst</city>
+  	<state>Massachusetts</state>
+	<country>USA</country>
+	<email>emery@cs.umass.edu</email>
+    </author>
+    <pubdate>2004-12-08</pubdate>
+    <revhistory>
+      <revision>
+        <revnumber>1.1</revnumber>
+        <date>2004-12-08</date>
+        <authorinitials>EDB</authorinitials>
+        <revremark>Improved formatting</revremark>
+      </revision>
+      <revision>
+        <revnumber>1.0</revnumber>
+        <date>2004-12-06</date>
+        <authorinitials>EDB</authorinitials>
+        <revremark>First draft</revremark>
+      </revision>
+    </revhistory>
+    <copyright>
+	<year>2004</year>
+	<holder role="mailto:emery@cs.umass.edu">Emery Berger</holder>
+    </copyright>
+    <abstract>
+       Documentation for the Hoard scalable memory allocator, including build and usage directions for several platforms.
+    </abstract>
+  </articleinfo>
+
+<!--
+  add mailing list and website info.
+  proper web links
+  big line between sections
+
+-->
+
+  <blockquote>
+   <para>
+   <emphasis role="strong">hoard:</emphasis>
+To amass and put away (anything valuable) for preservation, security,
+or future use; to treasure up: esp. money or wealth.
+   </para>
+   <para><emphasis>Oxford English Dictionary</emphasis>
+   </para>
+  </blockquote>
+
+<sect1 id="intro">
+  <title>Introduction</title>
+  <para>
+The Hoard memory allocator is a fast, scalable, and memory-efficient
+memory allocator for shared-memory multiprocessors. It runs on a
+variety of platforms, including Linux, Solaris, and Windows.
+  </para>
+  <sect2>
+     <title>Why Hoard?</title>
+     <sect3>
+        <title>Contention</title>
+        <para>
+Multithreaded programs often do not scale because the heap is a
+bottleneck. When multiple threads simultaneously allocate or
+deallocate memory from the allocator, the allocator will serialize
+them. Programs making intensive use of the allocator actually slow
+down as the number of processors increases. Your program may be
+allocation-intensive without you realizing it, for instance, if your
+program makes many calls to the C++ Standard Template Library (STL).
+        </para>
+     </sect3>
+     <sect3>
+     <title>False Sharing</title>
+     <para>
+The allocator can cause other problems for multithreaded code. It can
+lead to <emphasis>false sharing</emphasis> in your application:
+threads on different CPUs can end up with memory in the same cache
+line, or chunk of memory. Accessing these falsely-shared cache lines
+is hundreds of times slower than accessing unshared cache lines.
+     </para>
+  </sect3>
+  <sect3>
+  <title>Blowup</title>
+  <para>
+Multithreaded programs can also lead the allocator to blowup memory
+consumption. This effect can multiply the amount of memory needed to
+run your application by the number of CPUs on your machine: four CPUs
+could mean that you need four times as much memory. Hoard is a fast
+allocator that solves all of these problems.
+  </para>
+  </sect3>
+  </sect2>
+
+  <sect2>
+  <title>How Do I Use Hoard?</title>
+  <para>
+Hoard is a drop-in replacement for malloc(), etc. In general, you just
+link it in or set just one environment variable. You do not have to
+change your source code in any way. See the section "Windows Builds"
+below for more information for particular platforms.
+  </para>
+  </sect2>
+
+  <sect2>
+  <title>Who's Using Hoard?</title>
+  <para>
+Companies using Hoard in their products and servers include <ulink
+url="http://www.aol.com">AOL</ulink>, <ulink
+url="http://www.bt.com">British Telecom</ulink>, <ulink
+url="http://www.businessobjects.com">Business Objects</ulink>
+(formerly Crystal Decisions), <ulink
+url="http://www.entrust.com">Entrust</ulink>, <ulink
+url="http://www.novell.com">Novell</ulink>, <ulink
+url="http://www.openwave.com">OpenWave Systems</ulink> (for their
+Typhoon and Twister servers), and <ulink
+url="http://www.reuters.com">Reuters</ulink>.
+</para>
+
+<para>
+Open source projects using Hoard include the Bayonne GNU telephony
+server, the <ulink
+url="http://supertech.lcs.mit.edu/cilk/">Cilk</ulink> parallel
+programming language, the <ulink
+url="http://www.cs.dartmouth.edu/research/DaSSF/index.html">Dartmouth
+Scalable Simulation Framework</ulink>, and the <ulink
+url="http://www.gnu.org/software/commoncpp/">GNU Common C++</ulink>
+system.
+  </para>
+  </sect2>
+</sect1>
+
+<sect1 id="Building Hoard">
+<title>Building Hoard</title>
+<para>
+You can use the available pre-built binaries or build Hoard
+yourself. Hoard is written to work on Windows and any variant of UNIX
+that supports threads, and should compile out of the box. Rather than
+using Makefiles or configure scripts, Hoard includes custom scripts
+that all start with the prefix compile.
+</para>
+
+<sect2>
+  <title>Platform-specific directions</title>
+  <sect2>
+    <title>Linux and Solaris Builds</title>
+<para>
+You can compile Hoard out of the box for Linux and Solaris using the
+GNU compilers (g++) just by running the <filename>compile</filename>
+script:
+ 
+<programlisting>
+./compile
+</programlisting>
+
+</para>
+  </sect2>
+  <sect2>
+  <title>Windows Builds</title>
+  <para>
+There are now three alternative ways of using Hoard with Windows.
+
+<itemizedlist>
+
+<listitem>
+<para>
+The first approach builds a DLL, <filename>libhoard.dll</filename> and
+its associated library <filename>libhoard.lib</filename>.
+
+<programlisting>
+.\compile-dll
+</programlisting>
+</para>
+</listitem>
+
+<listitem>
+<para>
+The second approach relies on Microsoft Research's <ulink
+url="http://research.microsoft.com/sn/detours">Detours</ulink>. With
+Detours, you can take advantage of Hoard without having to relink your
+applications. Install Detours into <filename
+class="directory">C:\detours</filename>, and then build the Hoard
+detours library:
+
+<programlisting>
+.\compile-detours 
+</programlisting>
+</para>
+</listitem>
+
+<listitem>
+<para>
+The third approach generates winhoard, which replaces malloc/new calls
+in your program <emphasis>and</emphasis> in any DLLs it might use.
+
+<programlisting>
+.\compile-winhoard
+</programlisting>
+  </para>
+  </listitem>
+  </itemizedlist>
+  </para>
+  </sect2>
+</sect2>
+</sect1>
+
+
+<sect1 id="Using Hoard">
+<title>Using Hoard</title>
+<sect2>
+  <title>UNIX</title>
+  <para>
+In UNIX, you can use the <envar>LD_PRELOAD</envar> variable to use
+Hoard instead of the system allocator for any program not linked with
+the "static option" (that's most programs). Below are settings for
+Linux and Solaris.
+  </para>
+  <sect3>
+    <title>Linux</title>
+    <para>
+    <programlisting>
+LD_PRELOAD="/path/libhoard.so:/usr/lib/libdl.so"
+    </programlisting>
+    </para>
+  </sect3>
+  <sect3>
+    <title>Solaris</title>
+    <para>
+    Depending on whether you are using the GNU-compiled version (as
+    produced by <filename>compile</filename>) or the Sun
+    Workshop-compiled versions (produced by
+    <filename>compile-sunw</filename>), your settings will be slightly
+    different.
+    </para>
+
+    <informaltable frame="none">
+      <tgroup cols="2">
+      <colspec colwidth="1in"/>
+        <thead>
+           <row>
+              <entry>Version</entry>
+              <entry>Setting</entry>
+           </row>
+        </thead>
+        <tbody>
+           <row valign="center">
+              <entry>GNU-compiled</entry>
+              <entry>
+                <programlisting>
+LD_PRELOAD="/path/libhoard.so:/usr/lib/libdl.so"
+                </programlisting>
+              </entry>
+           </row>
+           <row valign="center">
+              <entry>Sun-compiled (<emphasis>32-bits</emphasis>)</entry>
+              <entry>
+                 <programlisting>
+LD_PRELOAD="/path/libhoard_32.so"
+                  </programlisting>
+              </entry>
+           </row>
+           <row valign="center">
+              <entry>Sun-compiled (<emphasis>64-bits</emphasis>)</entry>
+              <entry>
+                 <programlisting>
+LD_PRELOAD="/path/libhoard_64.so:/usr/lib/64/libCrun.so.1:/usr/lib/64/libdl.so"
+                  </programlisting>
+              </entry>
+           </row>
+         </tbody>
+       </tgroup>
+     </informaltable>
+     <note>
+       <para>
+For some security-sensitive applications, Solaris requires you place
+libraries used in <envar>LD_PRELOAD</envar> into the <filename
+class="directory">/usr/lib/secure</filename> directory. In that event,
+after copying these libraries into <filename
+class="directory">/usr/lib/secure</filename>, set
+<envar>LD_PRELOAD</envar> by omitting the absolute locations of the libraries, as follows:
+       <programlisting>
+LD_PRELOAD="libhoard.so:libCrun.so.1:libdl.so"
+       </programlisting>
+       </para>
+     </note>
+
+  </sect3>
+</sect2>
+
+<sect2>
+  <title>Windows</title>
+  <para>
+  There are three ways to use Hoard on Windows.
+  </para>
+  <orderedlist>
+    <listitem>
+    Using Detours
+    <para>
+By using Detours, you can take advantage of Hoard's benefits without
+relinking your Windows application (as long as it is dynamically
+linked to the C runtime libraries). You will need to use one of the
+two included Detours tools (<filename>setdll.exe</filename> or
+<filename>withdll.exe</filename> in the <filename
+class="directory">detours/</filename> directory) in conjunction with
+this version of Hoard. To <emphasis>temporarily</emphasis> use Hoard
+as the allocator for a given application, use <filename>withdll</filename>:
+
+<programlisting>
+withdll -d:hoarddetours.dll myprogram.exe
+</programlisting>
+
+If you want your program to use Hoard without having to invoke
+<filename>withdll</filename> every time, you can use
+<filename>setdll</filename> to add it to your executable:
+
+<programlisting>
+setdll -d:hoarddetours.dll myprogram.exe myprogram.exe
+</programlisting>
+
+You can later remove Hoard from your executable as follows:
+
+<programlisting>
+setdll -r:hoarddetours.dll myprogram.exe
+</programlisting>
+    </para>
+  </listitem>
+  <listitem>
+    Using <filename>winhoard</filename>
+    <para>
+Another method is to use <filename>winhoard</filename>. Winhoard,
+like Detours, replaces malloc/new calls from your program and any DLLs
+it might use (leaving <filename>HeapAlloc</filename> calls
+intact). One advantage is that it does not require Detours to do this.
+
+To use the Winhoard version, link your executable with
+<filename>usewinhoard.obj</filename> and
+<filename>winhoard.lib</filename>, and then use
+<filename>winhoard.dll</filename>:
+
+<programlisting>
+cl /Ox /MD /c usewinhoard.cpp
+cl /Ox /MD myprogram.cpp usewinhoard.obj winhoard.lib
+</programlisting>
+
+    </para>
+  </listitem>
+  <listitem>
+    Using <filename>libhoard</filename>
+    <para>
+
+The last method is to link directly with the
+<filename>libhoard</filename> DLL. This approach is simple, but only
+suitable for small applications, since it will not affect malloc calls
+in any other DLL you might load. To use this option, you should put
+the following into your source code as the very first lines:
+
+<programlisting>
+#if defined(USE_HOARD)
+#pragma comment(lib, "libhoard.lib") 
+#endif 
+</programlisting>
+
+This stanza should be in the first part of a header file included by
+all of your code. It ensures that Hoard loads before any other library
+(you will need <filename>libhoard.lib</filename> in your path). When
+you execute your program, as long as <filename>libhoard.dll</filename>
+is in your path, your program will run with Hoard instead of the
+system allocator. Note that you must compile your program with the
+<filename>/MD</filename> flag, as in:
+
+<programlisting>
+cl /MD /G6 /Ox /DUSE_HOARD=1 myprogram.cpp 
+</programlisting>
+
+Hoard will not work if you use another switch (like
+<filename>/MT</filename>) to compile your program.
+    </para>
+  </listitem>
+  </orderedlist>
+</sect2>
+</sect1>
+
+
+<sect1 id="FAQs">
+  <title>Frequently Asked Questions</title>
+  <qandaset>
+
+  <qandaentry>
+  <question>
+  <para>What kind of applications will Hoard speed up?</para>
+  </question>
+  <answer>
+  <para>
+Hoard will always improve the performance of multithreaded programs
+running on multiprocessors that make frequent use of the heap (calls
+to malloc/free or new/delete, as well as many STL functions). Because
+Hoard avoids false sharing, Hoard also speeds up programs that only
+occasionally call heap functions but access these objects frequently.
+  </para>
+  </answer>
+  </qandaentry>
+
+  <qandaentry>
+    <question>
+      <para>I'm using the STL but not seeing any performance improvement. Why not?</para>
+    </question>
+    <answer>
+      <para>
+In order to benefit from Hoard, you have to tell STL to use malloc instead of its internal custom memory allocator, as in:
+
+<programlisting>
+typedef list&lt;unsigned int, malloc_alloc&gt; mylist;
+</programlisting>
+
+      </para>
+    </answer>
+  </qandaentry>
+
+
+  <qandaentry>
+    <question>
+      <para> Have you compared Hoard against mtmalloc or libumem?</para>
+    </question>
+    <answer>
+      <para>
+Yes. Hoard is much faster than either. For example, here's an
+execution of threadtest on Solaris:
+
+      <informaltable frame="none">
+        <tgroup cols="2">
+        <tbody>
+           <row>
+             <entry>Default:</entry>
+ 	     <entry>4.60 seconds</entry>
+           </row>
+           <row>
+             <entry>Libmtmalloc:</entry>
+ 	     <entry>6.23 seconds</entry>
+           </row>
+           <row>
+             <entry>Libumem:</entry>
+             <entry>5.47 seconds</entry>
+           </row>
+           <row>
+             <entry>Hoard 3.2:</entry>
+ 	     <entry>1.99 seconds</entry>
+           </row>
+         </tbody>
+       </tgroup>
+     </informaltable>
+     </para>
+    </answer>
+  </qandaentry>
+
+  <qandaentry>
+  <question>
+  <para>
+  What systems does Hoard work on?
+  </para>
+  </question>
+  <answer>
+  <para>
+Hoard has been successfully tested on numerous Windows, Linux and
+Solaris systems, including a 4-processor x86 box running Windows
+NT/2000, a 4-processor x86 box running RedHat Linux 6.0 and 6.1, and a
+16-processor Sun Enterprise server running Solaris.
+  </para>
+  </answer>
+  </qandaentry>
+
+  <qandaentry>
+  <question>
+  <para>
+  Have you compared Hoard with SmartHeap SMP?
+  </para>
+  </question>
+  <answer>
+  <para>
+We tried SmartHeap SMP but it did not work on our Suns (due to an
+apparent race condition in the code).
+  </para>
+  </answer>
+  </qandaentry>
+  </qandaset>
+</sect1>
+
+<sect1 id="More Info">
+<title>More Information</title>
+<para>
+The first place to look for Hoard-related information is at the Hoard
+web page, <ulink url="http://www.hoard.org">www.hoard.org</ulink>.
+</para>
+
+<para>
+There are two mailing lists you should consider being on if you are a
+user of Hoard. If you are just interested in being informed of new
+releases, join the <ulink
+url="http://groups.yahoo.com/group/hoard-announce/">Hoard-Announce</ulink>
+list. For general Hoard discussion, join the <ulink
+url="http://groups.yahoo.com/group/hoard/">Hoard</ulink> mailing
+list. You can also search the archives of these lists.
+</para>
+</sect1>
+
+<sect1 id="License Info">
+<title>License Information</title>
+
+<para>
+The use and distribution of Hoard is governed by the GNU General
+Public License as published by the <ulink
+url="http://www.fsf.org">Free Software Foundation</ulink>: see the
+included file <filename>COPYING</filename> for more details.
+</para>
+
+<para>
+Because of the restrictions imposed by this license, most commercial
+users of Hoard have purchased commercial licenses, which are arranged
+through the University of Texas at Austin. <ulink
+url="mailto:software@otc.utexas.edu">Contact Richard Friedman</ulink>
+at the Office of Technology Commercialization at The University of
+Texas at Austin for more information (phone: (512) 471-4738).
+</para>
+
+</sect1>
+
+</article>
Index: /proiecte/swift/trunk/lib/hoard-371/doc/index.html
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/doc/index.html	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/doc/index.html	(revision 176)
@@ -0,0 +1,320 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="Apache Forrest" name="Generator">
+<meta name="Forrest-version" content="0.6">
+<meta name="Forrest-skin-name" content="pelt">
+<title>The Hoard Multiprocessor Memory Allocator</title>
+<link type="text/css" href="skin/basic.css" rel="stylesheet">
+<link media="screen" type="text/css" href="skin/screen.css" rel="stylesheet">
+<link media="print" type="text/css" href="skin/print.css" rel="stylesheet">
+<link type="text/css" href="skin/profile.css" rel="stylesheet">
+<script src="skin/getBlank.js" language="javascript" type="text/javascript"></script><script src="skin/getMenu.js" language="javascript" type="text/javascript"></script><script src="skin/fontsize.js" language="javascript" type="text/javascript"></script>
+<link rel="shortcut icon" href="">
+</head>
+<body onload="init()">
+<script type="text/javascript">ndeSetTextSize();</script>
+<div id="top">
+<!--+
+    |header
+    +-->
+<div class="header">
+<!--+
+    |start group logo
+    +-->
+<div class="grouplogo">
+<a href="http://www.hoard.org"><img class="logoImage" alt="Hoard" src="images/hoard-logo.jpg" title="The Hoard Multiprocessor Memory Allocator"></a>
+</div>
+<!--+
+    |end group logo
+    +-->
+<!--+
+    |start Project Logo
+    +-->
+<div class="projectlogoA1">
+<a href=""></a>
+</div>
+<!--+
+    |end Project Logo
+    +-->
+<!--+
+    |start Tabs
+    +-->
+<ul id="tabs"></ul>
+<!--+
+    |end Tabs
+    +-->
+</div>
+</div>
+<div id="main">
+<div id="publishedStrip">
+<!--+
+    |start Subtabs
+    +-->
+<div id="level2tabs"></div>
+<!--+
+    |end Endtabs
+    +-->
+<script type="text/javascript" language="JavaScript"><!--
+              document.write("Published: " + document.lastModified);
+              //  --></script>
+</div>
+<!--+
+    |breadtrail
+    +-->
+<div class="breadtrail">
+             
+             &nbsp;
+           </div>
+<!--+
+    |start Menu, mainarea
+    +-->
+<!--+
+    |start Menu
+    +-->
+<div id="menu">
+<div onclick="SwitchMenu('menu_selected_1.1', 'skin/')" id="menu_selected_1.1Title" class="menutitle" style="background-image: url('skin/images/chapter_open.gif');">Table of Contents</div>
+<div id="menu_selected_1.1" class="selectedmenuitemgroup" style="display: block;">
+<div class="menupage">
+<div class="menupagetitle">Home</div>
+</div>
+<div class="menuitem">
+<a title="Download Hoard" href="download.html">Download</a>
+</div>
+<div class="menuitem">
+<a title="Screenshots" href="screenshot.html">Screenshots</a>
+</div>
+<div class="menuitem">
+<a title="How to Use Hoard" href="using.html">Using Hoard</a>
+</div>
+<div class="menuitem">
+<a title="How to Build Hoard" href="building.html">Building Hoard</a>
+</div>
+<div class="menuitem">
+<a title="FAQs" href="faqs.html">FAQs</a>
+</div>
+<div class="menuitem">
+<a title="License Info" href="licensing.html">Licensing Info</a>
+</div>
+</div>
+<div id="credit"></div>
+<div id="roundbottom">
+<img style="display: none" class="corner" height="15" width="15" alt="" src="skin/images/rc-b-l-15-1body-2menu-3menu.png"></div>
+<!--+
+  |alternative credits
+  +-->
+</div>
+<!--+
+    |end Menu
+    +-->
+<!--+
+    |start content
+    +-->
+<div id="content">
+<div id="skinconf-txtlink"></div>
+<h1>The Hoard Multiprocessor Memory Allocator</h1>
+<div id="minitoc-area">
+<ul class="minitoc">
+<li>
+<a href="#Why+Hoard%3F">Why Hoard?</a>
+<ul class="minitoc">
+<li>
+<a href="#Contention">Contention</a>
+</li>
+<li>
+<a href="#False+Sharing">False Sharing</a>
+</li>
+<li>
+<a href="#Blowup">Blowup</a>
+</li>
+</ul>
+</li>
+<li>
+<a href="#Press">Press</a>
+</li>
+<li>
+<a href="#Who%27s+Using+Hoard%3F">Who's Using Hoard?</a>
+</li>
+<li>
+<a href="#More+Information">More Information</a>
+</li>
+<li>
+<a href="#Technical+Information">Technical Information</a>
+</li>
+</ul>
+</div> 
+
+   
+<p class="quote">
+   ...if you'll be running on multiprocessor machines, ... <strong>use <a href="http://www.cs.umass.edu/~emery">Emery Berger</a>'s excellent Hoard multiprocessor memory management code</strong>. It's a drop-in replacement for the C and C++ memory routines and is very fast on multiprocessor machines.
+   <em><a href="http://www.nerdbooks.com/item.php?id=0735615365">Debugging Applications for Microsoft .NET and Microsoft Windows</a>, Microsoft Press, 2003</em>
+   
+</p>
+
+<!--
+   <p class="quote">
+   <strong>hoard:</strong>
+To amass and put away (anything valuable) for preservation, security,
+or future use; to treasure up: esp. money or wealth.
+   <em>Oxford English Dictionary</em>
+   </p>
+-->
+
+  
+<p>
+The Hoard memory allocator is a fast, scalable, and memory-efficient
+memory allocator for shared-memory multiprocessors. It runs on a
+variety of platforms, including Linux, Solaris, and Windows. Hoard is
+a drop-in replacement for malloc(), etc. No change to your source is
+necessary. Just link it in or set just one environment variable (see
+<a href="using.html">Using Hoard</a> for more
+information). <strong>Hoard can dramatically improve the performance
+of multithreaded programs running on multiprocessors.</strong>
+
+
+  
+</p>
+
+  
+<a name="N1002C"></a><a name="Why+Hoard%3F"></a>
+<h2 class="boxed">Why Hoard?</h2>
+<div class="section">
+<p>
+There are a number of problems with existing memory allocators that make Hoard a better choice.
+</p>
+<a name="N10035"></a><a name="Contention"></a>
+<h3 class="boxed">Contention</h3>
+<p>
+Multithreaded programs often do not scale because the heap is a
+bottleneck. When multiple threads simultaneously allocate or
+deallocate memory from the allocator, the allocator will serialize
+them. Programs making intensive use of the allocator actually slow
+down as the number of processors increases. Your program may be
+allocation-intensive without you realizing it, for instance, if your
+program makes many calls to the C++ Standard Template Library (STL).
+        </p>
+<a name="N1003F"></a><a name="False+Sharing"></a>
+<h3 class="boxed">False Sharing</h3>
+<p>
+The allocator can cause other problems for multithreaded code. It can
+lead to <em>false sharing</em> in your application:
+threads on different CPUs can end up with memory in the same cache
+line, or chunk of memory. Accessing these falsely-shared cache lines
+is hundreds of times slower than accessing unshared cache lines.
+     </p>
+<a name="N1004C"></a><a name="Blowup"></a>
+<h3 class="boxed">Blowup</h3>
+<p>
+Multithreaded programs can also lead the allocator to blowup memory
+consumption. This effect can multiply the amount of memory needed to
+run your application by the number of CPUs on your machine: four CPUs
+could mean that you need four times as much memory. Hoard is a fast
+allocator that solves all of these problems.
+  </p>
+</div>
+
+
+<a name="N10057"></a><a name="Press"></a>
+<h2 class="boxed">Press</h2>
+<div class="section">
+<p>
+
+<a href="http://www.intel.com/cd/ids/developer/asmo-na/eng/dc/xeon/43893.htm?page=4"><strong>Intel</strong> highlights the benefits of using Hoard</a> (a previous, slower version) on a 4-way Xeon system.
+</p>
+<p>
+
+<a href="http://developers.sun.com/solaris/articles/multiproc/multiproc.html"><strong>Sun</strong> concludes that Hoard is more space-efficient</a> than their own allocators.
+</p>
+</div>
+
+<!--
+  <section>
+  <title>How Do I Use Hoard?</title>
+  <p>
+Hoard is a drop-in replacement for malloc(), etc. No change to your source is necessary. Just link it in or set just one environment variable. See <a href="using.html">Using Hoard</a> for more information.
+  </p>
+  </section>
+-->
+
+
+  
+<a name="N10072"></a><a name="Who%27s+Using+Hoard%3F"></a>
+<h2 class="boxed">Who's Using Hoard?</h2>
+<div class="section">
+<p>
+Companies using Hoard in their products and servers include <a href="http://www.aol.com">AOL</a>, <a href="http://www.bt.com">British Telecom</a>, <a href="http://www.businessobjects.com">Business Objects</a>
+(formerly Crystal Decisions), <a href="http://www.entrust.com">Entrust</a>, <a href="http://www.novell.com">Novell</a>, <a href="http://www.openwave.com">OpenWave Systems</a> (for their
+Typhoon and Twister servers), and <a href="http://www.reuters.com">Reuters</a>.
+</p>
+<p>
+Open source projects using Hoard include the Bayonne GNU telephony
+server, the <a href="http://supertech.lcs.mit.edu/cilk/">Cilk</a> parallel
+programming language, the <a href="http://www.cs.dartmouth.edu/research/DaSSF/index.html">Dartmouth
+Scalable Simulation Framework</a>, and the <a href="http://www.gnu.org/software/commoncpp/">GNU Common C++</a>
+system.
+  </p>
+<p>
+Hoard is also a part of several major Linux distributions, including Debian and Novell's SuSe.
+</p>
+</div>
+
+
+
+<a name="N100AA"></a><a name="More+Information"></a>
+<h2 class="boxed">More Information</h2>
+<div class="section">
+<p>
+The first place to look for Hoard-related information is at the Hoard
+web page, <a href="http://www.hoard.org">www.hoard.org</a>.
+</p>
+<p>
+There are two mailing lists you should join if you are a
+user of Hoard. If you are just interested in being informed of new
+releases, join the <a href="http://groups.yahoo.com/group/hoard-announce/">Hoard-Announce</a>
+list. For general Hoard discussion, join the <a href="http://groups.yahoo.com/group/hoard/">Hoard</a> mailing
+list. You can also search the archives of these lists.
+</p>
+</div>
+
+
+
+<a name="N100C3"></a><a name="Technical+Information"></a>
+<h2 class="boxed">Technical Information</h2>
+<div class="section">
+<p>
+For technical details of a previous version of Hoard, read <a href="http://www.cs.umass.edu/~emery/hoard/asplos2000.pdf">Hoard: A Scalable Memory Allocator for Multithreaded Applications</a>, by Emery D. Berger, Kathryn S. McKinley, Robert D. Blumofe, and Paul R. Wilson. The Ninth International Conference on Architectural Support for Programming Languages and Operating Systems (ASPLOS-IX). Cambridge, MA, November 2000.
+</p>
+</div>
+
+  
+</div>
+<!--+
+    |end content
+    +-->
+<div class="clearboth">&nbsp;</div>
+</div>
+<div id="footer">
+<!--+
+    |start bottomstrip
+    +-->
+<div class="lastmodified">
+<script type="text/javascript"><!--
+document.write("Last Published: " + document.lastModified);
+//  --></script>
+</div>
+<div class="copyright">
+ Copyright &copy; 2005 Emery Berger.</div>
+<div id="logos">
+<a href="http://forrest.apache.org/"><img border="0" title="Built with Apache Forrest" alt="Built with Apache Forrest - logo" src="images/built-with-forrest-button.png" style="width: 88px;height: 31px;"></a>
+</div>
+<div id="feedback">
+    Send feedback about the website to:
+  <a id="feedbackto" href="mailto:emery@cs.umass.edu?subject=Feedback,index.html">emery@cs.umass.edu</a>
+</div>
+<!--+
+    |end bottomstrip
+    +-->
+</div>
+</body>
+</html>
Index: /proiecte/swift/trunk/lib/hoard-371/doc/licensing.html
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/doc/licensing.html	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/doc/licensing.html	(revision 176)
@@ -0,0 +1,208 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="Apache Forrest" name="Generator">
+<meta name="Forrest-version" content="0.6">
+<meta name="Forrest-skin-name" content="pelt">
+<title>
+Licensing Overview
+</title>
+<link type="text/css" href="skin/basic.css" rel="stylesheet">
+<link media="screen" type="text/css" href="skin/screen.css" rel="stylesheet">
+<link media="print" type="text/css" href="skin/print.css" rel="stylesheet">
+<link type="text/css" href="skin/profile.css" rel="stylesheet">
+<script src="skin/getBlank.js" language="javascript" type="text/javascript"></script><script src="skin/getMenu.js" language="javascript" type="text/javascript"></script><script src="skin/fontsize.js" language="javascript" type="text/javascript"></script>
+<link rel="shortcut icon" href="">
+</head>
+<body onload="init()">
+<script type="text/javascript">ndeSetTextSize();</script>
+<div id="top">
+<!--+
+    |header
+    +-->
+<div class="header">
+<!--+
+    |start group logo
+    +-->
+<div class="grouplogo">
+<a href="http://www.hoard.org"><img class="logoImage" alt="Hoard" src="images/hoard-logo.jpg" title="The Hoard Multiprocessor Memory Allocator"></a>
+</div>
+<!--+
+    |end group logo
+    +-->
+<!--+
+    |start Project Logo
+    +-->
+<div class="projectlogoA1">
+<a href=""></a>
+</div>
+<!--+
+    |end Project Logo
+    +-->
+<!--+
+    |start Tabs
+    +-->
+<ul id="tabs"></ul>
+<!--+
+    |end Tabs
+    +-->
+</div>
+</div>
+<div id="main">
+<div id="publishedStrip">
+<!--+
+    |start Subtabs
+    +-->
+<div id="level2tabs"></div>
+<!--+
+    |end Endtabs
+    +-->
+<script type="text/javascript" language="JavaScript"><!--
+              document.write("Published: " + document.lastModified);
+              //  --></script>
+</div>
+<!--+
+    |breadtrail
+    +-->
+<div class="breadtrail">
+             
+             &nbsp;
+           </div>
+<!--+
+    |start Menu, mainarea
+    +-->
+<!--+
+    |start Menu
+    +-->
+<div id="menu">
+<div onclick="SwitchMenu('menu_selected_1.1', 'skin/')" id="menu_selected_1.1Title" class="menutitle" style="background-image: url('skin/images/chapter_open.gif');">Table of Contents</div>
+<div id="menu_selected_1.1" class="selectedmenuitemgroup" style="display: block;">
+<div class="menuitem">
+<a title="Welcome to Hoard" href="index.html">Home</a>
+</div>
+<div class="menuitem">
+<a title="Download Hoard" href="download.html">Download</a>
+</div>
+<div class="menuitem">
+<a title="Screenshots" href="screenshot.html">Screenshots</a>
+</div>
+<div class="menuitem">
+<a title="How to Use Hoard" href="using.html">Using Hoard</a>
+</div>
+<div class="menuitem">
+<a title="How to Build Hoard" href="building.html">Building Hoard</a>
+</div>
+<div class="menuitem">
+<a title="FAQs" href="faqs.html">FAQs</a>
+</div>
+<div class="menupage">
+<div class="menupagetitle">Licensing Info</div>
+</div>
+</div>
+<div id="credit"></div>
+<div id="roundbottom">
+<img style="display: none" class="corner" height="15" width="15" alt="" src="skin/images/rc-b-l-15-1body-2menu-3menu.png"></div>
+<!--+
+  |alternative credits
+  +-->
+</div>
+<!--+
+    |end Menu
+    +-->
+<!--+
+    |start content
+    +-->
+<div id="content">
+<div id="skinconf-txtlink"></div>
+<h1>
+Licensing Overview
+</h1>
+<div id="minitoc-area">
+<ul class="minitoc">
+<li>
+<a href="#%0AGNU+General+Public+License%0A">
+GNU General Public License
+</a>
+</li>
+<li>
+<a href="#%0ACommercial+Licenses%0A">
+Commercial Licenses
+</a>
+</li>
+</ul>
+</div>
+
+
+<a name="N1000C"></a><a name="%0AGNU+General+Public+License%0A"></a>
+<h2 class="boxed">
+GNU General Public License
+</h2>
+<div class="section">
+<p>
+The use and distribution of Hoard is governed by the <a href="http://www.gnu.org/copyleft/gpl.html">GNU General
+Public License</a> as published by the <a href="http://www.fsf.org">Free Software Foundation</a>.
+</p>
+</div>
+
+
+<a name="N1001E"></a><a name="%0ACommercial+Licenses%0A"></a>
+<h2 class="boxed">
+Commercial Licenses
+</h2>
+<div class="section">
+<p>
+Because of the restrictions imposed by this license (you must make
+your code open-source), commercial users of Hoard can purchase
+licenses through the University of Texas at Austin. For detailed
+information on licenses, please contact <a href="mailto:software.at.otc.utexas.edu">Richard Friedman</a> or myself, <a href="mailto:emery.at.cs.umass.edu">Emery Berger</a>.
+</p>
+<p>
+Richard Friedman's contact information follows:
+</p>
+<p>
+
+<a href="mailto:software.at.otc.utexas.edu">Richard Friedman</a>
+<br>
+  The University of Texas at Austin
+<br>  Office of Technology Commercialization
+<br>  MCC Building, Suite 1.9A
+<br>  3925 West Braker Lane
+<br>  Austin, Texas 78759
+<br>  (512) 471-4738
+<br>  (512) 475-6894 (FAX)
+</p>
+<p>
+
+A sample software license can be found <a href="http://www.otc.utexas.edu/otc/New/Forms/SLAShortForm_18Jan2006.doc">here</a>, along with <a href="http://www.otc.utexas.edu/otc/New/Forms/ExhibitA-SLATermsAndConditions_18Jan2006.pdf">terms and conditions</a>.
+
+</p>
+</div>
+
+</div>
+<!--+
+    |end content
+    +-->
+<div class="clearboth">&nbsp;</div>
+</div>
+<div id="footer">
+<!--+
+    |start bottomstrip
+    +-->
+<div class="lastmodified">
+<script type="text/javascript"><!--
+document.write("Last Published: " + document.lastModified);
+//  --></script>
+</div>
+<div class="copyright">
+ Copyright &copy; 2005 Emery Berger.</div>
+<div id="feedback">
+    Send feedback about the website to:
+  <a id="feedbackto" href="mailto:emery@cs.umass.edu?subject=Feedback,licensing.html">emery@cs.umass.edu</a>
+</div>
+<!--+
+    |end bottomstrip
+    +-->
+</div>
+</body>
+</html>
Index: /proiecte/swift/trunk/lib/hoard-371/doc/screenshot.html
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/doc/screenshot.html	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/doc/screenshot.html	(revision 176)
@@ -0,0 +1,243 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="Apache Forrest" name="Generator">
+<meta name="Forrest-version" content="0.6">
+<meta name="Forrest-skin-name" content="pelt">
+<title>Screenshots</title>
+<link type="text/css" href="skin/basic.css" rel="stylesheet">
+<link media="screen" type="text/css" href="skin/screen.css" rel="stylesheet">
+<link media="print" type="text/css" href="skin/print.css" rel="stylesheet">
+<link type="text/css" href="skin/profile.css" rel="stylesheet">
+<script src="skin/getBlank.js" language="javascript" type="text/javascript"></script><script src="skin/getMenu.js" language="javascript" type="text/javascript"></script><script src="skin/fontsize.js" language="javascript" type="text/javascript"></script>
+<link rel="shortcut icon" href="">
+</head>
+<body onload="init()">
+<script type="text/javascript">ndeSetTextSize();</script>
+<div id="top">
+<!--+
+    |header
+    +-->
+<div class="header">
+<!--+
+    |start group logo
+    +-->
+<div class="grouplogo">
+<a href="http://www.hoard.org"><img class="logoImage" alt="Hoard" src="images/hoard-logo.jpg" title="The Hoard Multiprocessor Memory Allocator"></a>
+</div>
+<!--+
+    |end group logo
+    +-->
+<!--+
+    |start Project Logo
+    +-->
+<div class="projectlogoA1">
+<a href=""></a>
+</div>
+<!--+
+    |end Project Logo
+    +-->
+<!--+
+    |start Tabs
+    +-->
+<ul id="tabs"></ul>
+<!--+
+    |end Tabs
+    +-->
+</div>
+</div>
+<div id="main">
+<div id="publishedStrip">
+<!--+
+    |start Subtabs
+    +-->
+<div id="level2tabs"></div>
+<!--+
+    |end Endtabs
+    +-->
+<script type="text/javascript" language="JavaScript"><!--
+              document.write("Published: " + document.lastModified);
+              //  --></script>
+</div>
+<!--+
+    |breadtrail
+    +-->
+<div class="breadtrail">
+             
+             &nbsp;
+           </div>
+<!--+
+    |start Menu, mainarea
+    +-->
+<!--+
+    |start Menu
+    +-->
+<div id="menu">
+<div onclick="SwitchMenu('menu_selected_1.1', 'skin/')" id="menu_selected_1.1Title" class="menutitle" style="background-image: url('skin/images/chapter_open.gif');">Table of Contents</div>
+<div id="menu_selected_1.1" class="selectedmenuitemgroup" style="display: block;">
+<div class="menuitem">
+<a title="Welcome to Hoard" href="index.html">Home</a>
+</div>
+<div class="menuitem">
+<a title="Download Hoard" href="download.html">Download</a>
+</div>
+<div class="menupage">
+<div class="menupagetitle">Screenshots</div>
+</div>
+<div class="menuitem">
+<a title="How to Use Hoard" href="using.html">Using Hoard</a>
+</div>
+<div class="menuitem">
+<a title="How to Build Hoard" href="building.html">Building Hoard</a>
+</div>
+<div class="menuitem">
+<a title="FAQs" href="faqs.html">FAQs</a>
+</div>
+<div class="menuitem">
+<a title="License Info" href="licensing.html">Licensing Info</a>
+</div>
+</div>
+<div id="credit"></div>
+<div id="roundbottom">
+<img style="display: none" class="corner" height="15" width="15" alt="" src="skin/images/rc-b-l-15-1body-2menu-3menu.png"></div>
+<!--+
+  |alternative credits
+  +-->
+</div>
+<!--+
+    |end Menu
+    +-->
+<!--+
+    |start content
+    +-->
+<div id="content">
+<div id="skinconf-txtlink"></div>
+<h1>Screenshots</h1>
+
+  
+<p>
+  Because Hoard is a transparent plug-in replacement, ordinary
+  screenshots don't make much sense, since the applications look and
+  work the same! However, it's easy to visualize Hoard's impact on
+  application performance. Here are a few example speedup
+  graphs. Ideally, the speedup as the number of processors increases
+  is a straight diagonal line going from the lower left of each graph
+  to the upper right. These benchmarks compare Hoard to Ptmalloc (the
+  Linux allocator), mtmalloc version 8, and the Solaris default
+  allocator, and are run on a 14-processor Sun.
+</p>
+
+  
+<table class="ForrestTable" cellspacing="1" cellpadding="4">
+  
+<tr>
+    
+<td colspan="1" rowspan="1">
+    <!-- <center> -->
+    <img alt="Threadtest graph" src="images/plot-threadtest-speedup.gif">
+    <!-- </center> -->
+    </td>
+  
+</tr>
+  
+<tr>
+    
+<td colspan="1" rowspan="1">
+    <!-- <center> -->
+
+<p>
+    This benchmark has multiple threads, each allocating and freeing
+    objects. It stresses raw scalability of allocation in individual
+    threads. In this case, Hoard achieves a linear speedup. Ptmalloc
+    scales to four processors but then runs out of steam.
+</p>
+    <!-- </center> -->
+    
+</td>
+  
+</tr>
+  
+<tr>
+    
+<td colspan="1" rowspan="1">
+    <!-- <center> -->
+    <img alt="Larson graph" src="images/plot-larson-speedup.gif">
+    <!-- </center> -->
+    </td>
+  
+</tr>
+  
+<tr>
+    
+<td colspan="1" rowspan="1">
+    <!-- <center> -->
+
+<p>
+    In this benchmark, multiple threads allocate objects and pass some
+    objects to other threads that free them. This stresses the ability
+    of the memory manager to handle object sharing. Only Hoard scales
+    for this case.
+</p>
+    <!-- </center> -->
+    
+</td>
+  
+</tr>
+  
+<tr>
+    
+<td colspan="1" rowspan="1">
+    <!-- <center> -->
+    <img alt="Cache-scratch graph" src="images/plot-cache-scratch-speedup.gif">
+    <!-- </center> -->
+    </td>
+  
+</tr>
+  
+<tr>
+    
+<td colspan="1" rowspan="1">
+    <!-- <center> -->
+
+<p>
+    A test of whether a memory manager avoids causing false sharing of
+    cache lines (an insidious effect that destroys scalability). The
+    linear speedup shows that Hoard avoids false sharing completely.
+</p>
+    <!-- </center> -->
+    
+</td>
+  
+</tr>
+  
+</table>
+
+
+</div>
+<!--+
+    |end content
+    +-->
+<div class="clearboth">&nbsp;</div>
+</div>
+<div id="footer">
+<!--+
+    |start bottomstrip
+    +-->
+<div class="lastmodified">
+<script type="text/javascript"><!--
+document.write("Last Published: " + document.lastModified);
+//  --></script>
+</div>
+<div class="copyright">
+ Copyright &copy; 2005 Emery Berger.</div>
+<div id="feedback">
+    Send feedback about the website to:
+  <a id="feedbackto" href="mailto:emery@cs.umass.edu?subject=Feedback,screenshot.html">emery@cs.umass.edu</a>
+</div>
+<!--+
+    |end bottomstrip
+    +-->
+</div>
+</body>
+</html>
Index: /proiecte/swift/trunk/lib/hoard-371/doc/skin/basic.css
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/doc/skin/basic.css	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/doc/skin/basic.css	(revision 176)
@@ -0,0 +1,285 @@
+/*
+
+* Copyright 2002-2004 The Apache Software Foundation
+
+*
+
+* Licensed under the Apache License, Version 2.0 (the "License");
+
+* you may not use this file except in compliance with the License.
+
+* You may obtain a copy of the License at
+
+*
+
+*     http://www.apache.org/licenses/LICENSE-2.0
+
+*
+
+* Unless required by applicable law or agreed to in writing, software
+
+* distributed under the License is distributed on an "AS IS" BASIS,
+
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+
+* See the License for the specific language governing permissions and
+
+* limitations under the License.
+
+*/
+
+/**
+
+ * General
+
+ */
+
+
+
+img { border: 0; }
+
+
+
+#content table {
+
+  border: 0;
+
+  width: 100%;
+
+}
+
+#content th,
+
+#content td {
+
+  margin: 0;
+
+  padding: 0;
+
+  vertical-align: top;
+
+}
+
+
+
+.clearboth {
+
+  clear: both;
+
+}
+
+
+
+.frame {
+
+  border: solid black 1px;
+
+  margin: 1em 3em;
+
+}
+
+
+
+.frame .label {
+
+  background: #369;
+
+  color: white;
+
+  font-weight: bold;
+
+  padding: 5px 10px;
+
+}
+
+.frame .content {
+
+  padding: 5px 10px;
+
+  background: #F0F0FF;
+
+  color: black;
+
+  line-height: 120%;
+
+  font-size: 90%;
+
+}
+
+.warning .label {
+
+  background: #C00;
+
+  color: white;
+
+}
+
+.warning .content {
+
+  background: #FFF0F0;
+
+  color: black;
+
+}
+
+.fixme .label {
+
+  background: #C6C600;
+
+}
+
+
+
+/**
+
+ * Typography
+
+ */
+
+
+
+body {
+
+  font-family: verdana, "Trebuchet MS", arial, helvetica, sans-serif;
+
+  font-size: 100%;
+
+}
+
+
+
+#content {
+
+  font-family: Georgia, Palatino, Times, serif;
+
+  font-size: 95%;
+
+}
+
+#tabs {
+
+  font-size: 70%;
+
+}
+
+#menu {
+
+  font-size: 80%;
+
+}
+
+#footer {
+
+  font-size: 70%;
+
+}
+
+
+
+h1, h2, h3, h4, h5, h6 {
+
+  font-family: "Trebuchet MS", verdana, arial, helvetica, sans-serif;
+
+  font-weight: bold;
+
+  margin-top: 1em;
+
+  margin-bottom: .5em;
+
+}
+
+
+
+h1 {
+
+    margin-top: 0;
+
+    margin-bottom: 1em;
+
+  font-size: 1.4em;
+
+}
+
+#content h1 {
+
+  font-size: 160%;
+
+  margin-bottom: .5em;
+
+}
+
+#menu h1 {
+
+  margin: 0;
+
+  padding: 10px;
+
+  background: #336699;
+
+  color: white;
+
+}
+
+h2 { font-size: 120%; }
+
+h3 { font-size: 100%; }
+
+h4 { font-size: 90%; }
+
+h5 { font-size: 80%; }
+
+h6 { font-size: 75%; }
+
+
+
+p {
+
+  line-height: 120%;
+
+  text-align: left;
+
+  margin-top: .5em;
+
+  margin-bottom: 1em;
+
+}
+
+
+
+#content li,
+
+#content th,
+
+#content td {
+
+  line-height: 110%;  
+
+  margin-top: .1em;
+
+  margin-bottom: .1em;
+
+}
+
+
+
+#content .attribution {
+
+  text-align: right;
+
+  font-style: italic;
+
+  font-size: 85%;
+
+  margin-top: 1em;
+
+}
+
+
+
+.codefrag {
+
+  font-family: "Courier New", Courier, monospace;
+
+  font-size: 110%;
+
+}
Index: /proiecte/swift/trunk/lib/hoard-371/doc/skin/breadcrumbs-optimized.js
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/doc/skin/breadcrumbs-optimized.js	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/doc/skin/breadcrumbs-optimized.js	(revision 176)
@@ -0,0 +1,89 @@
+/*
+* Copyright 2002-2004 The Apache Software Foundation
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+var PREPREND_CRUMBS=new Array();
+var link1="@skinconfig.trail.link1.name@";
+var link2="@skinconfig.trail.link2.name@";
+var link3="@skinconfig.trail.link3.name@";
+if(!(link1=="")&&!link1.indexOf( "@" ) == 0){
+  PREPREND_CRUMBS.push( new Array( link1, @skinconfig.trail.link1.href@ ) ); }
+if(!(link2=="")&&!link2.indexOf( "@" ) == 0){
+  PREPREND_CRUMBS.push( new Array( link2, @skinconfig.trail.link2.href@ ) ); }
+if(!(link3=="")&&!link3.indexOf( "@" ) == 0){
+  PREPREND_CRUMBS.push( new Array( link3, @skinconfig.trail.link3.href@ ) ); }
+var DISPLAY_SEPARATOR=" &gt; ";
+var DISPLAY_PREPREND=" &gt; ";
+var DISPLAY_POSTPREND=":";
+var CSS_CLASS_CRUMB="breadcrumb";
+var CSS_CLASS_TRAIL="breadcrumbTrail";
+var CSS_CLASS_SEPARATOR="crumbSeparator";
+var FILE_EXTENSIONS=new Array( ".html", ".htm", ".jsp", ".php", ".php3", ".php4" );
+var PATH_SEPARATOR="/";
+
+function sc(s) {
+	var l=s.toLowerCase();
+	return l.substr(0,1).toUpperCase()+l.substr(1);
+}
+function getdirs() {
+	var t=document.location.pathname.split(PATH_SEPARATOR);
+	var lc=t[t.length-1];
+	for(var i=0;i < FILE_EXTENSIONS.length;i++)
+	{
+		if(lc.indexOf(FILE_EXTENSIONS[i]))
+			return t.slice(1,t.length-1); }
+	return t.slice(1,t.length);
+}
+function getcrumbs( d )
+{
+	var pre = "/";
+	var post = "/";
+	var c = new Array();
+	if( d != null )
+	{
+		for(var i=0;i < d.length;i++) {
+			pre+=d[i]+postfix;
+			c.push(new Array(d[i],pre)); }
+	}
+	if(PREPREND_CRUMBS.length > 0 )
+		return PREPREND_CRUMBS.concat( c );
+	return c;
+}
+function gettrail( c )
+{
+	var h=DISPLAY_PREPREND;
+	for(var i=0;i < c.length;i++)
+	{
+		h+='<a href="'+c[i][1]+'" >'+sc(c[i][0])+'</a>';
+		if(i!=(c.length-1))
+			h+=DISPLAY_SEPARATOR; }
+	return h+DISPLAY_POSTPREND;
+}
+
+function gettrailXHTML( c )
+{
+	var h='<span class="'+CSS_CLASS_TRAIL+'">'+DISPLAY_PREPREND;
+	for(var i=0;i < c.length;i++)
+	{
+		h+='<a href="'+c[i][1]+'" class="'+CSS_CLASS_CRUMB+'">'+sc(c[i][0])+'</a>';
+		if(i!=(c.length-1))
+			h+='<span class="'+CSS_CLASS_SEPARATOR+'">'+DISPLAY_SEPARATOR+'</span>'; }
+	return h+DISPLAY_POSTPREND+'</span>';
+}
+
+if(document.location.href.toLowerCase().indexOf("http://")==-1)
+	document.write(gettrail(getcrumbs()));
+else
+	document.write(gettrail(getcrumbs(getdirs())));
+
Index: /proiecte/swift/trunk/lib/hoard-371/doc/skin/breadcrumbs.js
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/doc/skin/breadcrumbs.js	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/doc/skin/breadcrumbs.js	(revision 176)
@@ -0,0 +1,236 @@
+/*
+* Copyright 2002-2004 The Apache Software Foundation
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+/**
+ * This script, when included in a html file, builds a neat breadcrumb trail
+ * based on its url. That is, if it doesn't contains bugs (I'm relatively
+ * sure it does).
+ *
+ * Typical usage:
+ * <script type="text/javascript" language="JavaScript" src="breadcrumbs.js"></script>
+ */
+
+/**
+ * IE 5 on Mac doesn't know Array.push.
+ *
+ * Implement it - courtesy to fritz.
+ */
+var abc	= new Array();
+if (!abc.push) {
+  Array.prototype.push	= function(what){this[this.length]=what}
+}
+
+/* ========================================================================
+	CONSTANTS
+   ======================================================================== */
+
+/**
+ * Two-dimensional array containing extra crumbs to place at the front of
+ * the trail. Specify first the name of the crumb, then the URI that belongs
+ * to it. You'll need to modify this for every domain or subdomain where
+ * you use this script (you can leave it as an empty array if you wish)
+ */
+var PREPREND_CRUMBS = new Array();
+
+var link1 = "@skinconfig.trail.link1.name@";
+var link2 = "@skinconfig.trail.link2.name@";
+var link3 = "@skinconfig.trail.link3.name@";
+
+var href1 = "@skinconfig.trail.link1.href@";
+var href2 = "@skinconfig.trail.link2.href@";
+var href3 = "@skinconfig.trail.link3.href@";
+
+   if(!(link1=="")&&!link1.indexOf( "@" ) == 0){
+     PREPREND_CRUMBS.push( new Array( link1, href1 ) );
+   }
+   if(!(link2=="")&&!link2.indexOf( "@" ) == 0){
+     PREPREND_CRUMBS.push( new Array( link2, href2 ) );
+   }
+   if(!(link3=="")&&!link3.indexOf( "@" ) == 0){
+     PREPREND_CRUMBS.push( new Array( link3, href3 ) );
+   }
+
+/**
+ * String to include between crumbs:
+ */
+var DISPLAY_SEPARATOR = " &gt; ";
+/**
+ * String to include at the beginning of the trail
+ */
+var DISPLAY_PREPREND = " &gt; ";
+/**
+ * String to include at the end of the trail
+ */
+var DISPLAY_POSTPREND = "";
+
+/**
+ * CSS Class to use for a single crumb:
+ */
+var CSS_CLASS_CRUMB = "breadcrumb";
+
+/**
+ * CSS Class to use for the complete trail:
+ */
+var CSS_CLASS_TRAIL = "breadcrumbTrail";
+
+/**
+ * CSS Class to use for crumb separator:
+ */
+var CSS_CLASS_SEPARATOR = "crumbSeparator";
+
+/**
+ * Array of strings containing common file extensions. We use this to
+ * determine what part of the url to ignore (if it contains one of the
+ * string specified here, we ignore it).
+ */
+var FILE_EXTENSIONS = new Array( ".html", ".htm", ".jsp", ".php", ".php3", ".php4" );
+
+/**
+ * String that separates parts of the breadcrumb trail from each other.
+ * When this is no longer a slash, I'm sure I'll be old and grey.
+ */
+var PATH_SEPARATOR = "/";
+
+/* ========================================================================
+	UTILITY FUNCTIONS
+   ======================================================================== */
+/**
+ * Capitalize first letter of the provided string and return the modified
+ * string.
+ */
+function sentenceCase( string )
+{        return string;
+	//var lower = string.toLowerCase();
+	//return lower.substr(0,1).toUpperCase() + lower.substr(1);
+}
+
+/**
+ * Returns an array containing the names of all the directories in the
+ * current document URL
+ */
+function getDirectoriesInURL()
+{
+	var trail = document.location.pathname.split( PATH_SEPARATOR );
+
+	// check whether last section is a file or a directory
+	var lastcrumb = trail[trail.length-1];
+	for( var i = 0; i < FILE_EXTENSIONS.length; i++ )
+	{
+		if( lastcrumb.indexOf( FILE_EXTENSIONS[i] ) )
+		{
+			// it is, remove it and send results
+			return trail.slice( 1, trail.length-1 );
+		}
+	}
+
+	// it's not; send the trail unmodified
+	return trail.slice( 1, trail.length );
+}
+
+/* ========================================================================
+	BREADCRUMB FUNCTIONALITY
+   ======================================================================== */
+/**
+ * Return a two-dimensional array describing the breadcrumbs based on the
+ * array of directories passed in.
+ */
+function getBreadcrumbs( dirs )
+{
+	var prefix = "/";
+	var postfix = "/";
+
+	// the array we will return
+	var crumbs = new Array();
+
+	if( dirs != null )
+	{
+		for( var i = 0; i < dirs.length; i++ )
+		{
+			prefix += dirs[i] + postfix;
+			crumbs.push( new Array( dirs[i], prefix ) );
+		}
+	}
+
+	// preprend the PREPREND_CRUMBS
+	if(PREPREND_CRUMBS.length > 0 )
+	{
+		return PREPREND_CRUMBS.concat( crumbs );
+	}
+
+	return crumbs;
+}
+
+/**
+ * Return a string containing a simple text breadcrumb trail based on the
+ * two-dimensional array passed in.
+ */
+function getCrumbTrail( crumbs )
+{
+	var xhtml = DISPLAY_PREPREND;
+
+	for( var i = 0; i < crumbs.length; i++ )
+	{
+		xhtml += '<a href="' + crumbs[i][1] + '" >';
+		xhtml += unescape( crumbs[i][0] ) + '</a>';
+		if( i != (crumbs.length-1) )
+		{
+			xhtml += DISPLAY_SEPARATOR;
+		}
+	}
+
+	xhtml += DISPLAY_POSTPREND;
+
+	return xhtml;
+}
+
+/**
+ * Return a string containing an XHTML breadcrumb trail based on the
+ * two-dimensional array passed in.
+ */
+function getCrumbTrailXHTML( crumbs )
+{
+	var xhtml = '<span class="' + CSS_CLASS_TRAIL  + '">';
+	xhtml += DISPLAY_PREPREND;
+
+	for( var i = 0; i < crumbs.length; i++ )
+	{
+		xhtml += '<a href="' + crumbs[i][1] + '" class="' + CSS_CLASS_CRUMB + '">';
+		xhtml += unescape( crumbs[i][0] ) + '</a>';
+		if( i != (crumbs.length-1) )
+		{
+			xhtml += '<span class="' + CSS_CLASS_SEPARATOR + '">' + DISPLAY_SEPARATOR + '</span>';
+		}
+	}
+
+	xhtml += DISPLAY_POSTPREND;
+	xhtml += '</span>';
+
+	return xhtml;
+}
+
+/* ========================================================================
+	PRINT BREADCRUMB TRAIL
+   ======================================================================== */
+
+// check if we're local; if so, only print the PREPREND_CRUMBS
+if( document.location.href.toLowerCase().indexOf( "http://" ) == -1 )
+{
+	document.write( getCrumbTrail( getBreadcrumbs() ) );
+}
+else
+{
+	document.write( getCrumbTrail( getBreadcrumbs( getDirectoriesInURL() ) ) );
+}
+
Index: /proiecte/swift/trunk/lib/hoard-371/doc/skin/fontsize.js
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/doc/skin/fontsize.js	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/doc/skin/fontsize.js	(revision 176)
@@ -0,0 +1,165 @@
+/*
+* Copyright 2002-2004 The Apache Software Foundation
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+function init() 
+{ //embedded in the doc
+  //ndeSetTextSize();
+}
+
+function checkBrowser(){
+  if (!document.getElementsByTagName){
+    return true;
+  }
+  else{
+    return false;
+  }
+}
+
+
+function ndeSetTextSize(chgsize,rs) 
+{
+  var startSize;
+  var newSize;
+
+  if (!checkBrowser)
+  {
+    return;
+  }
+
+  startSize = parseInt(ndeGetDocTextSize());
+
+  if (!startSize)
+  {
+    startSize = 16;
+  }
+
+  switch (chgsize)
+  {
+  case 'incr':
+    newSize = startSize + 2;
+    break;
+
+  case 'decr':
+    newSize = startSize - 2;
+    break;
+
+  case 'reset':
+    if (rs) {newSize = rs;} else {newSize = 16;}
+    break;
+
+  default:
+    try{
+      newSize = parseInt(ndeReadCookie("nde-textsize"));
+    }
+    catch(e){
+      alert(e);
+    }
+    
+    if (!newSize || newSize == 'NaN')
+    {
+      newSize = startSize;
+    }
+    break;
+
+  }
+
+  if (newSize < 10) 
+  {
+    newSize = 10;
+  }
+
+  newSize += 'px';
+
+  document.getElementsByTagName('html')[0].style.fontSize = newSize;
+  document.getElementsByTagName('body')[0].style.fontSize = newSize;
+
+  ndeCreateCookie("nde-textsize", newSize, 365);
+}
+
+function ndeGetDocTextSize() 
+{
+  if (!checkBrowser)
+  {
+    return 0;
+  }
+
+  var size = 0;
+  var body = document.getElementsByTagName('body')[0];
+
+  if (body.style && body.style.fontSize)
+  {
+    size = body.style.fontSize;
+  }
+  else if (typeof(getComputedStyle) != 'undefined')
+  {
+    size = getComputedStyle(body,'').getPropertyValue('font-size');
+  }
+  else if (body.currentStyle)
+  {
+   size = body.currentStyle.fontSize;
+  }
+
+  //fix IE bug
+  if( isNaN(size)){
+    if(size.substring(size.length-1)=="%"){
+      return
+    }
+
+  }
+
+  return size;
+
+}
+
+
+
+function ndeCreateCookie(name,value,days) 
+{
+  var cookie = name + "=" + value + ";";
+
+  if (days) 
+  {
+    var date = new Date();
+    date.setTime(date.getTime()+(days*24*60*60*1000));
+    cookie += " expires=" + date.toGMTString() + ";";
+  }
+  cookie += " path=/";
+
+  document.cookie = cookie;
+
+}
+
+function ndeReadCookie(name) 
+{
+  var nameEQ = name + "=";
+  var ca = document.cookie.split(';');
+
+ 
+  for(var i = 0; i < ca.length; i++) 
+  {
+    var c = ca[i];
+    while (c.charAt(0) == ' ') 
+    {
+      c = c.substring(1, c.length);
+    }
+
+    ctest = c.substring(0,name.length);
+ 
+    if(ctest == name){
+      return c.substring(nameEQ.length,c.length);
+    }
+  }
+  return null;
+}
Index: /proiecte/swift/trunk/lib/hoard-371/doc/skin/forrest.css.xslt
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/doc/skin/forrest.css.xslt	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/doc/skin/forrest.css.xslt	(revision 176)
@@ -0,0 +1,83 @@
+<?xml version="1.0"?>
+<!--
+  Copyright 2002-2004 The Apache Software Foundation
+
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+  <!-- This is not used by Forrest but makes it possible to debug the 
+       stylesheet in standalone editors -->
+  <xsl:output method = "text"  omit-xml-declaration="yes"  />
+
+<!--
+  If the skin doesn't override this, at least aural styles 
+  and extra-css are present 
+-->
+  <xsl:template match="skinconfig">
+
+   <xsl:call-template name="aural"/>
+   <xsl:call-template name="a-external"/>
+   <xsl:apply-templates/>
+  </xsl:template>
+
+  <xsl:template match="colors">
+   <xsl:apply-templates/>
+  </xsl:template>
+  
+  <xsl:template name="aural">
+
+/* ==================== aural ============================ */
+
+@media aural {
+  h1, h2, h3, h4, h5, h6 { voice-family: paul, male; stress: 20; richness: 90 }
+  h1 { pitch: x-low; pitch-range: 90 }
+  h2 { pitch: x-low; pitch-range: 80 }
+  h3 { pitch: low; pitch-range: 70 }
+  h4 { pitch: medium; pitch-range: 60 }
+  h5 { pitch: medium; pitch-range: 50 }
+  h6 { pitch: medium; pitch-range: 40 }
+  li, dt, dd { pitch: medium; richness: 60 }
+  dt { stress: 80 }
+  pre, code, tt { pitch: medium; pitch-range: 0; stress: 0; richness: 80 }
+  em { pitch: medium; pitch-range: 60; stress: 60; richness: 50 }
+  strong { pitch: medium; pitch-range: 60; stress: 90; richness: 90 }
+  dfn { pitch: high; pitch-range: 60; stress: 60 }
+  s, strike { richness: 0 }
+  i { pitch: medium; pitch-range: 60; stress: 60; richness: 50 }
+  b { pitch: medium; pitch-range: 60; stress: 90; richness: 90 }
+  u { richness: 0 }
+  
+  :link { voice-family: harry, male }
+  :visited { voice-family: betty, female }
+  :active { voice-family: betty, female; pitch-range: 80; pitch: x-high }
+}
+  </xsl:template>
+  
+  <xsl:template name="a-external">
+a.external  {
+  padding: 0 20px 0px 0px;
+	display:inline;
+  background-repeat: no-repeat;
+	background-position: center right;
+	background-image: url(images/external-link.gif);
+}
+  </xsl:template>
+  
+  <xsl:template match="extra-css">
+    <xsl:value-of select="."/>
+  </xsl:template>
+  
+  <xsl:template match="*"></xsl:template>
+  <xsl:template match="text()"></xsl:template>
+
+</xsl:stylesheet>
Index: /proiecte/swift/trunk/lib/hoard-371/doc/skin/getBlank.js
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/doc/skin/getBlank.js	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/doc/skin/getBlank.js	(revision 176)
@@ -0,0 +1,31 @@
+/*
+* Copyright 2002-2004 The Apache Software Foundation
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+/**
+ * This script, when included in a html file and called from a form text field, will set the value of this field to ""
+ * if the text value is still the standard value.
+ *
+ * Typical usage:
+ * <script type="text/javascript" language="JavaScript" src="getBlank.js"></script>
+ * <input type="text" id="query" value="Search the site:" onFocus="getBlank (this, 'Search the site:');"/>
+ */
+<!--
+function getBlank (form, stdValue){
+if (form.value == stdValue){
+	form.value = '';
+	}
+return true;
+}
+//-->
Index: /proiecte/swift/trunk/lib/hoard-371/doc/skin/getMenu.js
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/doc/skin/getMenu.js	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/doc/skin/getMenu.js	(revision 176)
@@ -0,0 +1,44 @@
+/*
+* Copyright 2002-2004 The Apache Software Foundation
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+/**
+ * This script, when included in a html file, can be used to make collapsible menus
+ *
+ * Typical usage:
+ * <script type="text/javascript" language="JavaScript" src="menu.js"></script>
+ */
+
+if (document.getElementById){ 
+  document.write('<style type="text/css">.menuitemgroup{display: none;}</style>')
+}
+
+
+function SwitchMenu(obj, thePath)
+{
+var open = 'url("'+thePath + 'images/chapter_open.gif")';
+var close = 'url("'+thePath + 'images/chapter.gif")';
+  if(document.getElementById)  {
+    var el = document.getElementById(obj);
+    var title = document.getElementById(obj+'Title');
+
+    if(el.style.display != "block"){ 
+      title.style.backgroundImage = open;
+      el.style.display = "block";
+    }else{
+      title.style.backgroundImage = close;
+      el.style.display = "none";
+    }
+  }// end -  if(document.getElementById) 
+}//end - function SwitchMenu(obj)
Index: /proiecte/swift/trunk/lib/hoard-371/doc/skin/images/README.txt
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/doc/skin/images/README.txt	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/doc/skin/images/README.txt	(revision 176)
@@ -0,0 +1,1 @@
+The images in this directory are used if the current skin lacks them.
Index: /proiecte/swift/trunk/lib/hoard-371/doc/skin/images/corner-imports.svg.xslt
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/doc/skin/images/corner-imports.svg.xslt	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/doc/skin/images/corner-imports.svg.xslt	(revision 176)
@@ -0,0 +1,95 @@
+<?xml version="1.0"?>
+<!--
+  Copyright 2002-2004 The Apache Software Foundation
+
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+
+    <xsl:param name="orientation-tb"/>
+    <xsl:param name="orientation-lr"/>
+    <xsl:param name="size"/>
+    <xsl:param name="bg-color-name"/>
+    <xsl:param name="stroke-color-name"/>
+    <xsl:param name="fg-color-name"/>    
+
+   <!-- if not all colors are present, don't even try to render the corners -->
+    <xsl:variable name="isize"><xsl:choose>
+    	<xsl:when test="$bg-color-name and $stroke-color-name and $fg-color-name"><xsl:value-of select="$size"/></xsl:when>
+    	<xsl:otherwise>0</xsl:otherwise>
+    </xsl:choose></xsl:variable>
+    <xsl:variable name="smallersize" select="number($isize)-1"/>
+    <xsl:variable name="biggersize" select="number($isize)+1"/>     
+    <xsl:variable name="bg"><xsl:if test="skinconfig/colors/color[@name=$bg-color-name]">fill:<xsl:value-of select="skinconfig/colors/color[@name=$bg-color-name]/@value"/>;</xsl:if></xsl:variable>
+    <xsl:variable name="fill"><xsl:if test="skinconfig/colors/color[@name=$stroke-color-name]">fill:<xsl:value-of select="skinconfig/colors/color[@name=$stroke-color-name]/@value"/>;</xsl:if></xsl:variable>
+    <xsl:variable name="stroke"><xsl:if test="skinconfig/colors/color[@name=$fg-color-name]">stroke:<xsl:value-of select="skinconfig/colors/color[@name=$fg-color-name]/@value"/>;</xsl:if></xsl:variable>
+        
+	<xsl:template match="skinconfig">
+
+        	
+
+<svg width="{$isize}" height="{$isize}">
+    <!-- background-->
+    <rect x="-1" y="-1" width="{$biggersize}" height="{$biggersize}" style="{$bg}stroke-width:0"/>
+<!-- 0,0 0,-4 4,0 4,-4-->
+
+    <xsl:variable name="flip-tb-scale">
+      <xsl:choose>
+    	<xsl:when test="$orientation-tb='t'">1</xsl:when>
+    	<xsl:otherwise>-1</xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
+
+    <xsl:variable name="flip-lr-scale">
+      <xsl:choose>
+    	<xsl:when test="$orientation-lr='l'">1</xsl:when>
+    	<xsl:otherwise>-1</xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
+    
+    <xsl:variable name="flip-tb-translate">
+      <xsl:choose>
+    	<xsl:when test="$orientation-tb='t'">0</xsl:when>
+    	<xsl:otherwise>-<xsl:value-of select="$isize" /></xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
+
+    <xsl:variable name="flip-lr-translate">
+      <xsl:choose>
+    	<xsl:when test="$orientation-lr='l'">0</xsl:when>
+    	<xsl:otherwise>-<xsl:value-of select="$isize" /></xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>    
+    
+    <!-- flip transform -->
+    <g transform="scale({$flip-lr-scale},{$flip-tb-scale}) translate({$flip-lr-translate}, {$flip-tb-translate})"> 
+      <xsl:call-template name="figure" />
+    </g>
+</svg>
+</xsl:template>
+
+        
+  <xsl:template name="figure">
+       <!-- Just change shape here -->     
+		<g transform="translate(0.5 0.5)">
+			<ellipse cx="{$smallersize}" cy="{$smallersize}" rx="{$smallersize}" ry="{$smallersize}"
+				 style="{$fill}{$stroke}stroke-width:1"/>
+		</g>
+	   <!-- end -->	
+  </xsl:template>
+    
+  
+  <xsl:template match="*"></xsl:template>
+  <xsl:template match="text()"></xsl:template>
+  
+</xsl:stylesheet>
Index: /proiecte/swift/trunk/lib/hoard-371/doc/skin/images/dc.svg.xslt
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/doc/skin/images/dc.svg.xslt	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/doc/skin/images/dc.svg.xslt	(revision 176)
@@ -0,0 +1,30 @@
+<?xml version="1.0"?>
+<!--
+  Copyright 2002-2004 The Apache Software Foundation
+
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+  <xsl:import href="corner-imports.svg.xslt" />
+  
+  <!-- Diagonal 45 degrees corner -->
+  <xsl:template name="figure">
+        <xsl:variable name="biggersize" select="number($size)+number($size)"/>     
+		<g transform="translate(0 0.5)">
+           <polygon points="0,{$size} {$size},0 {$biggersize},0 {$biggersize},{$biggersize} 0,{$biggersize}"
+                    style="{$fill}{$stroke}stroke-width:1"/>
+		</g>
+  </xsl:template>
+      
+</xsl:stylesheet>
+
Index: /proiecte/swift/trunk/lib/hoard-371/doc/skin/images/poddoc.svg.xslt
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/doc/skin/images/poddoc.svg.xslt	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/doc/skin/images/poddoc.svg.xslt	(revision 176)
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+  Copyright 2002-2004 The Apache Software Foundation
+
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<svg width="20pt" height="20pt"
+   xmlns="http://www.w3.org/2000/svg"
+   xmlns:xlink="http://www.w3.org/1999/xlink">
+  <defs
+     id="defs550">
+    <linearGradient id="gray2white">
+      <stop style="stop-color:#7f7f7f;stop-opacity:1;" offset="0.000000"/>
+      <stop style="stop-color:#ffffff;stop-opacity:1;" offset="1.000000"/>
+    </linearGradient>
+    <linearGradient id="pageshade" xlink:href="#gray2white"
+       x1="0.95" y1="0.95"
+       x2="0.40" y2="0.20"
+       gradientUnits="objectBoundingBox" spreadMethod="pad" />
+    <path d="M 0 0 L 200 0" style="stroke:#000000;stroke-width:1pt;" id="hr"/>
+  </defs>
+
+  <g transform="scale(0.08)">
+    <g transform="translate(40, 0)">
+      <rect width="230" height="300" x="0" y="0"
+            style="fill:url(#pageshade);fill-rule:evenodd;
+            stroke:#000000;stroke-width:1.25;"/>
+
+      <g transform="translate(15, 60)">
+        <use xlink:href="#hr" x="0" y="0"/>
+        <use xlink:href="#hr" x="0" y="60"/>
+        <use xlink:href="#hr" x="0" y="120"/>
+        <use xlink:href="#hr" x="0" y="180"/>
+      </g>
+    </g>
+
+    <g transform="translate(0,70),scale(1.1,1.6)">
+      <rect width="200" height="100" x="0" y="0"
+         style="fill:#ff0000;fill-rule:evenodd;
+                stroke:#000000;stroke-width:2.33903;"/>
+      <text x="20" y="75"
+            style="stroke:#ffffff;stroke-width:1.0;
+                   font-size:72;font-weight:normal;fill:#ffffff;
+                   font-family:Arial;text-anchor:start;">POD</text>
+    </g>
+  </g>
+</svg>
Index: /proiecte/swift/trunk/lib/hoard-371/doc/skin/images/rc.svg.xslt
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/doc/skin/images/rc.svg.xslt	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/doc/skin/images/rc.svg.xslt	(revision 176)
@@ -0,0 +1,29 @@
+<?xml version="1.0"?>
+<!--
+  Copyright 2002-2004 The Apache Software Foundation
+
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+  <xsl:import href="corner-imports.svg.xslt" />
+
+  <!-- Rounded corner -->
+  <xsl:template name="figure">
+		<g transform="translate(0.5 0.5)">
+			<ellipse cx="{$smallersize}" cy="{$smallersize}" rx="{$smallersize}" ry="{$smallersize}"
+				 style="{$fill}{$stroke}stroke-width:1"/>
+		</g>
+  </xsl:template>
+      
+</xsl:stylesheet>
+
Index: /proiecte/swift/trunk/lib/hoard-371/doc/skin/menu.js
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/doc/skin/menu.js	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/doc/skin/menu.js	(revision 176)
@@ -0,0 +1,49 @@
+/*
+* Copyright 2002-2004 The Apache Software Foundation
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+/**
+ * This script, when included in a html file, can be used to make collapsible menus
+ *
+ * Typical usage:
+ * <script type="text/javascript" language="JavaScript" src="menu.js"></script>
+ */
+
+if (document.getElementById){ 
+  document.write('<style type="text/css">.menuitemgroup{display: none;}</style>')
+}
+
+function SwitchMenu(obj)
+{
+  if(document.getElementById)  {
+    var el = document.getElementById(obj);
+    var title = document.getElementById(obj+'Title');
+
+    if(obj.indexOf("_selected_")==0&&el.style.display == ""){
+      //nicolaken: doesn't work :-(
+      //title.style.backgroundImage = "url('images/chapter_open.gif')";
+      el.style.display = "block";
+    }
+
+    if(el.style.display != "block"){ 
+      //nicolaken: doesn't work :-(
+      //title.style.backgroundImage = 'url([url]images/chapter_open.gif[/url])';
+      el.style.display = "block";
+    }else{
+      //nicolaken: doesn't work :-(
+      //title.style.backgroundImage = "url('images/chapter.gif')";
+      el.style.display = "none";
+    }
+  }// end -  if(document.getElementById) 
+}//end - function SwitchMenu(obj)
Index: /proiecte/swift/trunk/lib/hoard-371/doc/skin/note.txt
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/doc/skin/note.txt	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/doc/skin/note.txt	(revision 176)
@@ -0,0 +1,50 @@
+Notes for developer:
+
+--Legend-------------------
+TODO -> blocker
+DONE -> blocker
+ToDo -> enhancement bug
+done -> enhancement bug
+
+--Issues-------------------
+- the corner images should be rendered through svg with the header color.
+-> DONE 
+-> ToDo: get rid of the images and use only divs!
+
+- the menu points should be displayed "better". 
+-> DONE
+-- Use the krysalis-site menu approach for the overall menu display.
+-> DONE
+-- Use the old lenya innermenu approch to further enhance the menu .
+-> DONE
+
+- the content area needs some attention.
+-> DONE
+-- introduce the heading scheme from krysalis (<headings type="clean|box|underlined"/>)
+-> DONE 
+-> ToDo: make box with round corners
+-> done: make underlined with variable border height
+-> ToDo: make underline with bottom round corner
+-- introduce the toc for each html-page
+-> DONE
+-- introduce the external-link-images.
+-> DONE
+
+- the publish note should be where now only a border is. 
+Like <div id="published"/>
+-> DONE
+, but make it configurable.
+-> DONE
+- footer needs some attention
+-> DONE
+-- the footer do not have the color profile! Enable it!
+-> DONE
+-- the footer should as well contain a feedback link. 
+See http://issues.apache.org/eyebrowse/ReadMsg?listName=forrest-user@xml.apache.org&msgNo=71
+-> DONE
+
+- introduce credits alternativ location
+-> DONE
+
+- border for published / breadtrail / menu /tab divs 
+-> ToDo
Index: /proiecte/swift/trunk/lib/hoard-371/doc/skin/print.css
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/doc/skin/print.css	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/doc/skin/print.css	(revision 176)
@@ -0,0 +1,105 @@
+/*
+
+* Copyright 2002-2004 The Apache Software Foundation
+
+*
+
+* Licensed under the Apache License, Version 2.0 (the "License");
+
+* you may not use this file except in compliance with the License.
+
+* You may obtain a copy of the License at
+
+*
+
+*     http://www.apache.org/licenses/LICENSE-2.0
+
+*
+
+* Unless required by applicable law or agreed to in writing, software
+
+* distributed under the License is distributed on an "AS IS" BASIS,
+
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+
+* See the License for the specific language governing permissions and
+
+* limitations under the License.
+
+*/
+
+body {
+
+  font-family: Georgia, Palatino, serif;
+
+  font-size: 12pt;
+
+  background: white;
+
+}
+
+
+
+#tabs,
+
+#menu,
+
+#content .toc {
+
+  display: none;
+
+}
+
+
+
+#content {
+
+  width: auto;
+
+  padding: 0;
+
+  float: none !important;
+
+  color: black;
+
+  background: transparent;
+
+}
+
+
+
+a:link, a:visited {
+
+  color: #336699;
+
+  background: transparent;
+
+  text-decoration: underline;
+
+}
+
+
+
+#top .logo {
+
+  padding: 0;
+
+  margin: 0 0 2em 0;
+
+}
+
+
+
+#footer {
+
+  margin-top: 4em;
+
+}
+
+
+
+acronym {
+
+  border: 0;
+
+}
Index: /proiecte/swift/trunk/lib/hoard-371/doc/skin/profile.css
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/doc/skin/profile.css	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/doc/skin/profile.css	(revision 176)
@@ -0,0 +1,152 @@
+
+
+/* ==================== aural ============================ */
+
+@media aural {
+  h1, h2, h3, h4, h5, h6 { voice-family: paul, male; stress: 20; richness: 90 }
+  h1 { pitch: x-low; pitch-range: 90 }
+  h2 { pitch: x-low; pitch-range: 80 }
+  h3 { pitch: low; pitch-range: 70 }
+  h4 { pitch: medium; pitch-range: 60 }
+  h5 { pitch: medium; pitch-range: 50 }
+  h6 { pitch: medium; pitch-range: 40 }
+  li, dt, dd { pitch: medium; richness: 60 }
+  dt { stress: 80 }
+  pre, code, tt { pitch: medium; pitch-range: 0; stress: 0; richness: 80 }
+  em { pitch: medium; pitch-range: 60; stress: 60; richness: 50 }
+  strong { pitch: medium; pitch-range: 60; stress: 90; richness: 90 }
+  dfn { pitch: high; pitch-range: 60; stress: 60 }
+  s, strike { richness: 0 }
+  i { pitch: medium; pitch-range: 60; stress: 60; richness: 50 }
+  b { pitch: medium; pitch-range: 60; stress: 90; richness: 90 }
+  u { richness: 0 }
+  
+  :link { voice-family: harry, male }
+  :visited { voice-family: betty, female }
+  :active { voice-family: betty, female; pitch-range: 80; pitch: x-high }
+}
+  
+a.external  {
+  padding: 0 20px 0px 0px;
+	display:inline;
+  background-repeat: no-repeat;
+	background-position: center right;
+	background-image: url(images/external-link.gif);
+}
+  
+    
+    p.quote {
+      margin-left: 2em;
+      padding: .5em;
+      background-color: #f0f0f0;
+      font-family: Bookman Old Style; Palatino;
+    }
+  
+#top          { background-color: #FFFFFF;}  
+ 
+#top .header .current { background-color: #4C6C8F;} 
+#top .header .current a:link {  color: #ffffff;  }
+#top .header .current a:visited { color: #ffffff; }
+#top .header .current a:hover { color: #ffffff; }
+ 
+#tabs li      { background-color: #E5E4D9 ;} 
+#tabs li a:link {  color: #000000;  }
+#tabs li a:visited { color: #000000; }
+#tabs li a:hover { color: #000000; }
+
+#level2tabs       { background-color: #4C6C8F ;} 
+#level2tabs a:link {  color: #ffffff;  }
+#level2tabs a:visited { color: #ffffff; }
+#level2tabs a:hover { color: #ffffff; }
+
+.heading { background-color: #E5E4D9;} 
+
+.boxed { background-color: #E5E4D9;} 
+.underlined_5 	{border-bottom: solid 5px #E5E4D9;}
+.underlined_10 	{border-bottom: solid 10px #E5E4D9;}
+table caption { 
+background-color: #E5E4D9; 
+color: #000000;
+}
+    
+#feedback {
+color: #FFFFFF;
+background: #4C6C8F;
+text-align: center;
+}
+#feedback #feedbackto {
+color: #FFFFFF;
+}   
+
+#publishedStrip { 
+color: #FFFFFF;
+background: #4C6C8F; 
+}
+
+#publishedStrip { 
+color: #000000;
+background: #E5E4D9; 
+}
+
+#menu .menupagetitle  { background-color: #CFDCED}
+
+#menu           { border-color: #999999;}
+#menu .menupagetitle  { border-color: #999999;}
+#menu .menupageitemgroup  { border-color: #999999;}
+
+#menu      { background-color: #4C6C8F;} 
+#menu  {  color: #ffffff;} 
+#menu a:link {  color: #ffffff;} 
+#menu a:visited {  color: #ffffff;} 
+#menu a:hover {  
+background-color: #4C6C8F;
+color: #ffffff;} 
+
+#menu h1 {
+color: #000000;
+background-color: #cfdced;
+}   
+ 
+#top .searchbox { 
+background-color: #E5E4D9 ;
+color: #000000; 
+} 
+ 
+#menu .menupagetitle  { color: #000000;}    
+#menu .menupageitemgroup     { 
+background-color: #E5E4D9;
+}
+#menu .menupageitem {
+color: #000000;
+} 
+#menu .menupageitem a:link {  color: #000000;} 
+#menu .menupageitem a:visited {  color: #000000;} 
+#menu .menupageitem a:hover {  
+background-color: #E5E4D9;
+color: #000000;
+}
+
+body{ 
+background-color: #ffffff;
+color: #000000;
+} 
+a:link { color:#0000ff} 
+a:visited { color:#0000ff} 
+a:hover { color:#0000ff} 
+
+ 
+.ForrestTable      { background-color: #ccc;} 
+ 
+.ForrestTable td   { background-color: #ffffff;} 
+ 
+.highlight        { background-color: #ffff00;} 
+ 
+.fixme        { border-color: #c60;} 
+ 
+.note         { border-color: #069;} 
+ 
+.warning         { border-color: #900;} 
+ 
+.code         { border-color: #a5b6c6;} 
+ 
+#footer       { background-color: #E5E4D9;} 
Index: /proiecte/swift/trunk/lib/hoard-371/doc/skin/profile.css.xslt
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/doc/skin/profile.css.xslt	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/doc/skin/profile.css.xslt	(revision 176)
@@ -0,0 +1,207 @@
+<?xml version="1.0"?>
+<!--
+  Copyright 2002-2004 The Apache Software Foundation
+
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+
+  <xsl:import href="../../common/css/forrest.css.xslt"/>
+
+  <!-- This is not used by Forrest but makes it possible to debug the 
+       stylesheet in standalone editors -->
+  <xsl:output method = "text"  omit-xml-declaration="yes"  />
+  
+<!-- ==================== main block colors ============================ -->
+
+<xsl:template match="color[@name='header']">
+#top          { background-color: <xsl:value-of select="@value"/>;}  
+</xsl:template>
+
+<xsl:template match="color[@name='tab-selected']"> 
+#top .header .current { background-color: <xsl:value-of select="@value"/>;} 
+#top .header .current a:link {  color: <xsl:value-of select="@link"/>;  }
+#top .header .current a:visited { color: <xsl:value-of select="@vlink"/>; }
+#top .header .current a:hover { color: <xsl:value-of select="@hlink"/>; }
+</xsl:template> 
+
+<xsl:template match="color[@name='tab-unselected']"> 
+#tabs li      { background-color: <xsl:value-of select="@value"/> ;} 
+#tabs li a:link {  color: <xsl:value-of select="@link"/>;  }
+#tabs li a:visited { color: <xsl:value-of select="@vlink"/>; }
+#tabs li a:hover { color: <xsl:value-of select="@hlink"/>; }
+</xsl:template> 
+
+<xsl:template match="color[@name='subtab-selected']">
+#level2tabs       { background-color: <xsl:value-of select="@value"/> ;} 
+#level2tabs a:link {  color: <xsl:value-of select="@link"/>;  }
+#level2tabs a:visited { color: <xsl:value-of select="@vlink"/>; }
+#level2tabs a:hover { color: <xsl:value-of select="@hlink"/>; }
+</xsl:template> 
+
+<!--xsl:template match="color[@name='subtab-unselected']">
+.level2tabstrip { background-color: <xsl:value-of select="@value"/>;}
+.datenote { background-color: <xsl:value-of select="@value"/>;} 
+.level2tabstrip.unselected a:link {  color: <xsl:value-of select="@link"/>;  }
+.level2tabstrip.unselected a:visited { color: <xsl:value-of select="@vlink"/>; }
+.level2tabstrip.unselected a:hover { color: <xsl:value-of select="@hlink"/>; }
+</xsl:template--> 
+
+<xsl:template match="color[@name='heading']">
+.heading { background-color: <xsl:value-of select="@value"/>;} 
+</xsl:template> 
+
+<xsl:template match="color[@name='subheading']">
+.boxed { background-color: <xsl:value-of select="@value"/>;} 
+.underlined_5 	{border-bottom: solid 5px <xsl:value-of select="@value"/>;}
+.underlined_10 	{border-bottom: solid 10px <xsl:value-of select="@value"/>;}
+table caption { 
+background-color: <xsl:value-of select="@value"/>; 
+color: <xsl:value-of select="@font"/>;
+}
+</xsl:template> 
+<xsl:template match="color[@name='feedback']">    
+#feedback {
+color: <xsl:value-of select="@font"/>;
+background: <xsl:value-of select="@value"/>;
+text-align: <xsl:value-of select="@align"/>;
+}
+#feedback #feedbackto {
+color: <xsl:value-of select="@font"/>;
+}   
+</xsl:template>
+
+<xsl:template match="color[@name='breadtrail']">
+#main .breadtrail {
+background: <xsl:value-of select="@value"/>; 
+color: <xsl:value-of select="@font"/>;
+}
+#main .breadtrail a:link {  color: <xsl:value-of select="@link"/>;  }
+#main .breadtrail a:visited { color: <xsl:value-of select="@vlink"/>; }
+#main .breadtrail a:hover { color: <xsl:value-of select="@hlink"/>; }
+#top .breadtrail {
+background: <xsl:value-of select="@value"/>; 
+color: <xsl:value-of select="@font"/>;
+}
+#top .breadtrail a:link {  color: <xsl:value-of select="@link"/>;  }
+#top .breadtrail a:visited { color: <xsl:value-of select="@vlink"/>; }
+#top .breadtrail a:hover { color: <xsl:value-of select="@hlink"/>; }    
+</xsl:template>
+<!--Fix for other (old) profiles-->
+<xsl:template match="color[@name='navstrip']">
+#publishedStrip { 
+color: <xsl:value-of select="@font"/>;
+background: <xsl:value-of select="@value"/>; 
+}
+</xsl:template> 
+<!--has to go after the nav-strip (no 'navstrip')-->
+<xsl:template match="color[@name='published']">
+#publishedStrip { 
+color: <xsl:value-of select="@font"/>;
+background: <xsl:value-of select="@value"/>; 
+}
+</xsl:template> 
+<xsl:template match="color[@name='toolbox']">
+#menu .menupagetitle  { background-color: <xsl:value-of select="@value"/>}
+</xsl:template> 
+
+<xsl:template match="color[@name='border']">
+#menu           { border-color: <xsl:value-of select="@value"/>;}
+#menu .menupagetitle  { border-color: <xsl:value-of select="@value"/>;}
+#menu .menupageitemgroup  { border-color: <xsl:value-of select="@value"/>;}
+</xsl:template> 
+
+<xsl:template match="color[@name='menu']">
+#menu      { background-color: <xsl:value-of select="@value"/>;} 
+#menu  {  color: <xsl:value-of select="@font"/>;} 
+#menu a:link {  color: <xsl:value-of select="@link"/>;} 
+#menu a:visited {  color: <xsl:value-of select="@vlink"/>;} 
+#menu a:hover {  
+background-color: <xsl:value-of select="@value"/>;
+color: <xsl:value-of select="@hlink"/>;} 
+</xsl:template> 
+<xsl:template match="color[@name='dialog']"> 
+#menu .menupagetitle  { color: <xsl:value-of select="@font"/>;}    
+#menu .menupageitemgroup     { 
+background-color: <xsl:value-of select="@value"/>;
+}
+#menu .menupageitem {
+color: <xsl:value-of select="@font"/>;
+} 
+#menu .menupageitem a:link {  color: <xsl:value-of select="@link"/>;} 
+#menu .menupageitem a:visited {  color: <xsl:value-of select="@vlink"/>;} 
+#menu .menupageitem a:hover {  
+background-color: <xsl:value-of select="@value"/>;
+color: <xsl:value-of select="@hlink"/>;
+}
+</xsl:template> 
+<xsl:template match="color[@name='menuheading']">
+#menu h1 {
+color: <xsl:value-of select="@font"/>;
+background-color: <xsl:value-of select="@value"/>;
+}   
+</xsl:template> 
+<xsl:template match="color[@name='searchbox']"> 
+#top .searchbox { 
+background-color: <xsl:value-of select="@value"/> ;
+color: <xsl:value-of select="@font"/>; 
+} 
+</xsl:template>
+
+<xsl:template match="color[@name='body']">
+body{ 
+background-color: <xsl:value-of select="@value"/>;
+color: <xsl:value-of select="@font"/>;
+} 
+a:link { color:<xsl:value-of select="@link"/>} 
+a:visited { color:<xsl:value-of select="@vlink"/>} 
+a:hover { color:<xsl:value-of select="@hlink"/>} 
+
+</xsl:template>
+
+<xsl:template match="color[@name='footer']"> 
+#footer       { background-color: <xsl:value-of select="@value"/>;} 
+</xsl:template> 
+
+
+<!-- ==================== other colors ============================ -->
+<xsl:template match="color[@name='highlight']"> 
+.highlight        { background-color: <xsl:value-of select="@value"/>;} 
+</xsl:template> 
+
+<xsl:template match="color[@name='fixme']"> 
+.fixme        { border-color: <xsl:value-of select="@value"/>;} 
+</xsl:template> 
+
+<xsl:template match="color[@name='note']"> 
+.note         { border-color: <xsl:value-of select="@value"/>;} 
+</xsl:template> 
+
+<xsl:template match="color[@name='warning']"> 
+.warning         { border-color: <xsl:value-of select="@value"/>;} 
+</xsl:template>
+
+<xsl:template match="color[@name='code']"> 
+.code         { border-color: <xsl:value-of select="@value"/>;} 
+</xsl:template> 
+
+<xsl:template match="color[@name='table']"> 
+.ForrestTable      { background-color: <xsl:value-of select="@value"/>;} 
+</xsl:template> 
+
+<xsl:template match="color[@name='table-cell']"> 
+.ForrestTable td   { background-color: <xsl:value-of select="@value"/>;} 
+</xsl:template> 
+
+
+</xsl:stylesheet>
Index: /proiecte/swift/trunk/lib/hoard-371/doc/skin/screen.css
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/doc/skin/screen.css	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/doc/skin/screen.css	(revision 176)
@@ -0,0 +1,1023 @@
+/*
+
+* Copyright 2002-2004 The Apache Software Foundation
+
+*
+
+* Licensed under the Apache License, Version 2.0 (the "License");
+
+* you may not use this file except in compliance with the License.
+
+* You may obtain a copy of the License at
+
+*
+
+*     http://www.apache.org/licenses/LICENSE-2.0
+
+*
+
+* Unless required by applicable law or agreed to in writing, software
+
+* distributed under the License is distributed on an "AS IS" BASIS,
+
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+
+* See the License for the specific language governing permissions and
+
+* limitations under the License.
+
+*/
+
+body {  margin: 0px 0px 0px 0px; font-family: Verdana, Helvetica, sans-serif; }
+
+
+
+h1     { font-size : 160%; margin: 0px 0px 0px 0px;  padding: 0px; }
+
+h2     { font-size : 140%; margin: 0.9em 0px 0px 0px; padding: 0px; font-weight : bold;}
+
+h3     { font-size : 130%; margin: 0.8em 0px 0px 0px; padding: 0px; font-weight : bold; }
+
+.h3 { margin: 22px 0px 3px 0px; }
+
+h4     { font-size : 120%; margin: 0.7em 0px 0px 0px; padding: 0px; font-weight : normal; text-align: left; }
+
+.h4 { margin: 18px 0px 0px 0px; }
+
+h4.faq { font-size : 120%; margin: 18px 0px 0px 0px; padding: 0px; font-weight : bold;   text-align: left; }
+
+h5     { font-size : 100%; margin: 14px 0px 0px 0px; padding: 0px; font-weight : normal; text-align: left; }
+
+
+
+/**
+
+* table
+
+*/
+
+table .title { background-color: #000000; }
+
+.ForrestTable         {
+
+    color: #ffffff;
+
+    background-color: #7099C5;
+
+    width: 100%;
+
+    font-size : 100%;
+
+    empty-cells: show;
+
+}
+
+table caption {
+
+    padding-left: 5px;
+
+    color: white;
+
+    text-align: left;
+
+    font-weight: bold;
+
+    background-color: #000000;
+
+}
+
+.ForrestTable td {
+
+    color: black;
+
+    background-color: #f0f0ff;
+
+}
+
+.ForrestTable th { text-align: center; }
+
+/**
+
+ * Page Header
+
+ */
+
+
+
+#top {
+
+    position: relative;
+
+    float: left;
+
+    width: 100%;
+
+    background: #294563; /* if you want a background in the header, put it here */
+
+}
+
+
+
+#top .breadtrail {
+
+    background: #CFDCED;
+
+    color: black;
+
+    border-bottom: solid 1px white;
+
+    padding: 3px 10px;
+
+    font-size: 75%;
+
+}
+
+#top .breadtrail a { color: black; }
+
+
+
+#top .header {
+
+    float: left;
+
+    width: 100%;
+
+    background: url("images/header_white_line.gif") repeat-x bottom;
+
+}
+
+
+
+#top .grouplogo {
+
+    padding: 7px 0 10px 10px;
+
+    float: left;
+
+    text-align: left;
+
+}
+
+#top .projectlogo {
+
+    padding: 7px 0 10px 10px;
+
+    float: left;
+
+    width: 33%;
+
+    text-align: right;
+
+}
+
+#top .projectlogoA1 {
+
+    padding: 7px 0 10px 10px;
+
+    float: right;
+
+}
+
+html>body #top .searchbox {
+
+    bottom: 0px;
+
+}
+
+#top .searchbox {
+
+    position: absolute;
+
+    right: 10px;
+
+    height: 42px;
+
+    font-size: 70%;
+
+    white-space: nowrap;
+
+    text-align: right;
+
+    color: white;
+
+    background-color: #000000;
+
+    z-index:0;
+
+    background-image: url(images/rc-t-l-5-1header-2searchbox-3searchbox.png);
+
+    background-repeat: no-repeat;
+
+    background-position: top left;
+
+    bottom: -1px; /* compensate for IE rendering issue */
+
+}
+
+
+
+#top .searchbox form {
+
+    padding: 5px 10px;
+
+    margin: 0;
+
+}
+
+#top .searchbox p {
+
+    padding: 0 0 2px 0;
+
+    margin: 0;
+
+}
+
+#top .searchbox input {
+
+    font-size: 100%;
+
+}
+
+
+
+#tabs {
+
+    clear: both;
+
+    padding-left: 10px;
+
+    margin: 0;
+
+    list-style: none;
+
+}
+
+/*    background: #CFDCED url("images/tab-right.gif") no-repeat right top;*/
+
+#tabs li {
+
+    float: left;
+
+    background-image: url(images/rc-t-r-5-1header-2tab-unselected-3tab-unselected.png);
+
+    background-repeat: no-repeat;
+
+    background-position: top right;
+
+    background-color: #000000;
+
+    margin: 0 3px 0 0;
+
+    padding: 0;
+
+}
+
+
+
+/*background: url("images/tab-left.gif") no-repeat left top;*/
+
+#tabs li a {
+
+    float: left;
+
+    display: block;
+
+    font-family: verdana, arial, sans-serif;
+
+    text-decoration: none;
+
+    color: black;
+
+    white-space: nowrap;
+
+    background-image: url(images/rc-t-l-5-1header-2tab-unselected-3tab-unselected.png);
+
+    background-repeat: no-repeat;
+
+    background-position: top left;
+
+    padding: 5px 15px 4px;
+
+    width: .1em; /* IE/Win fix */
+
+}
+
+
+
+#tabs > li a { width: auto; } /* Rest of IE/Win fix */
+
+
+
+/* Commented Backslash Hack hides rule from IE5-Mac \*/
+
+#tabs a { float: none; }
+
+/* End IE5-Mac hack */
+
+
+
+#top .header .current {
+
+    background-color: #4C6C8F;
+
+    background-image: url(images/rc-t-r-5-1header-2tab-selected-3tab-selected.png);
+
+    background-repeat: no-repeat;
+
+    background-position: top right;
+
+}
+
+#top .header .current a {
+
+    font-weight: bold;
+
+    padding-bottom: 5px;
+
+    color: white;
+
+    background-image: url(images/rc-t-l-5-1header-2tab-selected-3tab-selected.png);
+
+    background-repeat: no-repeat;
+
+    background-position: top left;
+
+}
+
+#publishedStrip {
+
+    padding-right: 10px;
+
+    padding-left: 20px;
+
+    padding-top: 3px;
+
+    padding-bottom:3px;
+
+    color: #ffffff;
+
+    font-size : 60%;
+
+    font-weight: bold;
+
+    background-color: #4C6C8F;
+
+    text-align:right;
+
+}
+
+
+
+#level2tabs {
+
+margin: 0;
+
+float:left;
+
+position:relative;
+
+}
+
+
+
+/*
+
+*    border-top: solid #4C6C8F 15px;
+
+*/
+
+#main {
+
+    position: relative;
+
+    background: white;
+
+    clear:both;
+
+}
+
+#main .breadtrail {
+
+    clear:both;
+
+    position: relative;
+
+    background: #CFDCED;
+
+    color: black;
+
+    border-bottom: solid 1px black;
+
+    border-top: solid 1px black;
+
+    padding: 0px 180px;
+
+    font-size: 75%;
+
+    z-index:10;
+
+}
+
+/**
+
+* Round corner
+
+*/
+
+#roundtop {
+
+    background-image: url(images/rc-t-r-15-1body-2menu-3menu.png);
+
+    background-repeat: no-repeat;
+
+    background-position: top right;
+
+}
+
+
+
+#roundbottom {
+
+    background-image: url(images/rc-b-r-15-1body-2menu-3menu.png);
+
+    background-repeat: no-repeat;
+
+    background-position: top right;
+
+}
+
+
+
+img.corner {
+
+   width: 15px;
+
+   height: 15px;
+
+   border: none;
+
+   display: block !important;
+
+}
+
+
+
+.roundtopsmall {
+
+    background-image: url(images/rc-t-r-5-1header-2searchbox-3searchbox.png);
+
+    background-repeat: no-repeat;
+
+    background-position: top right;
+
+}
+
+
+
+#roundbottomsmall {
+
+    background-image: url(images/rc-b-r-5-1header-2tab-selected-3tab-selected.png);
+
+    background-repeat: no-repeat;
+
+    background-position: top right;
+
+}
+
+
+
+img.cornersmall {
+
+   width: 5px;
+
+   height: 5px;
+
+   border: none;
+
+   display: block !important;
+
+}
+
+/**
+
+ * Side menu
+
+ */
+
+#menu a {  font-weight: normal;}
+
+#menu a:visited {  font-weight: normal; }
+
+#menu a:active {  font-weight: normal; }
+
+#menu a:hover {  font-weight: normal; }
+
+
+
+#menuarea { width:10em;}
+
+#menu {
+
+    position: relative;
+
+    float: left;
+
+    width: 160px;
+
+    padding-top: 0px;
+
+    top:-18px;
+
+    left:10px;
+
+    z-index: 20;
+
+    background-color: #f90;
+
+    font-size : 70%;
+
+}
+
+
+
+.menutitle {
+
+        cursor:pointer;
+
+        padding: 3px 12px;
+
+        margin-left: 10px;
+
+        background-image: url('images/chapter.gif');
+
+        background-repeat: no-repeat;
+
+        background-position: center left;
+
+        font-weight : bold;
+
+}
+
+
+
+#menu .menuitemgroup {
+
+        margin: 0px 0px 6px 8px;
+
+        padding: 0px;
+
+        font-weight : bold; }
+
+
+
+#menu .selectedmenuitemgroup{
+
+        margin: 0px 0px 6px 8px;
+
+        padding: 0px;
+
+        font-weight : bold; }
+
+
+
+#menu .menuitem {
+
+        padding: 0px 0px 2px 12px;
+
+        background-image: url('images/page.gif');
+
+        background-repeat: no-repeat;
+
+        background-position: center left;
+
+        font-weight : normal;
+
+        margin-left: 10px;
+
+}
+
+
+
+#menu .menupage {
+
+        margin: 5px 0px 5px 10px;
+
+        padding: 0px 3px 0px 12px;
+
+        background-image: url('images/current.gif');
+
+        background-repeat: no-repeat;
+
+        background-position: top left;
+
+        font-style : normal;
+
+}
+
+#menu .menupagetitle {
+
+        padding: 0px 0px 0px 6px;
+
+        font-style : normal;
+
+        border-style: solid;
+
+        border-width: 1px;
+
+        margin-right: 10px;
+
+}
+
+#menu .menupageitemgroup {
+
+        padding: 3px 0px 4px 6px;
+
+        font-style : normal;
+
+        border-bottom: 1px solid ;
+
+        border-left: 1px solid ;
+
+        border-right: 1px solid ;
+
+        margin-right: 10px;
+
+}
+
+#menu .menupageitem {
+
+        font-style : normal;
+
+        font-weight : normal;
+
+        border-width: 0px;
+
+        font-size : 90%;
+
+}
+
+#menu #credit {
+
+    text-align: center;
+
+}
+
+
+
+#content {
+
+    padding: 20px 20px 20px 180px;
+
+    margin: 0;
+
+    font : small Verdana, Helvetica, sans-serif;
+
+    font-size : 80%;
+
+}
+
+
+
+#content ul {
+
+    margin: 0;
+
+    padding: 0 25px;
+
+}
+
+#content li {
+
+    padding: 0 5px;
+
+}
+
+#feedback {
+
+    color: black;
+
+    background: #CFDCED;
+
+    text-align:center;
+
+    margin-top: 5px;
+
+}
+
+#feedback #feedbackto {
+
+    font-size: 90%;
+
+    color: black;
+
+}
+
+#footer {
+
+    clear: both;
+
+    position: relative; /* IE bugfix (http://www.dracos.co.uk/web/css/ie6floatbug/) */
+
+    width: 100%;
+
+    background: #CFDCED;
+
+    border-top: solid 1px #4C6C8F;
+
+    color: black;
+
+}
+
+#footer .copyright {
+
+    position: relative; /* IE bugfix cont'd */
+
+    padding: 5px;
+
+    margin: 0;
+
+    width: 45%;
+
+}
+
+#footer .lastmodified {
+
+    position: relative; /* IE bugfix cont'd */
+
+    float: right;
+
+    width: 45%;
+
+    padding: 5px;
+
+    margin: 0;
+
+    text-align: right;
+
+}
+
+#footer a { color: white; }
+
+
+
+#footer #logos {
+
+    text-align: left;
+
+}
+
+
+
+
+
+/**
+
+ * Misc Styles
+
+ */
+
+
+
+acronym { cursor: help; }
+
+.boxed      { background-color: #a5b6c6;}
+
+.underlined_5     {border-bottom: solid 5px #4C6C8F;}
+
+.underlined_10     {border-bottom: solid 10px #4C6C8F;}
+
+/* ==================== snail trail ============================ */
+
+
+
+.trail {
+
+  position: relative; /* IE bugfix cont'd */
+
+  font-size: 70%;
+
+  text-align: right;
+
+  float: right;
+
+  margin: -10px 5px 0px 5px;
+
+  padding: 0;
+
+}
+
+
+
+#minitoc-area {
+
+    border-top: solid 1px #4C6C8F;
+
+    border-bottom: solid 1px #4C6C8F;
+
+    margin-bottom: 15px;
+
+    margin-left: 15px;
+
+    margin-right: 10%;
+
+    padding-bottom: 5px;
+
+    padding-top: 5px;
+
+}
+
+.minitoc {
+
+    list-style-image: url('images/current.gif');
+
+    font-weight: normal;
+
+}
+
+li p {
+
+    margin: 0;
+
+    padding: 0;
+
+}
+
+
+
+.pdflink {
+
+    position: relative; /* IE bugfix cont'd */
+
+    float: right;
+
+    margin: 0px 5px;
+
+    padding: 0;
+
+}
+
+.pdflink br {
+
+    margin-top: -10px;
+
+    padding-left: 1px;
+
+}
+
+.pdflink a {
+
+    display: block;
+
+    font-size: 70%;
+
+    text-align: center;
+
+    margin: 0;
+
+    padding: 0;
+
+}
+
+
+
+.pdflink img {
+
+    display: block;
+
+    height: 16px;
+
+    width: 16px;
+
+}
+
+.xmllink {
+
+    position: relative; /* IE bugfix cont'd */
+
+    float: right;
+
+    margin: 0px 5px;
+
+    padding: 0;
+
+}
+
+.xmllink br {
+
+    margin-top: -10px;
+
+    padding-left: 1px;
+
+}
+
+.xmllink a {
+
+    display: block;
+
+    font-size: 70%;
+
+    text-align: center;
+
+    margin: 0;
+
+    padding: 0;
+
+}
+
+
+
+.xmllink img {
+
+    display: block;
+
+    height: 16px;
+
+    width: 16px;
+
+}
+
+.podlink {
+
+    position: relative; /* IE bugfix cont'd */
+
+    float: right;
+
+    margin: 0px 5px;
+
+    padding: 0;
+
+}
+
+.podlink br {
+
+    margin-top: -10px;
+
+    padding-left: 1px;
+
+}
+
+.podlink a {
+
+    display: block;
+
+    font-size: 70%;
+
+    text-align: center;
+
+    margin: 0;
+
+    padding: 0;
+
+}
+
+
+
+.podlink img {
+
+    display: block;
+
+    height: 16px;
+
+    width: 16px;
+
+}
+
+
+
+.printlink {
+
+    float: right;
+
+}
+
+.printlink br {
+
+    margin-top: -10px;
+
+    padding-left: 1px;
+
+}
+
+.printlink a {
+
+    display: block;
+
+    font-size: 70%;
+
+    text-align: center;
+
+    margin: 0;
+
+    padding: 0;
+
+}
+
+.printlink img {
+
+    display: block;
+
+    height: 16px;
+
+    width: 16px;
+
+}
Index: /proiecte/swift/trunk/lib/hoard-371/doc/skin/skinconf.xsl
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/doc/skin/skinconf.xsl	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/doc/skin/skinconf.xsl	(revision 176)
@@ -0,0 +1,152 @@
+<?xml version="1.0"?>
+<!--
+  Copyright 2002-2004 The Apache Software Foundation
+
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+        
+    <xsl:template match="skinconfig">
+
+  <xsl:if test="not(colors)">
+  <colors>
+<!-- Lenya -->
+  <color name="header" value="#ffffff"/>
+
+    <color name="tab-selected" value="#4C6C8F" link="#ffffff" vlink="#ffffff" hlink="#ffffff"/>
+    <color name="tab-unselected" value="#E5E4D9" link="#000000" vlink="#000000" hlink="#000000"/>
+    <color name="subtab-selected" value="#4C6C8F" link="#ffffff" vlink="#ffffff" hlink="#ffffff"/>
+    <color name="subtab-unselected" value="#E5E4D9" link="#000000" vlink="#000000" hlink="#000000"/>
+
+    <color name="heading" value="#E5E4D9"/>
+    <color name="subheading" value="#E5E4D9"/>
+    <color name="published" value="#4C6C8F" font="#FFFFFF"/>
+	<color name="feedback" value="#4C6C8F" font="#FFFFFF" align="center"/>
+    <color name="navstrip" value="#E5E4D9" font="#000000"/>
+
+    <color name="toolbox" value="#CFDCED" font="#000000"/>
+
+    <color name="border" value="#999999"/>
+    <color name="menu" value="#4C6C8F" font="#ffffff" link="#ffffff" vlink="#ffffff" hlink="#ffffff"  />    
+    <color name="menuheading" value="#cfdced" font="#000000" />
+    <color name="searchbox" value="#E5E4D9" font="#000000"/>
+    
+    <color name="dialog" value="#E5E4D9" font="#000000"/>
+	<color name="body" value="#ffffff" />            
+    
+    <color name="table" value="#ccc"/>    
+    <color name="table-cell" value="#ffffff"/>   
+    <color name="highlight" value="#ffff00"/>
+    <color name="fixme" value="#cc6600"/>
+    <color name="note" value="#006699"/>
+    <color name="warning" value="#990000"/>
+    <color name="code" value="#003366"/>
+        
+    <color name="footer" value="#E5E4D9"/>
+  </colors>
+  </xsl:if>
+
+     <xsl:copy>
+      <xsl:copy-of select="@*"/>
+      <xsl:copy-of select="node()[not(name(.)='colors')]"/>     
+      <xsl:apply-templates select="colors"/>
+     </xsl:copy> 
+
+    </xsl:template>
+
+    <xsl:template match="colors">
+     <xsl:copy>
+      <xsl:copy-of select="@*"/>
+      <xsl:copy-of select="node()[name(.)='color']"/> 
+      
+     <xsl:if test="not(color[@name='header'])">
+       <color name="header" value="#FFFFFF"/>
+     </xsl:if>  
+     <xsl:if test="not(color[@name='tab-selected'])">
+      <color name="tab-selected" value="#4C6C8F" link="#ffffff" vlink="#ffffff" hlink="#ffffff"/>
+     </xsl:if>  
+     <xsl:if test="not(color[@name='tab-unselected'])">
+      <color name="tab-unselected" value="#E5E4D9" link="#000000" vlink="#000000" hlink="#000000"/>
+     </xsl:if>
+     <xsl:if test="not(color[@name='subtab-selected'])">
+      <color name="subtab-selected" value="#4C6C8F" link="#ffffff" vlink="#ffffff" hlink="#ffffff"/>
+     </xsl:if>  
+     <xsl:if test="not(color[@name='subtab-unselected'])">
+      <color name="subtab-unselected" value="#E5E4D9" link="#000000" vlink="#000000" hlink="#000000"/>
+     </xsl:if>  
+     <xsl:if test="not(color[@name='heading'])">
+      <color name="heading" value="#E5E4D9"/>
+     </xsl:if>  
+     <xsl:if test="not(color[@name='subheading'])">
+      <color name="subheading" value="#E5E4D9"/>
+     </xsl:if>
+      <xsl:if test="not(color[@name='published'])">
+		<color name="feedback" value="#4C6C8F" font="#FFFFFF" align="center"/>
+     </xsl:if> 
+     <xsl:if test="not(color[@name='published'])">
+        <color name="published" value="#4C6C8F" font="#FFFFFF"/>
+     </xsl:if> 
+     <xsl:if test="not(color[@name='navstrip'])">
+      <color name="navstrip" value="#E5E4D9" font="#000000"/>
+     </xsl:if>  
+     <xsl:if test="not(color[@name='toolbox'])">
+       <color name="toolbox" value="#CFDCED" font="#000000"/>
+     </xsl:if>  
+     <xsl:if test="not(color[@name='border'])">
+       <color name="border" value="#999999"/>
+     </xsl:if>       
+     <xsl:if test="not(color[@name='menu'])">
+      	<color name="menu" value="#4C6C8F" font="#ffffff" link="#ffffff" vlink="#ffffff" hlink="#ffffff"  /> 
+     </xsl:if>
+     <xsl:if test="not(color[@name='menuheading'])">
+	     <color name="menuheading" value="#cfdced" font="#000000" />
+     </xsl:if> 
+     <xsl:if test="not(color[@name='searchbox'])">
+	 	<color name="searchbox" value="#E5E4D9" font="#000000"/>
+     </xsl:if> 
+     <xsl:if test="not(color[@name='dialog'])">
+      <color name="dialog" value="#E5E4D9" font="#000000" link="#000000" vlink="#000000" hlink="#000000"/>
+     </xsl:if>  
+     <xsl:if test="not(color[@name='body'])">
+      <color name="body" value="#ffffff" /> 
+     </xsl:if>  
+     <xsl:if test="not(color[@name='table'])">
+      <color name="table" value="#ccc"/>    
+     </xsl:if>  
+     <xsl:if test="not(color[@name='table-cell'])">
+      <color name="table-cell" value="#ffffff"/>    
+     </xsl:if>  
+     <xsl:if test="not(color[@name='highlight'])">
+       <color name="highlight" value="#ffff00"/>
+     </xsl:if>  
+     <xsl:if test="not(color[@name='fixme'])">
+       <color name="fixme" value="#c60"/>
+     </xsl:if>  
+     <xsl:if test="not(color[@name='note'])">
+       <color name="note" value="#069"/>
+     </xsl:if>  
+     <xsl:if test="not(color[@name='warning'])">
+       <color name="warning" value="#900"/>
+     </xsl:if>  
+     <xsl:if test="not(color[@name='code'])">
+       <color name="code" value="#a5b6c6"/>
+     </xsl:if>  
+     <xsl:if test="not(color[@name='footer'])">
+       <color name="footer" value="#E5E4D9"/>
+     </xsl:if>  
+    
+     </xsl:copy> 
+
+    </xsl:template>
+    
+</xsl:stylesheet>
Index: /proiecte/swift/trunk/lib/hoard-371/doc/src/documentation/content/xdocs/building.xml
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/doc/src/documentation/content/xdocs/building.xml	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/doc/src/documentation/content/xdocs/building.xml	(revision 176)
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V2.0//EN" "http://forrest.apache.org/dtd/document-v20.dtd">
+<document> 
+  <header> 
+    <title>Building Hoard</title> 
+  </header>
+
+<body>
+
+<p>
+You can use the available pre-built binaries or build Hoard
+yourself. Hoard is written to work on Windows and any variant of UNIX
+that supports threads, and should compile out of the box. Rather than
+using Makefiles or configure scripts, Hoard includes custom scripts
+that all start with the prefix compile.
+</p>
+
+  <section>
+    <title>Linux and Solaris Builds</title>
+<p>
+You can compile Hoard out of the box for Linux and Solaris using the
+GNU compilers (g++) just by running the compile
+script:
+</p>
+ 
+<source>
+./compile
+</source>
+
+  </section>
+
+  <section>
+  <title>Windows Builds</title>
+  <p>
+There are two alternative ways of using Hoard with Windows.
+</p>
+
+<ol>
+<li>
+<p>
+The first approach builds a DLL, libhoard.dll and
+its associated library libhoard.lib.
+</p>
+
+<source>
+.\compile-dll
+</source>
+</li>
+
+<li>
+<p>
+The second and preferred approach generates winhoard, which replaces
+malloc/new calls in your program and any DLLs it might use.
+  </p>
+
+<source>
+.\compile-winhoard
+</source>
+  </li>
+  </ol>
+
+  </section>
+
+</body>
+
+</document>
Index: /proiecte/swift/trunk/lib/hoard-371/doc/src/documentation/content/xdocs/download.xml
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/doc/src/documentation/content/xdocs/download.xml	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/doc/src/documentation/content/xdocs/download.xml	(revision 176)
@@ -0,0 +1,79 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V2.0//EN" "http://forrest.apache.org/dtd/document-v20.dtd">
+<document> 
+  <header> 
+    <title>Download Hoard</title> 
+  </header>
+
+<body>
+
+<section>
+  <title>Available Versions</title>
+
+<section>
+<title>
+Hoard (libhoard) 3.5.1, released May 22, 2006
+</title>
+
+<section>
+<title>Source code</title>
+
+<p>
+<a href="http://www.cs.umass.edu/~emery/hoard/hoard-3.5.1/heaplayers_3_5_1.tar.gz">gzipped tarball</a>, <a href="http://www.cs.umass.edu/~emery/hoard/hoard-3.5.1/heaplayers_3_5_1.zip">ZIP file</a>
+</p>
+</section>
+
+<section>
+<title>Binaries</title>
+<p>
+<a href="http://www.cs.umass.edu/~emery/hoard/hoard-3.5.1/linux/libhoard.so">Linux</a>, <a href="http://www.cs.umass.edu/~emery/hoard/hoard-3.5.1/solaris/libhoard.so">Solaris (GNU)</a>, <a href="http://www.cs.umass.edu/~emery/hoard/hoard-3.5.1/solaris/libhoard_32.so">Solaris (Sun, 32-bit)</a>, <a href="http://www.cs.umass.edu/~emery/hoard/hoard-3.5.1/solaris/libhoard_64.so">Solaris (Sun, 64-bit)</a>, <a href="http://www.cs.umass.edu/~emery/hoard/hoard-3.5.1/windows/windows-binaries.zip">Windows</a>
+</p>
+</section>
+
+</section>
+
+
+<section>
+<title>Previous Versions</title>
+
+<section>
+<title>Hoard 3.4.0 (December 28, 2005)</title>
+<p><a href="http://www.cs.umass.edu/~emery/hoard/hoard-3.4.0/heaplayers_3_4_0.tar.gz">gzipped tarball</a>, <a href="http://www.cs.umass.edu/~emery/hoard/hoard-3.4.0/heaplayers_3_4_0.zip">zip file</a>.
+</p>
+</section>
+
+<section>
+<title>Hoard 3.3.0 (May 27, 2005)</title>
+<p><a href="http://www.cs.umass.edu/~emery/hoard/hoard-3.3.0/heaplayers_3_3_0.tar.gz">gzipped tarball</a>, <a href="http://www.cs.umass.edu/~emery/hoard/hoard-3.3.0/heaplayers_3_3_0.zip">zip file</a>.
+</p>
+</section>
+
+
+<section>
+<title>Hoard 2.1.2d (April 7, 2003)</title>
+<p><a href="http://www.cs.umass.edu/~emery/hoard/libhoard-2.1.2d.tar.gz">gzipped tarball</a>, <a href="http://www.cs.umass.edu/~emery/hoard/libhoard-2.1.2d.zip">zip file</a>.
+</p>
+</section>
+
+<section>
+<title>Hoard 2.1.0 (December 24, 2001)</title>
+<p>
+<a href="http://www.cs.umass.edu/~emery/hoard/libhoard-2.1.0.tar.gz">gzipped tarball</a>, <a href="http://www.cs.umass.edu/~emery/hoard/libhoard-2.1.0.zip">zip file</a>.
+</p>
+</section>
+
+<section>
+<title>Hoard 2.0.6 (July 10, 2001)</title>
+<p>
+<a href="http://www.cs.umass.edu/~emery/hoard/libhoard-2.0.6.tar.gz">gzipped tarball</a>.
+</p>
+</section>
+
+
+</section>
+
+</section>
+
+</body>
+
+</document>
Index: /proiecte/swift/trunk/lib/hoard-371/doc/src/documentation/content/xdocs/faqs.xml
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/doc/src/documentation/content/xdocs/faqs.xml	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/doc/src/documentation/content/xdocs/faqs.xml	(revision 176)
@@ -0,0 +1,103 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V2.0//EN" "http://forrest.apache.org/dtd/document-v20.dtd">
+<document> 
+<header>
+    <title>Hoard Frequently Asked Questions</title> 
+</header>
+
+<body>
+  <section>
+<title>
+What kind of applications will Hoard speed up?
+</title>
+  <p>
+Hoard will always improve the performance of multithreaded programs
+running on multiprocessors that make frequent use of the heap (calls
+to malloc/free or new/delete, as well as many STL functions). Because
+Hoard avoids false sharing, Hoard also speeds up programs that only
+occasionally call heap functions but access these objects frequently.
+  </p>
+</section>
+
+
+  <section>
+<title>
+  I'm using the STL but not seeing any performance improvement. Why not?
+  </title>
+      <p>
+In order to benefit from Hoard, you have to tell STL to use malloc instead of its internal custom memory allocator:
+      </p>
+
+<source>
+typedef list&lt;unsigned int, malloc_alloc&gt; mylist;
+</source>
+
+</section>
+
+
+<section><title>
+What systems does Hoard work on?
+</title>
+  <p>
+Hoard has been successfully tested on numerous Windows, Linux and
+Solaris systems, including a 4-processor x86 box running Windows
+NT/2000, a 4-processor x86 box running RedHat Linux 6.0 and 6.1, and a
+16-processor Sun Enterprise server running Solaris.
+  </p>
+</section>
+
+
+<section><title>
+Have you compared Hoard with SmartHeap SMP?
+</title>
+  <p>
+We tried SmartHeap SMP but it did not work on our Suns (due to an
+apparent race condition in the code).
+  </p>
+  </section>
+
+
+  <section>
+<title>
+      Have you compared Hoard against mtmalloc or libumem?
+</title>
+<p>
+Yes. Hoard is much faster than either. For example, here's an
+execution of threadtest on Solaris:
+</p>
+      <table>
+           <tr>
+             <td>Default:</td>
+ 	     <td>4.60 seconds</td>
+           </tr>
+           <tr>
+             <td>Libmtmalloc:</td>
+ 	     <td>6.23 seconds</td>
+           </tr>
+           <tr>
+             <td>Libumem:</td>
+             <td>5.47 seconds</td>
+           </tr>
+           <tr>
+             <td>Hoard 3.2:</td>
+ 	     <td>1.99 seconds</td>
+           </tr>
+     </table>
+</section>
+
+<section>
+<title>
+Can I use Hoard with a commercial application?
+</title>
+<p>
+Yes. Hoard is available under two licenses. The first license is the
+GNU General Public License. That license is free, but it requires you
+to open-source your application. The second option is to purchase a
+license from the University of Texas at Austin. Click the "Licensing Info"
+link on the left for more information.
+</p>
+
+</section>
+
+</body>
+</document>
Index: /proiecte/swift/trunk/lib/hoard-371/doc/src/documentation/content/xdocs/index.xml
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/doc/src/documentation/content/xdocs/index.xml	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/doc/src/documentation/content/xdocs/index.xml	(revision 176)
@@ -0,0 +1,188 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Copyright 2002-2004 The Apache Software Foundation
+
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V2.0//EN" "http://forrest.apache.org/dtd/document-v20.dtd">
+<document> 
+  <header> 
+    <title>The Hoard Multiprocessor Memory Allocator</title> 
+  </header> 
+
+<!--
+  <articleinfo>
+    <author>
+  	<firstname>Emery</firstname>
+  	<surname>Berger</surname>
+  	<affiliation>University of Massachusetts Amherst</affiliation>
+  	<street>Department of Computer Science</street>
+  	<city>Amherst</city>
+  	<state>Massachusetts</state>
+	<country>USA</country>
+	<email>emery@cs.umass.edu</email>
+    </author>
+    <pubdate>2004-12-08</pubdate>
+    <copyright>
+	<year>2004</year>
+	<holder role="mailto:emery@cs.umass.edu">Emery Berger</holder>
+    </copyright>
+    <abstract>
+       Documentation for the Hoard scalable memory allocator, including build and usage directions for several platforms.
+    </abstract>
+  </articleinfo>
+-->
+
+  <body> 
+
+   <p class="quote">
+   ...if you'll be running on multiprocessor machines, ... <strong>use <a href="http://www.cs.umass.edu/~emery">Emery Berger</a>'s excellent Hoard multiprocessor memory management code</strong>. It's a drop-in replacement for the C and C++ memory routines and is very fast on multiprocessor machines.
+   <em><a href="http://www.nerdbooks.com/item.php?id=0735615365">Debugging Applications for Microsoft .NET and Microsoft Windows</a>, Microsoft Press, 2003</em>
+   </p>
+
+<!--
+   <p class="quote">
+   <strong>hoard:</strong>
+To amass and put away (anything valuable) for preservation, security,
+or future use; to treasure up: esp. money or wealth.
+   <em>Oxford English Dictionary</em>
+   </p>
+-->
+
+  <p>
+The Hoard memory allocator is a fast, scalable, and memory-efficient
+memory allocator for shared-memory multiprocessors. It runs on a
+variety of platforms, including Linux, Solaris, and Windows. Hoard is
+a drop-in replacement for malloc(), etc. No change to your source is
+necessary. Just link it in or set just one environment variable (see
+<a href="using.html">Using Hoard</a> for more
+information). <strong>Hoard can dramatically improve the performance
+of multithreaded programs running on multiprocessors.</strong>
+
+
+  </p>
+
+  <section>
+     <title>Why Hoard?</title>
+
+<p>
+There are a number of problems with existing memory allocators that make Hoard a better choice.
+</p>
+
+    <section>
+        <title>Contention</title>
+        <p>
+Multithreaded programs often do not scale because the heap is a
+bottleneck. When multiple threads simultaneously allocate or
+deallocate memory from the allocator, the allocator will serialize
+them. Programs making intensive use of the allocator actually slow
+down as the number of processors increases. Your program may be
+allocation-intensive without you realizing it, for instance, if your
+program makes many calls to the C++ Standard Template Library (STL).
+        </p>
+     </section>
+     <section>
+     <title>False Sharing</title>
+     <p>
+The allocator can cause other problems for multithreaded code. It can
+lead to <em>false sharing</em> in your application:
+threads on different CPUs can end up with memory in the same cache
+line, or chunk of memory. Accessing these falsely-shared cache lines
+is hundreds of times slower than accessing unshared cache lines.
+     </p>
+  </section>
+  <section>
+  <title>Blowup</title>
+  <p>
+Multithreaded programs can also lead the allocator to blowup memory
+consumption. This effect can multiply the amount of memory needed to
+run your application by the number of CPUs on your machine: four CPUs
+could mean that you need four times as much memory. Hoard is a fast
+allocator that solves all of these problems.
+  </p>
+  </section>
+  </section>
+
+<section>
+<title>Press</title>
+
+<p>
+<a href="http://www.intel.com/cd/ids/developer/asmo-na/eng/dc/xeon/43893.htm?page=4"><strong>Intel</strong> highlights the benefits of using Hoard</a> (a previous, slower version) on a 4-way Xeon system.
+</p>
+
+<p>
+<a href="http://developers.sun.com/solaris/articles/multiproc/multiproc.html"><strong>Sun</strong> concludes that Hoard is more space-efficient</a> than their own allocators.
+</p>
+
+</section>
+
+<!--
+  <section>
+  <title>How Do I Use Hoard?</title>
+  <p>
+Hoard is a drop-in replacement for malloc(), etc. No change to your source is necessary. Just link it in or set just one environment variable. See <a href="using.html">Using Hoard</a> for more information.
+  </p>
+  </section>
+-->
+
+
+  <section>
+  <title>Who's Using Hoard?</title>
+  <p>
+Companies using Hoard in their products and servers include <a href="http://www.aol.com">AOL</a>, <a href="http://www.bt.com">British Telecom</a>, <a href="http://www.businessobjects.com">Business Objects</a>
+(formerly Crystal Decisions), <a href="http://www.entrust.com">Entrust</a>, <a href="http://www.novell.com">Novell</a>, <a href="http://www.openwave.com">OpenWave Systems</a> (for their
+Typhoon and Twister servers), and <a href="http://www.reuters.com">Reuters</a>.
+</p>
+
+<p>
+Open source projects using Hoard include the Bayonne GNU telephony
+server, the <a href="http://supertech.lcs.mit.edu/cilk/">Cilk</a> parallel
+programming language, the <a href="http://www.cs.dartmouth.edu/research/DaSSF/index.html">Dartmouth
+Scalable Simulation Framework</a>, and the <a href="http://www.gnu.org/software/commoncpp/">GNU Common C++</a>
+system.
+  </p>
+
+<p>
+Hoard is also a part of several major Linux distributions, including Debian and Novell's SuSe.
+</p>
+  </section>
+
+
+<section>
+<title>More Information</title>
+<p>
+The first place to look for Hoard-related information is at the Hoard
+web page, <a href="http://www.hoard.org">www.hoard.org</a>.
+</p>
+
+<p>
+There are two mailing lists you should join if you are a
+user of Hoard. If you are just interested in being informed of new
+releases, join the <a
+href="http://groups.yahoo.com/group/hoard-announce/">Hoard-Announce</a>
+list. For general Hoard discussion, join the <a
+href="http://groups.yahoo.com/group/hoard/">Hoard</a> mailing
+list. You can also search the archives of these lists.
+</p>
+</section>
+
+
+<section>
+<title>Technical Information</title>
+<p>
+For technical details of a previous version of Hoard, read <a href="http://www.cs.umass.edu/~emery/hoard/asplos2000.pdf">Hoard: A Scalable Memory Allocator for Multithreaded Applications</a>, by Emery D. Berger, Kathryn S. McKinley, Robert D. Blumofe, and Paul R. Wilson. The Ninth International Conference on Architectural Support for Programming Languages and Operating Systems (ASPLOS-IX). Cambridge, MA, November 2000.
+</p>
+</section>
+
+  </body>
+</document>
Index: /proiecte/swift/trunk/lib/hoard-371/doc/src/documentation/content/xdocs/licensing.xml
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/doc/src/documentation/content/xdocs/licensing.xml	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/doc/src/documentation/content/xdocs/licensing.xml	(revision 176)
@@ -0,0 +1,62 @@
+<?xml version="1.0"?>
+<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V2.0//EN" "http://forrest.apache.org/dtd/document-v20.dtd">
+<document>
+
+<header>
+<title>
+Licensing Overview
+</title>
+</header>
+
+<body>
+
+<section>
+<title>
+GNU General Public License
+</title>
+
+<p>
+The use and distribution of Hoard is governed by the <a href="http://www.gnu.org/copyleft/gpl.html">GNU General
+Public License</a> as published by the <a
+href="http://www.fsf.org">Free Software Foundation</a>.
+</p>
+</section>
+
+<section>
+<title>
+Commercial Licenses
+</title>
+
+<p>
+Because of the restrictions imposed by this license (you must make
+your code open-source), commercial users of Hoard can purchase
+licenses through the University of Texas at Austin. For detailed
+information on licenses, please contact <a
+href="mailto:software@otc.utexas.edu">Richard Friedman</a> or myself, <a
+href="mailto:emery@cs.umass.edu">Emery Berger</a>.
+</p>
+
+<p>
+Richard Friedman's contact information follows:
+</p>
+
+<p>
+<a href="mailto:software@otc.utexas.edu">Richard Friedman</a><br></br>
+  The University of Texas at Austin
+<br></br>  Office of Technology Commercialization
+<br></br>  MCC Building, Suite 1.9A
+<br></br>  3925 West Braker Lane
+<br></br>  Austin, Texas 78759
+<br></br>  (512) 471-4738
+<br></br>  (512) 475-6894 (FAX)
+</p>
+
+<p>
+
+A sample software license can be found <a href="http://www.otc.utexas.edu/otc/New/Forms/SLAShortForm_18Jan2006.doc">here</a>, along with <a href="http://www.otc.utexas.edu/otc/New/Forms/ExhibitA-SLATermsAndConditions_18Jan2006.pdf">terms and conditions</a>.
+
+</p>
+
+</section>
+</body>
+</document>
Index: /proiecte/swift/trunk/lib/hoard-371/doc/src/documentation/content/xdocs/screenshot.xml
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/doc/src/documentation/content/xdocs/screenshot.xml	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/doc/src/documentation/content/xdocs/screenshot.xml	(revision 176)
@@ -0,0 +1,83 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V2.0//EN" "http://forrest.apache.org/dtd/document-v20.dtd">
+<document> 
+
+  <header> 
+    <title>Screenshots</title> 
+  </header> 
+
+<body>
+
+  <p>
+  Because Hoard is a transparent plug-in replacement, ordinary
+  screenshots don't make much sense, since the applications look and
+  work the same! However, it's easy to visualize Hoard's impact on
+  application performance. Here are a few example speedup
+  graphs. Ideally, the speedup as the number of processors increases
+  is a straight diagonal line going from the lower left of each graph
+  to the upper right. These benchmarks compare Hoard to Ptmalloc (the
+  Linux allocator), mtmalloc version 8, and the Solaris default
+  allocator, and are run on a 14-processor Sun.
+</p>
+
+  <table>
+  <tr>
+    <td>
+    <!-- <center> -->
+    <img alt="Threadtest graph" src="images/plot-threadtest-speedup.gif"/>
+    <!-- </center> -->
+    </td>
+  </tr>
+  <tr>
+    <td>
+    <!-- <center> -->
+<p>
+    This benchmark has multiple threads, each allocating and freeing
+    objects. It stresses raw scalability of allocation in individual
+    threads. In this case, Hoard achieves a linear speedup. Ptmalloc
+    scales to four processors but then runs out of steam.
+</p>
+    <!-- </center> -->
+    </td>
+  </tr>
+  <tr>
+    <td>
+    <!-- <center> -->
+    <img alt="Larson graph" src="images/plot-larson-speedup.gif"/>
+    <!-- </center> -->
+    </td>
+  </tr>
+  <tr>
+    <td>
+    <!-- <center> -->
+<p>
+    In this benchmark, multiple threads allocate objects and pass some
+    objects to other threads that free them. This stresses the ability
+    of the memory manager to handle object sharing. Only Hoard scales
+    for this case.
+</p>
+    <!-- </center> -->
+    </td>
+  </tr>
+  <tr>
+    <td>
+    <!-- <center> -->
+    <img alt="Cache-scratch graph" src="images/plot-cache-scratch-speedup.gif"/>
+    <!-- </center> -->
+    </td>
+  </tr>
+  <tr>
+    <td>
+    <!-- <center> -->
+<p>
+    A test of whether a memory manager avoids causing false sharing of
+    cache lines (an insidious effect that destroys scalability). The
+    linear speedup shows that Hoard avoids false sharing completely.
+</p>
+    <!-- </center> -->
+    </td>
+  </tr>
+  </table>
+
+</body>
+</document>
Index: /proiecte/swift/trunk/lib/hoard-371/doc/src/documentation/content/xdocs/site.xml
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/doc/src/documentation/content/xdocs/site.xml	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/doc/src/documentation/content/xdocs/site.xml	(revision 176)
@@ -0,0 +1,108 @@
+<?xml version="1.0"?>
+<!--
+  Copyright 2002-2004 The Apache Software Foundation
+
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+
+<!--
+Forrest site.xml
+
+This file contains an outline of the site's information content.  It is used to:
+- Generate the website menus (though these can be overridden - see docs)
+- Provide semantic, location-independent aliases for internal 'site:' URIs, eg
+<link href="site:changes"> links to changes.html (or ../changes.html if in
+  subdir).
+- Provide aliases for external URLs in the external-refs section.  Eg, <link
+  href="ext:cocoon"> links to http://cocoon.apache.org/ 
+
+See http://forrest.apache.org/docs/linking.html for more info
+-->
+
+<site label="Hoard" href="" xmlns="http://apache.org/forrest/linkmap/1.0" tab="">
+
+  <about label="Table of Contents">
+    <index label="Home" href="index.html" description="Welcome to Hoard"/>
+    <download label="Download" href="download.html" description="Download Hoard"/>
+    <screenshot label="Screenshots" href="screenshot.html" description="Screenshots" />
+    <using label="Using Hoard" href="using.html" description="How to Use Hoard" />
+    <building label="Building Hoard" href="building.html" description="How to Build Hoard" />
+    <faqs label="FAQs" href="faqs.html" description="FAQs" />
+    <licensing label="Licensing Info" href="licensing.html" description="License Info" />
+  </about>
+
+<!--
+  <samples label="Samples" href="samples/" tab="samples">
+    <index href="index.html"/>
+    <sample label="Apache doc v2.0" href="sample.html" 
+      description="A nonsense document using all possible elements in the current document v2.0">
+      <top href="#top"/>
+      <section href="#section"/>
+    </sample>
+    <document-v13 label="Apache doc v1.3" href="document-v13.html" 
+      description="A nonsense document using all possible elements in the document v1.3">
+      <top href="#top"/>
+      <section href="#section"/>
+    </document-v13>
+    <static label="Static content" href="static.html" 
+      description="Static raw un-processed content" />
+    <linking label="Linking" href="linking.html" 
+      description="Linking explained and demonstrated" />
+    <sample-wiki label="Wiki page" href="wiki-sample.html" 
+      description="wiki-sample" />
+    <sample-ihtml label="ihtml page" href="ihtml-sample.html" 
+      description="Test iHTML page" />
+    <sample-ascii-art label="ascii-art page" href="ascii-art.html" 
+      description="Sample Ascii Art page" />
+    <sample-openoffice-writer label="OpenOffice Writer" href="openoffice-writer.html" 
+      description="Openoffice Writer sample" />       
+    <faq label="FAQ" href="faq.html" description="Frequently Asked Questions" />
+    <sdocbook label="Simplifed Docbook" href="sdocbook.html" 
+      description="Simplified DocBook example" />     
+    <subdir label="Subdir" href="subdir/">
+      <index label="Index" href="index.html" 
+        description="Page generated from a sub-directory"/>
+    </subdir>
+  </samples>
+-->
+
+<!--
+  <files>
+    <hello_print href="hello.pdf" />
+    <test1 href="test1.html" />
+    <test3 href="samples/test3.html" />
+  </files>
+-->
+
+  <!--
+  The href must be wholesite.html/pdf  You can change the labels and node names
+  <all label="All">
+    <whole_site_html label="Whole Site HTML" href="wholesite.html"/>
+    <whole_site_pdf label="Whole Site PDF" href="wholesite.pdf"/>
+  </all>
+  -->
+
+<!--
+  <external-refs>
+    <forrest href="http://forrest.apache.org/">
+      <linking href="docs/linking.html"/>
+      <validation href="docs/validation.html"/>
+      <webapp href="docs/your-project.html#webapp"/>
+      <dtd-docs href="docs/dtd-docs.html"/>
+    </forrest>
+    <cocoon href="http://cocoon.apache.org/"/>
+    <xml.apache.org href="http://xml.apache.org/"/>
+  </external-refs>
+-->
+
+</site>
Index: /proiecte/swift/trunk/lib/hoard-371/doc/src/documentation/content/xdocs/tabs.xml
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/doc/src/documentation/content/xdocs/tabs.xml	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/doc/src/documentation/content/xdocs/tabs.xml	(revision 176)
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Copyright 2002-2004 The Apache Software Foundation
+
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<!DOCTYPE tabs PUBLIC "-//APACHE//DTD Cocoon Documentation Tab V1.1//EN" "http://forrest.apache.org/dtd/tab-cocoon-v11.dtd">
+
+<tabs software="Hoard"
+  title="Hoard"
+  copyright="Emery Berger"
+  xmlns:xlink="http://www.w3.org/1999/xlink">
+
+  <!-- The rules for tabs are:
+    @dir will always have '/@indexfile' added.
+    @indexfile gets appended to @dir if the tab is selected. Defaults to 'index.html'
+    @href is not modified unless it is root-relative and obviously specifies a
+    directory (ends in '/'), in which case /index.html will be added
+    If @id's are present, site.xml entries with a matching @tab will be in that tab.
+
+   Tabs can be embedded to a depth of two. The second level of tabs will only 
+    be displayed when their parent tab is selected.    
+  -->
+
+<!--  <tab id="" label="Home" dir="" indexfile="index.html"/> -->
+
+</tabs>
Index: /proiecte/swift/trunk/lib/hoard-371/doc/src/documentation/content/xdocs/using.xml
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/doc/src/documentation/content/xdocs/using.xml	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/doc/src/documentation/content/xdocs/using.xml	(revision 176)
@@ -0,0 +1,152 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V2.0//EN" "http://forrest.apache.org/dtd/document-v20.dtd">
+<document> 
+  <header> 
+    <title>Using Hoard</title> 
+  </header>
+
+<body>
+
+<p>
+Using Hoard is easy. On UNIX-based platforms, all you have to do is set one environment variable. You do not need to change any source code, recompile or relink your application. On Windows, you actually have even greater flexibility.
+</p>
+
+
+<section>
+  <title>UNIX</title>
+  <p>
+In UNIX, you can use the LD_PRELOAD variable to use
+Hoard instead of the system allocator for any program not linked with
+the "static option" (that's most programs). Below are settings for
+Linux and Solaris.
+  </p>
+  <section>
+    <title>Linux</title>
+    <source>
+LD_PRELOAD="/path/libhoard.so:/usr/lib/libdl.so"
+    </source>
+  </section>
+  <section>
+    <title>Solaris</title>
+    <p>
+    Depending on whether you are using the GNU-compiled version (as
+    produced by compile) or the Sun
+    Workshop-compiled versions (produced by
+    compile-sunw), your settings will be slightly
+    different.
+    </p>
+
+    <table>
+        <tr>
+              <td>Version</td>
+              <td>Setting</td>
+        </tr>
+        <tr>
+              <td>GNU</td>
+              <td>
+                <source>
+LD_PRELOAD="/path/libhoard.so:/usr/lib/libdl.so"
+                </source>
+              </td>
+           </tr>
+           <tr>
+              <td>Sun (<em>32-bits</em>)</td>
+              <td>
+                 <source>
+LD_PRELOAD="/path/libhoard_32.so:/usr/lib/libCrun.so.1:/usr/lib/libdl.so"
+                  </source>
+              </td>
+           </tr>
+           <tr>
+              <td>Sun (<em>64-bits</em>)</td>
+              <td>
+                 <source>
+LD_PRELOAD="/path/libhoard_64.so:/usr/lib/64/libCrun.so.1:/usr/lib/64/libdl.so"
+                  </source>
+              </td>
+           </tr>
+     </table>
+
+       <p>
+For some security-sensitive applications, Solaris requires you place
+libraries used in LD_PRELOAD into the /usr/lib/secure directory. In that event,
+after copying these libraries into /usr/lib/secure, set
+LD_PRELOAD by omitting the absolute locations of the libraries, as follows:
+       </p>
+       <source>
+LD_PRELOAD="libhoard.so:libCrun.so.1:libdl.so"
+       </source>
+
+</section>
+</section>
+
+<section>
+  <title>Windows</title>
+  <p>
+  There are two ways to use Hoard on Windows.
+  </p>
+  <ol>
+  <li>
+    Using winhoard
+    <p>
+The first and best method is to use winhoard. Winhoard replaces
+malloc/new calls from your program and any DLLs it might use (leaving
+HeapAlloc calls intact).
+</p>
+
+<p>
+To use the Winhoard version, link your executable with
+usewinhoard.obj and
+winhoard.lib, and then use
+winhoard.dll:
+</p>
+
+<source>
+cl /Ox /MD myprogram.cpp usewinhoard.obj winhoard.lib
+</source>
+
+  </li>
+  <li>
+    Using libhoard
+    <p>
+
+The other method is to link directly with the libhoard DLL. This
+approach is simple, but only suitable for small applications, since it
+will not affect malloc calls in any other DLL you might load. To use
+this option, you should put the following into your source code as the
+very first lines:
+</p>
+
+<source>
+#if defined(USE_HOARD)
+#pragma comment(lib, "libhoard.lib") 
+#endif 
+</source>
+
+<p>
+This stanza should be in the first part of a header file included by
+all of your code. It ensures that Hoard loads before any other library
+(you will need libhoard.lib in your path). When
+you execute your program, as long as libhoard.dll
+is in your path, your program will run with Hoard instead of the
+system allocator. Note that you must compile your program with the
+/MD flag, as in:
+</p>
+
+<source>
+cl /MD /G6 /Ox /DUSE_HOARD=1 myprogram.cpp 
+</source>
+
+<p>
+Hoard will not work if you use another switch (like
+/MT) to compile your program.
+    </p>
+  </li>
+  </ol>
+</section>
+
+
+
+</body>
+
+</document>
Index: /proiecte/swift/trunk/lib/hoard-371/doc/src/documentation/skinconf.xml
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/doc/src/documentation/skinconf.xml	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/doc/src/documentation/skinconf.xml	(revision 176)
@@ -0,0 +1,362 @@
+<?xml version="1.0"?>
+<!--
+  Copyright 2002-2004 The Apache Software Foundation
+
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+
+<!--
+Skin configuration file. This file contains details of your project,
+which will be used to configure the chosen Forrest skin.
+-->
+
+<!DOCTYPE skinconfig PUBLIC "-//APACHE//DTD Skin Configuration V0.6-3//EN" "http://forrest.apache.org/dtd/skinconfig-v06-3.dtd">
+<skinconfig>
+  <!-- To enable lucene search add provider="lucene" (default is google).
+    Add box-location="alt" to move the search box to an alternate location
+    (if the skin supports it) and box-location="all" to show it in all
+    available locations on the page.  Remove the <search> element to show
+    no search box. @domain will enable sitesearch for the specific domain with google.
+    In other words google will search the @domain for the query string.
+  -->
+<!--
+  <search name="MyProject" domain="mydomain" provider="google"/>
+-->
+
+  <!-- Disable the print link? If enabled, invalid HTML 4.0.1 -->
+  <disable-print-link>true</disable-print-link>  
+  <!-- Disable the PDF link? -->
+  <disable-pdf-link>true</disable-pdf-link>
+  <!-- Disable the POD link? -->
+  <disable-pod-link>true</disable-pod-link>
+  <!-- Disable the Text link? FIXME: NOT YET IMPLEMENETED. -->
+  <disable-txt-link>true</disable-txt-link>
+  <!-- Disable the xml source link? -->
+  <!-- The xml source link makes it possible to access the xml rendition
+    of the source frim the html page, and to have it generated statically.
+    This can be used to enable other sites and services to reuse the
+    xml format for their uses. Keep this disabled if you don't want other
+    sites to easily reuse your pages.-->
+  <disable-xml-link>true</disable-xml-link>
+
+  <!-- Disable navigation icons on all external links? -->
+  <disable-external-link-image>false</disable-external-link-image>
+
+  <!-- Disable w3c compliance links? 
+    Use e.g. align="center" to move the compliance links logos to 
+    an alternate location default is left.
+    (if the skin supports it) -->
+  <disable-compliance-links>true</disable-compliance-links>
+
+  <!-- Render mailto: links unrecognisable by spam harvesters? -->
+  <obfuscate-mail-links>true</obfuscate-mail-links>
+  <obfuscate-mail-value>.at.</obfuscate-mail-value>
+
+  <!-- Disable the javascript facility to change the font size -->
+  <disable-font-script>true</disable-font-script>
+
+  <!-- mandatory project logo
+       default skin: renders it at the top -->
+  <project-name></project-name>
+  <project-description>The Hoard Multiprocessor Memory Allocator</project-description>
+  <project-url></project-url>
+  <project-logo></project-logo>
+  <!-- Alternative static image:
+  <project-logo>images/project-logo.gif</project-logo> -->
+
+  <!-- optional group logo
+       default skin: renders it at the top-left corner -->
+  <group-name>Hoard</group-name>
+  <group-description>The Hoard Multiprocessor Memory Allocator</group-description>
+  <group-url>http://www.hoard.org</group-url>
+  <group-logo>images/hoard-logo.jpg</group-logo>
+
+  <!-- Alternative static image:
+  <group-logo>images/hoard-logo.jpg</group-logo> -->
+
+  <!-- optional host logo (e.g. sourceforge logo)
+       default skin: renders it at the bottom-left corner -->
+  <host-url></host-url>
+  <host-logo></host-logo>
+
+  <!-- relative url of a favicon file, normally favicon.ico -->
+  <favicon-url></favicon-url>
+
+  <!-- The following are used to construct a copyright statement -->
+  <year>2005</year>
+  <vendor>Emery Berger.</vendor>
+  <!-- The optional copyright-link URL will be used as a link in the
+    copyright statement
+  <copyright-link>http://www.apache.org/licenses/</copyright-link>
+  -->
+
+  <!-- Some skins use this to form a 'breadcrumb trail' of links.
+    Use location="alt" to move the trail to an alternate location
+    (if the skin supports it).
+	  Omit the location attribute to display the trail in the default location.
+	  Use location="none" to not display the trail (if the skin supports it).
+    For some skins just set the attributes to blank.
+  -->
+
+  <trail location="none">
+    <link1 name="Emery Berger" href="http://www.cs.umass.edu/~emery/"/>
+    <link2 name="Hoard" href="http://www.hoard.org/"/>
+    <link3 name="" href=""/>
+  </trail>
+
+  <!-- Configure the TOC, i.e. the Table of Contents.
+  @max-depth
+   how many "section" levels need to be included in the
+   generated Table of Contents (TOC). 
+  @min-sections
+   Minimum required to create a TOC.
+  @location ("page","menu","page,menu", "none")
+   Where to show the TOC.
+  -->
+  <toc max-depth="3" min-sections="1" location="page"/>
+
+  <!-- Heading types can be clean|underlined|boxed  -->
+  <headings type="boxed"/>
+  
+  <!-- The optional feedback element will be used to construct a
+    feedback link in the footer with the page pathname appended:
+    <a href="@href">{@to}</a>
+    -->
+  <feedback to="emery@cs.umass.edu"
+    href="mailto:emery@cs.umass.edu?subject=Feedback," >
+    Send feedback about the website to:
+  </feedback>
+  <!--
+    extra-css - here you can define custom css-elements that are 
+    a. overriding the fallback elements or 
+    b. adding the css definition from new elements that you may have 
+       used in your documentation.
+    -->
+  <extra-css>
+    <!--Example of b. 
+        To define the css definition of a new element that you may have used
+        in the class attribute of a <p> node. 
+        e.g. <p class="quote"/>
+    -->
+    p.quote {
+      margin-left: 2em;
+      padding: .5em;
+      background-color: #f0f0f0;
+      font-family: Bookman Old Style; Palatino;
+    }
+  </extra-css>
+
+  <colors>
+  <!-- These values are used for the generated CSS files. -->
+
+  <!-- Krysalis -->
+<!--
+    <color name="header"    value="#FFFFFF"/>
+
+    <color name="tab-selected" value="#a5b6c6" link="#000000" vlink="#000000" hlink="#000000"/>
+    <color name="tab-unselected" value="#F7F7F7"  link="#000000" vlink="#000000" hlink="#000000"/>
+    <color name="subtab-selected" value="#a5b6c6"  link="#000000" vlink="#000000" hlink="#000000"/>
+    <color name="subtab-unselected" value="#a5b6c6"  link="#000000" vlink="#000000" hlink="#000000"/>
+
+    <color name="heading" value="#a5b6c6"/>
+    <color name="subheading" value="#CFDCED"/>
+        
+    <color name="navstrip" value="#CFDCED" font="#000000" link="#000000" vlink="#000000" hlink="#000000"/>
+    <color name="toolbox" value="#a5b6c6"/>
+    <color name="border" value="#a5b6c6"/>
+        
+    <color name="menu" value="#F7F7F7" link="#000000" vlink="#000000" hlink="#000000"/>    
+    <color name="dialog" value="#F7F7F7"/>
+            
+    <color name="body"    value="#ffffff" link="#0F3660" vlink="#009999" hlink="#000066"/>
+    
+    <color name="table" value="#a5b6c6"/>    
+    <color name="table-cell" value="#ffffff"/>    
+    <color name="highlight" value="#ffff00"/>
+    <color name="fixme" value="#cc6600"/>
+    <color name="note" value="#006699"/>
+    <color name="warning" value="#990000"/>
+    <color name="code" value="#a5b6c6"/>
+        
+    <color name="footer" value="#a5b6c6"/>
+-->
+
+  <!-- Forrest -->
+<!--
+    <color name="header"    value="#294563"/>
+
+    <color name="tab-selected" value="#4a6d8c" link="#0F3660" vlink="#0F3660" hlink="#000066"/>
+    <color name="tab-unselected" value="#b5c7e7" link="#0F3660" vlink="#0F3660" hlink="#000066"/>
+    <color name="subtab-selected" value="#4a6d8c" link="#0F3660" vlink="#0F3660" hlink="#000066"/>
+    <color name="subtab-unselected" value="#4a6d8c" link="#0F3660" vlink="#0F3660" hlink="#000066"/>
+
+    <color name="heading" value="#294563"/>
+    <color name="subheading" value="#4a6d8c"/>
+        
+    <color name="navstrip" value="#cedfef" font="#0F3660" link="#0F3660" vlink="#0F3660" hlink="#000066"/>
+    <color name="toolbox" value="#4a6d8c"/>
+    <color name="border" value="#294563"/>
+    
+    <color name="menu" value="#4a6d8c" font="#cedfef" link="#ffffff" vlink="#ffffff" hlink="#ffcf00"/>    
+    <color name="dialog" value="#4a6d8c"/>
+            
+    <color name="body" value="#ffffff"  link="#0F3660" vlink="#009999" hlink="#000066"/>
+    
+    <color name="table" value="#7099C5"/>    
+    <color name="table-cell" value="#f0f0ff"/>    
+    <color name="highlight" value="#ffff00"/>
+    <color name="fixme" value="#cc6600"/>
+    <color name="note" value="#006699"/>
+    <color name="warning" value="#990000"/>
+    <color name="code" value="#CFDCED"/>
+        
+    <color name="footer" value="#cedfef"/>
+-->
+
+  <!-- Collabnet --> 
+<!--
+    <color name="header"    value="#003366"/>
+
+    <color name="tab-selected" value="#dddddd" link="#555555" vlink="#555555" hlink="#555555"/>
+    <color name="tab-unselected" value="#999999" link="#ffffff" vlink="#ffffff" hlink="#ffffff"/>
+    <color name="subtab-selected" value="#cccccc" link="#000000" vlink="#000000" hlink="#000000"/>
+    <color name="subtab-unselected" value="#cccccc" link="#555555" vlink="#555555" hlink="#555555"/>
+
+    <color name="heading" value="#003366"/>
+    <color name="subheading" value="#888888"/>
+    
+    <color name="navstrip" value="#dddddd" font="#555555"/>
+    <color name="toolbox" value="#dddddd" font="#555555"/>
+    <color name="border" value="#999999"/>
+    
+    <color name="menu" value="#ffffff"/>    
+    <color name="dialog" value="#eeeeee"/>
+            
+    <color name="body"      value="#ffffff"/>
+    
+    <color name="table" value="#ccc"/>    
+    <color name="table-cell" value="#ffffff"/>   
+    <color name="highlight" value="#ffff00"/>
+    <color name="fixme" value="#cc6600"/>
+    <color name="note" value="#006699"/>
+    <color name="warning" value="#990000"/>
+    <color name="code" value="#003366"/>
+        
+    <color name="footer" value="#ffffff"/>
+-->
+ <!-- Lenya using pelt-->
+<!--
+    <color name="header" value="#ffffff"/>
+
+    <color name="tab-selected" value="#4C6C8F" link="#ffffff" vlink="#ffffff" hlink="#ffffff"/>
+    <color name="tab-unselected" value="#E5E4D9" link="#000000" vlink="#000000" hlink="#000000"/>
+    <color name="subtab-selected" value="#000000" link="#000000" vlink="#000000" hlink="#000000"/>
+    <color name="subtab-unselected" value="#E5E4D9" link="#000000" vlink="#000000" hlink="#000000"/>
+
+    <color name="heading" value="#E5E4D9"/>
+    <color name="subheading" value="#000000"/>
+    <color name="published" value="#4C6C8F" font="#FFFFFF"/>
+    <color name="feedback" value="#4C6C8F" font="#FFFFFF" align="center"/>
+    <color name="navstrip" value="#E5E4D9" font="#000000"/>
+
+    <color name="toolbox" value="#CFDCED" font="#000000"/>
+
+    <color name="border" value="#999999"/>
+    <color name="menu" value="#4C6C8F" font="#ffffff" link="#ffffff" vlink="#ffffff" hlink="#ffffff" current="#FFCC33" />    
+    <color name="menuheading" value="#cfdced" font="#000000" />
+    <color name="searchbox" value="#E5E4D9" font="#000000"/>
+    
+    <color name="dialog" value="#CFDCED"/>
+    <color name="body" value="#ffffff" />            
+    
+    <color name="table" value="#ccc"/>    
+    <color name="table-cell" value="#ffffff"/>   
+    <color name="highlight" value="#ffff00"/>
+    <color name="fixme" value="#cc6600"/>
+    <color name="note" value="#006699"/>
+    <color name="warning" value="#990000"/>
+    <color name="code" value="#003366"/>
+        
+    <color name="footer" value="#E5E4D9"/>
+-->
+  </colors>
+ 
+  <!-- Settings specific to PDF output. -->
+  <pdf>
+    <!-- 
+       Supported page sizes are a0, a1, a2, a3, a4, a5, executive,
+       folio, legal, ledger, letter, quarto, tabloid (default letter).
+       Supported page orientations are portrait, landscape (default
+       portrait).
+       Supported text alignments are left, right, justify (default left).
+    -->
+    <page size="letter" orientation="portrait" text-align="left"/>
+
+    <!--
+       Margins can be specified for top, bottom, inner, and outer
+       edges. If double-sided="false", the inner edge is always left
+       and the outer is always right. If double-sided="true", the
+       inner edge will be left on odd pages, right on even pages,
+       the outer edge vice versa.
+       Specified below are the default settings.
+    -->
+    <margins double-sided="false">
+      <top>1in</top>
+      <bottom>1in</bottom>
+      <inner>1.25in</inner>
+      <outer>1in</outer>
+    </margins>
+
+    <!--
+      Print the URL text next to all links going outside the file
+    -->
+    <show-external-urls>false</show-external-urls>
+
+    <!--
+      Disable the copyright footer on each page of the PDF.
+      A footer is composed for each page. By default, a "credit" with role=pdf
+      will be used, as explained below. Otherwise a copyright statement
+      will be generated. This latter can be disabled.
+    -->
+    <disable-copyright-footer>false</disable-copyright-footer>
+  </pdf>
+
+  <!-- Credits are typically rendered as a set of small clickable
+    images in the page footer.
+    Use box-location="alt" to move the credit to an alternate location
+    (if the skin supports it). 
+  -->
+<!--
+  <credits>
+    <credit box-location="alt">
+      <name>Built with Apache Forrest</name>
+      <url>http://forrest.apache.org/</url>
+      <image>images/built-with-forrest-button.png</image>
+      <width>88</width>
+      <height>31</height>
+    </credit>
+-->
+    <!-- A credit with @role="pdf" will be used to compose a footer
+     for each page in the PDF, using either "name" or "url" or both.
+    -->
+    <!--
+    <credit role="pdf">
+      <name>Built with Apache Forrest</name>
+      <url>http://forrest.apache.org/</url>
+    </credit>
+    -->
+<!--
+  </credits>
+-->
+
+</skinconfig>
Index: /proiecte/swift/trunk/lib/hoard-371/doc/status.xml
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/doc/status.xml	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/doc/status.xml	(revision 176)
@@ -0,0 +1,74 @@
+<?xml version="1.0"?>
+<!--
+  Copyright 2002-2004 The Apache Software Foundation
+
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<status>
+
+  <developers>
+    <person name="Emery Berger"      email="emery@cs.umass.edu"      id="EDB" />
+    <!-- Add more people here -->
+  </developers>
+
+  <changes>
+    <!-- Add new releases here -->
+    <release version="0.1" date="unreleased">
+      <!-- Some action types have associated images. By default, images are
+      defined for 'add', 'fix', 'remove', 'update' and 'hack'. If you add
+      src/documentation/resources/images/<foo>.jpg images, these will
+      automatically be used for entries of type <foo>. -->
+
+      <action dev="JB" type="add" context="admin">
+        Initial Import
+      </action>
+      <!-- Sample action:
+      <action dev="JB" type="fix" due-to="Joe Contributor"
+          due-to-email="joec@apache.org" fixes-bug="123">
+          Fixed a bug in the Foo class.
+        </action>
+        -->
+    </release>
+  </changes>
+
+  <todo>
+    <actions priority="high">
+      <action context="docs" dev="JB">
+        Customize this template project with your project's details.  This
+        TODO list is generated from 'status.xml'.
+      </action>
+      <action context="docs" dev="JB">
+        Add lots of content.  XML content goes in
+        <code>src/documentation/content/xdocs</code>, or wherever the
+        <code>${project.xdocs-dir}</code> property (set in
+        <code>forrest.properties</code>) points.
+      </action>
+      <action context="feedback" dev="JB">
+        Mail <link
+          href="mailto:forrest-dev@xml.apache.org">forrest-dev@xml.apache.org</link>
+        with feedback.
+      </action>
+    </actions>
+    <!-- Add todo items. @context is an arbitrary string. Eg:
+    <actions priority="high">
+      <action context="code" dev="SN">
+      </action>
+    </actions>
+    <actions priority="medium">
+      <action context="docs" dev="open">
+      </action>
+    </actions>
+    -->
+  </todo>
+
+</status>
Index: /proiecte/swift/trunk/lib/hoard-371/doc/using.html
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/doc/using.html	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/doc/using.html	(revision 176)
@@ -0,0 +1,333 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="Apache Forrest" name="Generator">
+<meta name="Forrest-version" content="0.6">
+<meta name="Forrest-skin-name" content="pelt">
+<title>Using Hoard</title>
+<link type="text/css" href="skin/basic.css" rel="stylesheet">
+<link media="screen" type="text/css" href="skin/screen.css" rel="stylesheet">
+<link media="print" type="text/css" href="skin/print.css" rel="stylesheet">
+<link type="text/css" href="skin/profile.css" rel="stylesheet">
+<script src="skin/getBlank.js" language="javascript" type="text/javascript"></script><script src="skin/getMenu.js" language="javascript" type="text/javascript"></script><script src="skin/fontsize.js" language="javascript" type="text/javascript"></script>
+<link rel="shortcut icon" href="">
+</head>
+<body onload="init()">
+<script type="text/javascript">ndeSetTextSize();</script>
+<div id="top">
+<!--+
+    |header
+    +-->
+<div class="header">
+<!--+
+    |start group logo
+    +-->
+<div class="grouplogo">
+<a href="http://www.hoard.org"><img class="logoImage" alt="Hoard" src="images/hoard-logo.jpg" title="The Hoard Multiprocessor Memory Allocator"></a>
+</div>
+<!--+
+    |end group logo
+    +-->
+<!--+
+    |start Project Logo
+    +-->
+<div class="projectlogoA1">
+<a href=""></a>
+</div>
+<!--+
+    |end Project Logo
+    +-->
+<!--+
+    |start Tabs
+    +-->
+<ul id="tabs"></ul>
+<!--+
+    |end Tabs
+    +-->
+</div>
+</div>
+<div id="main">
+<div id="publishedStrip">
+<!--+
+    |start Subtabs
+    +-->
+<div id="level2tabs"></div>
+<!--+
+    |end Endtabs
+    +-->
+<script type="text/javascript" language="JavaScript"><!--
+              document.write("Published: " + document.lastModified);
+              //  --></script>
+</div>
+<!--+
+    |breadtrail
+    +-->
+<div class="breadtrail">
+             
+             &nbsp;
+           </div>
+<!--+
+    |start Menu, mainarea
+    +-->
+<!--+
+    |start Menu
+    +-->
+<div id="menu">
+<div onclick="SwitchMenu('menu_selected_1.1', 'skin/')" id="menu_selected_1.1Title" class="menutitle" style="background-image: url('skin/images/chapter_open.gif');">Table of Contents</div>
+<div id="menu_selected_1.1" class="selectedmenuitemgroup" style="display: block;">
+<div class="menuitem">
+<a title="Welcome to Hoard" href="index.html">Home</a>
+</div>
+<div class="menuitem">
+<a title="Download Hoard" href="download.html">Download</a>
+</div>
+<div class="menuitem">
+<a title="Screenshots" href="screenshot.html">Screenshots</a>
+</div>
+<div class="menupage">
+<div class="menupagetitle">Using Hoard</div>
+</div>
+<div class="menuitem">
+<a title="How to Build Hoard" href="building.html">Building Hoard</a>
+</div>
+<div class="menuitem">
+<a title="FAQs" href="faqs.html">FAQs</a>
+</div>
+<div class="menuitem">
+<a title="License Info" href="licensing.html">Licensing Info</a>
+</div>
+</div>
+<div id="credit"></div>
+<div id="roundbottom">
+<img style="display: none" class="corner" height="15" width="15" alt="" src="skin/images/rc-b-l-15-1body-2menu-3menu.png"></div>
+<!--+
+  |alternative credits
+  +-->
+</div>
+<!--+
+    |end Menu
+    +-->
+<!--+
+    |start content
+    +-->
+<div id="content">
+<div id="skinconf-txtlink"></div>
+<h1>Using Hoard</h1>
+<div id="minitoc-area">
+<ul class="minitoc">
+<li>
+<a href="#UNIX">UNIX</a>
+<ul class="minitoc">
+<li>
+<a href="#Linux">Linux</a>
+</li>
+<li>
+<a href="#Solaris">Solaris</a>
+</li>
+</ul>
+</li>
+<li>
+<a href="#Windows">Windows</a>
+</li>
+</ul>
+</div>
+
+
+<p>
+Using Hoard is easy. On UNIX-based platforms, all you have to do is set one environment variable. You do not need to change any source code, recompile or relink your application. On Windows, you actually have even greater flexibility.
+</p>
+
+
+
+<a name="N1000F"></a><a name="UNIX"></a>
+<h2 class="boxed">UNIX</h2>
+<div class="section">
+<p>
+In UNIX, you can use the LD_PRELOAD variable to use
+Hoard instead of the system allocator for any program not linked with
+the "static option" (that's most programs). Below are settings for
+Linux and Solaris.
+  </p>
+<a name="N10018"></a><a name="Linux"></a>
+<h3 class="boxed">Linux</h3>
+<pre class="code">
+LD_PRELOAD="/path/libhoard.so"
+    </pre>
+<a name="N10023"></a><a name="Solaris"></a>
+<h3 class="boxed">Solaris</h3>
+<p>
+    Depending on whether you are using the GNU-compiled version (as
+    produced by compile) or the Sun
+    Workshop-compiled versions (produced by
+    compile-sunw), your settings will be slightly
+    different.
+    </p>
+<table class="ForrestTable" cellspacing="1" cellpadding="4">
+        
+<tr>
+              
+<td colspan="1" rowspan="1">Version</td>
+              <td colspan="1" rowspan="1">Setting</td>
+        
+</tr>
+        
+<tr>
+              
+<td colspan="1" rowspan="1">GNU</td>
+              <td colspan="1" rowspan="1">
+                
+<pre class="code">
+LD_PRELOAD="/path/libhoard.so"
+                </pre>
+              
+</td>
+           
+</tr>
+           
+<tr>
+              
+<td colspan="1" rowspan="1">Sun (<em>32-bits</em>)</td>
+              <td colspan="1" rowspan="1">
+                 
+<pre class="code">
+LD_PRELOAD="/path/libhoard_32.so:/usr/lib/libCrun.so.1"
+                  </pre>
+              
+</td>
+           
+</tr>
+           
+<tr>
+              
+<td colspan="1" rowspan="1">Sun (<em>64-bits</em>)</td>
+              <td colspan="1" rowspan="1">
+                 
+<pre class="code">
+LD_PRELOAD="/path/libhoard_64.so:/usr/lib/64/libCrun.so.1"
+                  </pre>
+              
+</td>
+           
+</tr>
+     
+</table>
+<p>
+For some security-sensitive applications, Solaris requires you place
+libraries used in LD_PRELOAD into the /usr/lib/secure directory. In that event,
+after copying these libraries into /usr/lib/secure, set
+LD_PRELOAD by omitting the absolute locations of the libraries, as follows:
+       </p>
+<pre class="code">
+LD_PRELOAD="libhoard.so:libCrun.so.1"
+       </pre>
+</div>
+
+
+<a name="N1007E"></a><a name="Windows"></a>
+<h2 class="boxed">Windows</h2>
+<div class="section">
+<p>
+  There are two ways to use Hoard on Windows.
+  </p>
+<ol>
+  
+<li>
+    Using winhoard
+    <p>
+The first and best method is to use winhoard. Winhoard replaces
+malloc/new calls from your program and any DLLs it might use (leaving
+HeapAlloc calls intact).
+</p>
+
+
+<p>
+To use the Winhoard version, link your executable with
+usewinhoard.obj and
+winhoard.lib, and then use
+winhoard.dll:
+</p>
+
+
+<pre class="code">
+cl /Ox /MD myprogram.cpp usewinhoard.obj winhoard.lib
+</pre>
+
+  
+</li>
+  
+<li>
+    Using libhoard
+    <p>
+
+The other method is to link directly with the libhoard DLL. This
+approach is simple, but only suitable for small applications, since it
+will not affect malloc calls in any other DLL you might load. To use
+this option, you should put the following into your source code as the
+very first lines:
+</p>
+
+
+<pre class="code">
+#if defined(USE_HOARD)
+#pragma comment(lib, "libhoard.lib") 
+#endif 
+</pre>
+
+
+<p>
+This stanza should be in the first part of a header file included by
+all of your code. It ensures that Hoard loads before any other library
+(you will need libhoard.lib in your path). When
+you execute your program, as long as libhoard.dll
+is in your path, your program will run with Hoard instead of the
+system allocator. Note that you must compile your program with the
+/MD flag, as in:
+</p>
+
+
+<pre class="code">
+cl /MD /G6 /Ox /DUSE_HOARD=1 myprogram.cpp 
+</pre>
+
+
+<p>
+Hoard will not work if you use another switch (like
+/MT) to compile your program.
+    </p>
+  
+</li>
+  
+</ol>
+</div>
+
+
+
+
+</div>
+<!--+
+    |end content
+    +-->
+<div class="clearboth">&nbsp;</div>
+</div>
+<div id="footer">
+<!--+
+    |start bottomstrip
+    +-->
+<div class="lastmodified">
+<script type="text/javascript"><!--
+document.write("Last Published: " + document.lastModified);
+//  --></script>
+</div>
+<div class="copyright">
+ Copyright &copy; 2005 Emery Berger.</div>
+<div id="feedback">
+    Send feedback about the website to:
+  <a id="feedbackto" href="mailto:emery@cs.umass.edu?subject=Feedback,using.html">emery@cs.umass.edu</a>
+</div>
+<!--+
+    |end bottomstrip
+    +-->
+</div>
+</body>
+</html>
Index: /proiecte/swift/trunk/lib/hoard-371/src/Makefile
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/Makefile	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/Makefile	(revision 176)
@@ -0,0 +1,105 @@
+# Commands to compile Hoard for various targets.
+# Run make (with no arguments) to see the complete target list.
+
+FREEBSD_COMPILE := g++ -O2 -DNDEBUG  -DNDEBUG  -I. -Iheaplayers -Iheaplayers/util -D_REENTRANT=1 -shared libhoard.cpp -Bsymbolic -o libhoard.so -pthread -fPIC
+
+DARWIN8_COMPILE := g++ -pipe -O2 -DNDEBUG  -I. -Iheaplayers -Iheaplayers/util -D_REENTRANT=1 -compatibility_version 1 -current_version 1 -dynamiclib libhoard.cpp -o libhoard.dylib -ldl -lpthread
+
+DARWIN8_COMPILE_DEBUG := g++ -pipe -g -I. -Iheaplayers -Iheaplayers/util -D_REENTRANT=1 -compatibility_version 1 -current_version 1 -dynamiclib libhoard.cpp -o libhoard.dylib -ldl -lpthread
+
+LINUX_GCC_x86_COMPILE := g++ -I/usr/include/nptl -ffast-math -g -malign-double -pipe -march=pentium4 -O3 -finline-limit=20000 -fomit-frame-pointer -finline-functions  -DNDEBUG  -I. -Iheaplayers -Iheaplayers/util -D_REENTRANT=1 -shared libhoard.cpp -Bsymbolic -o libhoard.so -ldl -lpthread
+
+LINUX_GCC_x86_64_COMPILE := g++ -W -Wconversion -Wall -march=nocona -m64 -msse2 -I/usr/include/nptl -pipe -fPIC -O3 -finline-limit=20000 -fomit-frame-pointer -finline-functions  -DNDEBUG  -I. -Iheaplayers -Iheaplayers/util -D_REENTRANT=1 -shared libhoard.cpp -Bsymbolic -o libhoard.so -ldl -lpthread
+
+LINUX_GCC_x86_64_COMPILE_DEBUG := g++ -W -Wconversion -Wall -march=nocona -m64 -I/usr/include/nptl -pipe -fPIC -O0 -g -I. -Iheaplayers -Iheaplayers/util -D_REENTRANT=1 -shared libhoard.cpp -Bsymbolic -o libhoard.so -ldl -lpthread
+
+LINUX_GCC_x86_COMPILE_STATIC := g++ -I/usr/include/nptl -static -malign-double -pipe -march=pentium4 -O3 -finline-limit=20000 -fomit-frame-pointer -finline-functions  -DNDEBUG  -I. -Iheaplayers -Iheaplayers/util -D_REENTRANT=1 -c libhoard.cpp ; ar cr libhoard.a libhoard.o
+
+LINUX_GCC_x86_COMPILE_DEBUG := g++ -O0 -fno-inline -malign-double -I/usr/include/nptl  -g -pipe -I. -Iheaplayers -Iheaplayers/util -D_REENTRANT=1 -shared libhoard.cpp -Bsymbolic -o libhoard.so -ldl -lpthread
+
+SOLARIS_SUNW_SPARC_COMPILE_32_DEBUG := CC -dalign -mt -g -xildoff -xthreadvar=dynamic -L/usr/lib/lwp -R/usr/lib/lwp -DNDEBUG -I. -Iheaplayers -Iheaplayers/util -D_REENTRANT=1 -G -PIC libhoard.cpp heaplayers/util/sparc-interchange.il -o libhoard_32.so -lthread -ldl -lCrun
+
+SOLARIS_SUNW_SPARC_COMPILE_32 := CC -dalign -xbuiltin=%all -mt -xO5 -fast -xtarget=ultra2 -xildoff -xthreadvar=dynamic -L/usr/lib/lwp -R/usr/lib/lwp -DNDEBUG -I. -Iheaplayers -Iheaplayers/util -D_REENTRANT=1 -G -PIC libhoard.cpp heaplayers/util/sparc-interchange.il -o libhoard_32.so -lthread -ldl -lCrun
+
+SOLARIS_SUNW_SPARC_COMPILE_64 := CC -xcode=pic13 -m64 -mt -fast -dalign -xbuiltin=%all -xO5 -xtarget=ultra2 -xildoff -xthreadvar=dynamic -L/usr/lib/lwp -R/usr/lib/lwp -DNDEBUG -I. -Iheaplayers -Iheaplayers/util -D_REENTRANT=1 -G -PIC libhoard.cpp heaplayers/util/sparc-interchange.il -o libhoard_64.so -lthread -ldl -lCrun
+
+SOLARIS_SUNW_x86_COMPILE_32 := CC -fns -fsimple=2 -ftrap=%none -xbuiltin=%all -mt -xO5 -fast -xildoff -xthreadvar=dynamic -L/usr/lib/lwp -R/usr/lib/lwp -DNDEBUG -I. -Iheaplayers -Iheaplayers/util -D_REENTRANT=1 -G -PIC libhoard.cpp heaplayers/util/x86-interchange.il -o libhoard_32.so -lthread -ldl -lCrun
+
+SOLARIS_SUNW_x86_COMPILE_32_DEBUG := CC -mt -g -xildoff -xthreadvar=dynamic -L/usr/lib/lwp -R/usr/lib/lwp -I. -Iheaplayers -Iheaplayers/util -D_REENTRANT=1 -G -PIC libhoard.cpp heaplayers/util/x86-interchange.il -o libhoard_32.so -lthread -ldl -lCrun
+
+SOLARIS_SUNW_x86_COMPILE_64 := CC -xarch=amd64 -fns -fsimple=2 -ftrap=%none -xbuiltin=%all -xO5 -xildoff -xthreadvar=dynamic -L/usr/lib/lwp -R/usr/lib/lwp -DNDEBUG -I. -Iheaplayers -Iheaplayers/util -D_REENTRANT=1 -G -PIC libhoard.cpp heaplayers/util/x86_64-interchange.il -o libhoard_64.so -lthread -ldl -lCrun
+
+SOLARIS_GCC_SPARC_COMPILE := g++ -nostartfiles -pipe -DNDEBUG -mcpu=ultrasparc -O3 -finline-limit=20000 -fPIC -fkeep-inline-functions -finline-functions -ffast-math -fomit-frame-pointer -I. -Iheaplayers -Iheaplayers/util -D_REENTRANT=1 -shared libhoard.cpp -lthread -lpthread -ldl -o libhoard.so
+
+SOLARIS_GCC_SPARC_COMPILE_DEBUG := g++ -nostartfiles -pipe -mcpu=ultrasparc -g -fPIC -I. -Iheaplayers -Iheaplayers/util -D_REENTRANT=1 -shared libhoard.cpp -lthread -lpthread -ldl -o libhoard.so
+
+GENERIC_GCC_COMPILE := g++ -I/usr/include/nptl  -malign-double -pipe -O3 -finline-limit=20000 -fomit-frame-pointer -finline-functions  -DNDEBUG  -I. -Iheaplayers -Iheaplayers/util -D_REENTRANT=1 -shared libhoard.cpp -Bsymbolic -o libhoard.so -ldl -lpthread
+
+DEPS = libhoard.cpp check.h fixedrequestheap.h hoardmanager.h addheaderheap.h semilockedheap.h alignedheap.h threadpoolheap.h redirectfree.h ignoreinvalidfree.h conformantheap.h hoardsuperblock.h lockmallocheap.h alignedsuperblockheap.h alignedmmap.h globalheap.h
+
+all:
+	@echo "To build Hoard, specify the desired build target:"
+
+	@echo " darwin"
+	@echo " freebsd"
+	@echo " linux-gcc-x86"
+	@echo " linux-gcc-x86-64"
+	@echo " solaris-sunw-sparc"
+	@echo " solaris-sunw-x86"
+	@echo " solaris-sunw-x86-64"
+	@echo " solaris-gcc-sparc"
+	@echo " generic-gcc"
+	@echo "  (for build instructions on Windows, see NOTES.Windows)"
+
+.PHONY: darwin freebsd linux-gcc-x86 linux-gcc-x86-debug solaris-sunw-sparc solaris-sunw-x86 solaris-gcc-sparc generic-gcc linux-gcc-x86-64 clean
+
+darwin:
+	$(DARWIN8_COMPILE)
+
+darwin-debug:
+	$(DARWIN8_COMPILE_DEBUG)
+
+freebsd:
+	$(FREEBSD_COMPILE)
+
+generic-gcc:
+	$(GENERIC_GCC_COMPILE)
+
+linux-gcc-x86:
+	$(LINUX_GCC_x86_COMPILE)
+
+linux-gcc-x86-static:
+	$(LINUX_GCC_x86_COMPILE_STATIC)
+
+linux-gcc-x86-debug:
+	$(LINUX_GCC_x86_COMPILE_DEBUG)
+
+linux-gcc-x86-64:
+	$(LINUX_GCC_x86_64_COMPILE)
+
+linux-gcc-x86-64-debug:
+	$(LINUX_GCC_x86_64_COMPILE_DEBUG)
+
+solaris-sunw-sparc-debug:
+	$(SOLARIS_SUNW_SPARC_COMPILE_32_DEBUG)
+
+solaris-sunw-sparc:
+	$(SOLARIS_SUNW_SPARC_COMPILE_32)
+	$(SOLARIS_SUNW_SPARC_COMPILE_64)
+
+solaris-gcc-sparc:
+	$(SOLARIS_GCC_SPARC_COMPILE)
+
+solaris-gcc-sparc-debug:
+	$(SOLARIS_GCC_SPARC_COMPILE_DEBUG)
+
+solaris-sunw-x86:
+	$(SOLARIS_SUNW_x86_COMPILE_32)
+
+solaris-sunw-x86-64:
+	$(SOLARIS_SUNW_x86_COMPILE_64)
+
+clean:
+	rm -f libhoard.so
+
+
Index: /proiecte/swift/trunk/lib/hoard-371/src/NOTES.Windows
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/NOTES.Windows	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/NOTES.Windows	(revision 176)
@@ -0,0 +1,26 @@
+There are two options for using Hoard with Windows,
+in decreasing order of preference:
+
+	(1) Use winhoard.dll
+	    (when you have all object files)
+
+	- Execute 'compile-winhoard.cmd'.
+	- Link your executable with 'usewinhoard.cpp' and 'winhoard.lib'.
+          You must use the /MD flag.
+
+	(2) Use libhoard.dll
+	    (when you have all sources)
+
+	- Execute the 'compile-dll.cmd' script.
+	- Link your executable with 'libhoard.lib'.
+	You must use the /MD flag.
+
+	- You may need to add the link command:
+	"/FORCE:MULTIPLE". This option forces a link even
+	when multiply defined symbols exist, which you'll need.
+
+	- Make sure that you dynamically link the executable (i.e., don't
+	generate a Multithreaded version, but rather Multithreaded DLL),
+        as in /MD. This linkage will ensure that you completely
+        replace every memory allocation call.
+
Index: /proiecte/swift/trunk/lib/hoard-371/src/VERSION.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/VERSION.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/VERSION.h	(revision 176)
@@ -0,0 +1,8 @@
+// Hoard version X.Y.0 = X0Y00
+
+#define HOARD_MAJOR 3
+#define HOARD_MINOR 7
+#define HOARD_PATCH 1
+
+#define HOARD_VERSION_STRING "3.7.1"
+#define HOARD_VERSION_NUMBER (HOARD_MAJOR * 10000 + HOARD_MINOR * 100 + HOARD_PATCH)
Index: /proiecte/swift/trunk/lib/hoard-371/src/addheaderheap.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/addheaderheap.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/addheaderheap.h	(revision 176)
@@ -0,0 +1,63 @@
+// -*- C++ -*-
+
+#ifndef _ADDHEADERHEAP_H_
+#define _ADDHEADERHEAP_H_
+
+#include "sassert.h"
+#include "hldefines.h"
+
+namespace Hoard {
+
+/**
+ * @class AddHeaderHeap
+ */
+
+template <class SuperblockType,
+	  size_t SuperblockSize,
+	  class SuperHeap>
+class AddHeaderHeap {
+private:
+
+  HL::sassert<(((int) SuperHeap::Alignment) % SuperblockSize == 0)> verifySize1;
+  HL::sassert<(((int) SuperHeap::Alignment) >= SuperblockSize)> verifySize2;
+
+  SuperHeap theHeap;
+
+public:
+
+  enum { Alignment = 0 };
+
+  MALLOC_FUNCTION INLINE void * malloc (size_t sz) {
+    // Allocate extra space for the header,
+    // put it at the front of the object,
+    // and return a pointer to just past it.
+    const size_t headerSize = sizeof(typename SuperblockType::Header);
+    void * ptr = theHeap.malloc (sz + headerSize);
+    if (ptr == NULL) {
+      return NULL;
+    }
+    typename SuperblockType::Header * p
+      = new (ptr) typename SuperblockType::Header (sz, sz);
+    assert ((size_t) (p + 1) == (size_t) ptr + headerSize);
+    return reinterpret_cast<void *>(p + 1);
+  }
+
+  INLINE static size_t getSize (void * ptr) {
+    // Find the header (just before the pointer) and return the size
+    // value stored there.
+    typename SuperblockType::Header * p;
+    p = reinterpret_cast<typename SuperblockType::Header *>(ptr);
+    return (p - 1)->getSize (ptr);
+  }
+
+  INLINE void free (void * ptr) {
+    // Find the header (just before the pointer) and free the whole object.
+    typename SuperblockType::Header * p;
+    p = reinterpret_cast<typename SuperblockType::Header *>(ptr);
+    theHeap.free (reinterpret_cast<void *>(p - 1));
+  }
+};
+
+};
+
+#endif
Index: /proiecte/swift/trunk/lib/hoard-371/src/alignedmmap.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/alignedmmap.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/alignedmmap.h	(revision 176)
@@ -0,0 +1,173 @@
+// -*- C++ -*-
+
+/**
+ * @file alignedmmap.h
+ * @author Emery Berger <http://www.cs.umass.edu/~emery>
+ */
+
+
+#ifndef _ALIGNEDMMAP_H_
+#define _ALIGNEDMMAP_H_
+
+#include "sassert.h"
+#include "myhashmap.h"
+#include "freelistheap.h"
+#include "mmapwrapper.h"
+#include "bumpalloc.h"
+#include "exactlyone.h"
+#include "mmapalloc.h"
+
+using namespace std;
+using namespace HL;
+
+namespace Hoard {
+
+/**
+ * @class AlignedMmapInstance
+ * @brief Memory allocated from here is aligned with respect to Alignment.
+ * @author Emery Berger <http://www.cs.umass.edu/~emery>
+ */
+
+
+template <size_t Alignment_>
+class AlignedMmapInstance {
+public:
+
+  enum { Alignment = Alignment_ };
+
+  inline void * malloc (size_t sz) {
+
+    // Round up sz to the nearest page.
+    sz = (sz + HL::MmapWrapper::Size - 1) & ~(HL::MmapWrapper::Size - 1);
+
+    // If the memory is already suitably aligned, just track size requests.
+    if ((size_t) HL::MmapWrapper::Alignment % (size_t) Alignment == 0) {
+      void * ptr = HL::MmapWrapper::map (sz);
+      MyMap.set (ptr, sz);
+      return ptr;
+    }
+
+    // Try a map call and hope that it's suitably aligned. If we get lucky,
+    // we're done.
+
+    char * ptr = reinterpret_cast<char *>(HL::MmapWrapper::map (sz));
+
+    if (ptr == align(ptr)) {
+      // We're done.
+      MyMap.set (ptr, sz);
+      return ptr;
+    } else {
+      // Try again.
+      HL::MmapWrapper::unmap ((void *) ptr, sz);
+    }
+
+    // We have to align it ourselves. We get memory from
+    // mmap, align a pointer in the space, and free the space before
+    // and after the aligned segment.
+
+    ptr = reinterpret_cast<char *>(HL::MmapWrapper::map (sz + Alignment_));
+
+    if (ptr == NULL) {
+      return NULL;
+    }
+
+    char * newptr = align (ptr);
+
+    // Unmap the part before (prolog) and after.
+
+    size_t prolog = (size_t) newptr - (size_t) ptr;
+
+    if (prolog > 0) {
+      // Get rid of the prolog.
+      HL::MmapWrapper::unmap (ptr, prolog);
+    }
+
+    size_t epilog = Alignment_ - prolog;
+    HL::MmapWrapper::unmap ((char *) newptr + sz, epilog);
+
+    // Now record the size associated with this pointer.
+
+    MyMap.set (newptr, sz);
+    return newptr;
+  }
+
+  inline void free (void * ptr) {
+
+    // Find the object. If we don't find it, we didn't allocate it.
+    // For now, just ignore such an invalid free...
+
+    size_t requestedSize = MyMap.get (ptr);
+
+    if (requestedSize == 0) {
+      return;
+    }
+
+    HL::MmapWrapper::unmap (ptr, requestedSize);
+
+    // Finally, undo the mapping.
+    MyMap.erase (ptr);
+
+    assert (MyMap.get (ptr) == 0);
+  }
+  
+  inline size_t getSize (void * ptr) {
+    return MyMap.get (ptr);
+  }
+
+
+private:
+
+  /// Round a pointer up to the next Alignment-rounded chunk.
+  inline static char * align (char * buf) {
+    return (char *)(((size_t) buf + (Alignment_-1)) & ~(Alignment_-1));
+  }
+
+  // Manage information in a map that uses a custom heap for
+  // allocation.
+
+  /// The key is an mmapped pointer.
+  typedef void * keyType;
+
+  /// The value is the requested size.
+  typedef size_t valType;
+
+  // The heap from which memory comes for the Map's purposes.
+  // Objects come from chunks via mmap, and we manage these with a free list.
+  class SourceHeap : public HL::FreelistHeap<BumpAlloc<65536, MmapAlloc> > { };
+
+  /// The map type, with all the pieces in place.
+  typedef MyHashMap<keyType, valType, SourceHeap> mapType;
+
+  /// The map that maintains the size of each mmapped chunk.
+  mapType MyMap;
+
+};
+
+
+/**
+ * @class AlignedMmap
+ * @brief Route requests to the one aligned mmap instance.
+ * @author Emery Berger <http://www.cs.umass.edu/~emery>
+ */
+
+template <size_t Alignment_>
+class AlignedMmap : public ExactlyOne<AlignedMmapInstance<Alignment_> > {
+public:
+
+  enum { Alignment = Alignment_ };
+
+  inline void * malloc (size_t sz) {
+    return (*this)().malloc (sz);
+  }
+  inline void free (void * ptr) {
+    return (*this)().free (ptr);
+  }
+  inline size_t getSize (void * ptr) const {
+    return (*this)().getSize (ptr);
+  }
+ 
+};
+
+};
+
+#endif
Index: /proiecte/swift/trunk/lib/hoard-371/src/alignedsuperblockheap.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/alignedsuperblockheap.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/alignedsuperblockheap.h	(revision 176)
@@ -0,0 +1,85 @@
+// -*- C++ -*-
+
+#ifndef _ALIGNEDSUPERBLOCKHEAP_H_
+#define _ALIGNEDSUPERBLOCKHEAP_H_
+
+#include "mmapheap.h"
+#include "sassert.h"
+
+#include "conformantheap.h"
+#include "lockedheap.h"
+#include "fixedrequestheap.h"
+#include "dllist.h"
+
+// Always requests aligned superblocks.
+#include "alignedmmap.h"
+
+namespace Hoard {
+
+template <size_t SuperblockSize>
+class SuperblockStore {
+public:
+
+  enum { Alignment = AlignedMmap<SuperblockSize>::Alignment };
+
+  void * malloc (size_t sz) {
+    sz = sz; // to avoid warning.
+    assert (sz == SuperblockSize);
+    if (_freeSuperblocks.isEmpty()) {
+      // Get more memory.
+      void * ptr = _superblockSource.malloc (ChunksToGrab * SuperblockSize);
+      if (!ptr) {
+	return NULL;
+      }
+      char * p = (char *) ptr;
+      for (int i = 0; i < ChunksToGrab; i++) {
+	_freeSuperblocks.insert ((DLList::Entry *) p);
+	p += SuperblockSize;
+      }
+    }
+    return _freeSuperblocks.get();
+  }
+
+  void free (void * ptr) {
+    _freeSuperblocks.insert ((DLList::Entry *) ptr);
+  }
+
+private:
+
+#if defined(__SVR4)
+  enum { ChunksToGrab = 63 };
+#else
+  enum { ChunksToGrab = 1 };
+#endif
+
+  AlignedMmap<SuperblockSize> _superblockSource;
+  DLList _freeSuperblocks;
+
+};
+
+}
+
+
+namespace Hoard {
+
+template <class TheLockType,
+	  size_t SuperblockSize>
+class AlignedSuperblockHeapHelper :
+  public ConformantHeap<HL::LockedHeap<TheLockType,
+				       FixedRequestHeap<SuperblockSize, 
+							// AlignedMmap<SuperblockSize> > > > {};
+				       SuperblockStore<SuperblockSize> > > > {};
+
+
+template <class TheLockType,
+	  size_t SuperblockSize>
+class AlignedSuperblockHeap :
+  public AlignedSuperblockHeapHelper<TheLockType, SuperblockSize> {
+
+  HL::sassert<(AlignedSuperblockHeapHelper<TheLockType, SuperblockSize>::Alignment % SuperblockSize == 0)> EnsureProperAlignment;
+
+};
+
+};
+
+#endif
Index: /proiecte/swift/trunk/lib/hoard-371/src/array.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/array.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/array.h	(revision 176)
@@ -0,0 +1,59 @@
+// -*- C++ -*-
+
+#ifndef _ARRAY_H_
+#define _ARRAY_H_
+
+/*
+
+  Heap Layers: An Extensible Memory Allocation Infrastructure
+  
+  Copyright (C) 2000-2003 by Emery Berger
+  http://www.cs.umass.edu/~emery
+  emery@cs.umass.edu
+  
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or
+  (at your option) any later version.
+  
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+  
+  You should have received a copy of the GNU General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+*/
+
+#include <assert.h>
+
+namespace Hoard {
+
+template <int N, typename T>
+class Array {
+public:
+
+  inline T& operator()(int index) {
+    assert (index >= 0);
+    assert (index < N);
+    return _item[index];
+  }
+
+  inline const T& operator()(int index) const {
+    assert (index >= 0);
+    assert (index < N);
+    return _item[index];
+  }
+
+private:
+
+  T _item[N];
+
+};
+
+}
+
+
+#endif
Index: /proiecte/swift/trunk/lib/hoard-371/src/basehoardmanager.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/basehoardmanager.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/basehoardmanager.h	(revision 176)
@@ -0,0 +1,65 @@
+// -*- C++ -*-
+
+#ifndef _BASEHOARDMANAGER_H_
+#define _BASEHOARDMANAGER_H_
+
+/**
+ * @class BaseHoardManager
+ * @brief The top of the hoard manager hierarchy.
+ *
+ */
+
+#include "sassert.h"
+
+template <class SuperblockType_>
+class BaseHoardManager {
+public:
+
+  BaseHoardManager (void)
+    : _magic (0xedded00d)
+  {}
+
+  virtual ~BaseHoardManager (void)
+  {}
+
+  inline int isValid (void) const {
+    return (_magic == 0xedded00d);
+  }
+
+  // Export the superblock type.
+  typedef SuperblockType_ SuperblockType;
+
+  /// Free an object.
+  inline virtual void free (void *) {}
+
+  /// Lock this memory manager.
+  inline virtual void lock (void) {}
+
+  /// Unlock this memory manager.
+  inline virtual void unlock (void) {};
+
+  /// Return the size of an object.
+  static inline size_t getSize (void * ptr) {
+    SuperblockType * s = getSuperblock (ptr);
+    assert (s->isValidSuperblock());
+    return s->getSize (ptr);
+  }
+
+  /// @brief Find the superblock corresponding to a pointer via bitmasking.
+  /// @note  All superblocks <em>must</em> be naturally aligned, and powers of two.
+
+  static inline SuperblockType * getSuperblock (void * ptr) {
+    return SuperblockType::getSuperblock (ptr);
+  }
+
+private:
+
+  enum { SuperblockSize = sizeof(SuperblockType) };
+
+  HL::sassert<((SuperblockSize & (SuperblockSize - 1)) == 0)> EnsureSuperblockSizeIsPowerOfTwo;
+
+  const unsigned long _magic;
+
+};
+
+#endif
Index: /proiecte/swift/trunk/lib/hoard-371/src/bumpalloc.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/bumpalloc.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/bumpalloc.h	(revision 176)
@@ -0,0 +1,58 @@
+#ifndef _BUMPALLOC_H_
+#define _BUMPALLOC_H_
+
+/**
+ * @class BumpAlloc
+ * @brief Obtains memory in chunks and bumps a pointer through the chunks.
+ * @author Emery Berger <http://www.cs.umass.edu/~emery>
+ */
+
+namespace Hoard {
+
+template <int ChunkSize,
+	  class super>
+class BumpAlloc : public super {
+public:
+
+  BumpAlloc (void)
+    : _bump (NULL),
+      _remaining (0)
+  {}
+
+  inline void * malloc (size_t sz) {
+    // If there's not enough space left to fulfill this request, get
+    // another chunk.
+    if (_remaining < sz) {
+      refill(sz);
+    }
+    char * old = _bump;
+    _bump += sz;
+    _remaining -= sz;
+    return old;
+  }
+
+  /// Free is disabled (we only bump, never reclaim).
+  inline void free (void *) {}
+
+private:
+
+  /// The bump pointer.
+  char * _bump;
+
+  /// How much space remains in the current chunk.
+  size_t _remaining;
+
+  // Get another chunk.
+  void refill (size_t sz) {
+    if (sz < ChunkSize) {
+      sz = ChunkSize;
+    }
+    _bump = (char *) super::malloc (sz);
+    _remaining = sz;
+  }
+
+};
+
+};
+
+#endif
Index: /proiecte/swift/trunk/lib/hoard-371/src/check.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/check.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/check.h	(revision 176)
@@ -0,0 +1,36 @@
+// -*- C++ -*-
+
+#ifndef _CHECK_H_
+#define _CHECK_H_
+
+template <class TYPE, class CHECK>
+class Check {
+public:
+  Check (TYPE * t)
+#ifndef NDEBUG
+    : _object (t)
+#endif
+  {
+    t = t; // avoid warning
+#ifndef NDEBUG
+    CHECK::precondition (_object);
+#endif
+  }
+
+  ~Check (void) {
+#ifndef NDEBUG
+    CHECK::postcondition (_object);
+#endif
+  }
+
+private:
+  Check (const Check&);
+  Check& operator=(const Check&);
+
+#ifndef NDEBUG
+  TYPE * _object;
+#endif
+
+};
+
+#endif
Index: /proiecte/swift/trunk/lib/hoard-371/src/compile-dll.cmd
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/compile-dll.cmd	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/compile-dll.cmd	(revision 176)
@@ -0,0 +1,17 @@
+@echo off
+echo Building libhoard.dll and libhoard.lib (ignore linker warnings).
+: We need to execute this if we change libhoard.cpp.
+@echo off
+cl /Iheaplayers /Iheaplayers/util /c /Zi /DNDEBUG /MD /Ox /Zp8 /Oy libhoard.cpp
+nm -g libhoard.obj > @@@.@@@ 2>NUL
+grep ' T ?' @@@.@@@ > @@@.@@1 2>NUL
+grep ' T \_' @@@.@@@ > @@@.@@2 2>NUL
+echo EXPORTS > libhoard.def
+sed 's/.* T //' @@@.@@1 | grep -v DllMain >> libhoard.def 2>NUL
+sed 's/.* T \_//' @@@.@@2 | grep -v DllMain >> libhoard.def 2>NUL
+erase @@@.@@@
+erase @@@.@@1
+erase @@@.@@2
+cl /Iheaplayers /Iheaplayers/util /c /MD /DNDEBUG /Ox /Zp8 /Oy libhoard.cpp
+cl /Zi /LD libhoard.obj /o libhoard.dll /Ox /link /def:libhoard.def /force:multiple /subsystem:console /entry:_DllMainCRTStartup@12
+ 
Index: /proiecte/swift/trunk/lib/hoard-371/src/compile-winhoard.cmd
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/compile-winhoard.cmd	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/compile-winhoard.cmd	(revision 176)
@@ -0,0 +1,8 @@
+@echo off
+echo Building winhoard.dll.
+cl /MD /Iheaplayers /Iheaplayers/util /nologo /Ob2 /Ox /Oy /DNDEBUG /D_MT /c winhoard.cpp
+cl /MD /Iheaplayers /Iheaplayers/util /nologo /Ob2 /Ox /Oy /DNDEBUG /D_MT /c usewinhoard.cpp
+cl /LD winhoard.obj /link /base:0x63000000 kernel32.lib msvcrt.lib /subsystem:console /dll /incremental:no /entry:HoardDllMain
+echo *****
+echo Build complete.
+
Index: /proiecte/swift/trunk/lib/hoard-371/src/conformantheap.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/conformantheap.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/conformantheap.h	(revision 176)
@@ -0,0 +1,16 @@
+#ifndef _CONFORMANTHEAP_H_
+#define _CONFORMANTHEAP_H_
+
+namespace Hoard {
+
+// more concise than double declarations when the parent is complex
+// and we need the SuperHeap declaration.
+template <class Parent>
+class ConformantHeap : public Parent {
+public:
+  typedef Parent SuperHeap;
+};
+
+}
+
+#endif
Index: /proiecte/swift/trunk/lib/hoard-371/src/emptyclass.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/emptyclass.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/emptyclass.h	(revision 176)
@@ -0,0 +1,245 @@
+// -*- C++ -*-
+
+#ifndef _EMPTYCLASS_H_
+#define _EMPTYCLASS_H_
+
+#include <stdio.h> // for stderr
+#include "check.h"
+#include "array.h"
+#include "hldefines.h"
+
+/**
+ * @class EmptyClass
+ * @brief Maintains superblocks organized by emptiness.
+ */
+
+namespace Hoard {
+
+template <class SuperblockType_,
+	  int EmptinessClasses>
+class EmptyClass {
+
+  enum { SuperblockSize = sizeof(SuperblockType_) };
+
+public:
+
+  typedef SuperblockType_ SuperblockType;
+
+  EmptyClass (void)
+  {
+    for (int i = 0; i <= EmptinessClasses + 1; i++) {
+      _available(i) = 0;
+    }
+  }
+
+  void dumpStats (void) {
+    for (int i = 0; i <= EmptinessClasses + 1; i++) {
+      SuperblockType * s = _available(i);
+      if (s) {
+	fprintf (stderr, "EmptyClass: emptiness class = %d\n", i);
+	while (s) {
+	  s->dumpStats();
+	  s = s->getNext();
+	}
+      }
+    }
+  }
+
+
+  SuperblockType * getEmpty (void) {
+    Check<EmptyClass, MyChecker> check (this);
+    SuperblockType * s = _available(0);
+    if (s && 
+	(s->getObjectsFree() == s->getTotalObjects())) {
+      // Got an empty one. Remove it.
+      _available(0) = s->getNext();
+      if (_available(0)) {
+	_available(0)->setPrev (0);
+      }
+      s->setPrev (0);
+      s->setNext (0);
+      return s;
+    }
+    return 0;
+  }
+
+  SuperblockType * get (void) {
+    Check<EmptyClass, MyChecker> check (this);
+    // Return as empty a superblock as possible
+    // by iterating from the emptiest to the fullest available class.
+    for (int n = 0; n < EmptinessClasses + 1; n++) {
+      SuperblockType * s = _available(n);
+      while (s) {
+	assert (s->isValidSuperblock());
+	// Got one. Remove it.
+	_available(n) = s->getNext();
+	if (_available(n)) {
+	  _available(n)->setPrev (0);
+	}
+	s->setPrev (0);
+	s->setNext (0);
+
+#ifndef NDEBUG
+	// Verify that this superblock is *gone* from the lists.
+	for (int z = 0; z < EmptinessClasses + 1; z++) {
+	  SuperblockType * p = _available(z);
+	  while (p) {
+	    assert (p != s);
+	    p = p->getNext();
+	  }
+	}
+#endif
+
+	// Ensure that we return a superblock that is as free as
+	// possible.
+	int cl = getFullness (s);
+	if (cl > n) {
+	  put (s);
+	  SuperblockType * sNew = _available(n);
+	  assert (s != sNew);
+	  s = sNew;
+	} else {
+	  return s;
+	}
+      }
+    }
+    return 0;
+  }
+
+  void put (SuperblockType * s) {
+    Check<EmptyClass, MyChecker> check (this);
+
+#ifndef NDEBUG
+    // Check to verify that this superblock is not already on one of the lists.
+    for (int n = 0; n <= EmptinessClasses + 1; n++) {
+      SuperblockType * p = _available(n);
+      while (p) {
+	assert (p != s);
+	p = p->getNext();
+      }
+    }
+#endif
+
+    // Put on the appropriate available list.
+    int cl = getFullness (s);
+
+    //    printf ("put %x, cl = %d\n", s, cl);
+    s->setPrev (0);
+    s->setNext (_available(cl));
+    if (_available(cl)) {
+      _available(cl)->setPrev (s);
+    }
+    _available(cl) = s;
+  }
+
+  INLINE MALLOC_FUNCTION void * malloc (size_t sz) {
+    // Malloc from the fullest superblock first.
+    for (int i = EmptinessClasses; i >= 0; i--) {
+      SuperblockType * s = _available(i);
+      // printf ("i\n");
+      if (s) {
+	int oldCl = getFullness (s);
+	void * ptr = s->malloc (sz);
+	int newCl = getFullness (s);
+	if (ptr) {
+	  if (oldCl != newCl) {
+	    transfer (s, oldCl, newCl);
+	  }
+	  return ptr;
+	}
+      }
+    }
+    return NULL;
+  }
+
+  INLINE void free (void * ptr) {
+    Check<EmptyClass, MyChecker> check (this);
+    SuperblockType * s = getSuperblock (ptr);
+    int oldCl = getFullness (s);
+    s->free (ptr);
+    int newCl = getFullness (s);
+
+    if (oldCl != newCl) {
+      // Transfer.
+      transfer (s, oldCl, newCl);
+    }
+  }
+
+  /// Find the superblock (by bit-masking) that holds a given pointer.
+  static INLINE SuperblockType * getSuperblock (void * ptr) {
+    return SuperblockType::getSuperblock (ptr);
+  }
+
+private:
+
+  void transfer (SuperblockType * s, int oldCl, int newCl)
+  {
+    SuperblockType * prev = s->getPrev();
+    SuperblockType * next = s->getNext();
+    if (prev) { prev->setNext (next); }
+    if (next) { next->setPrev (prev); }
+    if (s == _available(oldCl)) {
+      assert (prev == 0);
+      _available(oldCl) = next;
+    }
+    s->setNext (_available(newCl));
+    s->setPrev (0);
+    if (_available(newCl)) { _available(newCl)->setPrev (s); }
+    _available(newCl) = s;
+  }
+
+  static INLINE int getFullness (SuperblockType * s) {
+    // Completely full = EmptinessClasses + 1
+    // Completely empty (all available) = 0
+    int total = s->getTotalObjects();
+    int free = s->getObjectsFree();
+    if (total == free) {
+      return 0;
+    } else {
+      return 1 + (EmptinessClasses * (total - free)) / total;
+    }
+  }
+
+  /// Forward declarations for the sanity checker.
+  /// @sa Check
+  class MyChecker;
+  friend class MyChecker;
+
+  /// Precondition and postcondition checking.
+  class MyChecker {
+  public:
+#ifndef NDEBUG
+    static void precondition (EmptyClass * e) {
+      e->sanityCheckPre();
+    }
+    static void postcondition (EmptyClass * e) {
+      e->sanityCheck();
+    }
+#else
+    static void precondition (EmptyClass *) {}
+    static void postcondition (EmptyClass *) {}
+#endif
+  };
+
+  void sanityCheckPre (void) { sanityCheck(); }
+
+  void sanityCheck (void) {
+    for (int i = 0; i <= EmptinessClasses + 1; i++) {
+      SuperblockType * s = _available(i);
+      while (s) {
+	assert (getFullness(s) == i);
+	s = s->getNext();
+      }
+    }
+  }
+
+  /// The bins of superblocks, by emptiness class.
+  /// @note index 0 = completely empty, EmptinessClasses + 1 = full
+  Array<EmptinessClasses + 2, SuperblockType *> _available;
+
+};
+
+}
+
+
+#endif
Index: /proiecte/swift/trunk/lib/hoard-371/src/emptyhoardmanager.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/emptyhoardmanager.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/emptyhoardmanager.h	(revision 176)
@@ -0,0 +1,39 @@
+#ifndef _EMPTYHOARDMANAGER_H_
+#define _EMPTYHOARDMANAGER_H_
+
+#include "basehoardmanager.h"
+#include "sassert.h"
+
+template <class SuperblockType_>
+class EmptyHoardManager : public BaseHoardManager<SuperblockType_> {
+public:
+
+  EmptyHoardManager (void)
+    : _magic (0x1d2d3d40)
+    {}
+
+  int isValid (void) const {
+    return (_magic == 0x1d2d3d40);
+  }
+
+  typedef SuperblockType_ SuperblockType;
+
+  void free (void *) { abort(); }
+  void lock (void) {}
+  void unlock (void) {}
+
+  SuperblockType * get (size_t, EmptyHoardManager *) { abort(); return NULL; }
+  void put (SuperblockType *, size_t) { abort(); }
+
+#if 0
+  void * malloc (size_t) { return NULL; }
+#endif
+
+private:
+
+  unsigned long _magic;
+
+};
+
+
+#endif
Index: /proiecte/swift/trunk/lib/hoard-371/src/exactlyone.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/exactlyone.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/exactlyone.h	(revision 176)
@@ -0,0 +1,26 @@
+#ifndef _EXACTLYONE_H_
+#define _EXACTLYONE_H_
+
+/**
+ * @class ExactlyOne
+ * @brief Creates a singleton of type CLASS, accessed through ().
+ * @author Emery Berger <http://www.cs.umass.edu/~emery>
+ */
+
+namespace Hoard {
+
+template <class CLASS>
+class ExactlyOne {
+public:
+  
+  inline CLASS& operator() (void) {
+    static CLASS theOneTrueInstance;
+    return theOneTrueInstance;
+  }
+
+};
+
+};
+
+#endif
+
Index: /proiecte/swift/trunk/lib/hoard-371/src/filter.cmd
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/filter.cmd	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/filter.cmd	(revision 176)
@@ -0,0 +1,11 @@
+REM filter.cmd
+@echo off
+nm -g libhoard.obj > @@@.@@@ 2>NUL
+grep ' T ?' @@@.@@@ > @@@.@@1 2>NUL
+grep ' T \_' @@@.@@@ > @@@.@@2 2>NUL
+echo EXPORTS > %1
+sed 's/.* T //' @@@.@@1 | grep -v DllMain >> %1 2>NUL
+sed 's/.* T \_//' @@@.@@2 | grep -v DllMain >> %1 2>NUL
+erase @@@.@@@
+erase @@@.@@1
+erase @@@.@@2
Index: /proiecte/swift/trunk/lib/hoard-371/src/fixedrequestheap.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/fixedrequestheap.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/fixedrequestheap.h	(revision 176)
@@ -0,0 +1,25 @@
+#ifndef _FIXEDREQUESTHEAP_H_
+#define _FIXEDREQUESTHEAP_H_
+
+/**
+ * @class FixedRequestHeap
+ * @brief Always grabs the same size, regardless of the request size.
+ */
+
+namespace Hoard {
+
+template <size_t RequestSize,
+	  class SuperHeap>
+class FixedRequestHeap : public SuperHeap {
+public:
+  inline void * malloc (size_t) {
+    return SuperHeap::malloc (RequestSize);
+  }
+  inline static size_t getSize (void *) {
+    return RequestSize;
+  }
+};
+
+}
+
+#endif
Index: /proiecte/swift/trunk/lib/hoard-371/src/globalheap.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/globalheap.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/globalheap.h	(revision 176)
@@ -0,0 +1,67 @@
+#ifndef _GLOBALHEAP_H_
+#define _GLOBALHEAP_H_
+
+#include "hoardsuperblock.h"
+#include "processheap.h"
+
+namespace Hoard {
+
+template <size_t SuperblockSize,
+	  int EmptinessClasses,
+	  class LockType>
+class GlobalHeap {
+  
+  class bogusThresholdFunctionClass {
+  public:
+    static inline bool function (int, int, size_t) {
+      // We *never* cross the threshold for a process heap.
+      return false;
+    }
+  };
+  
+public:
+
+  GlobalHeap (void) 
+    : theHeap (getHeap())
+    {
+    }
+  
+  typedef ProcessHeap<SuperblockSize, EmptinessClasses, LockType, bogusThresholdFunctionClass> SuperHeap;
+  typedef HoardSuperblock<LockType, SuperblockSize, GlobalHeap> SuperblockType;
+
+  void put (void * s, size_t sz) {
+    assert (s);
+    assert (((SuperblockType *) s)->isValidSuperblock());
+    theHeap->put ((typename SuperHeap::SuperblockType *) s,
+		  sz);
+  }
+
+  SuperblockType * get (size_t sz, void * dest) {
+    SuperblockType * s = 
+      reinterpret_cast<SuperblockType *>
+      (theHeap->get (sz, reinterpret_cast<SuperHeap *>(dest)));
+    if (s) {
+      assert (s->isValidSuperblock());
+    }
+    return s;
+  }
+
+private:
+
+  SuperHeap * theHeap;
+
+  inline static SuperHeap * getHeap (void) {
+    static double theHeapBuf[sizeof(SuperHeap) / sizeof(double) + 1];
+    static SuperHeap * theHeap = new (&theHeapBuf[0]) SuperHeap;
+    return theHeap;
+  }
+
+  // Prevent copying.
+  GlobalHeap (const GlobalHeap&);
+  GlobalHeap& operator=(const GlobalHeap&);
+
+};
+
+};
+
+#endif
Index: /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/adapt.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/adapt.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/adapt.h	(revision 176)
@@ -0,0 +1,82 @@
+// -*- C++ -*-
+
+/*
+
+  Heap Layers: An Extensible Memory Allocation Infrastructure
+  
+  Copyright (C) 2000-2003 by Emery Berger
+  http://www.cs.umass.edu/~emery
+  emery@cs.umass.edu
+  
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or
+  (at your option) any later version.
+  
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+  
+  You should have received a copy of the GNU General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+*/
+
+
+#ifndef _ADAPT_H_
+#define _ADAPT_H_
+
+/**
+ * @class AdaptHeap
+ * @brief Maintains dictionary entries through freed objects.
+ * Sample dictionaries include DLList and SLList.
+ */
+
+namespace HL {
+
+  template <class Dictionary, class SuperHeap>
+  class AdaptHeap : public SuperHeap {
+  public:
+
+    /// Allocate an object (remove from the dictionary).
+    inline void * malloc (const size_t) {
+      void * ptr = (Entry *) dict.get();
+      return ptr;
+    }
+
+    /// Deallocate the object (return to the dictionary).
+    inline void free (void * ptr) {
+      Entry * entry = (Entry *) ptr;
+      dict.insert (entry);
+    }
+
+    /// Remove an object from the dictionary.
+    inline int remove (void * ptr) {
+      dict.remove ((Entry *) ptr);
+      return 1;
+    }
+
+    /// Clear the dictionary.
+    inline void clear (void) {
+      Entry * ptr;
+      while ((ptr = (Entry *) dict.get()) != NULL) {
+	SuperHeap::free (ptr);
+      }
+      dict.clear();
+      SuperHeap::clear();
+    }
+
+
+  private:
+
+    /// The dictionary object.
+    Dictionary dict;
+
+    class Entry : public Dictionary::Entry {};
+  };
+
+}
+
+#endif // _ADAPT_H_
Index: /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/addheap.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/addheap.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/addheap.h	(revision 176)
@@ -0,0 +1,59 @@
+/* -*- C++ -*- */
+
+#ifndef _ADDHEAP_H_
+#define _ADDHEAP_H_
+
+/*
+
+  Heap Layers: An Extensible Memory Allocation Infrastructure
+  
+  Copyright (C) 2000-2003 by Emery Berger
+  http://www.cs.umass.edu/~emery
+  emery@cs.umass.edu
+  
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or
+  (at your option) any later version.
+  
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+  
+  You should have received a copy of the GNU General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+*/
+
+// Reserve space for a class in the head of every allocated object.
+
+#include <assert.h>
+
+namespace HL {
+
+template <class Add, class Super>
+class AddHeap : public Super {
+public:
+  
+  inline void * malloc (size_t sz) {
+	void * ptr = Super::malloc (sz + align(sizeof(Add)));
+	void * newPtr = (void *) align ((size_t) ((Add *) ptr + 1));
+	return ptr;
+  }
+
+  inline void free (void * ptr) {
+	void * origPtr = (void *) ((Add *) ptr - 1);
+	Super::free (origPtr);
+  }
+  
+private:
+	static inline size_t align (size_t sz) {
+		return (sz + (sizeof(double) - 1)) & ~(sizeof(double) - 1);
+	}
+
+};
+
+};
+#endif
Index: /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/ansiwrapper.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/ansiwrapper.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/ansiwrapper.h	(revision 176)
@@ -0,0 +1,99 @@
+/* -*- C++ -*- */
+
+#ifndef _ANSIWRAPPER_H_
+#define _ANSIWRAPPER_H_
+
+#include <stdlib.h>
+#include <string.h>
+
+/*
+ * @class ANSIWrapper
+ * @brief Provide ANSI C behavior for malloc & free.
+ *
+ * Implements all prescribed ANSI behavior, including zero-sized
+ * requests & aligned request sizes to a double word (or long word).
+ */
+
+
+namespace HL {
+
+template <class SuperHeap>
+class ANSIWrapper : public SuperHeap {
+public:
+  
+  ANSIWrapper (void)
+    {}
+
+  inline void * malloc (size_t sz) {
+    if (sz < 2 * sizeof(size_t)) {
+      // Make sure it's at least big enough to hold two pointers (and
+      // conveniently enough, that's at least the size of a double, as
+      // required by ANSI).
+      sz = 2 * sizeof(size_t);
+    }
+    sz = align(sz);
+    void * ptr = SuperHeap::malloc (sz);
+    return ptr;
+  }
+ 
+  inline void free (void * ptr) {
+    if (ptr != 0) {
+      SuperHeap::free (ptr);
+    }
+  }
+
+  inline void * calloc (const size_t s1, const size_t s2) {
+    void * ptr = malloc (s1 * s2);
+    if (ptr) {
+      memset (ptr, 0, s1 * s2);
+    }
+    return ptr;
+  }
+  
+  inline void * realloc (void * ptr, const size_t sz) {
+    if (ptr == 0) {
+      return malloc (sz);
+    }
+    if (sz == 0) {
+      free (ptr);
+      return 0;
+    }
+
+    size_t objSize = getSize (ptr);
+    if (objSize == sz) {
+      return ptr;
+    }
+
+    // Allocate a new block of size sz.
+    void * buf = malloc (sz);
+
+    // Copy the contents of the original object
+    // up to the size of the new block.
+
+    size_t minSize = (objSize < sz) ? objSize : sz;
+    if (buf) {
+      memcpy (buf, ptr, minSize);
+    }
+
+    // Free the old block.
+    free (ptr);
+    return buf;
+  }
+  
+  inline size_t getSize (void * ptr) {
+    if (ptr) {
+      return SuperHeap::getSize (ptr);
+    } else {
+      return 0;
+    }
+  }
+
+private:
+  inline static size_t align (size_t sz) {
+    return (sz + (sizeof(double) - 1)) & ~(sizeof(double) - 1);
+  }
+};
+
+}
+
+#endif
Index: /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/bins.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/bins.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/bins.h	(revision 176)
@@ -0,0 +1,12 @@
+#ifndef _BINS_H_
+#define _BINS_H_
+
+namespace HL {
+
+  template <class Header, int Size>
+    class bins;
+
+}
+
+
+#endif
Index: /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/bins16k.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/bins16k.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/bins16k.h	(revision 176)
@@ -0,0 +1,56 @@
+// -*- C++ -*-
+
+#if !defined(_BINS16K_H_)
+#define _BINS16K_H_
+
+#include <stdlib.h>
+#include <assert.h>
+
+#include "bins.h"
+#include "sassert.h"
+
+namespace HL {
+
+template <class Header>
+class bins<Header, 16384> {
+public:
+
+  bins (void)
+  {
+  }
+
+  enum { NUM_BINS = 24 };
+  enum { NUM_SIZECLASSES = 2044 };
+
+  enum { BIG_OBJECT = 16384 - sizeof(Header) };
+  
+  static const size_t _bins[NUM_BINS];
+  static const int _sizeclasses[NUM_SIZECLASSES];
+
+  static inline int getSizeClass (size_t sz) {
+    assert (sz <= BIG_OBJECT);
+    const int ind = (sz - 1) >> 3;
+    return _sizeclasses[ind];
+  }
+
+  static inline size_t getClassSize (const int i) {
+    assert (i >= 0);
+    assert (i < NUM_BINS);
+    return _bins[i];
+  }
+
+private:
+
+  sassert<(BIG_OBJECT > 0)> verifyHeaderSize;
+
+};
+
+}
+
+template <class Header>
+const size_t HL::bins<Header, 16384>::_bins[NUM_BINS] = { 8, 16, 24, 32, 40, 56, 80, 112, 160, 224, 320, 456, 648, 920, 1312, 1864, 2656, 3784, 5392, 5448, 7760, 8176, 11648, 16384 - sizeof(Header) };
+
+template <class Header>
+const int HL::bins<Header, 16384>::_sizeclasses[NUM_SIZECLASSES] = { 0, 1, 2, 3, 4, 5, 5, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19, 19, 19, 19, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23 };
+
+#endif
Index: /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/bins4k.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/bins4k.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/bins4k.h	(revision 176)
@@ -0,0 +1,62 @@
+// -*- C++ -*-
+
+#if !defined(_BINS4K_H_)
+#define _BINS4K_H_
+
+#include "bins.h"
+#include "sassert.h"
+
+namespace HL {
+
+  template <class Header>
+    class bins<Header, 4096> { 
+
+    public:
+      bins (void) {}
+
+      enum { NUM_BINS = 33 };
+      enum { BIG_OBJECT = 4096 - sizeof(Header) };
+
+      static const size_t _bins[NUM_BINS];
+
+      static inline int getSizeClass (size_t sz) {
+	assert (sz <= BIG_OBJECT);
+	if (sz < 8) {
+	  return 0;
+	} else if (sz <= 128) {
+	  return ((sz + 7) >> 3) - 1;
+	} else {
+	  return slowLookupSizeClass (sz);
+	}
+      }
+
+      static inline size_t getClassSize (const int i) {
+	assert (i >= 0);
+	assert (i < NUM_BINS);
+	return _bins[i];
+      }
+
+    private:
+      
+      static int slowLookupSizeClass (const size_t sz) {
+	// Find the size class for a given object size
+	// (the smallest i such that _bins[i] >= sz).
+	int sizeclass = 0;
+	while (_bins[sizeclass] < sz) 
+	  {
+	    sizeclass++;
+	    assert (sizeclass < NUM_BINS);
+	  }
+	return sizeclass;
+      }
+      
+      sassert<(BIG_OBJECT > 0)> verifyHeaderSize;
+      
+    };
+}
+
+template <class Header>
+const size_t HL::bins<Header, 4096>::_bins[NUM_BINS] = {8UL, 16UL, 24UL, 32UL, 40UL, 48UL, 56UL, 64UL, 72UL, 80UL, 88UL, 96UL, 104UL, 112UL, 120UL, 128UL, 152UL, 176UL, 208UL, 248UL, 296UL, 352UL, 416UL, 496UL, 592UL, 704UL, 856UL, 1024UL, 1224UL, 1712UL, 2048UL, 3416UL, 4096UL - sizeof(Header)};
+
+#endif
+
Index: /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/bins64k.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/bins64k.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/bins64k.h	(revision 176)
@@ -0,0 +1,80 @@
+// -*- C++ -*-
+
+#if !defined(_BINS64K_H_)
+#define _BINS64K_H_
+
+#include <stdlib.h>
+#include <assert.h>
+
+#include "bins.h"
+#include "sassert.h"
+
+namespace HL {
+
+template <class Header>
+class bins<Header, 65536> {
+public:
+
+  bins (void)
+  {
+#ifndef NDEBUG
+    for (int i = sizeof(double); i < BIG_OBJECT; i++) {
+      int sc = getSizeClass(i);
+      assert (getClassSize(sc) >= i);
+      assert (getClassSize(sc-1) < i);
+      assert (getSizeClass(getClassSize(sc)) == sc);
+    }
+#endif
+  }
+
+  enum { BIG_OBJECT = 65536 / 2 - sizeof(Header) };
+  
+  enum { NUM_BINS = 55,
+	 NUM_LOOKUP = 508 };
+
+  static const size_t _bins[NUM_BINS];
+  static const int    _sizeclasses[NUM_LOOKUP];
+
+  static inline int getSizeClass (size_t sz) {
+    assert (sz <= BIG_OBJECT);
+    sz = (sz < sizeof(double)) ? sizeof(double) : sz;
+    if (sz <= 80) {
+      return (sz - 1) >> 3;
+    } else {
+      return slowGetSizeClass (sz);
+    }
+  }
+
+  static inline size_t getClassSize (const int i) {
+    assert (i >= 0);
+    assert (i < NUM_BINS);
+    assert (getSizeClass(_bins[i]) == i);
+    return _bins[i];
+  }
+
+private:
+
+  static inline size_t slowGetSizeClass (size_t sz) {
+    int ind = 0;
+    while (sz > _bins[ind]) {
+      ind++;
+      assert (ind < NUM_BINS);
+    }
+    return ind;
+  }
+
+  sassert<(BIG_OBJECT > 0)> verifyHeaderSize;
+};
+
+}
+
+
+template <class Header>
+const size_t HL::bins<Header, 65536>::_bins[NUM_BINS] =
+  { 8, 16, 24, 32, 40, 48, 56, 64, 72, 80, 96, 112, 128, 152, 176, 208, 248, 296, 352, 416, 496, 592, 704, 840, 1008, 1208, 1448, 1736, 2080, 2496, 2992, 3584, 4096 - sizeof(Header), 4912, 5888, 7064, 8192 - sizeof(Header), 9824, 11784, 12288 - sizeof(Header), 14744, 16384 - sizeof(Header), 19656, 20480 - sizeof(Header), 24576 - sizeof(Header), 28672 - sizeof(Header), 32768 - sizeof(Header), 36864 - sizeof(Header), 40960 - sizeof(Header), 45056 - sizeof(Header), 49152 - sizeof(Header), 53248 - sizeof(Header), 57344 - sizeof(Header), 61440 - sizeof(Header), 65536 - sizeof(Header) };
+
+template <class Header>
+const int HL::bins<Header, 65536>::_sizeclasses[NUM_LOOKUP] =
+  {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 11, 11, 12, 12, 13, 13, 13, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 16, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19, 19, 19, 19, 19, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32 };
+
+#endif
Index: /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/bins8k.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/bins8k.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/bins8k.h	(revision 176)
@@ -0,0 +1,53 @@
+// -*- C++ -*-
+
+#if !defined(_BINS8K_H_)
+#define _BINS8K_H_
+
+#include "bins.h"
+#include "sassert.h"
+
+namespace HL {
+
+  template <class Header>
+    class bins<Header, 8192> { 
+
+    public:
+      bins (void) {}
+
+  enum { NUM_BINS = 32 };
+  enum { NUM_SIZECLASSES = 1018 };
+
+  enum { BIG_OBJECT = 4096 - sizeof(Header) };
+  
+  static const size_t _bins[NUM_BINS];
+  static const int _sizeclasses[NUM_SIZECLASSES];
+
+  static inline int getSizeClass (size_t sz) {
+    assert (sz <= BIG_OBJECT);
+    const int ind = (sz - 1) >> 3;
+    assert (_bins[_sizeclasses[ind]] >= sz);
+    return _sizeclasses[ind];
+  }
+
+  static inline size_t getClassSize (const int i) {
+    assert (i >= 0);
+    assert (i < NUM_BINS);
+    return _bins[i];
+  }
+
+private:
+
+  sassert<(BIG_OBJECT > 0)> verifyHeaderSize;
+
+};
+
+}
+
+template <class Header>
+const size_t HL::bins<Header, 8192>::_bins[NUM_BINS] = {8, 16, 24, 32, 40, 48, 56, 64, 72, 80, 96, 112, 128, 152, 176, 208, 248, 296, 352, 416, 496, 592, 704, 840, 1008, 1208, 1448, 1736, 2272, 2720, 3400, BIG_OBJECT};
+
+template <class Header>
+const int HL::bins<Header, 8192>::_sizeclasses[NUM_SIZECLASSES] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 11, 11, 12, 12, 13, 13, 13, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 16, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19, 19, 19, 19, 19, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33 };
+
+#endif
+
Index: /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/boundedfreelistheap.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/boundedfreelistheap.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/boundedfreelistheap.h	(revision 176)
@@ -0,0 +1,68 @@
+/* -*- C++ -*- */
+
+#ifndef _BOUNDEDFREELISTHEAP_H_
+#define _BOUNDEDFREELISTHEAP_H_
+
+// Beware -- this is for one "size class" only!!
+
+template <int numObjects, class Super>
+class BoundedFreeListHeap : public Super {
+public:
+  
+  BoundedFreeListHeap (void)
+    : nObjects (0),
+    myFreeList (NULL)
+  {}
+
+  ~BoundedFreeListHeap (void)
+  {
+    clear();
+  }
+
+  inline void * malloc (size_t sz) {
+    // Check the free list first.
+    void * ptr = myFreeList;
+    if (ptr == NULL) {
+      ptr = Super::malloc (sz);
+    } else {
+      myFreeList = myFreeList->next;
+    }
+    return ptr;
+  }
+  
+  inline void free (void * ptr) {
+    if (nObjects < numObjects) {
+      // Add this object to the free list.
+      ((freeObject *) ptr)->next = myFreeList;
+      myFreeList = (freeObject *) ptr;
+      nObjects++;
+    } else {
+      clear();
+      //      Super::free (ptr);
+    }
+  }
+
+  inline void clear (void) {
+    // Delete everything on the free list.
+    void * ptr = myFreeList;
+    while (ptr != NULL) {
+      void * oldptr = ptr;
+      ptr = (void *) ((freeObject *) ptr)->next;
+      Super::free (oldptr);
+    }
+    myFreeList = NULL;
+    nObjects = 0;
+  }
+
+private:
+
+  class freeObject {
+  public:
+    freeObject * next;
+  };
+
+  int nObjects;
+  freeObject * myFreeList;
+};
+
+#endif
Index: /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/checkheap.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/checkheap.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/checkheap.h	(revision 176)
@@ -0,0 +1,29 @@
+#ifndef _CHECKHEAP_H_
+#define _CHECKHEAP_H_
+
+
+template <class SuperHeap>
+class CheckHeap : public SuperHeap {
+private:
+	enum { RECEIVED_A_NULL_OBJECT_FROM_MALLOC = 0 };
+	enum { RECEIVED_AN_UNALIGNED_OBJECT_FROM_MALLOC = 0 };
+public:
+	inline void * malloc (size_t sz) {
+		void * addr = SuperHeap::malloc (sz);
+		if (addr == NULL) {
+			assert (RECEIVED_A_NULL_OBJECT_FROM_MALLOC);
+			printf ("RECEIVED_A_NULL_OBJECT_FROM_MALLOC\n");
+			abort();
+		}
+		if ((unsigned long) addr % sizeof(double) != 0) {
+			assert (RECEIVED_AN_UNALIGNED_OBJECT_FROM_MALLOC);
+			printf ("RECEIVED_AN_UNALIGNED_OBJECT_FROM_MALLOC\n");
+			abort();
+		}
+		return addr;
+	}
+};
+
+
+
+#endif
Index: /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/chunkheap.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/chunkheap.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/chunkheap.h	(revision 176)
@@ -0,0 +1,105 @@
+/* -*- C++ -*- */
+
+#ifndef _CHUNKHEAP_H_
+#define _CHUNKHEAP_H_
+
+/*
+
+  Heap Layers: An Extensible Memory Allocation Infrastructure
+  
+  Copyright (C) 2000-2003 by Emery Berger
+  http://www.cs.umass.edu/~emery
+  emery@cs.umass.edu
+  
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or
+  (at your option) any later version.
+  
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+  
+  You should have received a copy of the GNU General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+*/
+
+#include <assert.h>
+
+/**
+ * @class ChunkHeap
+ * @brief Allocates memory from the superheap in chunks.
+ * @param ChunkSize The minimum size for allocating memory from the superheap.
+ */
+
+namespace HL {
+
+  template <int ChunkSize, class SuperHeap>
+  class ChunkHeap : public SuperHeap {
+  public:
+
+    inline ChunkHeap (void)
+      : buffer (NULL),
+	eob (NULL)
+    {}
+
+    inline void * malloc (const size_t sz) {
+      void * ptr = buffer;
+      buffer += sz;
+      if (buffer <= eob) {
+	assert (eob != NULL);
+	assert ((size_t) (eob - (char *) ptr + 1) >= sz);
+	return ptr;
+      }
+	  buffer -= sz;		// we didn't succeed, back up
+      return getMoreMemory(sz);
+    }
+
+    inline void clear (void) {
+      buffer = NULL;
+      eob = NULL;
+      SuperHeap::clear ();
+    }
+
+  private:
+
+    // Disabled.
+    inline int remove (void *);
+
+    void * getMoreMemory (size_t sz) {
+      assert (sz > 0);
+      // Round sz to the next chunk size.
+      size_t reqSize = (((sz-1) / ChunkSize) + 1) * ChunkSize;
+      char * buf = (char *) SuperHeap::malloc (reqSize);
+      if (buf == NULL) {
+	return NULL;
+      }
+      // If the current end of buffer is not the same as the new buffer,
+      // reset the buffer pointer.
+      if (eob != buf) {
+	buffer = buf;
+      }
+	  else {
+		  // we still have a bit leftover at the end of previous buffer
+		  reqSize += eob - buffer;
+	  }
+      eob = buffer + reqSize;
+    
+      void * ptr = buffer;
+      buffer += sz;
+      return ptr;
+    }
+
+    /// The current allocation buffer.
+    char * buffer;
+
+    /// The end of the buffer.
+    char * eob;
+  };
+
+}
+
+#endif
Index: /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/coalesceableheap.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/coalesceableheap.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/coalesceableheap.h	(revision 176)
@@ -0,0 +1,339 @@
+/* -*- C++ -*- */
+
+/*
+
+  Heap Layers: An Extensible Memory Allocation Infrastructure
+  
+  Copyright (C) 2000-2003 by Emery Berger
+  http://www.cs.umass.edu/~emery
+  emery@cs.umass.edu
+  
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or
+  (at your option) any later version.
+  
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+  
+  You should have received a copy of the GNU General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+*/
+
+/**
+ * @file coalesceableheap.h
+ * @brief Coalescing support, via RequireCoalesceable and CoalesceableHeap.
+ * @author Emery Berger
+ */
+
+#ifndef _COALESCEABLEHEAP_H_
+#define _COALESCEABLEHEAP_H_
+
+#include <assert.h>
+
+#define MULTIPLE_HEAP_SUPPORT 0
+
+/**
+ * @class RequireCoalesceable
+ * @brief Provides support for coalescing objects.
+ */
+
+namespace HL {
+
+template <class SuperHeap>
+class RequireCoalesceable : public SuperHeap {
+public:
+
+  // Some thin wrappers over Header methods.
+  inline static int getHeap (void * ptr)          { return Header::getHeader(ptr)->getHeap(); }
+  inline static void setHeap (void * ptr, int h)  { Header::getHeader(ptr)->setHeap(h); }
+  inline static int getPrevHeap (void * ptr)      { return Header::getHeader(ptr)->getPrevHeap(); }
+  inline static void setPrevHeap (void * ptr, int h) { Header::getHeader(ptr)->setPrevHeap(h); }
+
+  inline static size_t getSize (const void * ptr)       { return Header::getHeader(ptr)->getSize(); }
+
+  inline static void setSize (void * ptr, const size_t sz) { Header::getHeader(ptr)->setSize(sz); }
+  inline static size_t getPrevSize (void * ptr)   { return Header::getHeader(ptr)->getPrevSize(); }
+  inline static void setPrevSize (void * ptr, const size_t sz) { Header::getHeader(ptr)->setPrevSize(sz); }
+  inline static void markFree (void * ptr)        { Header::getHeader(ptr)->markFree(); }
+  inline static void markInUse (void * ptr)       { Header::getHeader(ptr)->markInUse(); }
+  inline static void markPrevInUse (void * ptr)   { Header::getHeader(ptr)->markPrevInUse(); }
+  inline static void markMmapped (void * ptr)     { Header::getHeader(ptr)->markMmapped(); }
+  inline static int isFree (void * ptr)           { return Header::getHeader(ptr)->isFree(); }
+  inline static int isPrevFree (void * ptr)       { return Header::getHeader(ptr)->isPrevFree(); }
+  inline static int isMmapped (void * ptr)        { return Header::getHeader(ptr)->isMmapped(); }
+  inline static void * getNext (const void * ptr)       { return Header::getHeader(ptr)->getNext(); }
+  inline static void * getPrev (const void * ptr)       { return Header::getHeader(ptr)->getPrev(); }
+
+  // The Header for every object, allocated or freed.
+  class Header {
+	  friend class RequireCoalesceable<SuperHeap>;
+  public:
+
+    //
+    // Initialize a new object in a given buffer, with a previous & current object size.
+    // Returns the start of the object (i.e., just past the header).
+    //
+    inline static void * makeObject (void * buf, const size_t prevsz, const size_t sz) {
+	  *((Header *) buf) = Header (prevsz, sz);
+	  Header * nextHeader = (Header *) ((char *) ((Header *) buf + 1) + sz);
+//	  Header * nextHeader = h->getNextHeader();
+//	  nextHeader->markPrevInUse();
+	  nextHeader->setPrevSize (sz);
+      // return Header::getObject (h);
+	  return ((Header *) buf + 1);
+    }
+
+
+    inline void sanityCheck (void) {
+#ifndef NDEBUG
+      int headerSize = sizeof(Header);
+      assert (headerSize <= sizeof(double));
+      assert (getSize() == getNextHeader()->getPrevSize());
+      assert (isFree() == getNextHeader()->isPrevFree());
+      assert (getNextHeader()->getPrev() == getObject(this));
+#if 0
+      if (isPrevFree()) {
+	assert (getPrevSize() == getHeader(getPrev())->getSize());
+      }
+#endif
+#endif
+    }
+
+    // Get the header for a given object.
+    inline static Header * getHeader (const void * ptr) { return ((Header *) ptr - 1); }
+
+    // Get the object for a given header.
+    inline static void * getObject (const Header * hd)  { return (void *) (hd + 1); }
+
+    inline void setSize (const size_t sz)    { _size = sz; }
+    inline void setPrevSize (const size_t sz){ _prevSize = sz; }
+
+//  private:
+    inline size_t getPrevSize (void) const { return _prevSize; }
+
+    inline void markFree (void)        {
+		// printf ("markFree\n");
+		getNextHeader()->markPrevFree();
+	}
+    inline void markInUse (void)       {
+		// printf ("markInUse\n");
+		getNextHeader()->markPrevInUse();
+	}
+    inline void markMmapped (void)     { _isMmapped = IS_MMAPPED; }
+    inline void markNotMmapped (void)  { _isMmapped = NOT_MMAPPED; }
+    inline int isFree (void) const     {
+		// printf ("isFree\n");
+		return getNextHeader()->isPrevFree();
+	}
+    inline int isNextFree (void) const {
+		// printf ("isNextFree\n");
+		return getNextHeader()->getNextHeader()->isPrevFree();
+	}
+    inline int isMmapped (void) const  { return (_isMmapped != NOT_MMAPPED); }
+    inline void * getPrev (void) const {
+	//	fprintf (stderr, "coalesceableheap.h: %x, %d\n", this, getPrevSize());
+		return ((char *) this) - getPrevSize(); 
+	}
+    inline void * getNext (void) const { 
+		// printf ("getNext\n");
+		return ((char *) (this + 2)) + getSize();
+	}
+
+    inline void markPrevFree (void)    { _prevStatus = PREV_FREE; }
+    inline void markPrevInUse (void)   { _prevStatus = PREV_INUSE; }
+    inline int isPrevFree (void) const { return (_prevStatus != PREV_INUSE); }
+    inline size_t getSize (void) const { return _size; }
+
+#if MULTIPLE_HEAP_SUPPORT
+    inline int getHeap (void) const { return _currHeap; }
+    inline void setHeap (int h)     { _currHeap = h; }
+    inline int getPrevHeap (void) const { return _prevHeap; }
+    inline void setPrevHeap (int h) { _prevHeap = h; }
+#else
+    inline int getHeap (void) const { return 0; }
+    inline void setHeap (int)       {  }
+    inline int getPrevHeap (void) const { return 0; }
+    inline void setPrevHeap (int)   {  }
+#endif
+
+
+  private:
+
+    explicit inline Header (void) {}
+    explicit inline Header (const size_t prevsz, const size_t sz)
+      :
+      _prevSize (prevsz),
+      _size (sz),
+      // Assume that objects are NOT mmapped.
+      _isMmapped (NOT_MMAPPED)
+#if MULTIPLE_HEAP_SUPPORT
+      , _prevHeap (0),
+      _currHeap (0)
+#endif
+    {
+      assert (sizeof(Header) <= sizeof(double));
+    }
+
+    inline Header * getNextHeader (void) const {
+      // printf ("H\n");
+      return ((Header *) ((char *) (this + 1) + getSize()));
+    }
+
+#if !(MULTIPLE_HEAP_SUPPORT) // original
+
+    // Is the previous object free or in use?
+    enum { PREV_INUSE = 0, PREV_FREE = 1 };
+    unsigned int _prevStatus : 1;
+
+    // Is the current object mmapped?
+    enum { NOT_MMAPPED = 0, IS_MMAPPED = 1 };
+    unsigned int _isMmapped : 1;
+
+    // The size of the previous object.
+    enum { NUM_BITS_STOLEN_FROM_PREVSIZE = 2 };
+    size_t _prevSize : sizeof(size_t) * 8 - NUM_BITS_STOLEN_FROM_PREVSIZE;
+
+    // The size of the current object.
+    enum { NUM_BITS_STOLEN_FROM_SIZE = 0 };
+    size_t _size; // : sizeof(size_t) * 8 - NUM_BITS_STOLEN_FROM_SIZE;
+
+
+#else // new support for scalability...
+
+    // Support for 2^5 = 32 heaps.
+    enum { NUM_BITS_FOR_HEAP = 5 };
+
+    enum { NUM_BITS_STOLEN_FROM_SIZE = NUM_BITS_FOR_HEAP + 1 };     // 1 for isMmapped
+    enum { NUM_BITS_STOLEN_FROM_PREVSIZE = NUM_BITS_FOR_HEAP + 1 }; // 1 for isPrevFree
+
+    // Max object size.
+    enum { MAX_OBJECT_SIZE = 1 << (sizeof(size_t) * 8 - NUM_BITS_STOLEN_FROM_SIZE) };
+
+    //// word 1 ////
+
+    // The size of the previous object.
+    size_t _prevSize : sizeof(size_t) * 8 - NUM_BITS_STOLEN_FROM_PREVSIZE;
+
+    // What's the previous heap?
+    unsigned int _prevHeap : NUM_BITS_FOR_HEAP;
+
+    // Is the previous object free or in use?
+    enum { PREV_FREE = 0, PREV_INUSE = 1 };
+    unsigned int _prevStatus : 1;
+
+    //// word 2 ////
+
+    // The size of the current object.
+    size_t _size : sizeof(size_t) * 8 - NUM_BITS_STOLEN_FROM_SIZE;
+
+    // What's the current heap?
+    unsigned int _currHeap : NUM_BITS_FOR_HEAP;
+
+    // Is the current object mmapped?
+    enum { NOT_MMAPPED = 0, IS_MMAPPED = 1 };
+    unsigned int _isMmapped : 1;
+
+#endif
+  };
+
+  inline static void * makeObject (void * buf, const size_t prevsz, const size_t sz) {
+    return Header::makeObject (buf, prevsz, sz);
+  }
+
+  inline static Header * getHeader (const void * ptr) {
+    return Header::getHeader (ptr);
+  }
+
+};
+
+
+/**
+ * @class CoalesceableHeap
+ * @brief Manages coalesceable memory.
+ */
+
+template <class SuperHeap>
+class CoalesceableHeap : public RequireCoalesceable<SuperHeap> {
+public:
+
+  typedef typename RequireCoalesceable<SuperHeap>::Header Header;
+
+  inline CoalesceableHeap (void)
+  { }
+
+  inline void * malloc (const size_t sz) {
+    void * buf = SuperHeap::malloc (sz + sizeof(Header));
+    if (buf) {
+      Header * header = (Header *) buf;
+
+      //
+      // Record the size of this object in the current header
+      // and the next.
+      //
+
+      header->setSize (sz);
+
+      // Below was:
+//      Header * nextHeader = Header::getHeader (header->getNext());
+      Header * nextHeader = (Header *) ((char *) (header + 1) + sz);
+
+      nextHeader->setPrevSize (sz);
+
+#if 0
+      //
+      // As long as the source of this memory
+      // is always zeroed, these assertions will hold.
+      // The easiest way to do this is to use a ZeroHeap.
+      //
+      assert (header->isMmapped() == FALSE);
+      assert (nextHeader->getSize() ==  0);
+      assert (!nextHeader->isFree());
+      assert (!nextHeader->isPrevFree());
+
+#else
+
+      // If the memory is not zeroed, we need this section of code.
+
+      //
+      // Assume that everything allocated is NOT mmapped.
+      // It is the responsibility of a child layer
+      // to mark mmapped objects as such.
+      //
+
+      header->markNotMmapped ();
+
+      nextHeader->setSize (0);
+
+      //
+      // Mark the subsequent "object" as in use in order to prevent
+      // accidental coalescing.
+      //
+
+//	  (nextHeader + 1)->markPrevInUse();
+      nextHeader->markInUse ();
+#endif
+
+      // Below was:
+      // return Header::getObject (header);
+      return (header + 1);
+    }
+    return NULL;
+  }
+  
+  inline void free (void * ptr) {
+    assert (SuperHeap::isFree(ptr));
+    SuperHeap::free ((Header *) ptr - 1);
+  }
+
+
+};
+
+};
+
+#endif // _COALESCEABLEHEAP_H_
+
Index: /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/coalesceheap.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/coalesceheap.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/coalesceheap.h	(revision 176)
@@ -0,0 +1,136 @@
+/* -*- C++ -*- */
+
+#ifndef _COALESCEHEAP_H_
+#define _COALESCEHEAP_H_
+
+/*
+
+  Heap Layers: An Extensible Memory Allocation Infrastructure
+  
+  Copyright (C) 2000-2003 by Emery Berger
+  http://www.cs.umass.edu/~emery
+  emery@cs.umass.edu
+  
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or
+  (at your option) any later version.
+  
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+  
+  You should have received a copy of the GNU General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+*/
+
+#include <assert.h>
+
+#include "heaplayers.h"
+
+/**
+ * @class CoalesceHeap
+ * @brief Applies splitting and coalescing.
+ * @see CoalesceableHeap
+ * @see RequireCoalesceable
+ */
+
+namespace HL {
+
+template <class super>
+class CoalesceHeap : public super {
+public:
+
+  inline void * malloc (const size_t sz)
+  {
+    void * ptr = super::malloc (sz);
+    if (ptr != NULL) {
+      super::markInUse (ptr);
+      void * splitPiece = split (ptr, sz);
+      if (splitPiece != NULL) {
+	super::markFree (splitPiece);
+	super::free (splitPiece);
+      }
+    }
+    return ptr;
+  }
+
+
+  inline void free (void * ptr)
+  {
+    // Try to coalesce this object with its predecessor & successor.
+    if ((super::getNext(super::getPrev(ptr)) != ptr) || (super::getPrev(super::getNext(ptr)) != ptr)) {
+      // We're done with this object.
+      super::free (ptr);
+      return;
+    }
+    assert (super::getPrev(super::getNext(ptr)) == ptr);
+    // Try to coalesce with the previous object..
+    void * prev = super::getPrev(ptr);
+    void * next = super::getNext (ptr);
+    assert (prev != ptr);
+
+    if (super::isPrevFree(ptr)) {
+      assert (super::isFree(prev));
+      super::remove (prev);
+      coalesce (prev, ptr);
+      ptr = prev;
+    }
+    if (super::isFree(next)) {
+      super::remove (next);
+      coalesce (ptr, next);
+    }
+	
+    super::markFree (ptr);
+
+    // We're done with this object.
+    super::free (ptr);
+  }
+
+private:
+
+
+  // Combine the first object with the second.
+  inline static void coalesce (void * first, const void * second) {
+    // A few sanity checks first.
+    assert (super::getNext(first) == second);
+    assert (super::getPrev(second) == first);
+    // Now coalesce.
+    size_t newSize = ((size_t) second - (size_t) first) + super::getSize(second);
+    super::setSize (first, newSize);
+    setPrevSize (super::getNext(first), newSize);
+  }
+
+  // Split an object if it is big enough.
+  inline static void * split (void * obj, const size_t requestedSize) {
+    assert (super::getSize(obj) >= requestedSize);
+    // We split aggressively (for now; this could be a parameter).
+    const size_t actualSize = super::getSize(obj);
+    if (actualSize - requestedSize >= sizeof(typename super::Header) + sizeof(double)) {
+      // Split the object.
+      super::setSize(obj, requestedSize);
+      void * splitPiece = (char *) obj + requestedSize + sizeof(typename super::Header);
+      super::makeObject ((void *) super::getHeader(splitPiece),
+			 requestedSize,
+			 actualSize - requestedSize - sizeof(typename super::Header));
+      assert (!super::isFree(splitPiece));
+      // Now that we have a new successor (splitPiece), we need to
+      // mark obj as in use.
+      (super::getHeader(splitPiece))->markPrevInUse();
+      assert (super::getSize(splitPiece) >= sizeof(double));
+      assert (super::getSize(obj) >= requestedSize);
+      return splitPiece;
+    } else {
+      return NULL;
+    }
+  }
+
+};
+
+};
+
+
+#endif
Index: /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/debugheap.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/debugheap.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/debugheap.h	(revision 176)
@@ -0,0 +1,52 @@
+/* -*- C++ -*- */
+
+
+#ifndef _DEBUGHEAP_H_
+#define _DEBUGHEAP_H_
+
+#include <assert.h>
+
+/**
+ *
+ *
+ */
+
+namespace HL {
+
+template <class Super,
+	  char freeChar = 'F'>
+class DebugHeap : public Super {
+private:
+
+  enum { CANARY = 0xdeadbeef };
+
+public:
+
+  // Fill with A's.
+  inline void * malloc (size_t sz) {
+    // Add a guard area at the end.
+    void * ptr;
+    ptr = Super::malloc (sz + sizeof(unsigned long));
+    memset (ptr, 'A', sz);
+    *((unsigned long *) ((char *) ptr + sz)) = (unsigned long) CANARY;
+    assert (Super::getSize(ptr) >= sz);
+    return ptr;
+  }
+  
+  // Fill with F's.
+  inline void free (void * ptr) {
+    char * b = (char *) ptr;
+    size_t sz = Super::getSize(ptr);
+    // Check for the canary.
+    unsigned long storedCanary = *((unsigned long *) b + sz - sizeof(unsigned long));
+    if (storedCanary != CANARY) {
+      abort();
+    }
+    memset (ptr, freeChar, sz);
+    Super::free (ptr);
+  }
+};
+
+}
+
+#endif
Index: /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/dlheap.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/dlheap.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/dlheap.h	(revision 176)
@@ -0,0 +1,438 @@
+/* -*- C++ -*- */
+
+/*
+
+  Heap Layers: An Extensible Memory Allocation Infrastructure
+  
+  Copyright (C) 2000-2003 by Emery Berger
+  http://www.cs.umass.edu/~emery
+  emery@cs.umass.edu
+  
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or
+  (at your option) any later version.
+  
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+  
+  You should have received a copy of the GNU General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+*/
+
+#ifndef _DLHEAP_H_
+#define _DLHEAP_H_
+
+/**
+ * @file dlheap.h
+ * @brief Contains all the classes required to approximate DLmalloc 2.7.0.
+ * @author Emery Berger
+ */
+
+#include <assert.h>
+
+#include "adapt.h"
+#include "dllist.h"
+#include "sllist.h"
+
+#ifndef TRUE
+#define TRUE 1
+#define FALSE 0
+#endif
+ 
+#include "coalesceableheap.h"
+
+/**
+ * @class CoalesceableMmapHeap
+ * @brief Adds headers to mmapped objects to allow coalescing.
+ * @author Emery Berger
+ */
+
+namespace HL {
+
+template <class Mmap>
+class CoalesceableMmapHeap : public RequireCoalesceable<Mmap> {
+public:
+  typedef RequireCoalesceable<Mmap> super;
+  typedef typename RequireCoalesceable<Mmap>::Header Header;
+
+  inline void * malloc (const size_t sz) {
+    void * buf = super::malloc (sz + sizeof(Header));
+    void * ptr = Header::makeObject (buf, 0, sz);
+    super::markMmapped (ptr);
+    super::markInUse (ptr);
+    return ptr;
+  }
+  inline void free (void * ptr) {
+    super::free (Header::getHeader (ptr));
+  }
+  inline int remove (void * ptr) {
+    return super::remove (Header::getHeader (ptr));
+  }
+};
+
+/**
+ * @class SelectMmapHeap
+ * @brief Use Mmap (here the superheap) for objects above a certain size.
+ * @author Emery Berger
+ *
+ * @param ThresholdBytes The maximum number of bytes managed by SmallHeap.
+ * @param SmallHeap The heap for "small" objects.
+ * @param super The heap for "large" objects.
+ */
+
+template <int ThresholdBytes, class SmallHeap, class super>
+class SelectMmapHeap : public super {
+public:
+  inline void * malloc (const size_t sz) {
+    void * ptr = NULL;
+    if (sz <= ThresholdBytes) {
+      ptr = sm.malloc (sz);
+    }
+
+    // Fall-through: go ahead and try mmap if the small heap is out of memory.
+
+    if (ptr == NULL) {
+      ptr = super::malloc (sz);
+      super::markMmapped (ptr);
+    }
+    return ptr;
+  }
+  inline void free (void * ptr) {
+    if (super::isMmapped(ptr)) {
+      super::free (ptr);
+    } else {
+      sm.free (ptr);
+    }
+  }
+  inline int remove (void * ptr) {
+    if (super::isMmapped(ptr)) {
+      return super::remove (ptr);
+    } else {
+      return sm.remove (ptr);
+    }
+  }
+  inline void clear (void) {
+    sm.clear();
+    super::clear();
+  }
+
+private:
+  SmallHeap sm;
+};
+
+
+// LeaHeap 2.7.0-like threshold scheme
+// for managing a small superheap.
+
+
+// NOTE: THIS HAS BEEN CHANGED NOW!
+
+template <int ThresholdBytes, class super>
+class Threshold : public super {
+public:
+
+  enum { MIN_LARGE_SIZE = 64 };
+
+#if 1
+  Threshold (void)
+    : freeAllNextMalloc (FALSE),
+      inUse (0),
+      maxInUse (0),
+      threshold (0)
+  {}
+
+  inline void * malloc (const size_t sz) {
+    void * ptr = super::malloc (sz);
+    if (ptr) {
+      const size_t actualSize = super::getSize(ptr);
+      inUse += actualSize;
+      if (inUse > maxInUse) {
+	maxInUse = inUse;
+	threshold = 16384 + maxInUse / 2;
+      }
+#if 0
+      if (freed < 0) {
+	freed = 0;
+      }
+#endif
+    }
+    return ptr;
+  }
+
+
+#if 0
+  void * internalMalloc (const size_t sz) {
+    if (freeAllNextMalloc || (freed > 0)) {
+      freed = 0;
+      super::freeAll();
+      freeAllNextMalloc = FALSE;
+    }
+    void * ptr = super::malloc (sz);
+    if (ptr != NULL) {
+      if (sz < MIN_LARGE_SIZE) {
+	freed -= getSize(ptr);
+	if (freed < 0) {
+	  freed = 0;
+	}
+      }
+    }
+    return ptr;
+  }
+#endif
+
+
+  inline void free (void * ptr) {
+    const size_t sz = super::getSize(ptr);
+    inUse -= sz;
+    super::free (ptr);
+    if (super::getMemoryHeld() > threshold) {
+      super::freeAll();
+    }		
+  }
+
+private:
+
+  /// The number of bytes in use.
+  size_t inUse;
+
+  /// The high-water mark of bytes in use.
+  size_t maxInUse;
+
+  size_t threshold;
+
+  // How many bytes have been freed (whose requests were below MIN_LARGE_SIZE).
+  //  int freed;
+  
+  /// Should we free all in the superheap on the next malloc?
+  bool freeAllNextMalloc;
+  
+#else
+  inline Threshold (void)
+  {}
+  
+  inline void * malloc (const size_t sz) {
+    if ((getMemoryHeld() > ThresholdBytes) ||
+	((sz >= MIN_LARGE_SIZE) && (getMemoryHeld() >= sz))) {
+      super::freeAll();
+    }
+    return super::malloc (sz);
+  }
+#endif
+};
+
+
+/**
+ * @namespace DLBigHeapNS
+ * @brief All of the bins & size functions for the "big heap".
+ */
+
+namespace DLBigHeapNS
+{
+  const size_t bins[] = {8U, 16U, 24U, 32U, 40U, 48U, 56U, 64U, 72U, 80U, 88U,
+			 96U, 104U, 112U, 120U, 128U, 136U, 144U, 152U, 160U,
+			 168U, 176U, 184U, 192U, 200U, 208U, 216U, 224U, 232U,
+			 240U, 248U, 256U, 264U, 272U, 280U, 288U, 296U, 304U,
+			 312U, 320U, 328U, 336U, 344U, 352U, 360U, 368U, 376U,
+			 384U, 392U, 400U, 408U, 416U, 424U, 432U, 440U, 448U,
+			 456U, 464U, 472U, 480U, 488U, 496U, 504U, 512U, 576U,
+			 640U, 704U, 768U, 832U, 896U, 960U, 1024U, 1088U, 1152U,
+			 1216U, 1280U, 1344U, 1408U, 1472U, 1536U, 1600U, 1664U,
+			 1728U, 1792U, 1856U, 1920U, 1984U, 2048U, 2112U, 2560U,
+			 3072U, 3584U,
+			 4096U, 4608U, 5120U, 5632U, 6144U, 6656U, 7168U, 7680U,
+			 8192U, 8704U, 9216U, 9728U, 10240U, 10752U, 12288U,
+			 16384U, 20480U, 24576U, 28672U, 32768U, 36864U, 40960U,
+			 65536U, 98304U, 131072U, 163840U, 262144U, 524288U,
+			 1048576U, 2097152U, 4194304U, 8388608U, 16777216U,
+			 33554432U, 67108864U, 134217728U, 268435456U, 536870912U,
+			 1073741824U, 2147483648U  };
+
+  enum { NUMBINS = sizeof(bins) / sizeof(size_t) };
+  enum { BIG_OBJECT = 2147483648U };
+  
+  /**
+   * @brief Compute the log base two.
+   * @param sz The value we want the log of.
+   */
+  int log2 (const size_t sz) {
+    int c = 0;
+    size_t sz1 = sz;
+    while (sz1 > 1) {
+      sz1 >>= 1;
+      c++;
+    }
+    return c;
+  }
+  
+  inline int getSizeClass (const size_t sz);
+  
+  inline size_t getClassSize (const int i) {
+    assert (i >= 0);
+    assert (i < NUMBINS);
+#if 0
+    if (i < 64) {
+      return ((size_t) ((i+1) << 3));
+    } else {
+      return
+	(i < 89) ? ((size_t) ((i - 55) << 6)) :
+	(i < 106) ? ((size_t) ((i - 84) << 9)) :
+	(i < 114) ? ((size_t) ((i - 103) << 12)) :
+	(i < 118) ? ((size_t) ((i - 112) << 15)) :
+	(i < 120) ? ((size_t) ((i - 117) * 262144)) :
+	(i < 122) ? ((size_t) ((i - 119) * 1048576)) :
+	(i < 124) ? ((size_t) ((i - 121) * 4 * 1048576)) :
+	(i < 126) ? ((size_t) ((i - 123) * 16 * 1048576)) :
+	(i < 128) ? ((size_t) ((i - 125) * 64 * 1048576)) :
+	(i < 130) ? ((size_t) ((i - 127) * 256 * 1048576)) :
+	((size_t) ((i - 129) * 1024 * 1048576));
+    }
+#else
+#if 0
+    if (i < 64) {
+      return (size_t) ((i+1) << 3);
+    }
+#endif
+    return bins[i];
+#endif
+  }
+
+  inline int getSizeClass (const size_t sz) {
+    size_t sz1 = sz - 1;
+    if (sz1 <= 513) {
+      return sz1 >> 3;
+    } else {
+#if 0
+      //		size_t sz1 = sz - 1;
+      sz1 >>= 6;
+      if (sz1 <= 32) {
+	return 56 + sz1;
+      }
+      sz1 >>= 3;
+      if (sz1 <= 20) {
+	return 91 + sz1;
+      }
+      sz1 >>= 3;
+      if (sz1 <= 10) {
+	return 110 - 6 + sz1;
+      }
+      sz1 >>= 3;
+      if (sz1 <= 4) {
+	return 119 - 6 + sz1;
+      }
+      sz1 >>= 3;
+      if (sz1 <= 2) {
+	return 124 - 6 + sz1;
+      }
+      return 125 - 6 + log2(sz1 >> 2);
+#else
+      const size_t sz1 = sz - 1;
+      return (((sz1 >>  6) <= 32)?  56 + (sz1 >>  6): 
+	      ((sz1 >>  9) <= 20)?  91 + (sz1 >>  9):
+	      ((sz1 >> 12) <= 10)? 110 - 6 + (sz1 >> 12):
+	      ((sz1 >> 15) <=  4)? 119 - 6 + (sz1 >> 15):
+	      ((sz1 >> 18) <=  2)? 124 - 6 + (sz1 >> 18): 126 - 6 + log2(sz1>>19));
+#endif
+    }
+  }
+
+ }
+
+
+/**
+ * @namespace DLSmallHeapNS
+ * @brief The size functions for the "small" heap (fastbins).
+ */
+
+namespace DLSmallHeapNS {
+  enum { NUMBINS = 8 };
+  inline int getSizeClass (const size_t sz) {
+    return (int) ((sz-1) >> 3);
+  }
+  inline size_t getClassSize (const int i) {
+    assert (i >= 0);
+    assert (i < NUMBINS);
+    return (size_t) ((i+1) << 3);
+  }
+}
+
+#if 0
+
+#include "kingsleyheap.h"
+
+/**
+ * @class DLBigHeapType
+ * @brief The "big heap" -- a coalescing segregated-fits allocator.
+ * @author Emery Berger
+ */
+
+template <class super>
+class DLBigHeapType :
+  public 
+CoalesceHeap<RequireCoalesceable<
+  SegHeap<Kingsley::NUMBINS,
+	  Kingsley::size2Class,
+	  Kingsley::class2Size,
+	  AdaptHeap<DLList, NullHeap<super> >,
+	  super> > >
+{};
+
+#else
+
+template <class super>
+class DLBigHeapType :
+  public 
+CoalesceHeap<RequireCoalesceable<
+  SegHeap<DLBigHeapNS::NUMBINS,
+	  DLBigHeapNS::getSizeClass,
+	  DLBigHeapNS::getClassSize,
+	  AdaptHeap<DLList, NullHeap<super> >,
+	  super> > >
+{};
+
+#endif
+
+/**
+ * @class DLSmallHeapType
+ * @brief The "small heap" -- non-coalescing "fastbins" (quicklists).
+ * @author Emery Berger
+ */
+
+template <class super>
+class DLSmallHeapType :
+  public RequireCoalesceable<
+  StrictSegHeap<DLSmallHeapNS::NUMBINS,
+		DLSmallHeapNS::getSizeClass,
+		DLSmallHeapNS::getClassSize,
+		AdaptHeap<HL::SLList, NullHeap<super> >,
+		super> > {};
+
+
+/**
+ * @class LeaHeap
+ * @brief This heap approximates the algorithms used by DLmalloc 2.7.0.
+ * 
+ * The whole thing. Big objects are allocated via mmap.
+ * Other objects are first allocated from the special thresholded quicklists,
+ * or if they're too big, they're allocated from the coalescing big heap. 
+ *
+ * @param Sbrk An sbrk-like heap, for small object allocation.
+ * @param Mmap An mmap-like heap, for large object allocation.
+ */
+  
+template <class Sbrk, class Mmap>
+class LeaHeap :
+  public
+    SelectMmapHeap<128 * 1024,
+		   Threshold<4096,
+			     DLSmallHeapType<DLBigHeapType<CoalesceableHeap<Sbrk> > > >,
+		   CoalesceableMmapHeap<Mmap> >
+{};
+
+}
+
+#endif
Index: /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/exceptionheap.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/exceptionheap.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/exceptionheap.h	(revision 176)
@@ -0,0 +1,66 @@
+// -*- C++ -*-
+
+/*
+
+  Heap Layers: An Extensible Memory Allocation Infrastructure
+  
+  Copyright (C) 2000-2003 by Emery Berger
+  http://www.cs.umass.edu/~emery
+  emery@cs.umass.edu
+  
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or
+  (at your option) any later version.
+  
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+  
+  You should have received a copy of the GNU General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+*/
+
+#ifndef _EXCEPTION_HEAP
+#define _EXCEPTION_HEAP
+
+#include <new>
+#include <new.h>
+
+class std::bad_alloc;
+
+namespace HL {
+
+template <class Super>
+class ExceptionHeap : public Super {
+public:
+  inline void * malloc (size_t sz) throw (std::bad_alloc) {
+    void * ptr = Super::malloc (sz);
+    if (ptr == NULL) {
+      throw new std::bad_alloc;
+    }
+    return ptr;
+  }
+};
+
+
+template <class Super>
+class CatchExceptionHeap : public Super {
+public:
+  inline void * malloc (size_t sz) {
+    void * ptr;
+    try {
+      ptr = Super::malloc (sz);
+    } catch (std::bad_alloc) {
+      ptr = NULL;
+    }
+    return ptr;
+  }
+};
+
+};
+
+#endif
Index: /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/experimental/alignedchunk.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/experimental/alignedchunk.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/experimental/alignedchunk.h	(revision 176)
@@ -0,0 +1,398 @@
+/* -*- C++ -*- */
+
+#ifndef _ALIGNEDCHUNK_H_
+#define _ALIGNEDCHUNK_H_
+
+/*
+
+  Heap Layers: An Extensible Memory Allocation Infrastructure
+  
+  Copyright (C) 2000-2003 by Emery Berger
+  http://www.cs.umass.edu/~emery
+  emery@cs.umass.edu
+  
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or
+  (at your option) any later version.
+  
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+  
+  You should have received a copy of the GNU General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+*/
+
+#include <stdlib.h>
+#include <malloc.h>
+#include <assert.h>
+
+#include "bitindex.h"
+
+/*
+	An aligned chunk is a chunk of memory
+	containing a number of fixed-size "slots".
+	As long as the chunk is naturally aligned,
+	each slot will also be naturally aligned.
+
+	This alignment allows us to use address masking to find
+	which chunk a given pointer belongs to.
+
+	All information about the chunk is stored at the end
+	of the chunk.
+
+*/
+
+// AlignHeap aligns every memory request to chunkSize.
+//
+// If you know that memory allocations are always aligned to chunkSize
+// from your allocator of choice, don't use AlignHeap because it
+// will waste memory.
+
+namespace HL {
+
+template <int chunkSize, class Super>
+class AlignHeap {
+public:
+	inline void * malloc (size_t sz) {
+		// Get a piece of memory large enough to be able to guarantee alignment.
+		void * buf = ::malloc (sz + chunkSize);
+		// Align the buffer.
+		void * alignedBuf = (void *) (((unsigned long) buf + sizeof(unsigned long) + chunkSize - 1) & -chunkSize);
+		// Record the original buffer's address right behind the aligned part.
+		assert ((unsigned long) alignedBuf - (unsigned long) buf > sizeof(unsigned long));
+		*((unsigned long *) alignedBuf - 1) = (unsigned long) buf;
+		return alignedBuf;
+	}
+
+	void free (void * ptr) {
+		// Get the original buffer's address and free that.
+		::free ((void *) *((unsigned long *) ptr - 1));
+	}
+};
+
+
+// An aligned chunk is of size chunkSize and is divided up into 32 pieces
+// of size slotSize. The 32nd one will not be available for allocation
+// because it is used for 'header' information (albeit stored in the footer).
+
+// Some restrictions: chunkSize MUST BE A POWER OF TWO.
+//                    slotSize MUST BE AT LEAST THE SIZE OF A DOUBLE.
+
+// The amount of memory that this approach wastes is small in practice:
+//   For one aligned chunk, utilization is 31/32 = 97%.
+//   For two nested chunks, utilization is (31/32)^2 = 94%.
+//   For three nested chunks, utilization is (31/32)^3 = 91%.
+// Note that the smallest possible size of a three-deep aligned chunk
+// is 32 * 32 * 32 * 32 = one megabyte.
+
+template <int chunkSize, int slotSize>
+class AlignedChunk {
+public:
+
+	AlignedChunk (void)
+		: prev (NULL),
+			next (NULL),
+			status (ACQUIRED),
+			inUse (0)
+	{
+		// Make sure there's enough slop to let us store the chunk information!
+		assert (getNumSlots() * slotSize + sizeof(AlignedChunk) <= chunkSize);
+		// The slot size must be at least large enough to hold a double.
+		assert (slotSize == align(slotSize));
+		// Initialize the bitmap.
+		freeBitmap = 0;
+		// Block the last slot.
+		BitIndex::set (freeBitmap, 0);
+		emptyBitmap = freeBitmap;
+	}
+
+	~AlignedChunk (void)
+		{}
+
+
+  // Get and put slots.
+	// These are ATOMIC and lock-free.
+
+  // Get returns NULL iff there are no slots available.
+  void * getSlot (void) {
+RETRY_UNSET:
+		unsigned long currBitmap = freeBitmap;
+		// If currBitmap is all ones, everything is in use.
+		// Just return NULL.
+		if (currBitmap == (unsigned long) -1) {
+			assert (inUse == getNumSlots());
+			return NULL;
+		}
+		// Find an unset bit.
+		// We flip the bits in currBitmap and find the index of a one bit
+		// (which corresponds to the index of a zero in currBitmap).
+		int bitIndex;
+		unsigned long oneBit = (~currBitmap) & (-((signed long) ~currBitmap));
+		assert (oneBit != 0);
+		bitIndex = BitIndex::msb (oneBit);
+		if (bitIndex > getNumSlots()) {
+			assert (inUse == getNumSlots());
+			return NULL;
+		}
+		assert (inUse < getNumSlots());
+		assert (bitIndex < getNumSlots() + 1);
+		// Set it.
+		unsigned long oldBitmap = currBitmap;
+		BitIndex::set (currBitmap, bitIndex);
+		unsigned long updatedBitmap = InterlockedExchange ((long *) &freeBitmap, currBitmap);
+		if (updatedBitmap == oldBitmap) {
+			// Success.
+			// Return a pointer to the appropriate slot.
+			char * start = (char *) ((unsigned long) this & -chunkSize);
+			inUse++;
+			return start + slotSize * (getNumSlots() - bitIndex);
+		}
+		// Someone changed the bitmap before we were able to write it.
+		// Try again.
+		goto RETRY_UNSET;
+	}
+
+
+  // Put returns 1 iff the chunk is now completely empty.
+  inline int putSlot (void * ptr) {
+		assert (inUse >= 1);
+		AlignedChunk * ch = getChunk (ptr);
+		assert (ch == this);
+		// Find the index of this pointer.
+		// Since slotSize is known at compile time and is usually a power of two,
+		// the divide should be turned into shifts and will be fast.
+		char * start = (char *) ((unsigned long) ptr & -chunkSize);
+		int bitIndex = getNumSlots() - (((unsigned long) ((char *) ptr - start)) / slotSize);
+RETRY_RESET:
+		unsigned long currBitmap = freeBitmap;
+		unsigned long oldBitmap = currBitmap;
+		BitIndex::reset (currBitmap, bitIndex);
+		unsigned long updatedBitmap = InterlockedExchange ((long *) &freeBitmap, currBitmap);
+		if (updatedBitmap == oldBitmap) {
+			// Success.
+			inUse--;
+			assert ((inUse != 0) || (currBitmap == emptyBitmap));
+			assert ((inUse == 0) || (currBitmap != emptyBitmap));
+			// Return 1 iff the chunk is now empty.
+			if (currBitmap == emptyBitmap) {
+				assert (inUse == 0);
+				return 1;
+			} else {
+				assert (inUse > 0);
+				return 0;
+			}
+		}
+		// Try again.
+		goto RETRY_RESET;
+	}
+
+
+  // How many slots are there in total?
+  inline static int getNumSlots (void) {
+		return 31;
+	}
+
+	inline int isReleased (void) {
+		return (status == RELEASED);
+	}
+
+	inline void acquire (void) {
+		assert (status == RELEASED);
+		status = ACQUIRED;
+	}
+
+	inline void release (void) {
+		assert (status == ACQUIRED);
+		status = RELEASED;
+	}
+
+  // Find a chunk for a given slot.
+  inline static AlignedChunk * getChunk (void * slot) {
+		// Here's where the alignment is CRITICAL!!
+		// Verify that chunkSize is a power of two.
+		assert ((chunkSize & (chunkSize - 1)) == 0);
+		// Mask off the slot to find the start of the chunkSize block.
+		char * start = (char *) ((unsigned long) slot & -chunkSize);
+		// Find the end of the block.
+		char * eob = (start + chunkSize);
+		// Now locate the 'header' (in this case, it's actually a footer).
+		char * headerPos = eob - sizeof(AlignedChunk);
+		return (AlignedChunk *) headerPos;
+	}
+
+
+  // Add doubly linked-list operations.
+  AlignedChunk * getNext (void) { return next; }
+  AlignedChunk * getPrev (void) { return prev; } 
+  void setNext (AlignedChunk * p) { next = p; }
+  void setPrev (AlignedChunk * p) { prev = p; } 
+
+private:
+
+	enum { RELEASED = 0, ACQUIRED = 1 };
+
+  static inline size_t align (size_t sz) {
+    return (sz + (sizeof(double) - 1)) & ~(sizeof(double) - 1);
+  }
+
+	int inUse; // For debugging only.
+  unsigned long freeBitmap;
+	unsigned long emptyBitmap;
+	int status;
+  AlignedChunk * prev;
+  AlignedChunk * next;
+};
+
+
+// AlignedChunkHeap manages a number of chunks.
+
+template <int maxFree, int chunkSize, int slotSize, class Super>
+class AlignedChunkHeap : public Super {
+public:
+
+	AlignedChunkHeap (void)
+		: chunkList (NULL),
+		length (0)
+	{}
+
+	virtual ~AlignedChunkHeap (void)
+	{
+		chunkType * ch, * tmp;
+		ch = chunkList;
+		while (ch != NULL) {
+			tmp = ch;
+			ch = ch->getNext();
+			assert (tmp->isReleased());
+			Super::free ((char *) ((unsigned long) tmp & -chunkSize));
+		}
+	}
+
+	// Malloc a CHUNK. Returns a pointer to the start of the allocated block.
+	inline void * malloc (size_t sz)
+	{
+		assert (sz == chunkSize);
+		chunkType * ch;
+		// Get a chunk from our chunk list
+		// or make one.
+		if (chunkList != NULL) {
+			ch = chunkList;
+			chunkList = chunkList->getNext();
+			length--;
+			ch->acquire();
+		} else {
+			// Make a buffer large enough to hold the chunk.
+			void * buf = Super::malloc (chunkSize);
+			// The buffer MUST BE ALIGNED.
+			assert ((unsigned long) buf == ((unsigned long) buf & -chunkSize));
+			// Instantiate the chunk "header" (actually the footer)
+			// at the end of the chunk.
+			ch = new (chunkType::getChunk (buf)) chunkType;
+		}
+		// Now return the start of the chunk's buffer.
+		assert (!ch->isReleased());
+		return (void *) ((unsigned long) ch & -chunkSize);
+	}
+
+	// Free a CHUNK.
+	// The pointer is to the chunk header.
+	inline void free (void * ptr)
+	{
+		chunkType * ch = (chunkType *) AlignedChunk<chunkSize, slotSize>::getChunk(ptr);
+		assert (ch->isReleased());
+		if (length > maxFree) {
+			Super::free ((void *) ((unsigned long) ch & -chunkSize));
+		} else {
+		  ch->setNext (chunkList);
+		  chunkList = ch;
+			length++;
+		}
+	}
+
+	size_t size (void * ptr) {
+		return slotSize;
+	}
+
+private:
+
+	typedef AlignedChunk<chunkSize, slotSize> chunkType;
+
+	chunkType * chunkList;
+	int length;
+};
+
+
+// An AlignedSlotHeap holds at most one chunk.
+// When all of the slots are allocated from the chunk,
+// the chunk is "released" so that it may be freed back
+// to the super heap when all of its slots are freed.
+
+template <int chunkSize, int slotSize, class Super>
+class AlignedSlotHeap : public Super {
+public:
+
+	AlignedSlotHeap (void)
+		: myChunk (NULL)
+	{}
+
+	virtual ~AlignedSlotHeap (void) {
+		// Note that this is NOT enough to completely clean up after ourselves!!
+		if (myChunk != NULL) {
+			myChunk->release();
+			Super::free ((void *) ((unsigned long) myChunk & -chunkSize));
+		}
+	}
+
+	// Malloc a SLOT.
+	// Use up a chunk, if we've got one.
+	// Once it's used up, 'release it' and get another one.
+	inline void * malloc (size_t sz) {
+		assert (sz <= slotSize);
+		void * ptr = NULL;
+		while (ptr == NULL) {
+			if (myChunk == NULL) {
+				myChunk = AlignedChunk<chunkSize, slotSize>::getChunk(Super::malloc (chunkSize));
+			}
+			ptr = myChunk->getSlot();
+			if (ptr == NULL) {
+				// This chunk is completely in use.
+				// "Release" it.
+				myChunk->release();
+				myChunk = NULL;
+			}
+		};
+		return ptr;
+	}				
+
+	// Free a SLOT.
+	// If the chunk is now completely empty and has been 'released',
+	// free the whole chunk.
+	inline void free (void * ptr)
+	{
+		// Find out which chunk this slot belongs to.
+		AlignedChunk<chunkSize, slotSize> * ch = AlignedChunk<chunkSize, slotSize>::getChunk (ptr);
+		// Return it to its chunk.
+		int empty = ch->putSlot (ptr);
+		if (empty && ch->isReleased()) {
+			Super::free ((void *) ((unsigned long) ch & -chunkSize));
+		}
+	}
+
+private:
+
+	// A one chunk buffer. Emptied when the chunk is completely allocated.
+	AlignedChunk<chunkSize, slotSize> * myChunk;
+
+};
+
+
+template <int maxFree, int chunkSize, int slotSize, class Super>
+class AlignedChunkHeapFoo : public AlignedSlotHeap<chunkSize, slotSize, AlignedChunkHeap<maxFree, chunkSize, slotSize, Super> > {};
+
+};
+
+#endif
Index: /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/experimental/aoffheap.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/experimental/aoffheap.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/experimental/aoffheap.h	(revision 176)
@@ -0,0 +1,264 @@
+/* -*- C++ -*- */
+
+#ifndef _AOFHEAP_H_
+#define _AOFHEAP_H_
+
+#include <new> // for placement new
+using namespace std;
+
+/*
+  
+  A very simple address-oriented first-fit heap
+  with immediate coalescing.
+
+  Because the heap is stored as a sorted doubly-linked list,
+  it's potentially quite expensive:
+
+  cost of a malloc = O(f) {# of non-contiguous freed objects}
+  cost of a free   = O(f) {# of non-contiguous freed objects}
+
+  Worst-case performance could be improved by using a balanced O(log n) dictionary
+  (like an RB-tree). Also, the free list is threaded through the objects themselves,
+  something that can cause O(f) page faults; keeping the free list data structures
+  separate from the data (and in a contiguous region of memory) would avoid this problem.
+
+*/
+
+// Freed objects of at least FreeThreshold size are freed to the super heap.
+
+template <class SuperHeap, int FreeThreshold>
+class AOFFHeap : public SuperHeap {
+public:
+
+  AOFFHeap (void)
+  {
+    freeList.setSize (0);
+    freeList.setNext (&freeList);
+    freeList.setPrev (&freeList);
+  }
+
+  ~AOFFHeap (void) {
+    return; // FIX ME FIX ME FIX ME!!!
+    // Free everything on the free list.
+    freedObject * ptr = freeList.getNext();
+    while (ptr != &freeList) {
+      freedObject * prev = ptr;
+      ptr = ptr->getNext();
+      SuperHeap::free (prev);
+    }
+  }
+
+  void * malloc (size_t sz) {
+    // printf ("aoffheap malloc sz = %d\n", sz);
+    assert (isValid());
+    assert (sz >= sizeof(freedObject) - sizeof(allocatedObject));
+    // Find the first object in the free list that fits.
+    freedObject * ptr = freeList.getNext();
+    while ((ptr != &freeList) && (ptr->getSize() < sz + sizeof(freedObject))) {
+      ptr = ptr->getNext();
+    }
+    // If there wasn't a big-enough object available on the free list,
+    // make a new one.
+    if (ptr == &freeList) {
+
+      // printf ("AOFF super malloc(%d)\n", sz + sizeof(allocatedObject));
+
+      void * buf = SuperHeap::malloc (sz + sizeof(allocatedObject));
+      if (buf == NULL) {
+	assert (isValid());
+	return NULL;
+      }
+      freedObject * newptr 
+	= new (buf) freedObject (sz, NULL, NULL);
+      assert (size(newptr->getStart()) == sz);
+      assert (isValid());
+      return (void *) newptr->getStart();
+    } else {
+      assert (ptr->getSize() >= sz);
+      // Remove it from the free list.
+      freedObject * prev = ptr->getPrev();
+      freedObject * next = ptr->getNext();
+      assert (prev->isValid());
+      assert (next->isValid());
+      // If it's bigger than the request size,
+      // splice it up.
+      if (ptr->getSize() - sz >= sizeof(freedObject)) {
+				// There's room for another object.
+				// Splice it off.
+	size_t oldSize = ptr->getSize();
+	ptr->setSize (sz);
+	freedObject * splicedObj = new (ptr->getSuccessor())
+	  freedObject (oldSize - sz - sizeof(freedObject),
+		       prev,
+		       next);
+	prev->setNext (splicedObj);
+	next->setPrev (splicedObj);
+	assert (splicedObj->isValid());
+	assert (isValid());
+	assert (size(ptr->getStart()) == sz);
+	return (void *) ptr->getStart();
+      } else {
+	assert (0);
+	abort();
+				// It's just right.
+				// Just remove it.
+	prev->setNext (next);
+	next->setPrev (prev);
+	assert (isValid());
+	assert (size(ptr->getStart()) == sz);
+	return (void *) ptr->getStart();
+      }
+    }
+  }
+
+  void free (void * p) {
+    assert (isValid());
+    // Put the object back in sorted order (by address).
+    freedObject * thisObject = (freedObject *) ((char *) p - sizeof(allocatedObject));
+    assert (thisObject->getStart() == p);
+    freedObject * prev = &freeList;
+    freedObject * next = freeList.getNext();
+    while ((next != &freeList) && ((char *) thisObject > (char *) next)) {
+      prev = next;
+      next = next->getNext();
+    }
+    // Check if this object is already on the free list
+    // (i.e., it was already deleted).
+    if (thisObject == next) {
+      // printf ("Bad call.\n");
+      // Ignore the bad programmer and just walk away...
+      return;
+    }
+    // Now insert this object.
+    prev->setNext (thisObject);
+    next->setPrev (thisObject);
+    thisObject = new (thisObject) freedObject (thisObject->getSize(), prev, next);
+    // See if we can coalesce.
+    if (prev->getSuccessor() == thisObject) {
+      assert (prev != &freeList);
+      coalesce (prev, thisObject);
+      thisObject = prev;
+      assert (thisObject->isValid());
+      assert (thisObject->getSize() > 0);
+      // printf ("coalesced prev with this, new size = %d\n", thisObject->getSize());
+    }
+    if (thisObject->getSuccessor() == next) {
+      coalesce (thisObject, next);
+      assert (thisObject->isValid());
+      //printf ("coalesced this with next, new size = %d\n", thisObject->getSize());
+    }
+    // If this object is big enough, free it.
+    if (thisObject->getSize() >= FreeThreshold) {
+      // printf ("freed this (size = %d)\n", thisObject->getSize());
+      freedObject * prev = thisObject->getPrev();
+      freedObject * next = thisObject->getNext();
+      prev->setNext (next);
+      next->setPrev (prev);
+      assert (thisObject->isValid());
+      SuperHeap::free (thisObject);
+    }
+    assert (isValid());
+  }
+
+  //protected:
+  inline static size_t size (void * p)
+  {
+    allocatedObject * thisObject = (allocatedObject *) p - 1;
+    assert (thisObject->isValid());
+    return thisObject->getSize();
+  }
+
+
+private:
+
+  int isValid (void) {
+    // March through the whole list and check for validity.
+    freedObject * ptr = freeList.getNext();
+    while (ptr != &freeList) {
+      freedObject * prev = ptr;
+      assert (prev->getNext()->getPrev() == prev);
+      assert (prev->isValid());
+      ptr = ptr->getNext();
+    }
+    return 1;
+  }
+
+  class freedObject;
+
+  inline void coalesce (freedObject * curr, freedObject * succ) {
+    // printf ("Coalesce %d with %d\n", curr->getSize(), succ->getSize());
+    assert (curr->getSuccessor() == succ);
+    assert (succ->getPrev() == curr);
+    assert (curr->getNext() == succ);
+    curr->setNext (succ->getNext());
+    succ->getNext()->setPrev(curr);
+    curr->setSize (curr->getSize() + succ->getSize() + sizeof(allocatedObject));
+    assert (curr->isValid());
+  }
+  inline static size_t align (int sz) {
+    return (sz + (sizeof(double) - 1)) & ~(sizeof(double) - 1);
+  }
+
+  class allocatedObject {
+  public:
+    allocatedObject (void)
+    {
+      size = 0;
+#ifndef NDEBUG
+      magic = 0xfacefade;
+#endif
+    }
+    int isValid (void) const {
+      return (size >= 0) && (magic == 0xfacefade);
+    }
+    void setSize (size_t sz) { size = sz; assert (isValid()); }
+    int getSize (void) const { assert (isValid()); return size; }
+
+    // Return the start of the next object.
+    allocatedObject * getSuccessor (void) const {
+      assert (isValid());
+      return (allocatedObject *) ((char *) (this + 1) + size);
+    }
+
+    // Return the start of the actual object (beyond the header).
+    char * getStart (void) const {
+      assert (isValid());
+      return ((char *) (this + 1));
+    }
+  private:
+    int size;
+    int magic;
+  };
+
+  class freedObject : public allocatedObject {
+  public:
+    freedObject (void)
+      : prev ((freedObject *) 0xdeadbeef),
+	next ((freedObject *) 0xdeadbeef)
+    {}
+    freedObject (size_t sz,
+		 freedObject * p,
+		 freedObject * n)
+      :	prev (p),
+	next (n)
+    {
+      allocatedObject::setSize (sz);
+    }
+    int isValid (void) const {
+      return (allocatedObject::isValid());
+    }
+    freedObject * getPrev (void) const { assert (isValid()); return prev; }
+    freedObject * getNext (void) const { assert (isValid()); return next; }
+    void setPrev (freedObject * p) { assert (isValid()); prev = p; }
+    void setNext (freedObject * p) { assert (isValid()); next = p; }
+  private:
+    freedObject * prev;
+    freedObject * next;
+  };
+
+
+  freedObject freeList;
+  double _dummy; // Just to make sure that the freeList node won't ever be coalesced!
+};
+
+#endif
Index: /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/experimental/batchheap.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/experimental/batchheap.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/experimental/batchheap.h	(revision 176)
@@ -0,0 +1,131 @@
+/* -*- C++ -*- */
+
+#ifndef _BATCHHEAP_H_
+#define _BATCHHEAP_H_
+
+#include <assert.h>
+
+
+template <class SuperHeap>
+class MultiMalloc : public SuperHeap {
+public:
+	// Sets ptr to a list of up to num objects of size sz
+	// and returns how many free objects ptr points to.
+	int multimalloc (int num, size_t sz, void *& ptr)
+	{
+		int i = 0;
+		ptr = (freeObject *) SuperHeap::malloc (sz);
+		freeObject * p = (freeObject *) ptr;
+		if (ptr != NULL) {
+			for (i = 1; i < num; i++) {
+				p->next = (freeObject *) SuperHeap::malloc (sz);
+				if (p->next == NULL)
+					break;
+				p = p->next;
+			}
+			p->next = NULL;
+		}
+		return i;
+	}
+
+	// Frees all num items pointed to by ptr
+	// and sets ptr to NULL.
+	void multifree (int num, void *& ptr)
+	{
+		freeObject * p;
+		freeObject * prev = (freeObject *) ptr;
+		for (int i = 0; i < num; i++) {
+			p = prev->next;
+			SuperHeap::free (prev);
+			prev = p;
+		}
+		ptr = NULL;
+	}
+
+private:
+
+  class freeObject {
+  public:
+    freeObject * next;
+  };
+
+
+};
+
+
+template <int BatchNumber, class SuperHeap>
+class BatchHeap : public SuperHeap {
+public:
+
+	BatchHeap (void)
+		: nObjects (0)
+	{
+		freeList[0] = NULL;
+		freeList[1] = NULL;
+	}
+
+
+	~BatchHeap (void) {
+		if (nObjects <= BatchNumber) {
+			SuperHeap::multifree (nObjects, (void *&) freeList[0]);
+		} else {
+			SuperHeap::multifree (BatchNumber, (void *&) freeList[0]);
+			SuperHeap::multifree (nObjects - BatchNumber, (void *&) freeList[1]);
+		}
+	}
+
+	inline void * malloc (size_t sz) {
+		if (nObjects == 0) {
+			// Obtain BatchNumber objects if we're out.
+			nObjects = SuperHeap::multimalloc (BatchNumber, sz, (void *&) freeList[0]);
+		}
+		assert (nObjects >= 1);
+		freeObject * ptr;
+		if (nObjects > BatchNumber) {
+			freeObject *& head = freeList[1];
+			ptr = head;
+			nObjects--;
+			head = head->next;
+			return (void *) ptr;
+		} else {
+			freeObject *& head = freeList[0];
+			ptr = head;
+			nObjects--;
+			head = head->next;
+			return (void *) ptr;
+		}
+	}
+
+	inline void free (void * ptr) {
+		if (nObjects <= BatchNumber) {
+			freeObject *& head = freeList[0];
+			((freeObject *) ptr)->next = head;
+			head = (freeObject *) ptr;
+		} else {
+			freeObject *& head = freeList[1];
+			((freeObject *) ptr)->next = head;
+			head = (freeObject *) ptr;
+		}
+		nObjects++;
+		if (nObjects == 2 * BatchNumber) {
+			// Free half of them.
+			assert (freeList[1] != NULL);
+			SuperHeap::multifree (BatchNumber, (void *&) freeList[1]);
+		}
+	}
+
+private:
+
+  class freeObject {
+  public:
+    freeObject * next;
+  };
+
+  int nObjects;
+
+  // The first free list holds the first BatchNumber objects,
+  // while the second free list holds the rest.
+  freeObject * freeList[2];
+};
+
+#endif
Index: /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/experimental/bigchunk.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/experimental/bigchunk.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/experimental/bigchunk.h	(revision 176)
@@ -0,0 +1,194 @@
+/* -*- C++ -*- */
+
+#ifndef _BIGCHUNK_H_
+#define _BIGCHUNK_H_
+
+#include <assert.h>
+
+template <int chunkSize, int slotSize, class Super>
+class BigChunk {
+public:
+
+  inline BigChunk (void);
+
+  // Get and put slots.
+  // Get returns NULL if there are no slots available.
+  inline void * getSlot (void);
+  inline void putSlot (void *);
+
+  // How many slots are there in total?
+  inline static int getNumSlots (void);
+
+  // How many slots are available?
+  inline int getNumSlotsFree (void);
+
+  // How many slots are available?
+  inline int getNumSlotsInUse (void);
+
+  // Find a chunk given its slot.
+  inline static BigChunk * getChunk (void *);
+
+  class ChunkBlock {
+  public:
+    void setChunk (BigChunk * ch) { _myChunk = ch; }
+    BigChunk * getChunk (void) { return _myChunk; }
+    void setNext (ChunkBlock * n) { _next = n; }
+    ChunkBlock * getNext (void) { return _next; }
+  private:
+    BigChunk * _myChunk;   // If allocated, point to the chunk.
+    ChunkBlock * _next; // If not allocated, point to the next chunk block.
+  };
+
+  // Find a chunk block for a given pointer.
+  static inline ChunkBlock * getChunkBlock (void * ptr) {
+	assert (ptr != NULL);
+	return (ChunkBlock *) ptr - 1;
+  }
+
+  void setHeap (Super * h) {
+	heap = h;
+  }
+
+  inline Super * getHeap (void) {
+	return heap;
+  }
+
+  // Add doubly linked-list operations.
+  inline BigChunk * getNext (void);
+  inline BigChunk * getPrev (void);
+  inline void setNext (BigChunk *);
+  inline void setPrev (BigChunk *);
+
+private:
+
+  static inline size_t align (size_t sz) {
+    return (sz + (sizeof(double) - 1)) & ~(sizeof(double) - 1);
+  }
+
+  ChunkBlock * freeSlots;
+  int numSlotsAvailable;
+  Super * heap;
+  BigChunk * prev;
+  BigChunk * next;
+};
+
+
+template <int chunkSize, int slotSize, class Super>
+BigChunk<chunkSize, slotSize, Super> * BigChunk<chunkSize, slotSize, Super>::getNext (void)
+{
+  return next;
+}
+
+
+template <int chunkSize, int slotSize, class Super>
+BigChunk<chunkSize, slotSize, Super> * BigChunk<chunkSize, slotSize, Super>::getPrev (void)
+{
+  return prev;
+}
+
+
+template <int chunkSize, int slotSize, class Super>
+void BigChunk<chunkSize, slotSize, Super>::setNext (BigChunk<chunkSize, slotSize, Super> * ptr)
+{
+  next = ptr;
+}
+
+
+template <int chunkSize, int slotSize, class Super>
+void BigChunk<chunkSize, slotSize, Super>::setPrev (BigChunk<chunkSize, slotSize, Super> * ptr)
+{
+  prev = ptr;
+}
+
+
+template <int chunkSize, int slotSize, class Super>
+BigChunk<chunkSize, slotSize, Super>::BigChunk (void)
+  : freeSlots (NULL),
+    numSlotsAvailable (getNumSlots()),
+	prev (NULL),
+	next (NULL)
+{
+  //printf ("numSlots = %d\n", numSlots);
+  int numSlots = getNumSlots();
+  assert (numSlots > 0);
+  const int blksize = align(sizeof(ChunkBlock) + slotSize);
+  //printf ("blksize = %d\n", blksize);
+  // Carve up the chunk into a number of slots.
+  ChunkBlock * b = (ChunkBlock *) (this + 1);
+  for (int i = 0; i < numSlots; i++) {
+	assert ((unsigned long) b < ((unsigned long) (this + 1) + blksize * numSlots));
+    new (b) ChunkBlock;
+    b->setChunk (this);
+	assert (b->getChunk() == this);
+    b->setNext (freeSlots);
+    freeSlots = b;
+    b = (ChunkBlock *) ((char *) b + blksize);
+  }
+}
+
+
+template <int chunkSize, int slotSize, class Super>
+void * BigChunk<chunkSize, slotSize, Super>::getSlot (void)
+{
+  if (freeSlots == NULL) {
+    assert (numSlotsAvailable == 0);
+    return NULL;
+  }
+  assert (numSlotsAvailable > 0);
+  assert (numSlotsAvailable <= getNumSlots());
+  ChunkBlock * b = freeSlots;
+  freeSlots = freeSlots->getNext();
+  numSlotsAvailable--;
+  b->setChunk (this); // FIX ME -- this should be unnecessary.
+  b->setNext (NULL);
+  void * ptr = (void *) (b + 1);
+  BigChunk<chunkSize, slotSize, Super> * bch = getChunk(ptr);
+  assert (bch == this);
+  return (void *) (b + 1);
+}
+
+
+template <int chunkSize, int slotSize, class Super>
+void BigChunk<chunkSize, slotSize, Super>::putSlot (void * ptr)
+{
+  assert (numSlotsAvailable >= 0);
+  assert (numSlotsAvailable <= getNumSlots());
+  ChunkBlock * b = getChunkBlock (ptr);
+  assert (b->getChunk() == this);
+  b->setNext (freeSlots);
+  freeSlots = b;
+  numSlotsAvailable++;
+  assert (numSlotsAvailable > 0);
+  assert (numSlotsAvailable <= getNumSlots());
+}
+
+
+template <int chunkSize, int slotSize, class Super>
+int BigChunk<chunkSize, slotSize, Super>::getNumSlots (void)
+{
+  return ((chunkSize - sizeof(BigChunk)) / align (sizeof(ChunkBlock) + slotSize));
+}
+
+
+template <int chunkSize, int slotSize, class Super>
+int BigChunk<chunkSize, slotSize, Super>::getNumSlotsFree (void)
+{
+  return numSlotsAvailable;
+}
+
+
+template <int chunkSize, int slotSize, class Super>
+int BigChunk<chunkSize, slotSize, Super>::getNumSlotsInUse (void)
+{
+  return getNumSlots() - numSlotsAvailable;
+}
+
+
+template <int chunkSize, int slotSize, class Super>
+BigChunk<chunkSize, slotSize, Super> * BigChunk<chunkSize, slotSize, Super>::getChunk (void * ptr)
+{
+  ChunkBlock * ch = getChunkBlock (ptr);
+  return ch->getChunk();
+}
+
+#endif
Index: /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/experimental/binheap.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/experimental/binheap.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/experimental/binheap.h	(revision 176)
@@ -0,0 +1,42 @@
+/* -*- C++ -*- */
+
+#ifndef _BINHEAP_H_
+#define _BINHEAP_H_
+
+#include <stdio.h>
+
+
+template <int Bins[], int NumBins, class Super>
+class BinHeap {
+public:
+  
+  inline void * malloc (size_t sz) {
+    // Find bin.
+    int bin = findBin (sz);
+    void * ptr = myHeaps[bin].malloc (sz);
+    return ptr;
+  }
+  
+  inline void free (void * ptr) {
+    size_t sz = Super::size (ptr);
+    int bin = findBin (sz);
+    myHeaps[bin].free (ptr);
+  }
+
+private:
+
+  inline int findBin (size_t sz) {
+    int i;
+    for (i = 0; i < NumBins; i++) {
+      if (Bins[i] >= sz) {
+	break;
+      }
+    }
+    return i;
+  }
+
+  Super myHeaps[NumBins + 1];
+
+};
+
+#endif
Index: /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/experimental/cacheheap.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/experimental/cacheheap.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/experimental/cacheheap.h	(revision 176)
@@ -0,0 +1,26 @@
+/* -*- C++ -*- */
+
+#ifndef _CACHEHEAP_H_
+#define _CACHEHEAP_H_
+
+template <class Super>
+class CacheHeap : public Super {
+public:
+  
+  inline void * malloc (size_t sz) {
+    void * ptr = mySuper.malloc (sz);
+    return ptr;
+  }
+  
+  inline void free (void * ptr) {
+    // Insert checks here!
+    mySuper.free (ptr);
+  }
+  
+private:
+
+  Super mySuper;
+};
+
+
+#endif
Index: /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/experimental/cartesianheap.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/experimental/cartesianheap.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/experimental/cartesianheap.h	(revision 176)
@@ -0,0 +1,59 @@
+#ifndef _CARTESIANHEAP_H_
+#define _CARTESIANHEAP_H_
+
+//#include "heaplayers.h"
+//#include "treap.h"
+
+// NB: All objects are rounded up to at least the size of a treap node
+// (around 24 bytes on a 32-bit architecture).
+
+template <class SuperHeap>
+class CartesianHeap : public SuperHeap {
+
+  // Provide a freelist wrapper for treap nodes.
+  class MyTreap : public Treap<size_t, void *> {
+  public:
+    // class Node : public PerClassHeap<Treap<size_t, void *>::Node, FreelistHeap<SuperHeap> > {};
+  };
+
+public:
+
+  ~CartesianHeap (void) {
+    // FIX ME
+    // free everything from the treap.
+  }
+
+  void * malloc (size_t sz) {
+    // Round sz up.
+    sz = (sz < sizeof(MyTreap::Node)) ? sizeof(MyTreap::Node) : sz;
+    MyTreap::Node * n = (MyTreap::Node *) treap.lookupGreater (sz);
+    if (n != NULL) {
+      assert (n->getValue() == (void *) n);
+      void * ptr = n->getValue();
+      treap.remove (n);
+      // delete n; // onto a freelist
+      return ptr;
+    } else {
+      return SuperHeap::malloc (sz);
+    }
+  }
+
+  void free (void * ptr) {
+    // MyTreap::Node * n = new MyTreap::Node; // from a freelist
+    // cout << "n = " << (void *) n << endl;
+    MyTreap::Node * n = (MyTreap::Node *) ptr;
+    treap.insert (n, getSize(ptr), ptr, (unsigned int) ptr);
+  }
+
+  // Removes a pointer from the treap.
+  void remove (void * ptr) {
+    treap.remove ((MyTreap::Node *) ptr);
+  }
+    
+private:
+
+  MyTreap treap;
+
+};
+
+#endif // _CARTESIANHEAP_H_
Index: /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/experimental/chunk.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/experimental/chunk.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/experimental/chunk.h	(revision 176)
@@ -0,0 +1,171 @@
+/* -*- C++ -*- */
+
+#ifndef _CHUNK_H_
+#define _CHUNK_H_
+
+/*
+
+  Heap Layers: An Extensible Memory Allocation Infrastructure
+  
+  Copyright (C) 2000-2003 by Emery Berger
+  http://www.cs.umass.edu/~emery
+  emery@cs.umass.edu
+  
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or
+  (at your option) any later version.
+  
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+  
+  You should have received a copy of the GNU General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+*/
+
+#include <assert.h>
+
+namespace HL {
+
+template <int chunkSize, int slotSize>
+class Chunk {
+public:
+
+  inline Chunk (void);
+
+  // Get and put slots.
+  // Get returns NULL if there are no slots available.
+  inline void * getSlot (void);
+  inline void putSlot (void *);
+
+  // How many slots are there in total?
+  inline static int getNumSlots (void);
+
+  // How many slots are available?
+  inline int getNumSlotsFree (void);
+
+  // How many slots are available?
+  inline int getNumSlotsInUse (void);
+
+  // Find a chunk given its slot.
+  inline static Chunk * getChunk (void *);
+
+  class ChunkBlock {
+  public:
+    void setChunk (Chunk * ch) { _myChunk = ch; }
+    Chunk * getChunk (void) { return _myChunk; }
+    void setNext (ChunkBlock * n) { _next = n; }
+    ChunkBlock * getNext (void) { return _next; }
+  private:
+    Chunk * _myChunk;   // If allocated, point to the chunk.
+    ChunkBlock * _next; // If not allocated, point to the next chunk block.
+  };
+
+  // Find a chunk block for a given pointer.
+  static inline ChunkBlock * getChunkBlock (void * ptr) {
+	assert (ptr != NULL);
+	return (ChunkBlock *) ptr - 1;
+  }
+
+private:
+
+  ChunkBlock * freeSlots;
+  int numSlotsAvailable;
+
+  static inline size_t align (size_t sz) {
+    return (sz + (sizeof(double) - 1)) & ~(sizeof(double) - 1);
+  }
+
+};
+
+template <int chunkSize, int slotSize>
+Chunk<chunkSize, slotSize>::Chunk (void)
+  : freeSlots (NULL),
+    numSlotsAvailable (getNumSlots())
+{
+  //printf ("numSlots = %d\n", numSlots);
+  int numSlots = getNumSlots();
+  assert (numSlots > 0);
+  const int blksize = align(sizeof(ChunkBlock) + slotSize);
+  //printf ("blksize = %d\n", blksize);
+  // Carve up the chunk into a number of slots.
+  ChunkBlock * b = (ChunkBlock *) (this + 1);
+  for (int i = 0; i < numSlots; i++) {
+	assert ((unsigned long) b < ((unsigned long) (this + 1) + blksize * numSlots));
+    new (b) ChunkBlock;
+    b->setChunk (this);
+	assert (b->getChunk() == this);
+    b->setNext (freeSlots);
+    freeSlots = b;
+    b = (ChunkBlock *) ((char *) b + blksize);
+  }
+}
+
+
+template <int chunkSize, int slotSize>
+void * Chunk<chunkSize, slotSize>::getSlot (void)
+{
+  if (freeSlots == NULL) {
+    assert (numSlotsAvailable == 0);
+    return NULL;
+  }
+  assert (numSlotsAvailable > 0);
+  ChunkBlock * b = freeSlots;
+  freeSlots = freeSlots->getNext();
+  numSlotsAvailable--;
+  b->setChunk (this); // FIX ME -- this should be unnecessary.
+  b->setNext (NULL);
+  void * ptr = (void *) (b + 1);
+  Chunk<chunkSize, slotSize> * bch = getChunk(ptr);
+  assert (bch == this);
+  return (void *) (b + 1);
+}
+
+
+template <int chunkSize, int slotSize>
+void Chunk<chunkSize, slotSize>::putSlot (void * ptr)
+{
+  ChunkBlock * b = getChunkBlock (ptr);
+  assert (b->getChunk() == this);
+  b->setNext (freeSlots);
+  freeSlots = b;
+  numSlotsAvailable++;
+  assert (numSlotsAvailable <= getNumSlots());
+}
+
+
+template <int chunkSize, int slotSize>
+int Chunk<chunkSize, slotSize>::getNumSlots (void)
+{
+  return ((chunkSize - sizeof(Chunk)) / align (sizeof(ChunkBlock) + slotSize));
+}
+
+
+template <int chunkSize, int slotSize>
+int Chunk<chunkSize, slotSize>::getNumSlotsFree (void)
+{
+  return numSlotsAvailable;
+}
+
+
+template <int chunkSize, int slotSize>
+int Chunk<chunkSize, slotSize>::getNumSlotsInUse (void)
+{
+  return getNumSlots() - numSlotsAvailable;
+}
+
+
+template <int chunkSize, int slotSize>
+Chunk<chunkSize, slotSize> * Chunk<chunkSize, slotSize>::getChunk (void * ptr)
+{
+  ChunkBlock * ch = getChunkBlock (ptr);
+  return ch->getChunk();
+}
+
+};
+
+#endif
Index: /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/experimental/combineheap.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/experimental/combineheap.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/experimental/combineheap.h	(revision 176)
@@ -0,0 +1,69 @@
+// -*- C++ -*-
+
+/*
+
+  Heap Layers: An Extensible Memory Allocation Infrastructure
+  
+  Copyright (C) 2000-2003 by Emery Berger
+  http://www.cs.umass.edu/~emery
+  emery@cs.umass.edu
+  
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or
+  (at your option) any later version.
+  
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+  
+  You should have received a copy of the GNU General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+*/
+
+#ifndef _COMBINEHEAP_H_
+#define _COMBINEHEAP_H_
+
+
+/**
+* @class CombineHeap
+* @brief Combines MallocHeap and FreeHeap: MallocHeap for malloc, FreeHeap for the rest
+*/
+
+namespace HL {
+
+template <class MallocHeap, class FreeHeap>
+class CombineHeap : public FreeHeap {
+
+public:
+
+  inline void * malloc (size_t sz) { 
+    return mallocheap.malloc (sz); 
+  }
+
+  MallocHeap& getMallocHeap (void) {
+    return mallocheap;
+  }
+
+  inline void clear (void) {
+    mallocheap.clear();
+    FreeHeap::clear();
+  }
+
+  inline void free (void * ptr) {
+    printf ("combineheap: free %x, sz = %d!\n", ptr, getSize(ptr));
+    FreeHeap::free (ptr);
+  }
+
+private:
+  MallocHeap mallocheap;
+
+};
+
+};
+
+#endif
+
Index: /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/experimental/counteddictionary.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/experimental/counteddictionary.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/experimental/counteddictionary.h	(revision 176)
@@ -0,0 +1,47 @@
+#ifndef _COUNTEDDICTIONARY_H_
+#define _COUNTEDDICTIONARY_H_
+
+template <class Dict>
+class CountedDictionary : public Dict {
+public:
+  class Entry : public Dict::Entry {};
+
+  __forceinline CountedDictionary (void)
+    : num (0)
+  {}
+
+  __forceinline void clear (void) {
+    num = 0;
+    Dict::clear();
+  }
+
+  __forceinline Entry * get (void) {
+    Entry * e = (Entry *) Dict::get();
+    if (e) {
+      --num;
+    }
+    return e;
+  }
+
+  __forceinline Entry * remove (void) {
+    Entry * e = (Entry *) Dict::remove();
+    if (e) {
+      --num;
+    }
+    return e;
+  }
+
+  __forceinline void insert (Entry * e) {
+    Dict::insert (e);
+    ++num;
+  }
+
+  __forceinline int getNumber (void) const {
+    return num;
+  }
+
+private:
+  int num;
+};
+
+#endif
Index: /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/experimental/emptychunkheap.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/experimental/emptychunkheap.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/experimental/emptychunkheap.h	(revision 176)
@@ -0,0 +1,63 @@
+/* -*- C++ -*- */
+
+#ifndef _LAZYSLOTHEAP_H_
+#define _LAZYSLOTHEAP_H_
+
+/*
+  This heap manages memory in units of Chunks.
+  malloc returns a slot within a chunk,
+  while free returns slots back to a chunk.
+  
+  Once a chunk is COMPLETELY empty, it is returned to the superheap.
+*/
+
+#include <assert.h>
+#include <new.h>
+
+template <int chunkSize, int slotSize, class Super>
+class LazySlotHeap : public Super {
+public:
+
+  LazySlotHeap (void)
+    : myChunk (new (Super::malloc (sz)) Chunk<chunkSize, slotSize>())
+  {}
+
+  ~LazySlotHeap (void)
+  {
+    // Give up our chunk.
+    Super::free (myChunk);
+  }
+
+  inline void * malloc (size_t sz) {
+    assert (sz == chunkSize);
+    void * ptr = myChunk->getSlot();
+    if (ptr == NULL) {
+      myChunk = new (Super::malloc (sz)) Chunk<chunkSize, slotSize>();
+      ptr = myChunk->getSlot();
+      assert (ptr != NULL);
+    }
+    return ;
+  }
+
+  inline void free (void * ptr) {
+    /// Return a slot to its chunk.
+    Chunk<chunkSize, slotSize> * ch = Chunk<chunkSize, slotSize>::getChunk (ptr);
+    ch->putSlot (ptr);
+    // Once the chunk is completely empty, free it.
+    if (ch->getNumSlotsAvailable() == ch->getNumSlots()) {
+      if (ch == myChunk) {
+	// If this was 'our' chunk, get another one.
+	myChunk = new (Super::malloc (sz)) Chunk<chunkSize, slotSize>();
+      }
+      Super::free (ch);
+    }
+  }
+
+private:
+
+  Chunk<chunkSize, slotSize> * myChunk;
+
+};
+
+
+#endif
Index: /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/experimental/fifofreelist.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/experimental/fifofreelist.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/experimental/fifofreelist.h	(revision 176)
@@ -0,0 +1,105 @@
+/* -*- C++ -*- */
+
+#ifndef _FIFOFREELIST_H_
+#define _FIFOFREELIST_H_
+
+#include <assert.h>
+
+#ifdef NDEBUG
+#define IFDEBUG(x)
+#else
+#define IFDEBUG(x) x
+#endif
+
+
+template <class SuperHeap>
+class FIFOFreelistHeap : public SuperHeap {
+public:
+  
+  FIFOFreelistHeap (void)
+	  IFDEBUG(:	nObjects (0))
+  {
+	  head.next = &tail;
+	  tail.next = &tail;
+	  assert (isEmpty());
+  }
+
+  ~FIFOFreelistHeap (void)
+  {
+	// printf ("Adios free list.\n");
+    // Delete everything on the free list.
+    freeObject * ptr = head.next;
+    while (ptr != &tail) {
+      void * oldptr = ptr;
+      ptr = ptr->next;
+      SuperHeap::free (oldptr);
+    }
+  }
+
+  inline void * malloc (size_t sz) {
+	assert (isValid());
+    // Check the free list first.
+    freeObject * ptr = head.next;
+    if (ptr == &tail) {
+	  assert (nObjects == 0);
+	  assert (isEmpty());
+      ptr = (freeObject *) SuperHeap::malloc (sz);
+    } else {
+	  assert (nObjects > 0);
+	  head.next = ptr->next;
+	  if (head.next == &tail) {
+		  tail.next = &tail;
+	  }
+	  IFDEBUG (nObjects--);
+    }
+	assert (isValid());
+    return (void *) ptr;
+  }
+  
+  inline void free (void * ptr) {
+	assert (isValid());
+    // Add this object to the free list.
+	assert (ptr != NULL);
+	IFDEBUG (nObjects++);
+	freeObject * p = (freeObject *) ptr;
+    p->next = &tail;
+	tail.next->next = p;
+	tail.next = p;
+	if (head.next == &tail) {
+		head.next = p;
+	}
+	assert (!isEmpty());
+	assert (isValid());
+  }
+
+private:
+
+	int isValid (void) {
+		// Make sure every object is the right size.
+		freeObject * ptr = head.next;
+		if (ptr != &tail) {
+			size_t sz = SuperHeap::getSize(ptr);
+			while (ptr != &tail) {
+			  void * oldptr = ptr;
+			  ptr = ptr->next;
+			  assert (SuperHeap::getSize(oldptr) >= sz);
+			}
+		}
+		return 1;
+	}
+
+  int isEmpty (void) {
+	return (head.next == &tail);
+  }
+
+  class freeObject {
+  public:
+	freeObject * prev;
+    freeObject * next;
+  };
+
+  freeObject head, tail;
+  IFDEBUG (int nObjects);
+};
+
+#endif
Index: /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/experimental/kingsmodheap.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/experimental/kingsmodheap.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/experimental/kingsmodheap.h	(revision 176)
@@ -0,0 +1,34 @@
+#ifndef _KINGSMODHEAP_H_
+#define _KINGSMODHEAP_H_
+
+#include "segheap.h"
+
+/* KingsMod (segregated fits) allocator */
+
+namespace KingsMod {
+
+  inline size_t class2Size (int i);
+
+  inline int pow2Class (size_t sz) {
+    static   size_t sizeTable[] = {8UL, 16UL, 24UL, 32UL, 40UL, 48UL, 56UL, 72UL, 80UL, 96UL, 120UL, 144UL, 168UL, 200UL, 240UL, 288UL, 344UL, 416UL, 496UL, 592UL, 712UL, 856UL, 1024UL, 1232UL, 1472UL, 1768UL, 2120UL, 2544UL, 3048UL, 3664UL};
+	int c = 0;
+	while (c < 30 && sz < sizeTable[c]) {
+	  c++;
+	}
+	return c;
+  }
+
+  inline size_t class2Size (int i) {
+    assert (i >= 0);
+    assert (i < 30);
+    static size_t sizeTable[] = {8UL, 16UL, 24UL, 32UL, 40UL, 48UL, 56UL, 72UL, 80UL, 96UL, 120UL, 144UL, 168UL, 200UL, 240UL, 288UL, 344UL, 416UL, 496UL, 592UL, 712UL, 856UL, 1024UL, 1232UL, 1472UL, 1768UL, 2120UL, 2544UL, 3048UL, 3664UL};
+    return sizeTable[i];
+  }
+
+};
+
+
+template <class PerClassHeap>
+class KingsModHeap : public SegHeap<29, KingsMod::pow2Class, KingsMod::class2Size, PerClassHeap, PerClassHeap> {};
+
+#endif
Index: /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/experimental/lazyheap.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/experimental/lazyheap.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/experimental/lazyheap.h	(revision 176)
@@ -0,0 +1,47 @@
+// -*- C++ -*-
+
+#ifndef _LAZYHEAP_H_
+#define _LAZYHEAP_H_
+
+template <class SuperHeap>
+class LazyHeap {
+public:
+
+  LazyHeap (void)
+    : initialized (0)
+  {}
+
+  ~LazyHeap (void) {
+    if (initialized) {
+      delete lazyheap;
+    }
+  }
+
+  inline void * malloc (size_t sz) {
+    return getHeap()->malloc (sz);
+  }
+  inline void free (void * ptr) {
+    getHeap()->free (ptr);
+  }
+  inline void clear (void) {
+    if (initialized) {
+      getHeap()->clear();
+    }
+  }
+
+private:
+
+  SuperHeap * getHeap (void) {
+    if (!initialized) {
+      lazyheap = new SuperHeap;
+      initialized = 1;
+    }
+    return lazyheap;
+  }
+
+  bool initialized;
+  SuperHeap * lazyheap;
+};
+
+
+#endif
Index: /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/experimental/lazyslotheap.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/experimental/lazyslotheap.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/experimental/lazyslotheap.h	(revision 176)
@@ -0,0 +1,101 @@
+/* -*- C++ -*- */
+
+#ifndef _LAZYSLOTHEAP_H_
+#define _LAZYSLOTHEAP_H_
+
+/*
+  This heap manages memory in units of Chunks.
+  malloc returns a slot within a chunk,
+  while free returns slots back to a chunk.
+
+  We completely exhaust the first chunk before we ever get another one.
+  Once a chunk (except for our current one) is COMPLETELY empty, it is returned to the superheap.
+*/
+
+#include <assert.h>
+#include <new.h>
+
+#include "chunk.h"
+
+
+template <int chunkSize, int slotSize, class Super>
+class LazySlotHeap : public Super {
+public:
+
+  LazySlotHeap (void)
+    : myChunk (new (Super::malloc (chunkSize)) Chunk<chunkSize, slotSize>())
+  {}
+
+  ~LazySlotHeap (void)
+  {
+    // Give up our chunk.
+    Super::free (myChunk);
+  }
+
+  inline void * malloc (size_t sz) {
+    assert (sz <= slotSize);
+    void * ptr = myChunk->getSlot();
+    if (ptr == NULL) {
+      myChunk = new (Super::malloc (chunkSize)) Chunk<chunkSize, slotSize>();
+      ptr = myChunk->getSlot();
+      assert (ptr != NULL);
+    }
+    return ptr;
+  }
+
+  inline void free (void * ptr) {
+    /// Return a slot to its chunk.
+    Chunk<chunkSize, slotSize> * ch = Chunk<chunkSize, slotSize>::getChunk (ptr);
+    ch->putSlot (ptr);
+	  	// check if it's completely empty. If so, free it.
+	  if (ch != myChunk) {
+      // Once the chunk is completely empty, free it.
+      if (ch->getNumSlotsAvailable() == ch->getNumSlots()) {
+        Super::free (ch);
+      }
+    }
+
+#if 0
+	// If this chunk isn't the one we're currently holding,
+		// free it. NB: It is NOT guaranteed to be empty!
+		if (ch != myChunk) {
+      Super::free (ch);
+    }
+#endif
+#if 0
+		template <int chunkSize, int slotSize, class Super>
+class StrictSlotHeap : public LazySlotHeap {
+public:
+	inline void free (void * ptr) {
+    /// Return a slot to its chunk.
+    Chunk<chunkSize, slotSize> * ch = Chunk<chunkSize, slotSize>::getChunk (ptr);
+    ch->putSlot (ptr);
+  	// check if it's completely empty. If so, free it.
+	  if (ch != myChunk) {
+      // Once the chunk is completely empty, free it.
+      if (ch->getNumSlotsAvailable() == ch->getNumSlots()) {
+        Super::free (ch);
+      }
+    }
+  }
+
+};
+#endif
+
+  }
+
+  inline static size_t size (void * ptr)
+  {
+	  return slotSize;
+  }
+
+
+protected:
+
+  Chunk<chunkSize, slotSize> * myChunk;
+
+};
+
+
+
+#endif
Index: /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/experimental/looseslotheap.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/experimental/looseslotheap.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/experimental/looseslotheap.h	(revision 176)
@@ -0,0 +1,322 @@
+/* -*- C++ -*- */
+
+#ifndef _LOOSESLOTHEAP_H_
+#define _LOOSESLOTHEAP_H_
+
+#include <assert.h>
+
+#include "bigchunk.h"
+
+/*
+  LooseSlotHeap: A "Loose" slot heap.
+
+  malloc returns objects of size slotSize, allocated from the super heap
+  in chunkSize units.
+
+  free returns objects of size slotSize.
+
+  When the slot heap is at least 1/emptyFraction empty, a
+  chunk that is at least that empty is freed to the super heap.
+  Note that the chunk's memory MAY NOT SAFELY be recycled in toto --
+  it must be parceled out using the chunk interface.
+
+  The intent of this heap is to allow mostly-empty chunks to move up
+  to a staging area (the super heap) where they may be reused by other
+  "loose" slot heaps.
+
+*/
+
+template <int chunkSize, int slotSize, int emptyFraction, class Super>
+class LooseSlotHeap {
+public:
+
+	inline LooseSlotHeap (void);
+	inline ~LooseSlotHeap (void);
+
+  // Get a slotSize object.
+  inline void * malloc (size_t sz);
+
+  // Free a slotSize object.
+  static inline void free (void * ptr);
+
+private:
+
+	Super theHeap;
+
+	typedef BigChunk<chunkSize, slotSize, LooseSlotHeap> chunkType;
+
+	inline void localFree (void * ptr);
+
+	void checkClassInvariant (void) {
+#ifndef NDEBUG
+		assert (inUse >= 0);
+		assert (inUse <= space);
+		assert (lastIndex >= 0);
+		assert (lastIndex <= emptyFraction);
+		// Now check to make sure that inUse & space are correct.
+		int localInUse = 0;
+		int localSpace = 0;
+		for (int i = 0; i < emptyFraction + 1; i++) {
+			chunkType * ch = myChunks[i];
+			while (ch != NULL) {
+				assert (ch->getHeap() == this);
+				localInUse += ch->getNumSlotsInUse();
+				localSpace += ch->getNumSlots();
+				ch = ch->getNext();
+			}
+		}
+		assert (localSpace == space);
+		assert (localInUse == inUse);
+#endif
+	}
+
+  // How full is this block?
+	//   0 == empty to no more than 1/emptyFraction full.
+	//   emptyFraction == completely full.
+  static inline int getFullness (chunkType * ch);
+    
+	// Move a chunk, if necessary, into the right list
+  // based on its emptiness.
+	// Returns the index of which list it is put or left in.
+	inline int update (chunkType * ch, int prevIndex);
+
+  // The array of chunks, "radix sorted" by emptiness.
+  // completely empty chunks are in index 0.
+  // completely full chunks are in index emptyFraction.
+  chunkType * myChunks[emptyFraction + 1];
+
+  // The last index (from 0) in the above array that has a chunk.
+  int lastIndex;
+
+  // How much space is in use in all of the chunks.
+  int inUse;
+
+  // How much space there is (free or not) in all of the chunks.
+  int space;
+};
+
+
+template <int chunkSize, int slotSize, int emptyFraction, class Super>
+LooseSlotHeap<chunkSize, slotSize, emptyFraction, Super>::LooseSlotHeap (void)
+  : space (0),
+    inUse (0),
+    lastIndex (emptyFraction - 1)
+{
+	// Initialize the chunk pointers (all initially empty).
+	for (int i = 0; i < emptyFraction + 1; i++) {
+		myChunks[i] = NULL;
+	}
+}
+
+
+template <int chunkSize, int slotSize, int emptyFraction, class Super>
+LooseSlotHeap<chunkSize, slotSize, emptyFraction, Super>::~LooseSlotHeap (void)
+{
+	// Free every chunk.
+	chunkType * ch, * tmp;
+	for (int i = 0; i < emptyFraction + 1; i++) {
+		ch = myChunks[i];
+		while (ch != NULL) {
+			tmp = ch;
+			ch = ch->getNext();
+			theHeap.free (tmp);
+		}
+	}
+}
+
+
+template <int chunkSize, int slotSize, int emptyFraction, class Super>
+int LooseSlotHeap<chunkSize, slotSize, emptyFraction, Super>::getFullness (chunkType * ch)
+{
+  int fullness = (emptyFraction * ch->getNumSlotsInUse())/ch->getNumSlots();
+	//printf ("numslots avail = %d, num slots total = %d, fullness = %d\n", ch->getNumSlotsFree(), ch->getNumSlots(), fullness);
+	return fullness;
+}
+
+	
+template <int chunkSize, int slotSize, int emptyFraction, class Super>
+void * LooseSlotHeap<chunkSize, slotSize, emptyFraction, Super>::malloc (size_t sz)
+{
+	checkClassInvariant();
+	//printf ("Loose malloc %d (slot size = %d)\n", sz, slotSize);
+  assert (sz <= slotSize);
+  void * ptr = NULL;
+	chunkType * ch = NULL;
+  // Always try to allocate from the most-full chunk (resetting
+  // lastIndex as we go).
+	lastIndex = emptyFraction - 1; // FIX ME!
+  while (lastIndex >= 0) {
+		ch = myChunks[lastIndex];
+    if (ch == NULL) {
+      lastIndex--;
+    } else {
+      // Got one.
+      break;
+    }
+  }
+  if (lastIndex < 0) {
+		assert (ch == NULL);
+    // There were no chunks available.
+    assert ((space - inUse) == 0);
+    // Make one with memory from the "super" heap.
+		printf ("!!!\n");
+		ch = (chunkType*) theHeap.malloc (chunkSize);
+		ch->setHeap (this);
+		assert (ch->getNumSlotsFree() > 0);
+		printf ("Super malloc %d\n", chunkSize);
+		lastIndex = getFullness(ch);
+		register chunkType*& head = myChunks[lastIndex];
+		assert (head == NULL);
+		ch->setPrev (NULL);
+		ch->setNext (NULL);
+    head = ch;
+    inUse += ch->getNumSlotsInUse();
+    space += ch->getNumSlots();
+		assert (ch->getNumSlotsFree() <= ch->getNumSlots());
+		// FOR NOW!! FIX ME!!!
+		assert (ch->getNumSlotsFree() == ch->getNumSlots());
+		printf ("Space, in use was %d, %d\n", space, inUse);
+		printf ("Space, in use NOW %d, %d\n", space, inUse);
+  }
+	assert (ch != NULL);
+	assert (ch->getNumSlotsFree() > 0);
+	int prevFullness = getFullness (ch);
+	int prevInUse = ch->getNumSlotsInUse();
+	assert (ch->getHeap() == this);
+  ptr = ch->getSlot();
+  inUse++;
+	assert (prevInUse + 1 == ch->getNumSlotsInUse());
+	int newFullness = getFullness (ch);
+	if (prevFullness != newFullness) {
+		int n = update (ch, prevFullness);
+		assert (n == newFullness);
+	}
+  chunkType * bch = (chunkType *) chunkType::getChunk(ptr);
+  assert (bch == ch);
+  assert (ptr != NULL);
+	checkClassInvariant();
+  return ptr;
+}
+
+
+template <int chunkSize, int slotSize, int emptyFraction, class Super>
+void LooseSlotHeap<chunkSize, slotSize, emptyFraction, Super>::free (void * ptr) {
+  chunkType * ch
+    = (chunkType *) chunkType::getChunk (ptr);
+	assert (ch != NULL);
+	(ch->getHeap())->localFree (ptr);
+}
+
+
+template <int chunkSize, int slotSize, int emptyFraction, class Super>
+void LooseSlotHeap<chunkSize, slotSize, emptyFraction, Super>::localFree (void * ptr) {
+	checkClassInvariant();
+	printf ("free! (in use = %d, space = %d)\n", inUse, space);
+  // Mark the slot in the chunk as free.
+  chunkType * ch
+    = (chunkType *) chunkType::getChunk (ptr);
+	assert (ch != NULL);
+	assert (ch->getHeap() == this);
+	int prevFullness = getFullness (ch);
+	int prevInUse = ch->getNumSlotsInUse();
+  ch->putSlot (ptr);
+	inUse--;
+	assert (prevInUse - 1 == ch->getNumSlotsInUse());
+	checkClassInvariant();
+	int newIndex = getFullness (ch);
+	if (prevFullness != newIndex) {
+		int n = update (ch, prevFullness);
+		assert (n == newIndex);
+	}
+  // If we are more than 1/emptyFraction empty,
+  // return a mostly-empty chunk to the super heap.
+  if ((space - inUse > 2 * chunkSize/slotSize)
+		&& (emptyFraction * (space - inUse) > space)) {
+		printf ("RETURNING A CHUNK!\n");
+		// Find an empty chunk.
+		int emptyIndex = 0;
+		ch = NULL;
+		while (emptyIndex < emptyFraction) {
+			ch = myChunks[emptyIndex];
+			if (ch != NULL)
+				break;
+			emptyIndex++;
+		}
+		assert (ch != NULL);
+		checkClassInvariant();
+		ch->setHeap (NULL);
+    // Remove a chunk and give it to the super heap.
+		myChunks[emptyIndex] = myChunks[emptyIndex]->getNext();
+		if (myChunks[emptyIndex] != NULL) {
+			myChunks[emptyIndex]->setPrev (NULL);
+		}
+		ch->setPrev (NULL);
+		ch->setNext (NULL);
+		// A sanity check on the chunk we're about to return.
+		assert (ch->getNumSlotsFree() >= 0);
+		assert (ch->getNumSlots() >= ch->getNumSlotsFree());
+		printf ("Updating space & in use: was %d, %d (slots in use = %d)\n",
+			space, inUse, ch->getNumSlotsInUse());
+		space -= ch->getNumSlots();
+		inUse -= ch->getNumSlotsInUse();
+		printf ("Updating space & in use: NOW %d, %d\n", space, inUse);
+		theHeap.free (ch);
+		checkClassInvariant();
+  }
+	checkClassInvariant();
+}
+
+
+// Move a chunk, if necessary, into the right list
+// based on its emptiness.
+template <int chunkSize, int slotSize, int emptyFraction, class Super>
+int LooseSlotHeap<chunkSize, slotSize, emptyFraction, Super>::update (chunkType * ch, int prevIndex)
+{
+  // Move this chunk if necessary.
+#ifndef NDEBUG
+	chunkType * bch = myChunks[prevIndex];
+	while (bch != NULL) {
+		if (bch == ch)
+			break;
+		bch = bch->getNext();
+	}
+	assert (bch == ch);
+#endif
+  int newIndex = getFullness(ch);
+  // printf ("newIndex = %d\n", newIndex);
+	// Reset last index (for simplicity). // FIX ME??
+  // Remove the chunk from its current list.
+	if (ch == myChunks[prevIndex]) {
+		myChunks[prevIndex] = myChunks[prevIndex]->getNext();
+	}
+	/////	lastIndex = emptyFraction - 1;
+  if (ch->getPrev() != NULL) {
+		ch->getPrev()->setNext(ch->getNext());
+  }
+	if (ch->getNext() != NULL) {
+	  ch->getNext()->setPrev(ch->getPrev());
+  }
+  // Add it to the newIndex list.
+  chunkType*& head = myChunks[newIndex];
+  ch->setPrev (NULL);
+  ch->setNext (head);
+  if (head != NULL) {
+    head->setPrev(ch);
+  }
+	head = ch;
+	// Verify that the chunk is in the right list.
+#ifndef NDEBUG
+	bch = myChunks[newIndex];
+	while (bch != NULL) {
+		if (bch == ch)
+			break;
+		bch = bch->getNext();
+	}
+	assert (bch == ch);
+#endif
+	return newIndex;
+}
+
+
+
+#endif
Index: /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/experimental/multiheap.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/experimental/multiheap.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/experimental/multiheap.h	(revision 176)
@@ -0,0 +1,47 @@
+#ifndef _MULTIHEAP_H_
+#define _MULTIHEAP_H_
+
+#if defined(WIN32) || defined(__WIN32__) || defined(_WIN32)
+#ifndef WIN32
+#define WIN32 1
+#endif
+#include <windows.h>
+#include <process.h>
+#endif
+
+template <int NumHeaps, class Super>
+class MultiHeap : public Super {
+public:
+
+  inline void * malloc (size_t sz) {
+    // Hash the thread id.
+    // We assume that it's impossible for two threads to collide.
+    int tid = getThreadId() % NumHeaps;
+    void * ptr = mySuper[tid].malloc (sz + sizeof(double));
+    *((int *) ptr) = tid;
+    void * newPtr = (void *) ((double *) ptr + 1);
+    return newPtr;
+  }
+
+  inline void free (void * ptr) {
+    // Return the object to its own heap.
+    void * originalPtr = (void *) ((double *) ptr - 1);
+    int heapIndex = *((int *) originalPtr);
+    // FIX ME! A 'cache' would be nice here...
+    // FIX ME! We need a lock here.
+    mySuper[heapIndex].free (originalPtr);
+  }
+
+private:
+
+  Super mySuper[NumHeaps];
+
+  int getThreadId (void) {
+#if WIN32
+    return GetCurrentThreadId();
+#endif
+  }
+
+};
+
+#endif
Index: /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/experimental/multimalloc.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/experimental/multimalloc.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/experimental/multimalloc.h	(revision 176)
@@ -0,0 +1,126 @@
+#ifndef _MULTIMALLOC_H_
+#define _MULTIMALLOC_H_
+
+#include <assert.h>
+
+#include <fstream.h>
+
+
+#include "dynarray.h"
+#include "stack.h"
+
+
+template <class SuperHeap>
+class MultiMalloc : public SuperHeap {
+public:
+
+
+	MultiMalloc (void) {
+		//f.open ("multimalloc.log");
+	}
+
+	~MultiMalloc (void) {
+		//f.close ();
+	}
+
+	// Sets ptr to a list of up to num objects of size sz
+	// and returns how many free objects ptr points to.
+	int multimalloc (int num, size_t sz, void *& ptr)
+	{
+		//f << "multimalloc from " << this << endl << flush;
+		// printf ("multimalloc\n");
+		assert (num > 0);
+		if (stk.empty()) {
+#if 0
+			//f << "malloc " << num << ", " << sz << "\n" << flush;
+			ptr = SuperHeap::malloc (sz);
+			assert (size(ptr) >= sz);
+			assert (sz >= sizeof(FreeObject *));
+			FreeObject * p = (FreeObject *) ptr;
+			for (int i = 1; i < num; i++) {
+				p->next = (FreeObject *) SuperHeap::malloc (sz);
+				p = p->next;
+				assert (size(p) >= sz);
+			}
+			p->next = NULL;
+#else
+			size_t sz1 = align(sz + sizeof(double));
+			ptr = SuperHeap::malloc (num * sz1); // Allow room for size & thread info.
+			ptr = (double *) ptr + 1;
+			FreeObject * p = (FreeObject *) ptr;
+			for (int i = 0; i < num - 1; i++) {
+				size(p) = sz;
+				FreeObject * next = (FreeObject *) (((unsigned long) p) + sz1);
+				p->next = next;
+				p = p->next;
+			}
+			size(p) = sz;
+			p->next = NULL;
+			assert (size(p) + ((unsigned long) p) <= ((unsigned long) ptr + num * sz1));
+#endif
+
+#ifndef NDEBUG
+			p = (FreeObject *) ptr;
+			int c = 0;
+			while (p != NULL) {
+				c++;
+				p = p->next;
+			}
+			assert (c == num);
+#endif
+			return num;
+		} else {
+			// Pop off some memory from the stack.
+			assert (!stk.empty());
+			np v = stk.pop();
+			// JUST FOR CHECKING --
+			assert (v.num == num);
+			ptr = v.ptr;
+			assert (v.num > 0);
+			assert (size(ptr) >= sz);
+			//f << "multimalloc " << v.num << ", " << sz << "\n" << flush;
+			return v.num;
+		}
+	}
+
+	// Frees all num items pointed to by ptr.
+	void multifree (int num, void * ptr)
+	{
+		// printf ("multifree\n");
+		np v;
+		//f << "multifree " << num << ", size = " << size(ptr) << "\n" << flush;
+		v.num = num;
+		v.ptr = ptr;
+		stk.push (v);
+	}
+
+private:
+
+	MultiMalloc (const MultiMalloc&);
+	MultiMalloc& operator=(const MultiMalloc&);
+
+	class np {
+	public:
+		int num;
+		void * ptr;
+	};
+
+	class FreeObject {
+	public:
+		FreeObject * next;
+	};
+
+	void * malloc (size_t);
+	void free (void *);
+
+	Stack<np, DynArray<np> > stk;
+	//ofstream f;
+
+	static inline size_t align (size_t sz) {
+		return (sz + (sizeof(double) - 1)) & ~(sizeof(double) - 1);
+	}
+
+};
+
+
+#endif
Index: /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/experimental/objectmanager.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/experimental/objectmanager.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/experimental/objectmanager.h	(revision 176)
@@ -0,0 +1,354 @@
+// -*- C++ -*-
+
+/*
+
+  Heap Layers: An Extensible Memory Allocation Infrastructure
+  
+  Copyright (C) 2000-2003 by Emery Berger
+  http://www.cs.umass.edu/~emery
+  emery@cs.umass.edu
+  
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or
+  (at your option) any later version.
+  
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+  
+  You should have received a copy of the GNU General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+*/
+
+#ifndef _OBJECTMANAGER_H_
+#define _OBJECTMANAGER_H_
+
+#include <stdlib.h>  // for size_t
+
+namespace HL {
+
+class EmptyHeap {};
+
+// The default object manager class.
+
+
+template <class SuperHeap>
+class ObjectManagerBase : public SuperHeap {
+public:
+
+  // Return the object's size.
+  inline static size_t getSize (void * const ptr) {
+    return getObject(ptr)->getSize();
+  }
+
+protected:
+
+  //// accessors ////
+
+  // Return the object's overhead (i.e., in the header).
+  inline static size_t getOverhead (void * const) {
+    return sizeof(AllocatedObject);
+  }
+
+  // Is this object free?
+  inline static bool isFree (void * const ptr) {
+    return getObject(ptr)->isFree();
+  }
+
+
+  // Is the previous object free?
+  inline static bool isPrevFree (void * const ptr) {
+    return getObject(ptr)->isPrevFree();
+  }
+
+  // Previous object
+  inline static void * getPrev (void * const ptr) {
+    return getObject(ptr)->getPrev();
+  }
+
+
+  // Next object
+  inline static void * getNext (void * const ptr) {
+    return getObject(ptr)->getNext();
+  }
+
+
+  //// mutators ////
+	
+  // Instantiate an object in a given space.
+  inline static void * makeObject (void * buf, size_t prevSize, size_t sz) {
+    AllocatedObject * p = new (buf) AllocatedObject (prevSize, sz);
+    return (void *) (p + 1);
+  }
+
+  inline static size_t getPrevSize (void * const ptr) {
+    return getObject(ptr)->getPrevSize();
+  }
+	
+  // Mark this item as free.
+  inline static void markFree (void * ptr) {
+    getObject(ptr)->markFree();
+    getObject(getNext(ptr))->markPrevFree();
+  }
+
+  // Mark this item as in use.
+  inline static void markInUse (void * ptr) {
+    getObject(ptr)->markInUse();
+    getObject(getNext(ptr))->markPrevInUse();
+  }
+
+
+private:
+
+
+  // Change the object's size.
+  inline static void setSize (void * ptr, size_t sz) {
+    getObject(ptr)->setSize (sz);
+  }
+
+  // Change the object's size.
+  inline static void setPrevSize (void * ptr, size_t sz) {
+    getObject(ptr)->setPrevSize (sz);
+  }
+
+
+  // All objects managed by this object manager
+  // are prefaced by a header of type AllocatedObject,
+  // which manages the size of the current & previous allocated objects.
+
+  class AllocatedObject {
+    friend class ObjectManagerBase<SuperHeap>;
+  private:
+    inline AllocatedObject (size_t prevSize, size_t sz)
+      : _sz (sz)
+      , _prevSize (prevSize)
+#if 0 //ndef NDEBUG
+      , _magic ((double) MAGIC_NUMBER)
+#endif
+      {
+	// Set the prev size of the next object.
+	((AllocatedObject *) ((char *) (this + 1) + _sz))->setPrevSize (sz);
+	assert (!isFree());
+	assert (!isPrevFree());
+      }
+
+    inline size_t getSize (void) const {
+      assert (isValid());
+      return _sz & ~FREE_BIT;
+    }
+    inline void setSize (size_t sz) {
+      assert (sz > 0);
+      assert (isValid());
+      _sz = sz;
+    }
+    inline bool isFree (void) const {
+      assert (isValid());
+      return _sz & FREE_BIT;
+    }
+    inline bool isPrevFree (void) const {
+      assert (isValid());
+      return _prevSize & FREE_BIT;
+    }
+    // Return the previous object (in address order).
+    inline void * getPrev (void) const {
+      assert (isValid());
+      return (void *) ((char *) this - getPrevSize());
+    }
+    // Return the next object (in address order).
+    inline void * getNext (void) const {
+      assert (isValid());
+      return (void *) ((char *) (this+2) + getSize());
+    }
+    inline size_t getPrevSize (void) const {
+      assert (isValid());
+      return _prevSize & ~FREE_BIT;
+    }
+    inline void markFree (void) {
+      assert (isValid());
+      markFree(_sz);
+    }
+    inline void markInUse (void) {
+      assert (isValid());
+      markInUse(_sz);
+    }
+    inline void markPrevFree (void) {
+      assert (isValid());
+      markFree(_prevSize);
+    }
+    inline void markPrevInUse (void) {
+      assert (isValid());
+      markInUse(_prevSize);
+    }
+    inline void setPrevSize (size_t sz) {
+      assert (sz > 0);
+      assert (isValid());
+      _prevSize = sz;
+    }
+  private:
+    enum { FREE_BIT = 1 };
+    enum { MAGIC_NUMBER = 0 };
+
+    int isValid (void) const {
+#if 0 // ndef NDEBUG
+      return (_magic == (double) MAGIC_NUMBER);
+#else
+      return 1; //((_sz & 6) == 0);
+#endif
+    }
+
+    inline static void markInUse (size_t& sz) {
+      sz &= ~FREE_BIT;
+    }
+
+    inline static void markFree (size_t& sz) {
+      sz |= FREE_BIT;
+    }
+
+
+    // The size of the previous object (that is, right behind this one).
+    size_t _prevSize;
+
+    // We steal the last bit of the size field
+    // for free/in use.
+    // If the last bit is 1, the object is free.
+    // Otherwise, it's in use.
+    size_t _sz;
+
+#if 0 //ndef NDEBUG
+    double _magic;
+#endif
+  };
+
+protected:
+  inline static AllocatedObject * getObject (void * const ptr) {
+    return (AllocatedObject *) ptr - 1;
+  }
+};
+
+
+
+template <class SuperHeap>
+class ProvideObjectManager : public ObjectManagerBase<SuperHeap> {
+public:
+  inline void * malloc (size_t sz) {
+    assert (sz > 0);
+    void * ptr = SuperHeap::malloc (sz + getOverhead(NULL));
+    if (ptr == NULL)
+      return NULL;
+    void * p = makeObject (ptr, getPrevSize((char *) ptr + getOverhead(NULL)), sz);
+    markInUse (p);
+    assert (getSize(p) >= sz);
+    assert (getPrevSize(getNext(p)) == getSize(p));
+    return p;
+  }
+
+  inline void free (void * ptr) {
+    int ps = getPrevSize(getNext(ptr));
+    int sz = getSize(ptr);
+    assert (getPrevSize(getNext(ptr)) == getSize(ptr));
+    markFree (ptr);
+    SuperHeap::free ((void *) getObject(ptr));
+  }
+};
+
+
+template <class SuperHeap>
+class ObjectManager : public ObjectManagerBase<SuperHeap> {
+public:
+#if 1
+  inline void * malloc (size_t sz) {
+    void * p = SuperHeap::malloc (sz);
+    if (p != NULL) {
+      assert (getSize(p) >= sz);
+      //setPrevSize(getNext(p), getSize(p));
+      markInUse (p);
+    }
+    return p;
+  }
+
+  inline void free (void * ptr) {
+    markFree (ptr);
+    SuperHeap::free (ptr);
+  }
+#endif
+};
+
+
+
+class ObjectManagerWrapper {
+public:
+  template <class S>
+  class Manager : public ObjectManager<S> {};
+};
+
+
+class ProvideObjectManagerWrapper {
+public:
+  template <class S>
+  class Manager : public ProvideObjectManager<S> {};
+};
+
+template <class S>
+class NOP : public S {};
+
+class NullObjectManagerWrapper {
+public:
+  template <class S>
+  class Manager : public NOP<S> {};
+};
+
+
+/*
+
+  This ObjectManagerHeap is a tortuous work-around
+  for a bug in Visual C++ 6.0 that finally allows us
+  to pass ObjectManager wrappers as template arguments.
+
+  This can go away once support is added for nested templates.
+
+  Wrappers look like this:
+
+  class Wrap1 {
+  public:
+	template <class S>
+		class Manager : public ObjectManager<S> {};
+  };
+
+  */
+
+
+#if __SVR4
+template <class SuperHeap, class OMWrapper>
+class SelectObjectManagerHeap {
+public:
+  class TheHeap : public OMWrapper::Manager<SuperHeap> {};
+};
+
+#else
+template <class SuperHeap, class OMWrapper>
+class SelectObjectManagerHeap  {
+public:
+  class ObjectManagerHeapProxy1 : public OMWrapper {
+  public:
+    template <class A> class Manager {};
+  };
+
+  class ObjectManagerHeapProxy2 : public ObjectManagerHeapProxy1 {
+  private:
+    typedef typename OMWrapper::Manager<SuperHeap> ManageFoo;
+  public:
+    class ManageMe : public ManageFoo {};
+  };
+
+  class TheHeap : public ObjectManagerHeapProxy2::ManageMe {};
+};
+#endif
+
+};
+
+#endif
+
Index: /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/experimental/pad.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/experimental/pad.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/experimental/pad.h	(revision 176)
@@ -0,0 +1,16 @@
+#ifndef _PAD_H_
+#define _PAD_H_
+
+
+// Add a cache-pad to an object.
+
+template <int CacheLineSize, class Super>
+class Pad : public Super {
+private:
+	// Add a pad field with a name that is unlikely
+	// to conflict with a real field name.
+	char _pad_QWERTYUIOP1234567890[CacheLineSize];
+};
+
+
+#endif
Index: /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/experimental/prefetchheap.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/experimental/prefetchheap.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/experimental/prefetchheap.h	(revision 176)
@@ -0,0 +1,31 @@
+/* -*- C++ -*- */
+
+#ifndef _PREFETCHHEAP_H_
+#define _PREFETCHHEAP_H_
+
+#define prefetcht0					  __asm _emit 0x0f __asm _emit 0x18 __asm _emit 0x08
+
+
+template <class Super>
+class PrefetchHeap : public Super {
+public:
+  
+  inline void * malloc (size_t sz) {
+    void * Address = Super::malloc (sz);
+#ifdef _M_IX86
+      // Prefetch this ptr before we return.
+      __asm
+	{
+	  mov   eax,Address    // Load Address.
+	  prefetcht0    // Prefetch into the L1.
+	}
+#endif
+    return Address;
+  }
+  
+  inline void free (void * ptr) {
+    Super::free (ptr);
+  }
+};
+
+#endif
Index: /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/experimental/scalableleaheap.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/experimental/scalableleaheap.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/experimental/scalableleaheap.h	(revision 176)
@@ -0,0 +1,125 @@
+#ifndef _SCALABLELEAHEAP_H_
+#define _SCALABLELEAHEAP_H_
+
+#include "heaplayers.h"
+
+namespace ScalableHeapNS {
+
+	template <int NumHeaps, class SuperHeap>
+	class GlobalHeapWrapper : public SuperHeap {
+	public:
+		inline void * malloc (size_t sz) {
+			void * ptr = SuperHeap::malloc (sz);
+			if (ptr != NULL) {
+				assert (!isFree(ptr));
+			}
+			return ptr;
+		}
+		inline void free (void * ptr) {
+			// Set this object's heap to an unassigned heap (NumHeaps),
+			// then free it.
+			setHeap (ptr, NumHeaps); // This should be an unassigned heap number.
+			assert (getHeap(ptr) == NumHeaps);
+			setPrevHeap(getNext(ptr), NumHeaps);
+			assert (getPrevHeap(getNext(ptr)) == NumHeaps);
+			SuperHeap::free (ptr);
+		}
+	private:
+		inline int remove (void *);
+	};
+
+
+  template <int Threshold, class Heap1, class Heap2>
+  class TryHeap : public Heap2 {
+  public:
+	  TryHeap (void)
+		  : reserved (0)
+	  {}
+
+    inline void * malloc (size_t sz) {
+      void * ptr = heap1.malloc (sz);
+      if (ptr == NULL) {
+#if 1
+		// Get a big chunk.
+		size_t chunkSize = (Threshold / 2) > sz ? (Threshold / 2) : sz;
+		ptr = Heap2::malloc (chunkSize);
+		if (ptr == NULL) {
+			return NULL;
+		}
+		// Split it.
+		void * splitPiece = CoalesceHeap<Heap2>::split (ptr, sz);
+		assert (splitPiece != ptr);
+		assert (!isFree(ptr));
+		// Put the split piece on heap 1.
+		if (splitPiece != NULL) {
+			reserved += getSize(splitPiece);
+			heap1.free (splitPiece);
+		}
+#else
+		ptr = Heap2::malloc (sz);
+#endif
+	  } else {
+		  reserved -= getSize(ptr);
+	  }
+//	  assert (getHeap(ptr) == tid);
+      return ptr;
+    }
+    inline void free (void * ptr) {
+	  reserved += getSize(ptr);
+      heap1.free (ptr);
+      if (reserved > Threshold) {
+		// We've crossed the threshold.
+		// Free objects from heap 1 and give them to heap 2.
+		// Start big.
+		size_t sz = Threshold / 2;
+		while ((sz > sizeof(double)) && (reserved > Threshold / 2)) {
+		  void * p = NULL;
+		  while ((p == NULL) && (sz >= sizeof(double))) {
+			p = heap1.malloc (sz);
+			if (p == NULL) {
+			  sz >>= 1;
+			}
+		  }
+		  if (p != NULL) {
+			  reserved -= getSize(p);
+			  Heap2::free (p);
+		  }
+		}
+      }
+    }
+
+	
+  private:
+	inline int remove (void * ptr);
+#if 0
+	{
+		assert (0);
+		abort();
+	}
+#endif
+
+    Heap1 heap1;
+	int reserved;
+  };
+
+
+  template <int NumHeaps, int MmapThreshold, class BaseNullHeap, class BaseHeap>
+  class SmallHeap : public
+	  ScalableHeapNS::TryHeap<MmapThreshold,
+        MarkThreadHeap<NumHeaps, BaseNullHeap>,
+        MarkThreadHeap<NumHeaps, GlobalHeapWrapper<NumHeaps, BaseHeap> > > {};
+
+  template <int NumHeaps, int MmapThreshold, class BaseNullHeap, class BaseHeap>
+  class MTHeap :
+    public PHOThreadHeap<NumHeaps,
+		     LockedHeap<SmallHeap<NumHeaps, MmapThreshold, BaseNullHeap, BaseHeap> > > {};
+
+};
+
+  
+template <int NumHeaps, class BaseNullHeap, class BaseHeap, class Mmap>
+class ScalableHeap :
+public SelectMmapHeap<128 * 1024,
+         ScalableHeapNS::MTHeap<NumHeaps, 128 * 1024, BaseNullHeap, BaseHeap>,
+		    LockedHeap<Mmap> > {};
+#endif
Index: /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/experimental/seg.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/experimental/seg.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/experimental/seg.h	(revision 176)
@@ -0,0 +1,413 @@
+// -*- C++ -*-
+
+/*
+
+  Heap Layers: An Extensible Memory Allocation Infrastructure
+  
+  Copyright (C) 2000-2003 by Emery Berger
+  http://www.cs.umass.edu/~emery
+  emery@cs.umass.edu
+  
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or
+  (at your option) any later version.
+  
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+  
+  You should have received a copy of the GNU General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+*/
+
+#ifndef _SEG_H_
+#define _SEG_H_
+
+#include <assert.h>
+
+#include "sassert.h"
+#include "reaplet.h"
+
+namespace HL {
+
+template <int ReapletSize,
+	  class SizeClassComputer,
+	  class TopHeap>
+class Seg : public TopHeap {
+public:
+
+  enum { Alignment = sizeof(double) };
+
+private:
+
+  Seg (void)
+  {
+    sassert <(sizeof(Reaplet<ReapletSize>) == ReapletSize)> verifyReapletSize;
+  }
+  
+  class SanityChecker {
+  public:
+    SanityChecker (Seg * s)
+      : _s (s)
+      {
+	_s->sanityCheck();
+      }
+    ~SanityChecker (void) {
+      _s->sanityCheck();
+    }
+  private:
+    Seg * _s;
+  };
+
+
+#if 1
+  enum { TopAlignment = TopHeap::Alignment };
+
+  class VerifyAlignment :
+    public sassert <TopAlignment % ReapletSize == 0> {};
+#endif
+
+public:
+
+  __forceinline Seg (void) {
+    for (int i = 0; i < SizeClassComputer::NUM_BINS; i++) {
+      available[i] = 0;
+      full[i] = 0;
+    }
+  }
+
+  ~Seg (void) {
+    clear();
+  }
+
+  __forceinline void * malloc (size_t sz) {
+    SanityChecker c (this);
+    assert (sz <= SizeClassComputer::BIG_OBJECT);
+    const int SizeClass = SizeClassComputer::getSizeClass (sz);
+    // Try to use one of our reaplets to satisfy the request.
+    Reaplet<ReapletSize> * const xs = available[SizeClass];
+    if (xs) {
+      //      assert (!xs->isFull());
+      // We've got one. Now try to get some memory from it.
+      void * const ptr = xs->malloc (SizeClassComputer::bins[SizeClass]);
+      //      printf ("allocated: %x\n", ptr);
+      if (ptr) {
+	// Success! We're out of here.
+	return ptr;
+      } else {
+	// It's full.
+	//	printf ("Full - adios.\n");
+	removeFromAvailable (xs, SizeClass);
+      }
+    }
+    //    printf ("slow!\n");
+    // We have to go get more memory.
+    return slowPathGetMoreMemory (sz);
+  }
+
+
+  __forceinline static size_t getSize (void * ptr) {
+    return (enclosingReaplet (ptr))->getSize();
+  }
+
+  __forceinline void free (void * ptr) {
+    SanityChecker c (this);
+    // printf ("seg free: r = %x\n", r);
+    Reaplet<ReapletSize> * r = enclosingReaplet (ptr);
+    //    printf ("freeing %x to %x\n", ptr, r);
+    //    if (sz <= SizeClassComputer::BIG_OBJECT) {
+    // It's a small object. Free it.
+    bool wasFull = r->isFull(); //  || !r->getAmountAllocated()) {
+    r->free (ptr);
+    if (wasFull) {
+      moveFromFullToAvailable (r);
+    }
+  }
+
+  void clear (void) {
+    SanityChecker c (this);
+    for (int i = 0; i < SizeClassComputer::NUM_BINS; i++) {
+      clearOut (full[i]);
+      clearOut (available[i]);
+    }
+  }
+
+private:
+
+  __forceinline void * slowPathGetMoreMemory (const size_t sz) {
+    //    printf ("slowpathgetmorememory\n");
+    SanityChecker c (this);
+    if (sz <= SizeClassComputer::BIG_OBJECT) {
+      const int SizeClass = SizeClassComputer::getSizeClass (sz);
+      do {
+	// printf ("looking for more memory.\n");
+	Reaplet<ReapletSize> * xs = available[SizeClass];
+	// Look for an available reaplet.
+	if (xs != 0) {
+	  assert (!xs->isFull());
+	  // We've got one. Now try to get some memory from it.
+	  void * ptr = xs->malloc (SizeClassComputer::bins[SizeClass]);
+	  if (ptr) {
+	    // Success!
+	    //	    printf ("amt free = %d\n", enclosingReaplet(ptr)->getAmountFree());
+	    // printf ("success: found more memory.\n");
+	    return ptr;
+	  } else {
+	    //	    printf ("Adios!\n");
+	    // This reaplet is out of memory.
+	    // Remove it from the available list.
+	    removeFromAvailable (xs, SizeClass);
+	    // Put it on the full list.
+	    putOnFullList (xs, SizeClass);
+	  }
+	} else {
+	  // The current bin is empty - make another reaplet.
+	  int r = insertNewReaplet (SizeClass);
+	  if (!r) {
+	    return 0;
+	  }
+	}
+      } while (1);
+    } else {
+      return makeBigObject (sz);
+    }
+  }
+
+  __forceinline void sanityCheck (void) {
+#if !defined(NDEBUG)
+    // FIX ME
+    //#error "whoa dude. slowing things down."
+    Reaplet<ReapletSize> * q;
+    for (int i = 0; i < SizeClassComputer::NUM_BINS; i++) {
+      // Visit the available list.
+      q = available[i];
+      if (q) {
+	assert (q->getPrev() == 0);
+      }
+      while (q) {
+	if (q->isFull()) {
+	  // printf ("allocated = %d\n", q->getAmountAllocated());
+	}
+	assert (!q->isFull());
+	q = (Reaplet<ReapletSize> *) q->getNext();
+      }
+      // Now visit the full list.
+      q = full[i];
+      if (q) {
+	assert (q->getPrev() == 0);
+      }
+      while (q) {
+	assert (q->isFull());
+	q = (Reaplet<ReapletSize> *) q->getNext();
+      }
+    }
+#endif
+  }
+
+  __forceinline
+  void putOnFullList (Reaplet<ReapletSize> * xs,
+		      const int SizeClass) {
+    // printf ("putOnFullList %d\n", SizeClass);
+    SanityChecker c (this);
+    //    assert (!xs->isFull());
+    xs->setNext (full[SizeClass]);
+    xs->setPrev (0);
+    if (full[SizeClass]) {
+      full[SizeClass]->setPrev (xs);
+    }
+    full[SizeClass] = xs;
+    //    xs->markFull();
+  }
+
+  __forceinline void clearOut (Reaplet<ReapletSize> *& list) {
+    SanityChecker c (this);
+    Reaplet<ReapletSize> * q;
+    q = list;
+    while (q) {
+      Reaplet<ReapletSize> * c = q;
+      q = (Reaplet<ReapletSize> *) q->getNext();
+      TopHeap::free (c);
+    }
+    list = 0;
+  }
+
+  __forceinline void removeFromFullList (Reaplet<ReapletSize> * r,
+					 const size_t sz) {
+    //    printf ("removeFromFullList\n");
+    // prev <-> r <-> next =>
+    // prev <-> next
+    SanityChecker c (this);
+    //    assert (r->isFull());
+    // Remove from full list.
+    Reaplet<ReapletSize> * prev, * next;
+    prev = (Reaplet<ReapletSize> *) r->getPrev();
+    next = (Reaplet<ReapletSize> *) r->getNext();
+    assert (prev != r);
+    assert (next != r);
+    if (prev) {
+      prev->setNext (next);
+    }
+    if (next) {
+      next->setPrev (prev);
+    }
+    const int SizeClass = SizeClassComputer::getSizeClass (sz);
+    if (r == full[SizeClass]) {
+      assert (prev == 0);
+      full[SizeClass] = next;
+    }
+    assert (full[SizeClass] != r);
+    // r->setPrev (0);
+    // r->setNext (0);
+    //    r->markNotFull();
+  }
+
+  __forceinline
+  void moveFromFullToAvailable (Reaplet<ReapletSize> * r) {
+    SanityChecker c (this);
+    const size_t sz = r->getSize();
+    removeFromFullList (r, sz);
+    // Put it on the available list.
+    addToAvailableList (r, sz);
+    assert (r->getPrev() == 0);
+  }
+
+  __forceinline
+  void removeAndFreeReaplet (Reaplet<ReapletSize> * r)
+  {
+    SanityChecker c (this);
+    assert (!r->isFull());
+    const size_t sz = r->getSize();
+    Reaplet<ReapletSize> * n
+      = (Reaplet<ReapletSize> *) r->getNext();
+    Reaplet<ReapletSize> * p
+      = (Reaplet<ReapletSize> *) r->getPrev();
+    if (n) {
+      n->setPrev (p);
+    }
+    if (p) {
+      p->setNext (n);
+    }
+    int sizeclass = SizeClassComputer::getSizeClass (sz);
+    if (available[sizeclass] == r) {
+      available[sizeclass] = n;
+    }
+    //r->setPrev ((Reaplet<ReapletSize> *) 1);
+    //r->setNext ((Reaplet<ReapletSize> *) 1);
+    //r->clear();
+    TopHeap::free (r);
+    //	printf ("reset %d\n", sz);
+  }
+
+  __forceinline
+  int insertNewReaplet (int SizeClass)
+  {
+    // printf ("insertNewReaplet\n");
+    SanityChecker c (this);
+    void * m = TopHeap::malloc (ReapletSize);
+    // NOTE: TopHeap *must* add a reaplet prefix.
+    // Ensure m is aligned properly.
+    assert (((size_t) m & (ReapletSize - 1)) == 0);
+    if (m == 0) {
+      // printf ("NO MORE MEMORY!\n");
+      // No more memory.
+      return 0;
+    }
+    // Make a new Reaplet for this size class.
+    size_t ssz = SizeClassComputer::getClassSize (SizeClass);
+    
+    // printf ("new reaplet!: ssz = %d\n", ssz);
+    available[SizeClass] = new (m) Reaplet<ReapletSize> (ssz);
+    available[SizeClass]->clear();
+    return 1;
+  }
+
+protected:
+
+  __forceinline
+  void addToAvailableList (Reaplet<ReapletSize> * r,
+			   size_t sz)
+  {
+    SanityChecker c (this);
+    //    assert (!r->isFull());
+    const int SizeClass = SizeClassComputer::getSizeClass (sz);
+    Reaplet<ReapletSize> * head = available[SizeClass];
+
+    assert (head != r);
+
+    // r
+    // => r <-> head
+    
+    r->setPrev (0);
+    r->setNext (head);
+    if (head) {
+      head->setPrev (r);
+    }
+    available[SizeClass] = r;
+  }
+
+private:
+
+  NO_INLINE void removeFromAvailable (Reaplet<ReapletSize> * xs,
+					  const int SizeClass) {
+    //    printf ("removefromavailable %d.\n", SizeClass);
+    // The reaplet xs is out of memory.
+    // Remove it from the linked list.
+    // Note that it is the head of the linked list.
+    //	printf ("Removing REAPLET %x\n", xs);
+    assert (xs->isFull());
+    assert (xs->getPrev() == 0);
+    Reaplet<ReapletSize> * n
+      = (Reaplet<ReapletSize> *) xs->getNext();
+    if (n) {
+      // printf ("setprev.\n");
+      n->setPrev (0);
+      assert (!n->isFull());
+    }
+    available[SizeClass] = n;
+    SanityChecker c (this);
+    // xs->setPrev ((Reaplet<ReapletSize> *) 1);
+    // xs->setNext ((Reaplet<ReapletSize> *) 1);
+    assert (n == 0 || (n->getPrev() == 0));
+  }
+
+  __forceinline static Reaplet<ReapletSize> * enclosingReaplet (void * ptr) {
+    // Find the enclosing reaplet for this pointer.
+    Reaplet<ReapletSize> * r
+      = (Reaplet<ReapletSize> *) (((size_t) ptr) & ~(ReapletSize - 1));
+    return r;
+  }
+
+#if 1
+  NO_INLINE
+  void * makeBigObject (size_t sz) {
+    //    printf ("makeBigObject\n");
+    SanityChecker c (this);
+    //    printf ("make big object: %d\n", sz);
+    // Allocate big objects from the top heap. These must be
+    // ReapletSize aligned.
+    assert (sz > SizeClassComputer::BIG_OBJECT);
+    ReapletBase * m
+      = (ReapletBase *) TopHeap::malloc (sz + sizeof(ReapletBase));
+    // printf ("m = %x, size = %d\n", m, ReapletSize);
+    assert (((size_t) m & (ReapletSize - 1)) == 0);
+    // Put a reaplet base object as a header in the beginning. We
+    // need this for size information.
+    if (m == 0) {
+      return 0;
+    }
+    new (m) ReapletBase (sz, (char *) (m + 1)); 
+    return (void *) (m + 1);
+  }
+#endif
+
+  Reaplet<ReapletSize> * available[SizeClassComputer::NUM_BINS];
+  Reaplet<ReapletSize> * full[SizeClassComputer::NUM_BINS];
+};
+
+};
+
+#endif
Index: /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/experimental/sizethreadheap.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/experimental/sizethreadheap.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/experimental/sizethreadheap.h	(revision 176)
@@ -0,0 +1,95 @@
+/* -*- C++ -*- */
+
+#ifndef _SIZETHREADHEAP_H_
+#define _SIZETHREADHEAP_H_
+
+#include <assert.h>
+
+template <class Super>
+class SizeThreadHeap : public Super {
+public:
+  
+  inline void * malloc (size_t sz) {
+    // Add room for a size field & a thread field.
+	// Both of these must fit in a double.
+	assert (sizeof(st) <= sizeof(double));
+    st * ptr = (st *) Super::malloc (sz + sizeof(double));
+    // Store the requested size.
+    ptr->size = sz;
+	assert (getOrigPtr(ptr + 1) == ptr);
+    return (void *) (ptr + 1);
+  }
+  
+  inline void free (void * ptr) {
+    void * origPtr = (void *) getOrigPtr(ptr);
+    Super::free (origPtr);
+  }
+
+  static inline volatile int getThreadId (void);
+
+  static inline size_t& size (void * ptr) {
+		return getOrigPtr(ptr)->size;
+  }
+
+  static inline int& thread (void * ptr) {
+		return getOrigPtr(ptr)->tid;
+	}
+
+private:
+
+	typedef struct _st {
+		size_t size;
+		int tid;
+	} st;
+
+	static inline st * getOrigPtr (void * ptr) {
+		return (st *) ((double *) ptr - 1);
+	}
+
+};
+
+
+
+// A platform-dependent way to get a thread id.
+
+// Include the necessary platform-dependent crud.
+#if defined(WIN32) || defined(__WIN32__) || defined(_WIN32)
+#ifndef WIN32
+#define WIN32 1
+#endif
+#include <windows.h>
+#include <process.h>
+#endif
+
+template <class SuperHeap>
+inline volatile int
+SizeThreadHeap<SuperHeap>::getThreadId (void) {
+#if defined(WIN32)
+  return GetCurrentThreadId();
+#endif
+#if defined(__BEOS__)
+  return find_thread(0);
+#endif
+#if defined(__linux)
+  // Consecutive thread id's in Linux are 1024 apart;
+  // dividing off the 1024 gives us an appropriate thread id.
+  return (int) pthread_self() >> 10; // (>> 10 = / 1024)
+#endif
+#if defined(__SVR4)
+  return (int) lwp_self();
+#endif
+#if defined(POSIX) // FIX ME??
+  return (int) pthread_self();
+#endif
+#if USE_SPROC // FIX ME
+  // This hairiness has the same effect as calling getpid(),
+  // but it's MUCH faster since it avoids making a system call
+  // and just accesses the sproc-local data directly.
+  int pid = (int) PRDA->sys_prda.prda_sys.t_pid;
+  return pid;
+#endif
+}
+  
+
+
+#endif
Index: /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/experimental/slotheap.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/experimental/slotheap.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/experimental/slotheap.h	(revision 176)
@@ -0,0 +1,76 @@
+/* -*- C++ -*- */
+
+#ifndef _SLOTHEAP_H_
+#define _SLOTHEAP_H_
+
+// NOTE: All size requests to malloc must be identical!
+
+/*
+
+  A "slot" allocator.
+
+  All allocations come from a fixed-size chunk of memory
+  that is carved into a number of pieces.
+
+  The "chunk" class must support the following methods:
+
+  void * getSlot (void); // Returns NULL if there is no slot left.
+  void putSlot (void *); // Puts a slot back into its chunk.
+
+*/
+
+#include <assert.h>
+
+#include "chunkheap.h"
+
+/* A "slot" heap.
+
+   This heap reserves exactly one "chunk" that is divided into
+   a number of fixed-size slots. When the chunk is used up,
+   the heap requests another one. */
+
+template <int chunkSize, int slotSize, class Super>
+class SlotInterface;
+
+template <int chunkSize, int slotSize, class Super>
+class SlotHeap : public SlotInterface<chunkSize, slotSize, ChunkHeap<chunkSize, slotSize, Super> >{};
+
+template <int chunkSize, int slotSize, class Super>
+class SlotInterface : public Super {
+public:
+
+  SlotInterface (void)
+    : currentChunk (new (Super::malloc(chunkSize)) Chunk<chunkSize, slotSize>)
+  {}
+  
+  inline void * malloc (size_t sz) {
+    assert (sz == slotSize);
+    // Use up all of the slots in one chunk,
+    // and get another chunk if we need one.
+    void * ptr = currentChunk->getSlot();
+    if (ptr == NULL) {
+      // This chunk is empty -- get another one.
+      currentChunk = new (Super::malloc(chunkSize)) Chunk<chunkSize, slotSize>;
+      ptr = currentChunk->getSlot();
+    } 
+    assert (ptr != NULL);
+    return ptr;
+  }
+  
+  inline void free (void * ptr) {
+    // If this object belongs to "our" chunk,
+    // free it directly; otherwise, pass it up.
+    if (getChunk(ptr) == currentChunk) {
+      currentChunk->putSlot (ptr);
+    } else {
+      Super::free (ptr);
+    }
+  }
+
+private:
+
+  Chunk<chunkSize, slotSize> * currentChunk;
+
+};
+
+#endif
Index: /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/experimental/splitheap.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/experimental/splitheap.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/experimental/splitheap.h	(revision 176)
@@ -0,0 +1,28 @@
+#ifndef _SPLITHEAP_H_
+#define _SPLITHEAP_H_
+
+template <class SuperHeap>
+class SplitHeap : public SuperHeap {
+public:
+  inline void * malloc (const size_t sz)
+  {
+    void * ptr = SuperHeap::malloc (sz);
+    if (ptr != NULL) {
+		markInUse (ptr);
+		size_t oldSize = getSize(ptr);
+		if (oldSize <= sz + sizeof(double)) {
+			return ptr;
+		} else {
+			void * splitPiece = split (ptr, sz);
+			if (splitPiece != NULL) {
+				// printf ("split %d into %d and %d\n", oldSize, getSize(ptr), getSize(splitPiece));
+				markFree (splitPiece);
+				SuperHeap::free (splitPiece);
+			}
+		}
+	}
+    return ptr;
+  }
+};
+
+#endif
Index: /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/experimental/strictslotheap.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/experimental/strictslotheap.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/experimental/strictslotheap.h	(revision 176)
@@ -0,0 +1,74 @@
+/* -*- C++ -*- */
+
+#ifndef _LAZYSLOTHEAP_H_
+#define _LAZYSLOTHEAP_H_
+
+/*
+  This heap manages memory in units of Chunks.
+  malloc returns a slot within a chunk,
+  while free returns slots back to a chunk.
+
+  We completely exhaust the first chunk before we ever get another one.
+  Once a chunk is COMPLETELY empty, it is returned to the superheap.
+*/
+
+#include <assert.h>
+#include <new.h>
+
+#include "chunk.h"
+
+template <int chunkSize, int slotSize, class Super>
+class LazySlotHeap : public Super {
+public:
+
+  LazySlotHeap (void)
+    : myChunk (new (Super::malloc (chunkSize)) Chunk<chunkSize, slotSize>())
+  {}
+
+  virtual ~LazySlotHeap (void)
+  {
+    // Give up our chunk.
+    Super::free (myChunk);
+  }
+
+  inline void * malloc (size_t sz) {
+    assert (sz <= chunkSize);
+    void * ptr = myChunk->getSlot();
+    if (ptr == NULL) {
+      myChunk = new (Super::malloc (chunkSize)) Chunk<chunkSize, slotSize>();
+      ptr = myChunk->getSlot();
+      assert (ptr != NULL);
+    }
+    return ptr;
+  }
+
+  inline void free (void * ptr) {
+    /// Return a slot to its chunk.
+    Chunk<chunkSize, slotSize> * ch = Chunk<chunkSize, slotSize>::getChunk (ptr);
+    ch->putSlot (ptr);
+    // Once the chunk is completely empty, free it.
+    if (ch->getNumSlotsAvailable() == ch->getNumSlots()) {
+      if (ch == myChunk) {
+	// If this was 'our' chunk, get another one.
+	myChunk = new (Super::malloc (chunkSize)) Chunk<chunkSize, slotSize>();
+      }
+      Super::free (ch);
+    }
+  }
+
+protected:
+
+  inline static size_t size (void * ptr)
+  {
+	  return slotSize;
+  }
+
+
+private:
+
+  Chunk<chunkSize, slotSize> * myChunk;
+
+};
+
+
+#endif
Index: /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/experimental/testcoalesceableheap.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/experimental/testcoalesceableheap.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/experimental/testcoalesceableheap.h	(revision 176)
@@ -0,0 +1,377 @@
+// -*- C++ -*-
+
+// CoalesceableHeap: manages a range of coalesceable memory.
+
+#ifndef _COALESCEABLEHEAP_H_
+#define _COALESCEABLEHEAP_H_
+
+#include <assert.h>
+#include <new.h>
+
+#define MULTIPLE_HEAP_SUPPORT 0
+#define USE_TOP 0
+
+template <class SuperHeap>
+class RequireCoalesceable : public SuperHeap {
+public:
+
+  // Some thin wrappers over Header methods.
+  inline static int getHeap (void * ptr)          { return Header::getHeader(ptr)->getHeap(); }
+  inline static void setHeap (void * ptr, int h)  { Header::getHeader(ptr)->setHeap(h); }
+  inline static int getPrevHeap (void * ptr)      { return Header::getHeader(ptr)->getPrevHeap(); }
+  inline static void setPrevHeap (void * ptr, int h) { Header::getHeader(ptr)->setPrevHeap(h); }
+
+  inline static size_t getSize (void * ptr)       { return Header::getHeader(ptr)->getSize(); }
+
+  inline static void setSize (void * ptr, size_t sz) { Header::getHeader(ptr)->setSize(sz); }
+  inline static size_t getPrevSize (void * ptr)   { return Header::getHeader(ptr)->getPrevSize(); }
+  inline static void setPrevSize (void * ptr, size_t sz) { Header::getHeader(ptr)->setPrevSize(sz); }
+  inline static void markFree (void * ptr)        { Header::getHeader(ptr)->markFree(); }
+  inline static void markInUse (void * ptr)       { Header::getHeader(ptr)->markInUse(); }
+  inline static void markPrevInUse (void * ptr)   { Header::getHeader(ptr)->markPrevInUse(); }
+  inline static void markMmapped (void * ptr)     { Header::getHeader(ptr)->markMmapped(); }
+  inline static int isFree (void * ptr)           { return Header::getHeader(ptr)->isFree(); }
+  inline static int isPrevFree (void * ptr)       { return Header::getHeader(ptr)->isPrevFree(); }
+  inline static int isMmapped (void * ptr)        { return Header::getHeader(ptr)->isMmapped(); }
+  inline static void * getNext (void * ptr)       { return Header::getHeader(ptr)->getNext(); }
+  inline static void * getPrev (void * ptr)       { return Header::getHeader(ptr)->getPrev(); }
+
+
+  // The Header for every object, allocated or freed.
+  class Header {
+  public:
+
+    // Returns the start of the object (i.e., just past the header).
+    inline static void * makeObject (void * buf, size_t prevsz, size_t sz) {
+      Header * h = new (buf) Header (prevsz, sz);
+      // Record this object as in use in the next header.
+      h->markInUse();
+      // Record this object's size in the next header.
+      h->getNextHeader()->setPrevSize (sz);
+      return Header::getObject (h);
+    }
+
+#if USE_TOP
+    // Returns the start of the object, but without updating the next header.
+    inline static void * makeTop (void * buf, size_t prevsz, size_t sz) {
+      Header * h = new (buf) Header (prevsz, sz);
+      // Pretend the previous object is in use to prevent us from
+      // accidentally coalescing backwards with non-existent memory.
+      h->markPrevInUse();
+      h->markInUse();
+      return Header::getObject (h);
+    }
+#endif
+
+    inline void sanityCheck (void) {
+#ifndef NDEBUG
+      int headerSize = sizeof(Header);
+      assert (headerSize <= sizeof(double));
+      assert (getSize() == getNextHeader()->getPrevSize());
+      assert (isFree() == getNextHeader()->isPrevFree());
+      assert (getNextHeader()->getPrev() == getObject(this));
+#if 0
+      if (isPrevFree()) {
+	assert (getPrevSize() == getHeader(getPrev())->getSize());
+      }
+#endif
+#endif
+    }
+
+    // Get the header for a given object.
+    inline static Header * getHeader (const void * ptr) { return ((Header *) ptr - 1); }
+
+    // Get the object for a given header.
+    inline static void * getObject (const Header * hd)  { return (void *) (hd + 1); }
+
+    inline void setPrevSize (const size_t sz){ _prevSize = sz >> SIZE_SHIFT; }
+    inline size_t getPrevSize (void) const { return _prevSize << SIZE_SHIFT; }
+
+    inline void markFree (void)        { getNextHeader()->markPrevFree(); }
+    inline void markInUse (void)       { getNextHeader()->markPrevInUse(); }
+    inline void markMmapped (void)     { setIsMmapped(); } // _isMmapped = IS_MMAPPED; }
+    inline void markNotMmapped (void)  { setIsNotMmapped(); } // _isMmapped = NOT_MMAPPED; }
+    inline int isFree (void) const     { return getNextHeader()->isPrevFree(); }
+    inline int isNextFree (void) const { return getNextHeader()->getNextHeader()->isPrevFree(); }
+    inline int isMmapped (void) const  { return getIsMmapped(); } // _isMmapped == IS_MMAPPED; }
+    inline void * getPrev (void) const { return ((char *) this) - getPrevSize(); }
+    inline void * getNext (void) const { return ((char *) (this + 2)) + getSize(); }
+
+    inline void markPrevFree (void)    { setPrevIsFree(); } // _prevStatus = FREE; }
+    inline void markPrevInUse (void)   { setPrevInUse(); } //_prevStatus = IN_USE; }
+    inline int isPrevFree (void) const { return getPrevIsFree(); } // return _prevStatus == FREE; }
+    inline void setSize (size_t sz) {
+      _size = ((sz >> SIZE_SHIFT) << 2) | (_size & 3);
+    }
+
+    inline size_t getSize (void) const {
+      return (_size >> 2) << SIZE_SHIFT;
+    }
+
+	//    inline size_t getSize (void) const { return getSize(); } // return _size << SIZE_SHIFT; }
+//    inline void setSize (const size_t sz)    { setSize(sz); } // _size = sz >> SIZE_SHIFT; }
+
+#if MULTIPLE_HEAP_SUPPORT
+    inline int getHeap (void) const { return _currHeap; }
+    inline void setHeap (int h)     { _currHeap = h; }
+    inline int getPrevHeap (void) const { return _prevHeap; }
+    inline void setPrevHeap (int h) { _prevHeap = h; }
+#else
+    inline int getHeap (void) const { return 0; }
+    inline void setHeap (int)       {  }
+    inline int getPrevHeap (void) const { return 0; }
+    inline void setPrevHeap (int)   {  }
+#endif
+
+
+  private:
+
+    inline Header (void) {}
+    inline Header (size_t prevsz, size_t sz)
+      :
+	// Record sizes, shifting to account for "stolen bits".
+        _prevSize (prevsz >> SIZE_SHIFT)
+#if 0
+       ,_size (sz >> SIZE_SHIFT),
+	// Assume that objects are NOT mmapped.
+	_isMmapped (NOT_MMAPPED)
+#if MULTIPLE_HEAP_SUPPORT
+	, _prevHeap (0),
+	_currHeap (0)
+#endif
+#endif
+      {
+			_size = 0;
+	setSize (sz);
+	setIsNotMmapped();
+	assert (sizeof(Header) <= sizeof(double));
+      }
+
+    inline Header * getNextHeader (void) const {
+      return ((Header *) ((char *) (this + 1) + getSize()));
+    }
+
+    // How many bits we can shift size over without losing information.
+    //   3 = double-word alignment.
+    enum { SIZE_SHIFT = 3 };
+
+#if !(MULTIPLE_HEAP_SUPPORT) // original
+
+    inline int getIsMmapped (void) const {
+      return _size & 1;
+    }
+
+    inline void setIsMmapped (void) {
+      _size |= 1;
+    }
+
+    inline void setIsNotMmapped (void) {
+      _size &= ~1;
+    }
+
+    inline int getPrevIsFree (void) const {
+      return _size & 2;
+    }
+
+    inline void setPrevIsFree (void) {
+      _size |= 2;
+    }
+
+    inline void setPrevInUse (void) {
+      _size &= ~2;
+    }
+
+
+#if 1
+    // The size of the previous object.
+    size_t _prevSize;
+
+    // The size of the current object, with NOT_MMAPPED & IN_USE bits.
+    size_t _size;
+    
+#else
+    // The size of the previous object.
+    enum { NUM_BITS_STOLEN_FROM_PREVSIZE = 0 };
+    size_t _prevSize : sizeof(size_t) * 8 - NUM_BITS_STOLEN_FROM_PREVSIZE;
+
+    // The size of the current object.
+    enum { NUM_BITS_STOLEN_FROM_SIZE = 2 };
+    size_t _size : sizeof(size_t) * 8 - NUM_BITS_STOLEN_FROM_SIZE;
+    
+    // Is the current object mmapped?
+    enum { NOT_MMAPPED = 0, IS_MMAPPED = 1 };
+    unsigned int _isMmapped : 1;
+    
+    // Is the previous object free or in use?
+    enum { IN_USE = 0, FREE = 1 };
+    unsigned int _prevStatus : 1;
+#endif
+
+#else // new support for scalability...
+
+    // Support for 2^5 = 32 heaps.
+    enum { NUM_BITS_FOR_HEAP = 5 };
+
+    enum { NUM_BITS_STOLEN_FROM_SIZE = NUM_BITS_FOR_HEAP + 1 };     // 1 for isMmapped
+    enum { NUM_BITS_STOLEN_FROM_PREVSIZE = NUM_BITS_FOR_HEAP + 1 }; // 1 for isPrevFree
+
+    // Max object size.
+    enum { MAX_OBJECT_SIZE = 1 << (sizeof(size_t) * 8 + SIZE_SHIFT - NUM_BITS_STOLEN_FROM_SIZE) };
+
+    //// word 1 ////
+
+    // The size of the previous object.
+    size_t _prevSize : sizeof(size_t) * 8 - NUM_BITS_STOLEN_FROM_PREVSIZE;
+
+    // What's the previous heap?
+    unsigned int _prevHeap : NUM_BITS_FOR_HEAP;
+
+    // Is the previous object free or in use?
+    enum { FREE = 0, IN_USE = 1 };
+    unsigned int _prevStatus : 1;
+
+    //// word 2 ////
+
+    // The size of the current object.
+    size_t _size : sizeof(size_t) * 8 - NUM_BITS_STOLEN_FROM_SIZE;
+
+    // What's the current heap?
+    unsigned int _currHeap : NUM_BITS_FOR_HEAP;
+
+    // Is the current object mmapped?
+    enum { NOT_MMAPPED = 0, IS_MMAPPED = 1 };
+    unsigned int _isMmapped : 1;
+
+#endif
+  };
+
+};
+
+
+
+template <class SuperHeap>
+class CoalesceableHeap : public RequireCoalesceable<SuperHeap> {
+public:
+
+  CoalesceableHeap (void)
+#if USE_TOP
+	  : top (NULL)
+#endif
+  { }
+
+  inline void * malloc (size_t sz) {
+#if !USE_TOP
+	  void * buf = SuperHeap::malloc (sz + sizeof(Header));
+	  if (buf == NULL) {
+		  return NULL;
+	  } else {
+		  Header * header = (Header *) buf;
+
+		  //
+		  // Assume that everything allocated is NOT mmapped.
+		  // It is the responsibility of a child layer
+		  // to mark mmapped objects as such.
+		  //
+
+		  header->markNotMmapped ();
+
+		  //
+		  // Record the size of this object in the current header
+		  // and the next.
+		  //
+
+		  header->setSize (sz);
+		  Header * nextHeader = Header::getHeader (header->getNext());
+		  nextHeader->setSize (0);
+		  nextHeader->setPrevSize (sz);
+
+		  //
+		  // Mark the subsequent "object" as in use in order to prevent
+		  // accidental coalescing.
+		  //
+
+		  nextHeader->markInUse ();
+		  return Header::getObject (header);
+	  }
+#else
+
+    if ((top == NULL) || (sz + sizeof(Header) > getSize(top))) {
+      // There wasn't enough space in top. Get more memory (enough to
+      // hold an extra header).
+      void * buf = SuperHeap::malloc (sz + 2 * sizeof(Header));
+      if (buf == NULL)
+	return NULL;
+      void * ptr = Header::makeTop (buf, 0, sz);
+      // Is this object contiguous with top?
+      if ((top != NULL) && (getNext(top) == ptr)) {
+	// It is contiguous. Extend top.
+	setSize (top, getSize(top) + 2 * sizeof(Header) + sz);
+
+	 // printf ("Extended top by %d\n", getSize(ptr));
+
+      } else {
+	// We got some non-contiguous memory.
+	// For now, just abandon top.
+
+	 // printf ("Abandoning top.\n");
+	setSize (ptr, sz + sizeof(Header));
+	top = ptr;
+      }
+    }
+    assert (getSize(top) >= sz + sizeof(Header));
+    // Carve out an sz object from top and advance top.
+    size_t oldTopSize = getSize(top);
+    void * newObject = top;
+    setSize (newObject, sz);
+    top = getNext (newObject);
+    // Set top's new header.
+    setSize (top, oldTopSize - sz - sizeof(Header));
+    setPrevSize (top, sz);
+    // Mark the new top as in use to prevent it from being coalesced.
+
+    markInUse (top);
+
+	assert (getNext(newObject) == top);
+    Header::getHeader(newObject)->sanityCheck();
+	//printf ("top = %x\n", top);
+	assert (!isFree(top));
+    return newObject;
+#endif
+  }
+  
+  inline void free (void * ptr) {
+    assert (isFree(ptr));
+#if USE_TOP
+    // Try to extend top if this object is right before it.
+    if (getNext(ptr) == top) {
+      assert (getSize(ptr) == getPrevSize(top));
+      // Extend top backwards.
+      setSize (ptr, getSize(ptr) + sizeof(Header) + getSize(top));
+      top = ptr;
+	// printf ("free: top = %x\n", top);
+      return;
+    }
+#endif
+    SuperHeap::free (Header::getHeader(ptr));
+  }
+
+
+#if USE_TOP
+  inline void clear (void) {
+    top = NULL;
+    SuperHeap::clear ();
+  }
+#endif
+
+private:
+
+#if USE_TOP
+  // The top object allocated so far.
+  void * top;
+#endif
+
+};
+
+
+#endif // _COALESCEABLEHEAP_H_
+
Index: /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/experimental/theap.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/experimental/theap.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/experimental/theap.h	(revision 176)
@@ -0,0 +1,62 @@
+#ifndef _THEAP_H_
+#define _THEAP_H_
+
+// A general threshold-based heap.
+
+// Threshold layer.
+// Once we have more than Threshold bytes on our freelist,
+// return memory to the superheap.
+
+// The class argument FH should be some freelist heap that subclasses NullHeap.
+
+template <class SuperHeap, class FH, int Threshold>
+class THeap : public SuperHeap {
+public:
+  THeap (void)
+    : total (0)
+  {}
+
+  ~THeap (void)
+  {}
+
+  inline void * malloc (size_t sz) {
+    void * ptr;
+    ptr = fHeap.malloc (sz);
+    if (ptr == NULL) {
+      // We have no memory on our freelist.
+      // Get it from the superheap.
+      ptr = SuperHeap::malloc (sz);
+    } else {
+      total -= size(ptr);
+      // printf ("total = %d\n", total);
+    }
+	assert (size(ptr) >= sz);
+    return ptr;
+  }
+
+  inline void free (void * ptr) {
+    if (total < Threshold) {
+      // printf ("FREE TO FREELIST.\n");
+      total += size(ptr);
+      fHeap.free (ptr);
+      //printf ("total = %d\n", total);
+    } else {
+      // Dump the freelist heap.
+      void * p = fHeap.malloc (1);
+      while (p != NULL) {
+		SuperHeap::free (p);
+		p = fHeap.malloc (1);
+      }
+      SuperHeap::free (ptr);
+	  total = 0;
+    }
+  }
+
+private:
+  // Provide a free list that will return NULL if it is out of memory.
+  FH fHeap;
+  int total;
+};
+
+
+#endif
Index: /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/experimental/thinlock.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/experimental/thinlock.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/experimental/thinlock.h	(revision 176)
@@ -0,0 +1,29 @@
+// -*- C++ -*-
+
+#ifndef _THINLOCK_H_
+#define _THINLOCK_H_
+
+#include <windows.h>
+
+class ThinLock {
+public:
+
+  ThinLock (void)
+  {
+    InitializeCriticalSection (&crit);
+  }
+
+  inline void lock (void) {
+    EnterCriticalSection (&crit);
+  }
+
+  inline void unlock (void) {
+    LeaveCriticalSection (&crit);
+  }
+
+private:
+  CRITICAL_SECTION crit;
+};
+
+
+#endif
Index: /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/experimental/topslotheap.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/experimental/topslotheap.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/experimental/topslotheap.h	(revision 176)
@@ -0,0 +1,78 @@
+/* -*- C++ -*- */
+
+#ifndef _TOPSLOTHEAP_H_
+#define _TOPSLOTHEAP_H_
+
+#include <assert.h>
+
+#include "bigchunk.h"
+
+/*
+  TopSlotHeap.
+
+  malloc returns objects of size chunkSize.
+
+  free returns objects of size chunkSize.
+
+*/
+
+template <int chunkSize, int slotSize, class Super>
+class TopSlotHeap : public Super {
+public:
+
+  TopSlotHeap (void)
+    : myChunks (NULL)
+  {}
+
+  // Get a chunkSize object.
+  inline void * malloc (size_t sz);
+
+  // Free a chunkSize object.
+  inline void free (void * ptr);
+
+protected:
+
+	virtual inline void localFree (void * ptr);
+
+	
+private:
+
+  BigChunk<chunkSize, slotSize, TopSlotHeap> * myChunks;
+
+};
+
+
+template <int chunkSize, int slotSize, class Super>
+void * TopSlotHeap<chunkSize, slotSize, Super>::malloc (size_t sz)
+{
+  assert (sz <= chunkSize);
+  if (myChunks == NULL) {
+	return new (Super::malloc (chunkSize)) BigChunk<chunkSize, slotSize, TopSlotHeap>;
+  } else {
+	printf ("Recycled a chunk.\n");
+	BigChunk<chunkSize, slotSize, TopSlotHeap> * ch = myChunks;
+	myChunks = myChunks->getNext();
+	ch->setNext (NULL);
+	ch->setHeap (NULL);
+	return ch;
+  }
+}
+
+
+template <int chunkSize, int slotSize, class Super>
+void TopSlotHeap<chunkSize, slotSize, Super>::free (void * ptr) {
+  printf ("Freed a chunk.\n");
+  BigChunk<chunkSize, slotSize, TopSlotHeap> * ch = (BigChunk<chunkSize, slotSize, TopSlotHeap> *) ptr;
+  ch->setNext (myChunks);
+  ch->setHeap (this);
+  myChunks = ch;
+}
+
+
+template <int chunkSize, int slotSize, class Super>
+void TopSlotHeap<chunkSize, slotSize, Super>::localFree (void * ptr) {
+	free (ptr);
+}
+
+
+#endif
Index: /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/experimental/treap.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/experimental/treap.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/experimental/treap.h	(revision 176)
@@ -0,0 +1,447 @@
+/* -*- C++ -*- */
+
+#ifndef _TREAP_H_
+#define _TREAP_H_
+
+#include <assert.h>
+#include <stdlib.h>
+#include <limits.h>
+
+
+// A Cartesian tree.
+// adapted from treap code by Bobby Blumofe
+
+
+template <class KEY, class VALUE>
+class Treap {
+
+public:
+
+  class Node {   // A node in the treap.
+    friend class Treap;
+    unsigned int priority; //   The priority.
+    KEY key;      //   The key.
+    VALUE value;  //   The value.
+    Node* parent; //   Pointer to parent.
+    Node* left;   //   Pointer to left child.
+    Node* right;  //   Pointer to right child.
+
+  public:
+    // Construct node.
+    Node (void) : left (NULL), right (NULL) {}
+
+    Node (unsigned int priority_, KEY key_, VALUE value_, Node* parent_)
+      : priority (priority_), key (key_), value (value_),
+	parent (parent_), left (NULL), right (NULL) {}
+    KEY getKey (void) const { return key; }
+    VALUE getValue (void) const { return value; }
+  };
+
+  // Construct an empty treap.
+  Treap (void);
+
+  // Destructor.
+  ~Treap (void);
+
+  // Return value of key or 0 if not found.
+  // Return a matching node (or NULL if not found).
+  Node * lookup (KEY key) const {
+    return lookup_ (key);
+  }
+
+  // Return a matching node (or NULL if not found).
+  Node * lookupGreater (KEY key) const {
+    return lookupGreater_ (key);
+  }
+
+  // Set the given key to have the given value.
+  void insert (Node * n, KEY key, VALUE value, unsigned int priority);
+
+  // Remove entry with given key.
+  // Remove entry.
+  Node * remove (Node * node) {
+#if 0
+    // Search for node with given key.
+    Node* node = lookup_ (key);
+#endif
+    
+    // If not found, then do nothing.
+    if (!node)
+      return NULL;
+    
+    // While node is not a leaf...
+    while (node->left || node->right) {
+      
+      // If left child only, rotate right.
+      if (!node->right)
+	rotateRight (node);
+      
+      // If right child only, rotate left.
+      else if (!node->left)
+	rotateLeft (node);
+      
+      // If both children,
+      else {
+	if (node->left->priority < node->right->priority)
+	  rotateRight (node);
+	else
+	  rotateLeft (node);
+      }
+    }
+    
+    // Clip off node.
+    Node* parent = node->parent;
+    if (!parent) {
+      assert (root == node);
+      root = 0;
+    }
+    else {
+      if (parent->left == node)
+	parent->left = 0;
+      else
+	parent->right = 0;
+    }
+    
+    // Check treap properties.
+    // assert (heapProperty (root, INT_MIN));
+    // assert (bstProperty (root, INT_MIN, INT_MAX));
+    
+#if 0
+    delete node;
+    return NULL;
+#else
+    // Return the removed node.
+    
+    return node;
+#endif
+  }
+
+
+  void print (void) const { reallyPrint (root); cout << endl; }
+
+  void reallyPrint (Node * node) const {
+    if (node == NULL) return;
+    reallyPrint (node->left);
+    cout << "[" << node->key << "] ";
+    reallyPrint (node->right);
+  }
+
+
+
+private:
+
+  Node* root;  // Pointer to root node of treap.
+
+  // Disable copy and assignment.
+  Treap (const Treap& treap) {}
+  Treap& operator= (const Treap& treap) { return *this; }
+
+  // Check treap properties.
+  int heapProperty (Node* node, int lbound) const;
+  int bstProperty (Node* node, int lbound, int ubound) const;
+
+  // Delete treap rooted at given node.
+  void deleteTreap (Node* node);
+
+  // Return node with given key or NULL if not found.
+  Node* lookup_ (KEY key) const;
+  Node* lookupGreater_ (KEY key) const;
+  Node* lookupGeq (KEY key, Node * root) const;
+
+  // Perform rotations.
+  void rotateLeft (Node* node);
+  void rotateRight (Node* node);
+};
+
+
+// Construct an empty treap.
+template <class KEY, class VALUE>
+Treap<KEY,VALUE>::Treap (void)
+  : root (0)
+{
+}
+
+// Destructor.
+template <class KEY, class VALUE>
+Treap<KEY,VALUE>::~Treap (void)
+{
+  deleteTreap (root);
+}
+
+// Delete treap rooted at given node.
+template <class KEY, class VALUE>
+void Treap<KEY,VALUE>::deleteTreap (Node* node)
+{
+  // If empty, nothing to do.
+  if (!node)
+    return;
+
+  // Delete left and right subtreaps.
+  deleteTreap (node->left);
+  deleteTreap (node->right);
+
+  // Delete root node.
+  delete node;
+}
+
+// Test heap property in subtreap rooted at node.
+template <class KEY, class VALUE>
+int Treap<KEY,VALUE>::heapProperty (Node* node, int lbound) const
+{
+  // Empty treap satisfies.
+  if (!node)
+    return 1;
+
+  // Check priority.
+  if (node->priority < lbound)
+    return 0;
+
+  // Check left subtreap.
+  if (!heapProperty (node->left, node->priority))
+    return 0;
+
+  // Check right subtreap.
+  if (!heapProperty (node->right, node->priority))
+    return 0;
+
+  // All tests passed.
+  return 1;
+}
+
+// Test bst property in subtreap rooted at node.
+template <class KEY, class VALUE>
+int Treap<KEY,VALUE>::bstProperty (Node* node, int lbound, int ubound) const
+{
+  // Empty treap satisfies.
+  if (!node)
+    return 1;
+
+  // Check key in range.
+  if (node->key < lbound || node->key > ubound)
+    return 0;
+
+  // Check left subtreap.
+  if (!bstProperty (node->left, lbound, node->key))
+    return 0;
+
+  // Check right subtreap.
+  if (!bstProperty (node->right, node->key, ubound))
+    return 0;
+
+  // All tests passed.
+  return 1;
+}
+
+// Perform a left rotation.
+template <class KEY, class VALUE>
+void Treap<KEY,VALUE>::rotateLeft (Node* node)
+{
+  // Get right child.
+  Node* right = node->right;
+  assert (right);
+
+  // Give node right's left child.
+  node->right = right->left;
+
+  // Adjust parent pointers.
+  if (right->left)
+    right->left->parent = node;
+  right->parent = node->parent;
+
+  // If node is root, change root.
+  if (!node->parent) {
+    assert (root == node);
+    root = right;
+  }
+
+  // Link node parent to right.
+  else {
+    if (node->parent->left == node)
+      node->parent->left = right;
+    else
+      node->parent->right = right;
+  }
+
+  // Put node to left of right.
+  right->left = node;
+  node->parent = right;
+}
+
+// Perform a right rotation.
+template <class KEY, class VALUE>
+void Treap<KEY,VALUE>::rotateRight (Node* node)
+{
+  // Get left child.
+  Node* left = node->left;
+  assert (left);
+
+  // Give node left's right child.
+  node->left = left->right;
+
+  // Adjust parent pointers.
+  if (left->right)
+    left->right->parent = node;
+  left->parent = node->parent;
+
+  // If node is root, change root.
+  if (!node->parent) {
+    assert (root == node);
+    root = left;
+  }
+
+  // Link node parent to left.
+  else {
+    if (node->parent->left == node)
+      node->parent->left = left;
+    else
+      node->parent->right = left;
+  }
+
+  // Put node to right of left.
+  left->right = node;
+  node->parent = left;
+}
+
+// Return node with given key or 0 if not found.
+template <class KEY, class VALUE>
+Treap<KEY,VALUE>::Node* Treap<KEY,VALUE>::lookup_ (KEY key) const
+{
+  // Start at the root.
+  Node* node = root;
+
+  // While subtreap rooted at node not empty...
+  while (node) {
+
+    // If found, then return value.
+    if (key == node->key)
+      return node;
+
+    // Otherwise, search left or right subtreap.
+    else if (key < node->key)
+      node = node->left;
+    else
+      node = node->right;
+  }
+
+  // Return.
+  return node;
+}
+
+
+template <class KEY, class VALUE>
+Treap<KEY,VALUE>::Node* Treap<KEY,VALUE>::lookupGreater_ (KEY key) const
+{
+  return lookupGeq (key, root);
+}
+
+
+// Return node with greater or equal key or 0 if not found.
+template <class KEY, class VALUE>
+Treap<KEY,VALUE>::Node* Treap<KEY,VALUE>::lookupGeq (KEY key, Node * rt) const
+{
+  Node * bestSoFar = NULL;
+
+  // Start at the root.
+  Node* node = rt;
+
+  // While subtreap rooted at node not empty...
+  while (node) {
+
+    // If exact match found, then return value.
+    if (key == node->key)
+      return node;
+
+    // Move right -- this node is too small.
+    if (node->key < key)
+      node = node->right;
+    
+    // Otherwise, this one's pretty good;
+    // look for a better match.
+    else {
+      if ((bestSoFar == NULL) || (bestSoFar->key > node->key))
+	bestSoFar = node;
+      node = node->left;
+    }
+  }
+
+  // Return.
+  return bestSoFar;
+}
+
+
+// Set the given key to have the given value.
+template <class KEY, class VALUE>
+void Treap<KEY,VALUE>::insert (Treap<KEY,VALUE>::Node * n, KEY key, VALUE value, unsigned int priority)
+{
+
+  //  print();
+
+  // 0 is not a valid value.
+  assert (value != 0);
+
+  // Start at the root.
+  Node* parent = 0;
+  Node* node = root;
+
+
+  // While subtreap rooted at node not empty...
+  while (node) {
+
+#if 0
+    // If found, then update value and done.
+    if (key == node->key) {
+      node->value = value;
+      return;
+    }
+#endif
+
+    // Otherwise, search left or right subtreap.
+    parent = node;
+
+
+    if (key < node->key)
+      node = node->left;
+    else
+      node = node->right;
+  }
+
+
+  // Not found, so create new node.
+  // EDB was
+  // node = new Node (lrand48(), key, value, parent);
+  node = new (n) Node (priority, key, value, parent);
+  // node = new Node (priority, key, value, parent);
+
+  // If the treap was empty, then new node is root.
+  if (!parent)
+    root = node;
+
+  // Otherwise, add node as left or right child.
+  else if (key < parent->key)
+    parent->left = node;
+  else
+    parent->right = node;
+
+  // While heap property not satisfied...
+  while (parent && parent->priority > node->priority) {
+
+    // Perform rotation.
+    if (parent->left == node)
+      rotateRight (parent);
+    else
+      rotateLeft (parent);
+
+    // Move up.
+    parent = node->parent;
+  }
+
+  // print();
+
+  // Check treap properties.
+  // assert (heapProperty (root, INT_MIN));
+  // assert (bstProperty (root, INT_MIN, INT_MAX));
+}
+
+
+
+#endif // _TREAP_H_
Index: /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/fifodlfreelist.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/fifodlfreelist.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/fifodlfreelist.h	(revision 176)
@@ -0,0 +1,101 @@
+/* -*- C++ -*- */
+
+#ifndef _FIFODLFREELIST_H_
+#define _FIFODLFREELIST_H_
+
+#include <assert.h>
+
+template <class Super>
+class FIFODLFreelistHeap : public Super {
+public:
+  
+  FIFODLFreelistHeap (void)
+    {
+      head.prev = &head;
+      head.next = &tail;
+      tail.prev = &head;
+      tail.next = &tail;
+      assert (isEmpty());
+    }
+
+  ~FIFODLFreelistHeap (void)
+    {
+      // Delete everything on the free list.
+      freeObject * ptr = head.next;
+      while (ptr != &tail) {
+	void * oldptr = ptr;
+	ptr = ptr->next;
+	Super::free (oldptr);
+      }
+    }
+
+  inline void * malloc (size_t sz) {
+    //printf ("flist malloc %d\n", sz);
+    // Check the free list first.
+    freeObject * ptr = tail.prev;
+    if (ptr == &head) {
+      assert (isEmpty());
+      ptr = (freeObject *) Super::malloc (sz);
+    } else {
+      ptr->prev->next = &tail;
+      tail.prev = ptr->prev;
+#if 0
+      ptr->prev = NULL;
+      ptr->next = NULL;
+#endif
+    }
+    assert (getSize(ptr) >= sz);
+    assert (getSize(ptr) >= sizeof(freeObject));
+    return (void *) ptr;
+  }
+  
+  inline void free (void * ptr) {
+    // Add this object to the free list.
+    assert (ptr != NULL);
+    freeObject * p = (freeObject *) ptr;
+    p->next = head.next;
+    p->next->prev = p;
+    p->prev = &head;
+    head.next = p;
+    assert (!isEmpty());
+  }
+
+#if 0
+  // Returns the entire linked list of freed objects.
+  inline void * multimalloc (size_t sz) {
+    freeObject * ptr = head.next;
+    ptr->prev = NULL;
+    tail.prev->next = NULL;
+    head.next = &tail;
+    tail.prev = &head;
+    return ptr;
+  }
+#endif
+
+  inline static void remove (void * rptr)
+    {
+      freeObject * p = (freeObject *) rptr;
+      assert (p->next != NULL);
+      assert (p->prev != NULL);
+      p->prev->next = p->next;
+      p->next->prev = p->prev;
+      p->prev = p->next = NULL;
+    }
+
+
+private:
+
+  int isEmpty (void) {
+    return (head.next == &tail);
+  }
+
+  class freeObject {
+  public:
+    freeObject * prev;
+    freeObject * next;
+  };
+
+  freeObject head, tail;
+};
+
+#endif
Index: /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/fifofreelist.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/fifofreelist.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/fifofreelist.h	(revision 176)
@@ -0,0 +1,105 @@
+/* -*- C++ -*- */
+
+#ifndef _FIFOFREELIST_H_
+#define _FIFOFREELIST_H_
+
+#include <assert.h>
+
+#ifdef NDEBUG
+#define IFDEBUG(x)
+#else
+#define IFDEBUG(x) x
+#endif
+
+
+template <class SuperHeap>
+class FIFOFreelistHeap : public SuperHeap {
+public:
+  
+  FIFOFreelistHeap (void)
+	  IFDEBUG(:	nObjects (0))
+  {
+	  head.next = &tail;
+	  tail.next = &tail;
+	  assert (isEmpty());
+  }
+
+  ~FIFOFreelistHeap (void)
+  {
+	// printf ("Adios free list.\n");
+    // Delete everything on the free list.
+    freeObject * ptr = head.next;
+    while (ptr != &tail) {
+      void * oldptr = ptr;
+      ptr = ptr->next;
+      SuperHeap::free (oldptr);
+    }
+  }
+
+  inline void * malloc (size_t sz) {
+	assert (isValid());
+    // Check the free list first.
+    freeObject * ptr = head.next;
+    if (ptr == &tail) {
+	  assert (nObjects == 0);
+	  assert (isEmpty());
+      ptr = (freeObject *) SuperHeap::malloc (sz);
+    } else {
+	  assert (nObjects > 0);
+	  head.next = ptr->next;
+	  if (head.next == &tail) {
+		  tail.next = &tail;
+	  }
+	  IFDEBUG (nObjects--);
+    }
+	assert (isValid());
+    return (void *) ptr;
+  }
+  
+  inline void free (void * ptr) {
+	assert (isValid());
+    // Add this object to the free list.
+	assert (ptr != NULL);
+	IFDEBUG (nObjects++);
+	freeObject * p = (freeObject *) ptr;
+    p->next = &tail;
+	tail.next->next = p;
+	tail.next = p;
+	if (head.next == &tail) {
+		head.next = p;
+	}
+	assert (!isEmpty());
+	assert (isValid());
+  }
+
+private:
+
+	int isValid (void) {
+		// Make sure every object is the right size.
+		freeObject * ptr = head.next;
+		if (ptr != &tail) {
+			size_t sz = SuperHeap::getSize(ptr);
+			while (ptr != &tail) {
+			  void * oldptr = ptr;
+			  ptr = ptr->next;
+			  assert (SuperHeap::getSize(oldptr) >= sz);
+			}
+		}
+		return 1;
+	}
+
+  int isEmpty (void) {
+	return (head.next == &tail);
+  }
+
+  class freeObject {
+  public:
+	freeObject * prev;
+    freeObject * next;
+  };
+
+  freeObject head, tail;
+  IFDEBUG (int nObjects);
+};
+
+#endif
Index: /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/firstfitheap.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/firstfitheap.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/firstfitheap.h	(revision 176)
@@ -0,0 +1,117 @@
+/* -*- C++ -*- */
+
+#ifndef _FIRSTFITHEAP_H_
+#define _FIRSTFITHEAP_H_
+
+template <class Super>
+class FirstFitHeap : public Super {
+public:
+  
+  FirstFitHeap (void)
+    : myFreeList (NULL)
+#ifndef NDEBUG
+    ,nObjects (0)
+#endif
+    {
+      assert (classInvariant());
+    }
+
+  ~FirstFitHeap (void)
+    {
+#if 1
+      // Delete everything on the free list.
+      void * ptr = myFreeList;
+      while (ptr != NULL) {
+	// assert (nObjects > 0);
+	assert (ptr != NULL);
+	void * oldptr = ptr;
+	ptr = (void *) ((freeObject *) ptr)->next;
+	Super::free (oldptr);
+#ifndef NDEBUG
+	--nObjects;
+#endif
+      }
+#endif
+    }
+
+  inline void * malloc (size_t sz) {
+    // Check the free list first.
+    assert (classInvariant());
+    void * ptr = myFreeList;
+    if (ptr == NULL) {
+      assert (nObjects == 0);
+      ptr = Super::malloc (sz);
+    } else {
+      assert (nObjects > 0);
+      freeObject * p = myFreeList;
+      freeObject * prev = NULL;
+      while ((p != NULL) && (getSize((void *) p) < sz)) {
+	prev = p;
+	p = p->next;
+      }
+      if (p == NULL) {
+	ptr = Super::malloc (sz);
+      } else {
+	assert (getSize((void *) p) >= sz);
+	if (prev == NULL) {
+	  myFreeList = p->next;
+	} else {
+	  assert (prev->next == p);
+	  prev->next = p->next;
+	}
+#ifndef NDEBUG
+	nObjects--;
+#endif
+	ptr = p;
+      }
+    }
+    assert (classInvariant());
+    return ptr;
+  }
+  
+  inline void free (void * ptr) {
+    // Add this object to the free list.
+    assert (ptr != NULL);
+    assert (classInvariant());
+#ifndef NDEBUG
+    nObjects++;
+#endif
+    freeObject * p = myFreeList;
+    freeObject * prev = NULL;
+    // Insert the object "in order".
+#if 1
+    while ((p != NULL) & (p <= ptr)) {
+      prev = p;
+      p = p->next;
+    }
+#endif
+    if (prev == NULL) {
+      ((freeObject *) ptr)->next = myFreeList;
+      myFreeList = (freeObject *) ptr;
+    } else {
+      ((freeObject *) ptr)->next = prev->next;
+      prev->next = (freeObject *) ptr;
+    }
+    assert (classInvariant());
+  }
+
+private:
+
+  int classInvariant (void) {
+    return (((myFreeList == NULL) && (nObjects == 0))
+	    || ((myFreeList != NULL) && (nObjects > 0)));
+  }
+
+  class freeObject {
+  public:
+    freeObject * next;
+  };
+
+  freeObject * myFreeList;
+#ifndef NDEBUG
+  int nObjects;
+#endif
+
+};
+
+#endif
Index: /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/fixedsizeheap.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/fixedsizeheap.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/fixedsizeheap.h	(revision 176)
@@ -0,0 +1,23 @@
+#ifndef _FIXEDSIZEHEAP_H_
+#define _FIXEDSIZEHEAP_H_
+
+
+template <class SH, int Size>
+class FixedSizeHeap : public SH {
+public:
+  inline void * malloc (size_t sz) {
+    assert (sz <= Size);
+    //printf ("malloc\n");
+    return SH::malloc (Size);
+  }
+  inline void free (void * ptr) {
+    //printf ("free\n");
+    SH::free (ptr);
+  }
+protected:
+  inline static size_t size (void * p) {
+    return Size;
+  }
+};
+
+#endif
Index: /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/freelistheap.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/freelistheap.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/freelistheap.h	(revision 176)
@@ -0,0 +1,61 @@
+/* -*- C++ -*- */
+
+#ifndef _FREELISTHEAP_H_
+#define _FREELISTHEAP_H_
+
+/**
+ * @class FreelistHeap
+ * @brief Manage freed memory on a linked list.
+ * @warning This is for one "size class" only.
+ * 
+ * Note that the linked list is threaded through the freed objects,
+ * meaning that such objects must be at least the size of a pointer.
+ */
+
+#include "freesllist.h"
+#include <assert.h>
+
+#ifndef NULL
+#define NULL 0
+#endif
+
+namespace HL {
+
+template <class SuperHeap>
+class FreelistHeap : public SuperHeap {
+public:
+  
+  inline void * malloc (size_t sz) {
+    // Check the free list first.
+    void * ptr = _freelist.get();
+    // If it's empty, get more memory;
+    // otherwise, advance the free list pointer.
+    if (ptr == 0) {
+      ptr = SuperHeap::malloc (sz);
+    }
+    return ptr;
+  }
+  
+  inline void free (void * ptr) {
+    if (ptr == 0) {
+      return;
+    }
+    _freelist.insert (ptr);
+  }
+
+  inline void clear (void) {
+    void * ptr;
+    while (ptr = _freelist.get()) {
+      SuperHeap::free (ptr);
+    }
+  }
+
+private:
+
+  FreeSLList _freelist;
+
+};
+
+}
+
+#endif
Index: /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/freesllist.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/freesllist.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/freesllist.h	(revision 176)
@@ -0,0 +1,73 @@
+// -*- C++ -*-
+
+#ifndef _FREESLLIST_H_
+#define _FREESLLIST_H_
+
+#include <assert.h>
+
+/**
+ * @class FreeSLList
+ * @brief A "memory neutral" singly-linked list,
+ *
+ * Uses the free space in objects to store
+ * the pointers.
+ */
+
+
+class FreeSLList {
+public:
+
+  inline void clear (void) {
+    head.next = NULL;
+  }
+
+  class Entry;
+  
+  /// Get the head of the list.
+  inline Entry * get (void) {
+    const Entry * e = head.next;
+    if (e == NULL) {
+      return NULL;
+    }
+    head.next = e->next;
+    return const_cast<Entry *>(e);
+  }
+
+  inline Entry * remove (void) {
+    const Entry * e = head.next;
+    if (e == NULL) {
+      return NULL;
+    }
+    head.next = e->next;
+    return const_cast<Entry *>(e);
+  }
+  
+  inline void insert (void * e) {
+    Entry * entry = reinterpret_cast<Entry *>(e);
+    entry->next = head.next;
+    head.next = entry;
+  }
+
+  class Entry {
+  public:
+    Entry (void)
+      : next (NULL)
+    {}
+    Entry * next;
+#if 1
+  private:
+    Entry (const Entry&);
+    Entry& operator=(const Entry&);
+#endif
+  };
+  
+private:
+  Entry head;
+};
+
+
+#endif
+
+
+
+
Index: /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/heaplayers.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/heaplayers.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/heaplayers.h	(revision 176)
@@ -0,0 +1,178 @@
+// -*- C++ -*-
+
+/*
+
+  Heap Layers: An Extensible Memory Allocation Infrastructure
+  
+  Copyright (C) 2000-2004 by Emery Berger
+  http://www.cs.umass.edu/~emery
+  emery@cs.umass.edu
+  
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or
+  (at your option) any later version.
+  
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+  
+  You should have received a copy of the GNU General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+*/
+
+/**
+ * @file heaplayers.h
+ * @brief The master Heap Layers include file.
+ *
+ * Heap Layers is an extensible memory allocator infrastructure.  For
+ * more information, read the PLDI 2001 paper "Composing
+ * High-Performance Memory Allocators", by Emery D. Berger, Benjamin
+ * G. Zorn, and Kathryn S. McKinley.
+ * (http://citeseer.ist.psu.edu/berger01composing.html)
+ */
+
+#ifndef _HEAPLAYERS_H_
+#define _HEAPLAYERS_H_
+
+namespace HL {};
+
+#include "hldefines.h"
+
+/**
+ * @def ALLOCATION_STATS
+ *
+ * Defining ALLOCATION_STATS below as 1 enables tracking of allocation
+ * statistics in a variety of layers. You then must link in
+ * definitions of the extern variables used therein; stats.cpp
+ * contains these definitions.
+ *
+ * This should be undefined for all but experimental use.
+ *
+ */
+
+#ifndef ALLOCATION_STATS
+#define ALLOCATION_STATS 0
+#endif
+
+
+
+#ifdef _MSC_VER
+// 4786: Disable warnings about long (> 255 chars) identifiers.
+// 4512: Disable warnings about assignment operators.
+#pragma warning( push )
+#pragma warning( disable:4786 4512 )
+// Set inlining to the maximum possible depth.
+#pragma inline_depth(255)
+#define inline __forceinline
+#endif
+
+
+#include "util/sassert.h"
+// #include "utility.h"		// convenient wrappers to replace C++ new & delete operators
+#include "util/dynarray.h"		// an array that grows by doubling
+#include "util/myhashmap.h"
+
+// Hiding machine dependencies.
+
+#include "util/cpuinfo.h"
+#include "util/timer.h"			// allows high-resolution timing across a wide range of platforms
+#include "util/guard.h"
+#include "util/fred.h"
+
+// Lock implementations.
+
+#include "spinlock.h"		// spin-then-yield
+
+#if defined(_WIN32)
+#include "util/winlock.h"		// critical-sections (i.e., for Windows only)
+#include "util/recursivelock.h"	// a wrapper for recursive locking
+#endif
+
+
+// Useful utilities.
+
+#include "unique.h"
+#include "tryheap.h"
+
+// Base heaps
+
+#include "zoneheap.h"		// a zone allocator (frees all memory when the heap goes out of scope)
+
+// Adapters
+
+#include "perclassheap.h"	// make a per-class heap
+
+
+// Freelist-like heaps ("allocation caches")
+// NB: All of these should be used for exactly one size class.
+
+#include "freelistheap.h"	// a free list. Never frees memory.
+#include "fifofreelist.h"   // a FIFO free list.
+#include "fifodlfreelist.h"  // a doubly-linked FIFO free list.
+#include "boundedfreelistheap.h"	// a free list with a bounded length. 
+
+
+#include "nullheap.h"
+#include "coalesceheap.h" // A chunk heap with coalescing.
+#include "coalesceableheap.h"
+
+// Utility heap layers
+
+#include "sizethreadheap.h"	// Adds size(ptr) & thread(ptr) methods
+#include "lockedheap.h"		// Code-locks a heap
+#include "checkheap.h"		// Raises assertions if malloc'ed objects aren't right.
+// #include "exceptionheap.h"	// Raise an exception if a malloc fails.
+
+#include "sanitycheckheap.h" // Check for multiple frees and mallocs of same locations.
+#include "ansiwrapper.h"     // Provide ANSI C like behavior for malloc (alignment, etc.)
+
+// Multi-threaded heaps
+//   hashes the thread id across a number of heaps
+
+#include "phothreadheap.h"	// Private-heaps with ownership
+#include "threadheap.h"		// Pure-private heaps (sort of)
+
+// Generic heaps
+
+#include "segheap.h"		// A *very general* segregated fits allocator.
+
+// "Standard" heap layers
+
+#include "kingsleyheap.h"	// A power-of-two size class allocator,
+							// a la Chris Kingsley's BSD allocator.
+
+// "Top" heaps.
+#include "mallocheap.h"		// a thin wrapper around the system's malloc/free
+#include "mmapheap.h"		// a wrapper around the system's virtual memory system
+
+// the rest...
+
+#include "oneheap.h"
+#include "debugheap.h"
+#include "sizeheap.h"
+#include "addheap.h"
+#include "profileheap.h"
+#include "sizeownerheap.h"
+#include "hybridheap.h"
+#include "traceheap.h"
+#include "stlallocator.h"
+#include "adapt.h"
+#include "util/dllist.h"
+#include "dlheap.h"
+// #include "logheap.h"
+#include "obstackheap.h"
+#include "sbrkheap.h"
+
+#include "xallocHeap.h" // 197.parser's heap
+
+#include "staticheap.h"
+
+#ifdef _MSC_VER
+#pragma warning( pop )
+#endif
+
+#endif // _HEAPLAYERS_H_
Index: /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/hldefines.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/hldefines.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/hldefines.h	(revision 176)
@@ -0,0 +1,46 @@
+#ifndef _HLDEFINES_H_
+#define _HLDEFINES_H_
+
+/*
+ * @file hldefines.h
+ * @brief Defines macros used throughout Heap Layers.
+ *
+ */
+
+// Define HL_EXECUTABLE_HEAP as 1 if you want that (i.e., you're doing
+// dynamic code generation).
+
+#define HL_EXECUTABLE_HEAP 0
+
+#if defined(_MSC_VER)
+
+// Microsoft Visual Studio
+#pragma inline_depth(255)
+#define INLINE __forceinline
+#define inline __forceinline
+#define NO_INLINE __declspec(noinline)
+#pragma warning(disable: 4530)
+#define MALLOC_FUNCTION
+#define RESTRICT
+
+#elif defined(__GNUC__)
+
+// GNU C
+
+#define NO_INLINE       __attribute__ ((noinline))
+#define INLINE          inline
+#define MALLOC_FUNCTION __attribute__((malloc))
+#define RESTRICT        __restrict__
+
+#else
+
+// All others
+
+#define NO_INLINE
+#define INLINE inline
+#define MALLOC_FUNCTION
+#define RESTRICT
+
+#endif
+
+#endif
Index: /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/hybridheap.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/hybridheap.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/hybridheap.h	(revision 176)
@@ -0,0 +1,67 @@
+/* -*- C++ -*- */
+
+#ifndef _HYBRIDHEAP_H_
+#define _HYBRIDHEAP_H_
+
+#include <assert.h>
+#include "sassert.h"
+#include "hldefines.h"
+
+/**
+ * @class HybridHeap
+ * Objects no bigger than BigSize are allocated and freed to SmallHeap.
+ * Bigger objects are passed on to the super heap.
+ */
+
+namespace HL {
+
+template <int BigSize, class SmallHeap, class BigHeap>
+class HybridHeap : public SmallHeap {
+public:
+
+  HybridHeap (void)
+  {
+  }
+
+  enum { Alignment = ((int) SmallHeap::Alignment < (int) BigHeap::Alignment) ?
+                      (int) SmallHeap::Alignment :
+	              (int) BigHeap::Alignment };
+
+  MALLOC_FUNCTION INLINE void * malloc (size_t sz) {
+    if (sz <= BigSize) {
+      return SmallHeap::malloc (sz);
+    } else {
+      return slowPath (sz);
+    }
+  }
+  
+  inline void free (void * ptr) {
+    if (SmallHeap::getSize(ptr) <= BigSize) {
+      SmallHeap::free (ptr);
+    } else {
+      bm.free (ptr);
+    }
+  }
+  
+  inline void clear (void) {
+    bm.clear();
+    SmallHeap::clear();
+  }
+  
+
+private:
+
+  MALLOC_FUNCTION NO_INLINE
+    void * slowPath (size_t sz) {
+    return bm.malloc (sz);
+  }
+
+
+  HL::sassert<(BigSize > 0)> checkBigSizeNonZero;
+
+  BigHeap bm;
+};
+
+}
+
+#endif
Index: /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/kingsleyheap.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/kingsleyheap.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/kingsleyheap.h	(revision 176)
@@ -0,0 +1,125 @@
+// -*- C++ -*-
+
+/*
+
+  Heap Layers: An Extensible Memory Allocation Infrastructure
+  
+  Copyright (C) 2000-2003 by Emery Berger
+  http://www.cs.umass.edu/~emery
+  emery@cs.umass.edu
+  
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or
+  (at your option) any later version.
+  
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+  
+  You should have received a copy of the GNU General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+*/
+
+#ifndef _KINGSLEYHEAP_H_
+#define _KINGSLEYHEAP_H_
+
+#include "segheap.h"
+
+/**
+ * @file kingsleyheap.h
+ * @brief Classes to implement a Kingsley (power-of-two, segregated fits) allocator.
+ */
+
+/**
+ * @namespace Kingsley
+ * @brief Functions to implement KingsleyHeap.
+ */
+
+
+
+namespace Kingsley {
+
+  size_t class2Size (const int i);
+
+#if defined(__sparc) && defined(__GNUC__)
+  inline int popc (int v) {
+    int r;
+    asm volatile ("popc %1, %0"
+		  : "=r" (r)
+		  : "r" (v));
+    return r;
+  }
+#endif
+
+  /**
+   * A speed optimization:
+   * we use this array to quickly return the size class of objects
+   * from 8 to 128 bytes.
+   */
+  const int cl[16] = { 0, 1, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4 };
+
+  inline int size2Class (const size_t sz) {
+#if defined(__sparc) && defined(__GNUC__)
+    // Adapted from _Hacker's Delight_, by Henry Warren (p.80)
+    size_t x = sz;
+    x = x | (x >> 1);
+    x = x | (x >> 2);
+    x = x | (x >> 4);
+    x = x | (x >> 8);
+    x = x | (x >> 16);
+    return popc(x) - 3;
+#else
+    if (sz < 128 ) {
+      assert (class2Size(cl[sz >> 3]) >= sz);
+      return cl[(sz - 1) >> 3];
+    } else {
+      //
+      // We know that the object is more than 128 bytes long,
+      // so we can avoid iterating 5 times.
+      //
+      int c = 5;
+      size_t sz1 = ((sz - 1) >> 5);
+      while (sz1 > 7) {
+	sz1 >>= 1;
+	c++;
+      }
+      assert (class2Size(c) >= sz);
+      return c;
+    }
+#endif
+
+  }
+
+  inline size_t class2Size (const int i) {
+    return (size_t) (1 << (i+3));
+  }
+
+  enum { NUMBINS = 29 };
+
+};
+
+/**
+ * @class KingsleyHeap
+ * @brief The Kingsley-style allocator.
+ * @param PerClassHeap The heap to use for each size class.
+ * @param BigHeap The heap for "large" objects.
+ * @see Kingsley
+ */
+
+namespace HL {
+
+template <class PerClassHeap, class BigHeap>
+  class KingsleyHeap : 
+   public StrictSegHeap<Kingsley::NUMBINS,
+			Kingsley::size2Class,
+			Kingsley::class2Size,
+			PerClassHeap,
+			BigHeap> {};
+
+};
+
+#endif
Index: /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/leamallocheap.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/leamallocheap.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/leamallocheap.h	(revision 176)
@@ -0,0 +1,61 @@
+// -*- C++ -*-
+
+/*
+
+  Heap Layers: An Extensible Memory Allocation Infrastructure
+  
+  Copyright (C) 2000-2003 by Emery Berger
+  http://www.cs.umass.edu/~emery
+  emery@cs.umass.edu
+  
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or
+  (at your option) any later version.
+  
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+  
+  You should have received a copy of the GNU General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+*/
+
+#ifndef _LEAMALLOCHEAP_H_
+#define _LEAMALLOCHEAP_H_
+
+#include <stdlib.h>
+
+/**
+ * @class LeaMallocHeap
+ * @brief A "source heap" that uses the Lea allocator.
+ */
+
+extern "C" void * dlmalloc (size_t);
+extern "C" void   dlfree (void *);
+extern "C" size_t dlmalloc_usable_size (void *);
+
+namespace HL {
+
+class LeaMallocHeap {
+ public:
+  inline void * malloc (size_t sz) {
+    void * ptr = dlmalloc (sz);
+    return ptr;
+  }
+
+  inline void free (void * p) {
+    dlfree (p);
+  }
+
+  inline size_t getSize (const void * p) {
+    return dlmalloc_usable_size ((void *) p);
+  }
+};
+
+};
+
+#endif
Index: /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/localmallocheap.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/localmallocheap.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/localmallocheap.h	(revision 176)
@@ -0,0 +1,113 @@
+#ifndef _LOCALMALLOCHEAP_H_
+#define _LOCALMALLOCHEAP_H_
+
+#include <dlfcn.h>
+
+#include "ansiwrapper.h"
+#include "sizeheap.h"
+#include "staticheap.h"
+
+extern "C" {
+  size_t malloc_usable_size (void *);
+  
+  typedef void * mallocFunction (size_t);
+  typedef void freeFunction (void *);
+  typedef size_t msizeFunction (void *);
+  
+  typedef void exitFunction (int);
+  exitFunction * trueExitFunction;
+}
+
+namespace HL {
+
+  class LocalMallocHeap {
+  public:
+
+    LocalMallocHeap (void)
+      : freefn (NULL),
+      msizefn (NULL),
+      mallocfn (NULL),
+      firsttime (true)
+      {}
+
+    inline void * malloc (size_t sz) {
+      if (firsttime) {
+
+	firsttime = false;
+
+	// We haven't initialized anything yet.
+	// Initialize all of the malloc shim functions.
+
+	freefn = (freeFunction *) dlsym (RTLD_NEXT, "free");
+	msizefn = (msizeFunction *) dlsym (RTLD_NEXT, "malloc_usable_size");
+	trueExitFunction = (exitFunction *) dlsym (RTLD_NEXT, "exit");
+	mallocfn = (mallocFunction *) dlsym (RTLD_NEXT, "malloc");
+
+	if (!(freefn && msizefn && trueExitFunction && mallocfn)) {
+	  fprintf (stderr, "Serious problem!\n");
+	  abort();
+	}
+
+	assert (freefn);
+	assert (msizefn);
+	assert (trueExitFunction);
+	assert (mallocfn);
+
+	// Go get some memory from malloc!
+	return (*mallocfn)(sz);
+      }
+
+      // Now, once we have mallocfn resolved, we can use it.
+      // Otherwise, we're still in dlsym-land, and have to use our local heap.
+
+      if (mallocfn) {
+	return (*mallocfn)(sz);
+      } else {
+	void * ptr = localHeap.malloc (sz);
+	assert (ptr);
+	return ptr;
+      }
+    }
+
+    inline void free (void * ptr) {
+      if (mallocfn) {
+	if (localHeap.isValid (ptr)) {
+	  // We got a pointer to the temporary allocation buffer.
+	  localHeap.free (ptr);
+	} else {
+	  (*freefn)(ptr);
+	}
+      }
+    }
+
+    inline size_t getSize (void * ptr) {
+      if (localHeap.isValid (ptr)) {
+	return localHeap.getSize (ptr);
+      } else if (mallocfn) {
+	return (*msizefn)(ptr);
+      } else {
+	// This should never happen.
+	return 0;
+      }
+    }
+
+  private:
+
+    bool firsttime;   /// True iff we haven't initialized the shim functions.
+
+    // Shim functions below.
+
+    freeFunction *   freefn;
+    msizeFunction *  msizefn;
+    mallocFunction * mallocfn;
+
+    /// The local heap (for use while we are in dlsym, installing the
+    /// shim functions). Hopefully 64K is enough...
+
+    ANSIWrapper<SizeHeap<StaticHeap<65536> > > localHeap;
+
+  };
+
+}
+
+#endif
Index: /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/lockedheap.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/lockedheap.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/lockedheap.h	(revision 176)
@@ -0,0 +1,62 @@
+/* -*- C++ -*- */
+
+/*
+
+  Heap Layers: An Extensible Memory Allocation Infrastructure
+  
+  Copyright (C) 2000-2003 by Emery Berger
+  http://www.cs.umass.edu/~emery
+  emery@cs.umass.edu
+  
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or
+  (at your option) any later version.
+  
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+  
+  You should have received a copy of the GNU General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+*/
+
+#ifndef _LOCKEDHEAP_H_
+#define _LOCKEDHEAP_H_
+
+#include "guard.h"
+
+namespace HL {
+
+template <class LockType, class Super>
+class LockedHeap : public Super {
+public:
+
+  inline void * malloc (size_t sz) {
+    Guard<LockType> l (thelock);
+    return Super::malloc (sz);
+  }
+  
+  inline void free (void * ptr) {
+    Guard<LockType> l (thelock);
+    Super::free (ptr);
+  }
+
+  inline void lock (void) {
+    thelock.lock();
+  }
+
+  inline void unlock (void) {
+    thelock.unlock(); 
+  }
+ 
+private:
+  LockType thelock;
+};
+
+}
+
+#endif
Index: /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/logheap.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/logheap.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/logheap.h	(revision 176)
@@ -0,0 +1,273 @@
+/* -*- C++ -*- */
+
+#ifndef _LOGHEAP_H_
+#define _LOGHEAP_H_
+
+/**
+ * @file logheap.h
+ * @brief Contains the implementations of Log and LogHeap.
+ */
+
+#include <assert.h>
+#include <math.h>
+#include <limits.h>
+
+// UNIX-specific for now...
+#include <unistd.h>
+
+#include <fstream>
+#include <ios>
+
+
+using namespace std;
+
+namespace HL {
+
+template <class Obj>
+class Log {
+public:
+
+  enum { MAX_ENTRIES = 300000 };
+
+  Log (void) :
+    numEntries (0)
+  {
+    sprintf (filename, "theLog-%d", getpid());
+  }
+
+  ~Log (void) {
+    //    writeLog();
+  }
+
+  void writeLog (void) {
+    {
+      ofstream outfile (filename, ios_base::app);
+    }
+    write(filename);
+  }
+
+  void dump (void) {
+    write (filename);
+    numEntries = 0;
+  }
+
+  int append (const Obj& o) {
+    if (numEntries < MAX_ENTRIES) {
+      entries[numEntries] = o;
+      numEntries++;
+      return 1;
+    } else {
+      return 0;
+    }
+  }
+    
+  void write (char * fname) {
+    ofstream outfile (fname, ios_base::app);
+    for (int i = 0; i < numEntries; i++) {
+      outfile << entries[i] << endl;
+    }
+  }
+
+private:
+
+  int numEntries;
+  Obj entries[MAX_ENTRIES];
+  char filename[255];
+};
+
+
+template <class SuperHeap>
+class LogHeap : public SuperHeap {
+public:
+
+  LogHeap (void)
+    : allDone (false)
+  {}
+
+  inline void * malloc (size_t sz) {
+    void * ptr = SuperHeap::malloc (sz);
+    if (!allDone) {
+      MemoryRequest m;
+      m.malloc (ptr, sz);
+      if (!log.append (m)) {
+	allDone = true;
+	log.dump();
+	log.append(m);
+	allDone = false;
+      }
+    }
+    return ptr;
+  }
+
+  void write (void) {
+    allDone = true;
+    log.writeLog();
+  }
+
+  inline void free (void * ptr) {
+    if (!allDone) {
+      MemoryRequest m;
+      m.free (ptr);
+      log.append (m);
+    }
+    SuperHeap::free (ptr);
+  }
+
+private:
+
+  class MemoryRequest {
+  public:
+
+    MemoryRequest (void)
+      :
+#if 0
+      _sec (LONG_MAX),
+      _usec (LONG_MAX),
+#endif
+      _size (0),
+      _address (INVALID)
+    {}
+
+    enum { FREE_OP = 0,
+	   MALLOC_OP,
+	   REALLOC_OP,
+	   REFREE_OP,
+	   ALLOCATE_OP,
+	   DEALLOCATE_OP,
+	   INVALID
+    };
+
+    friend std::ostream& operator<< (std::ostream& os, MemoryRequest& m) {
+      switch (m.getType()) {
+      case FREE_OP:
+	os << "F\t" << (void *) m.getAddress();
+	break;
+      case MALLOC_OP:
+	os << "M\t" << m.getSize() << "\t" << (void *) m.getAddress();
+	break;
+      default:
+	abort();
+      }
+      return os;
+    }
+
+    void malloc (void * addr,
+		 size_t sz)
+    {
+      assert ((((unsigned long) addr) & 7) == 0);
+      _size = sz;
+      _address = (unsigned long) addr | MALLOC_OP;
+      //      markTime (_sec, _usec);
+      // printf ("malloc %d (%f)\n", sz, getTime());
+    }
+
+
+    void free (void * addr)
+    {
+      assert ((((unsigned long) addr) & 7) == 0);
+      _address = (unsigned long) addr | FREE_OP;
+      //      markTime (_sec, _usec);
+      // printf ("free %d (%f)\n", _address, getTime());
+    }
+
+
+    void allocate (int sz)
+    {
+      _address = ALLOCATE_OP;
+      _size = sz;
+      markTime (_sec, _usec);
+      // printf ("allocate %d (%f)\n", sz, getTime());
+    }
+
+
+    void deallocate (int sz)
+    {
+      _address = DEALLOCATE_OP;
+      _size = sz;
+      markTime (_sec, _usec);
+      // printf ("allocate %d (%f)\n", sz, getTime());
+    }
+
+
+    // Set sec & usec to the current time.
+    void markTime (long& sec, long& usec)
+    {
+#if 0
+#ifdef __SVR4 // Solaris
+      hrtime_t t;
+      t = gethrtime();
+      sec = *((long *) &t);
+      usec = *((long *) &t + 1);
+#else
+      struct timeval tv;
+      struct timezone tz;
+      gettimeofday (&tv, &tz);
+      sec = tv.tv_sec;
+      usec = tv.tv_usec;
+#endif
+#endif
+    }
+
+    int getType (void) {
+      return _address & 7;
+    }
+
+    int getAllocated (void) {
+      return _size;
+    }
+
+    int getDeallocated (void) {
+      return _size;
+    }
+
+    unsigned long getAddress (void) {
+      return _address & ~7;
+    }
+
+    int getSize (void) {
+      return _size;
+    }
+
+#if 0
+    double getTime (void) {
+      return (double) _sec + (double) _usec / 1000000.0;
+    }
+
+    long getSeconds (void) {
+      return _sec;
+    }
+
+    long getUseconds (void) {
+      return _usec;
+    }
+
+    friend int operator< (MemoryRequest& m, MemoryRequest& n) {
+      return ((m._sec < n._sec)
+	      || ((m._sec == n._sec)
+		  && (m._usec < n._usec)));
+    }
+
+    friend int operator== (MemoryRequest& m, MemoryRequest& n) {
+      return ((m._sec == n._sec) && (m._usec == n._usec));
+    }
+#endif
+
+  private:
+    int	_size;     	// in bytes 
+    unsigned long _address;  // The address returned by malloc/realloc   
+#if 1
+    long	_sec;      	// seconds as returned by gettimeofday      
+    long	_usec;     	// microseconds as returned by gettimeofday 
+#endif
+  };
+
+  Log<MemoryRequest> log;
+
+  bool allDone;
+
+
+};
+
+}
+
+#endif // _LOGHEAP_H_
Index: /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/mallocheap.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/mallocheap.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/mallocheap.h	(revision 176)
@@ -0,0 +1,83 @@
+/* -*- C++ -*- */
+
+/*
+
+  Heap Layers: An Extensible Memory Allocation Infrastructure
+  
+  Copyright (C) 2000-2005 by Emery Berger
+  http://www.cs.umass.edu/~emery
+  emery@cs.umass.edu
+  
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or
+  (at your option) any later version.
+  
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+  
+  You should have received a copy of the GNU General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+*/
+
+#ifndef _MALLOCHEAP_H_
+#define _MALLOCHEAP_H_
+
+#include <stdlib.h>
+
+#if defined(__SVR4)
+extern "C" size_t malloc_usable_size (void *);
+#else
+extern "C" size_t malloc_usable_size (void *) throw ();
+#endif
+
+#if defined(_WIN32) || defined(linux)
+#include <malloc.h>
+#elif defined(__APPLE__)
+#include <malloc/malloc.h>
+#endif
+
+/**
+ * @class mallocHeap
+ * @brief A "source heap" that uses malloc and free.
+ */
+
+namespace HL {
+
+class mallocHeap {
+public:
+
+  ~mallocHeap (void) {}
+  
+  inline void * malloc (size_t sz) {
+    return ::malloc (sz);
+  }
+  
+  
+  inline void free (void * ptr) {
+    ::free (ptr);
+  }
+
+#if defined(_MSC_VER)
+  inline size_t getSize (void * ptr) {
+    return ::_msize (ptr);
+  }
+#elif defined(__GNUC__) && !defined(__SVR4)
+  inline size_t getSize (void * ptr) {
+    return ::malloc_usable_size (ptr);
+  }
+#elif defined(__APPLE__)
+  inline size_t getSize (void * ptr) {
+    return ::malloc_size (ptr);
+  }
+#endif
+  
+};
+
+};
+
+#endif
Index: /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/mmapheap.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/mmapheap.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/mmapheap.h	(revision 176)
@@ -0,0 +1,212 @@
+/* -*- C++ -*- */
+
+/*
+
+  Heap Layers: An Extensible Memory Allocation Infrastructure
+  
+  Copyright (C) 2000-2004 by Emery Berger
+  http://www.cs.umass.edu/~emery
+  emery@cs.umass.edu
+  
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or
+  (at your option) any later version.
+  
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+  
+  You should have received a copy of the GNU General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+*/
+
+#ifndef _MMAPHEAP_H_
+#define _MMAPHEAP_H_
+
+#if defined(_WIN32)
+#include <windows.h>
+#else
+// UNIX
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <sys/mman.h>
+#include <map>
+#endif
+
+#include "sassert.h"
+#include "myhashmap.h"
+#include "stlallocator.h"
+#include "freelistheap.h"
+#include "zoneheap.h"
+#include "lockedheap.h"
+#include "spinlock.h"
+#include "hldefines.h"
+
+#if HL_EXECUTABLE_HEAP
+#define HL_MMAP_PROTECTION_MASK (PROT_READ | PROT_WRITE | PROT_EXEC)
+#else
+#define HL_MMAP_PROTECTION_MASK (PROT_READ | PROT_WRITE)
+#endif
+
+#if !defined(MAP_ANONYMOUS) && defined(MAP_ANON)
+#define MAP_ANONYMOUS MAP_ANON
+#endif
+
+
+#include <new>
+
+/**
+ * @class MmapHeap
+ * @brief A "source heap" that manages memory via calls to the VM interface.
+ * @author Emery Berger
+ */
+
+namespace HL {
+
+  class PrivateMmapHeap {
+  public:
+
+    /// All memory from here is zeroed.
+    enum { ZeroMemory = 1 };
+
+#if defined(_WIN32) 
+
+    // Microsoft Windows aligns all memory to a 64K boundary.
+    enum { Alignment = 64 * 1024 };
+
+    inline void * malloc (size_t sz) {
+      //    printf ("mmapheap: Size request = %d\n", sz);
+#if HL_EXECUTABLE_HEAP
+      char * ptr = (char *) VirtualAlloc (NULL, sz, MEM_RESERVE | MEM_COMMIT | MEM_TOP_DOWN, PAGE_EXECUTE_READWRITE);
+#else
+      char * ptr = (char *) VirtualAlloc (NULL, sz, MEM_RESERVE | MEM_COMMIT | MEM_TOP_DOWN, PAGE_READWRITE);
+#endif
+      return (void *) ptr;
+    }
+  
+    inline void free (void * ptr, size_t) {
+      VirtualFree (ptr, 0, MEM_RELEASE);
+    }
+
+    inline void free (void * ptr) {
+      VirtualFree (ptr, 0, MEM_RELEASE);
+    }
+  
+    inline static size_t getSize (void * ptr) {
+      MEMORY_BASIC_INFORMATION mbi;
+      VirtualQuery (ptr, &mbi, sizeof(mbi));
+      return (size_t) mbi.RegionSize;
+    }
+
+#else
+
+    virtual ~PrivateMmapHeap (void) {}
+
+#if defined(__SVR4)
+
+    // Solaris aligns all memory to a 64K boundary.
+    enum { Alignment = 64 * 1024 };
+#else
+    // Linux and most other operating systems align memory to a 4K boundary.
+    enum { Alignment = 4 * 1024 };
+#endif
+
+    inline void * malloc (size_t sz) {
+#if defined(MAP_ALIGN) && defined(MAP_ANON)
+      // Request memory aligned to the Alignment value above.
+      void * ptr = mmap ((char *) Alignment, sz, HL_MMAP_PROTECTION_MASK, MAP_PRIVATE | MAP_ALIGN | MAP_ANON, -1, 0);
+#elif !defined(MAP_ANONYMOUS)
+      static int fd = ::open ("/dev/zero", O_RDWR);
+      void * ptr = mmap (NULL, sz, HL_MMAP_PROTECTION_MASK, MAP_PRIVATE, fd, 0);
+#else
+      void * ptr = mmap (NULL, sz, HL_MMAP_PROTECTION_MASK, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
+#endif
+      if (ptr == MAP_FAILED) {
+	ptr = NULL;
+      }
+      return ptr;
+    }
+    
+#if 1
+    inline void free (void * ptr) {
+      abort();
+      munmap (reinterpret_cast<char *>(ptr), getSize(ptr));
+    }
+
+    inline size_t getSize (void * ptr) {
+      ptr = ptr;
+      abort();
+      return Alignment; // Obviously broken. Such is life.
+    }
+#endif
+
+    void free (void * ptr, size_t sz)
+    {
+      if ((long) sz < 0) {
+	abort();
+      }
+
+      munmap (reinterpret_cast<char *>(ptr), sz);
+    }
+
+#endif
+
+  };
+
+
+  class MmapHeap : public PrivateMmapHeap {
+#if !defined(_WIN32)
+
+  private:
+
+    class MyHeap : public LockedHeap<SpinLockType, FreelistHeap<ZoneHeap<PrivateMmapHeap, 16384 - 16> > > {}; // FIX ME: 16 = size of ZoneHeap header.
+
+    typedef MyHashMap<void *, size_t, MyHeap> mapType;
+
+  protected:
+    mapType MyMap;
+
+    SpinLockType MyMapLock;
+
+  public:
+    inline void * malloc (size_t sz) {
+      void * ptr = PrivateMmapHeap::malloc (sz);
+      MyMapLock.lock();
+      MyMap.set (ptr, sz);
+      MyMapLock.unlock();
+      assert (reinterpret_cast<size_t>(ptr) % Alignment == 0);
+      return const_cast<void *>(ptr);
+    }
+
+    inline size_t getSize (void * ptr) {
+      MyMapLock.lock();
+      size_t sz = MyMap.get (ptr);
+      MyMapLock.unlock();
+      return sz;
+    }
+
+    // WORKAROUND: apparent gcc bug.
+    void free (void * ptr, size_t sz) {
+      PrivateMmapHeap::free (ptr, sz);
+    }
+
+    inline void free (void * ptr) {
+      assert (reinterpret_cast<size_t>(ptr) % Alignment == 0);
+      MyMapLock.lock();
+      size_t sz = MyMap.get (ptr);
+      PrivateMmapHeap::free (ptr, sz);
+      MyMap.erase (ptr);
+      MyMapLock.unlock();
+    }
+#endif
+  };
+
+}
+
+#endif
Index: /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/mmapwrapper.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/mmapwrapper.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/mmapwrapper.h	(revision 176)
@@ -0,0 +1,125 @@
+// -*- C++ -*-
+
+/*
+
+  Heap Layers: An Extensible Memory Allocation Infrastructure
+  
+  Copyright (C) 2000-2005 by Emery Berger
+  http://www.cs.umass.edu/~emery
+  emery@cs.umass.edu
+  
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or
+  (at your option) any later version.
+  
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+  
+  You should have received a copy of the GNU General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+*/
+
+#ifndef _MMAPWRAPPER_H_
+#define _MMAPWRAPPER_H_
+
+#if defined(_WIN32)
+#include <windows.h>
+#else
+// UNIX
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <sys/mman.h>
+#include <map>
+#endif
+
+#if HL_EXECUTABLE_HEAP
+#define HL_MMAP_PROTECTION_MASK (PROT_READ | PROT_WRITE | PROT_EXEC)
+#else
+#define HL_MMAP_PROTECTION_MASK (PROT_READ | PROT_WRITE)
+#endif
+
+#if !defined(MAP_ANONYMOUS) && defined(MAP_ANON)
+#define MAP_ANONYMOUS MAP_ANON
+#endif
+
+namespace HL {
+
+class MmapWrapper {
+public:
+
+#if defined(_WIN32) 
+  
+  // Microsoft Windows has 4K pages aligned to a 64K boundary.
+  enum { Size = 4 * 1024 };
+  enum { Alignment = 64 * 1024 };
+
+  static void * map (size_t sz) {
+    void * ptr;
+#if HL_EXECUTABLE_HEAP
+    const int permflags = PAGE_EXECUTE_READWRITE;
+#else
+    const int permflags = PAGE_READWRITE;
+#endif
+    ptr = VirtualAlloc (NULL, sz, MEM_RESERVE | MEM_COMMIT | MEM_TOP_DOWN, permflags);
+    return  ptr;
+  }
+  
+  static void unmap (void * ptr, size_t) {
+    VirtualFree (ptr, 0, MEM_RELEASE);
+  }
+
+#else
+
+#if defined(__SVR4)
+  // Solaris aligns 8K pages to a 64K boundary.
+  enum { Size = 8 * 1024 };
+  enum { Alignment = 64 * 1024 };
+#else
+  // Linux and most other operating systems align memory to a 4K boundary.
+  enum { Size = 4 * 1024 };
+  enum { Alignment = 4 * 1024 };
+#endif
+
+  static void * map (size_t sz) {
+
+    if (sz == 0) {
+      return NULL;
+    }
+
+    void * ptr;
+
+#if defined(MAP_ALIGN) && defined(MAP_ANON)
+    // Request memory aligned to the Alignment value above.
+    ptr = mmap ((char *) Alignment, sz, HL_MMAP_PROTECTION_MASK, MAP_PRIVATE | MAP_ALIGN | MAP_ANON, -1, 0);
+#elif !defined(MAP_ANONYMOUS)
+    static int fd = ::open ("/dev/zero", O_RDWR);
+    ptr = mmap (NULL, sz, HL_MMAP_PROTECTION_MASK, MAP_PRIVATE, fd, 0);
+#else
+    ptr = mmap (0, sz, HL_MMAP_PROTECTION_MASK, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
+#endif
+
+    if (ptr == MAP_FAILED) {
+      return NULL;
+    } else {
+      return ptr;
+    }
+  }
+
+  static void unmap (void * ptr, size_t sz) {
+    munmap (reinterpret_cast<char *>(ptr), sz);
+  }
+   
+#endif
+
+};
+
+}
+
+#endif
Index: /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/nestedheap.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/nestedheap.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/nestedheap.h	(revision 176)
@@ -0,0 +1,152 @@
+// -*- C++ -*-
+
+/*
+
+  Heap Layers: An Extensible Memory Allocation Infrastructure
+  
+  Copyright (C) 2000-2003 by Emery Berger
+  http://www.cs.umass.edu/~emery
+  emery@cs.umass.edu
+  
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or
+  (at your option) any later version.
+  
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+  
+  You should have received a copy of the GNU General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+*/
+
+#ifndef _NESTEDHEAP_H_
+#define _NESTEDHEAP_H_
+
+#include <assert.h>
+
+/**
+ * @class NestedHeap
+ * @brief Hierarchical heaps.
+ * @author Emery Berger <http://www.cs.umass.edu/~emery>
+ */
+
+namespace HL {
+
+template <class SuperHeap>
+class NestedHeap : public SuperHeap {
+public:
+
+  NestedHeap (void)
+    : parent (NULL),
+      child (NULL),
+      prev (NULL),
+      next (NULL)
+  {
+  }
+
+  ~NestedHeap (void)
+  {
+    clear();
+    if (parent != NULL) {
+      parent->removeChild (this);
+    }
+    removeSibling (this);
+  }
+
+  inline void clear (void) {
+
+    // Clear this heap.
+    SuperHeap::clear();
+
+#if 0
+    //
+    // Iterate through all children and delete them.
+    //
+
+    if (child != NULL) {
+      NestedHeap<SuperHeap> * nextChild = child->next;
+      while (child != NULL) {
+	NestedHeap<SuperHeap> * prevChild = child->prev;
+	delete child;
+	child = prevChild;
+      }
+      child = nextChild;
+      while (child != NULL) {
+	nextChild = child->next;
+	delete child;
+	child = nextChild;
+      }
+    }
+    assert (child == NULL);
+
+#else // clear all the children.
+
+    NestedHeap<SuperHeap> * ch = child;
+    while (ch != NULL) {
+      NestedHeap<SuperHeap> * nextChild = ch->next;
+      ch->clear();
+      ch = nextChild;
+    }
+#endif
+
+  }
+
+  void addChild (NestedHeap<SuperHeap> * ch)
+  {
+    if (child == NULL) {
+      child = ch;
+      child->prev = NULL;
+      child->next = NULL;
+    } else {
+      assert (child->prev == NULL);
+      assert (ch->next == NULL);
+      ch->prev = NULL;
+      ch->next = child;
+      child->prev = ch;
+      child = ch;
+    }
+    child->parent = this;
+  }
+
+private:
+
+  void removeChild (NestedHeap<SuperHeap> * ch)
+  {
+    assert (ch != NULL);
+    if (child == ch) {
+      if (ch->prev) {
+	child = ch->prev;
+      } else if (ch->next) {
+	child = ch->next;
+      } else {
+	child = NULL;
+      }
+    }
+    removeSibling (ch);
+  }
+
+  inline static void removeSibling (NestedHeap<SuperHeap> * sib)
+  {
+    if (sib->prev) {
+      sib->prev->next = sib->next;
+    }
+    if (sib->next) {
+      sib->next->prev = sib->prev;
+    }
+  }
+
+  NestedHeap<SuperHeap> * parent;
+  NestedHeap<SuperHeap> * child;
+  NestedHeap<SuperHeap> * prev;
+  NestedHeap<SuperHeap> * next;
+
+};
+
+}
+
+#endif
Index: /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/nullheap.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/nullheap.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/nullheap.h	(revision 176)
@@ -0,0 +1,50 @@
+// -*- C++ -*-
+
+/*
+
+  Heap Layers: An Extensible Memory Allocation Infrastructure
+  
+  Copyright (C) 2000-2003 by Emery Berger
+  http://www.cs.umass.edu/~emery
+  emery@cs.umass.edu
+  
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or
+  (at your option) any later version.
+  
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+  
+  You should have received a copy of the GNU General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+*/
+
+#ifndef _NULLHEAP_H_
+#define _NULLHEAP_H_
+
+#include <assert.h>
+
+/**
+ * @class NullHeap
+ * @brief A source heap that does nothing.
+ */
+
+namespace HL {
+
+template <class SuperHeap>
+class NullHeap : public SuperHeap {
+public:
+  inline void * malloc (size_t) const { return 0; }
+  inline void free (void *) const {}
+  inline int remove (void *) const { return 0; }
+  inline void clear (void) const {}
+};
+
+}
+
+#endif
Index: /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/obstack.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/obstack.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/obstack.h	(revision 176)
@@ -0,0 +1,300 @@
+/* -*- C++ -*- */
+
+/*
+
+  Heap Layers: An Extensible Memory Allocation Infrastructure
+  
+  Copyright (C) 2000-2003 by Emery Berger
+  http://www.cs.umass.edu/~emery
+  emery@cs.umass.edu
+  
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or
+  (at your option) any later version.
+  
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+  
+  You should have received a copy of the GNU General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+*/
+
+
+// An "Obstack".
+
+#ifndef _HLOBSTACK_H_
+#define _HLOBSTACK_H_
+
+
+#ifdef __cplusplus
+
+#include <assert.h>
+#include <new>
+
+/**
+ * @class ObstackHeap
+ * @brief Implements obstack functionality (as in the GNU obstack library).
+ */
+
+namespace HL {
+
+template <int ChunkSize, class SuperHeap>
+class ObstackHeap : public SuperHeap {
+public:
+
+  ObstackHeap (void)
+  {
+    // Get one chunk and set the current position marker.
+    currentChunk = makeChunk (NULL, ChunkSize);
+    currentBase = nextPos = (char *) (currentChunk + 1);
+    assert (isValid());
+  }
+
+  ~ObstackHeap (void) {
+    // Free every chunk.
+    assert (isValid());
+    ChunkHeader * ch = currentChunk;
+    while (ch != NULL) {
+      ChunkHeader * pch = ch->getPrevChunk();
+      // cout << "Freeing chunk " << ch << endl;
+      SuperHeap::free (ch);
+      ch = pch;
+    }
+  }
+
+  // "Grow" the current object.
+  // Returns a point in the object just before the current "grow".
+  inline void * grow (size_t sz) {
+    // If we've grown beyond the confines of this chunk,
+    // get a new one.
+    assert (isValid());
+    if ((int) ((char *) currentChunk->getLimit() - (char *) nextPos) < sz) {
+      ChunkHeader * newCurrent = copyToNew(sz);
+      if (newCurrent == NULL)
+	return NULL;
+#if 0
+      // Now delete the previous chunk if this was the only object in it.
+      if (deleteChunk != NULL) {
+	SuperHeap::free (deleteChunk);
+      }
+#endif
+      assert (isValid());
+    }
+    assert (((int) ((char *) currentChunk->getLimit() - (char *) nextPos) >= sz));
+    assert ((char *) (sz + nextPos) <= currentChunk->getLimit());
+    // Bump the pointer for the next object.
+    void * prevNextPos = nextPos;
+    nextPos += sz;
+    assert (isValid());
+    return prevNextPos;
+  }
+
+
+  inline void * malloc (size_t sz) {
+    assert (isValid());
+    if (currentChunk == NULL) {
+      return NULL;
+    }
+    //sz = align(sz > 0 ? sz : 1);
+    // If this object can't fit in the current chunk,
+    // get another one.
+    if ((int) ((char *) currentChunk->getLimit() - (char *) nextPos) < sz) {
+      // Allocate a chunk that's large enough to hold the requested size.
+      currentChunk = makeChunk (currentChunk, sz);
+      if (currentChunk == NULL) {
+	return NULL;
+      }
+      currentBase = nextPos = (char *) (currentChunk + 1);
+      assert (isValid());
+    }
+    assert (((int) ((char *) currentChunk->getLimit() - (char *) nextPos) >= sz));
+    assert ((char *) (sz + nextPos) <= currentChunk->getLimit());
+    // Bump the pointers forward.
+    currentBase = nextPos;
+    nextPos += sz;
+    void * ptr = currentBase;
+    finalize();
+    assert (isValid());
+    return (void *) ptr;
+  }
+
+  // Free everything allocated "after" ptr.
+  // NB: Freeing NULL safely empties the entire obstack.
+  inline void free (void * ptr) {
+    assert (isValid());
+    // Free every chunk until we find the one that this pointer is in.
+    // Then reset the current position to ptr.
+    while (currentChunk != NULL &&
+	   (((char *) currentChunk > (char *) ptr) ||
+	    ((char *) currentChunk->getLimit() < (char *) ptr))) {
+      ChunkHeader * pch = currentChunk;
+      currentChunk = currentChunk->getPrevChunk();
+      SuperHeap::free (pch);
+    }
+    if (currentChunk != NULL) {
+      currentBase = nextPos = (char *) ptr;
+      assert (isValid());
+    } else {
+      if (ptr != NULL) {
+	// Something bad has happened -- we tried to free an item that
+	// wasn't in any chunk.
+	abort();
+      } else {
+	// Get one chunk.
+	currentChunk = makeChunk (NULL, ChunkSize);
+	currentBase = nextPos = (char *) (currentChunk + 1);
+	assert (isValid());
+      }
+    }
+  }
+
+
+  inline void * getObjectBase (void) {
+    assert (isValid());
+    return currentBase;
+  }
+
+
+  inline void finalize (void) {
+    assert (isValid());
+    nextPos = (char *) align((int) nextPos);
+    currentBase = nextPos;
+    assert (isValid());
+  }
+
+
+private:
+
+
+  inline int objectSize (void) {
+    int diff = (int) (nextPos - currentBase);
+    assert (diff >= 0);
+    return diff;
+  }
+
+
+  int isValid (void) {
+    // Verify class invariants.
+#ifndef NDEBUG
+    bool c1 = (currentBase <= nextPos);
+    assert (c1);
+    bool c2 = (nextPos <= currentChunk->getLimit());
+    assert (c2);
+    bool c3 = ((char *) currentChunk <= currentChunk->getLimit());
+    assert (c3);
+    bool c4 = ((char *) currentChunk <= currentBase);
+    assert (c4);
+    bool c5 = (currentChunk != currentChunk->getPrevChunk());
+    assert (c5);
+    bool c6 = (objectSize() >= 0);
+    assert (c6);
+    return (c1 && c2 && c3 && c4 && c5 && c6);
+#else
+    return 1;
+#endif
+  }
+
+  // The header for every chunk.
+  class ChunkHeader {
+  public:
+    inline ChunkHeader (ChunkHeader * prev, size_t sz)
+      : _pastEnd ((char *) (this + 1) + sz),
+	_prevChunk (prev)
+    {}
+
+    // Return the end of the current chunk.
+    inline char * getLimit (void) { return _pastEnd; }
+
+    // Return the previous chunk.
+    inline ChunkHeader * getPrevChunk (void) { return _prevChunk; }
+
+  private:
+    // Just past the end of this chunk.
+    char * _pastEnd;
+
+    // Address of prior chunk.
+    ChunkHeader * _prevChunk;
+  };
+
+
+  inline static size_t align (int sz) {
+    return (sz + (sizeof(double) - 1)) & ~(sizeof(double) - 1);
+  }
+
+  // Make a new chunk of at least sz bytes.
+  inline ChunkHeader * makeChunk (ChunkHeader * ch, size_t sz) {
+    // Round up the allocation size to at least one chunk.
+    size_t allocSize
+      = align((sz > ChunkSize - sizeof(ChunkHeader)) ? sz : ChunkSize - sizeof(ChunkHeader));
+    // Make a new chunk.
+    ChunkHeader * newChunk 
+      = new (SuperHeap::malloc (sizeof(ChunkHeader) + allocSize)) ChunkHeader (ch, allocSize);
+    return newChunk;
+  }
+
+
+  // Copy the current object to a new chunk.
+  // sz = the minimum amount of extra space we need.
+  inline ChunkHeader * copyToNew (size_t sz) {
+    size_t obj_size = objectSize();
+    size_t new_size = obj_size + sz + (obj_size >> 3) + 100;
+    //size_t new_size = 2 * (obj_size + sz);
+    ChunkHeader * newChunk;
+#if 0
+    // This variable will hold the chunk to be deleted (if any).
+    ChunkHeader * deleteChunk = NULL;
+    // If this object was the only one in the chunk,
+    // link back past this chunk.
+    if (currentBase == (char *) (currentChunk + 1)) {
+      newChunk = makeChunk (currentChunk->getPrevChunk(), new_size);
+      deleteChunk = currentChunk;
+    } else {
+      newChunk = makeChunk (currentChunk, new_size);
+    }
+#else
+    newChunk = makeChunk (currentChunk, new_size);
+#endif
+    if (newChunk == NULL) {
+      currentChunk = NULL;
+      return NULL;
+    }
+    // Copy the current object to the new chunk.
+    memcpy ((char *) (newChunk + 1), currentBase, obj_size);
+    currentChunk = newChunk;
+    currentBase = (char *) (currentChunk + 1);
+    nextPos = currentBase + obj_size;
+#if 0
+    if (deleteChunk != NULL) {
+      SuperHeap::free (deleteChunk);
+    }
+#endif
+    return currentChunk;
+  }
+
+
+  // Current position in the current chunk.
+  char * currentBase;
+
+  // Where to add the next character to the current object.
+  char * nextPos;
+
+  // My current chunk.
+  ChunkHeader * currentChunk;
+
+};
+
+#endif // __cplusplus
+
+// The C version of the above (just large enough to hold all of the data structures).
+struct obstack {
+  void * _dummy[3];
+};
+
+};
+
+#endif // _HLOBSTACK_H_
Index: /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/obstackheap.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/obstackheap.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/obstackheap.h	(revision 176)
@@ -0,0 +1,292 @@
+/* -*- C++ -*- */
+
+/*
+
+  Heap Layers: An Extensible Memory Allocation Infrastructure
+  
+  Copyright (C) 2000-2003 by Emery Berger
+  http://www.cs.umass.edu/~emery
+  emery@cs.umass.edu
+  
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or
+  (at your option) any later version.
+  
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+  
+  You should have received a copy of the GNU General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+*/
+
+// An "Obstack".
+
+#ifndef _HLOBSTACK_H_
+#define _HLOBSTACK_H_
+
+#ifdef __cplusplus
+
+#include <assert.h>
+#include <new>
+
+namespace HL {
+
+template <int ChunkSize, class SuperHeap>
+class ObstackHeap : public SuperHeap {
+public:
+
+  ObstackHeap (void)
+  {
+    // Get one chunk and set the current position marker.
+    currentChunk = makeChunk (NULL, ChunkSize);
+    currentBase = nextPos = (char *) (currentChunk + 1);
+    assert (isValid());
+  }
+
+  ~ObstackHeap (void) {
+    // Free every chunk.
+    assert (isValid());
+    ChunkHeader * ch = currentChunk;
+    while (ch != NULL) {
+      ChunkHeader * pch = ch->getPrevChunk();
+      // cout << "Freeing chunk " << ch << endl;
+      SuperHeap::free (ch);
+      ch = pch;
+    }
+  }
+
+  // "Grow" the current object.
+  // Returns a point in the object just before the current "grow".
+  inline void * grow (size_t sz) {
+    // If we've grown beyond the confines of this chunk,
+    // get a new one.
+    assert (isValid());
+    if ((int) ((char *) currentChunk->getLimit() - (char *) nextPos) < sz) {
+      ChunkHeader * newCurrent = copyToNew(sz);
+      if (newCurrent == NULL)
+	return NULL;
+#if 0
+      // Now delete the previous chunk if this was the only object in it.
+      if (deleteChunk != NULL) {
+	SuperHeap::free (deleteChunk);
+      }
+#endif
+      assert (isValid());
+    }
+    assert (((int) ((char *) currentChunk->getLimit() - (char *) nextPos) >= sz));
+    assert ((char *) (sz + nextPos) <= currentChunk->getLimit());
+    // Bump the pointer for the next object.
+    void * prevNextPos = nextPos;
+    nextPos += sz;
+    assert (isValid());
+    return prevNextPos;
+  }
+
+
+  inline void * malloc (size_t sz) {
+    assert (isValid());
+    if (currentChunk == NULL) {
+      return NULL;
+    }
+    //sz = align(sz > 0 ? sz : 1);
+    // If this object can't fit in the current chunk,
+    // get another one.
+    if ((int) ((char *) currentChunk->getLimit() - (char *) nextPos) < sz) {
+      // Allocate a chunk that's large enough to hold the requested size.
+      currentChunk = makeChunk (currentChunk, sz);
+      if (currentChunk == NULL) {
+	return NULL;
+      }
+      currentBase = nextPos = (char *) (currentChunk + 1);
+      assert (isValid());
+    }
+    assert (((int) ((char *) currentChunk->getLimit() - (char *) nextPos) >= sz));
+    assert ((char *) (sz + nextPos) <= currentChunk->getLimit());
+    // Bump the pointers forward.
+    currentBase = nextPos;
+    nextPos += sz;
+    void * ptr = currentBase;
+    finalize();
+    assert (isValid());
+    return (void *) ptr;
+  }
+
+  // Free everything allocated "after" ptr.
+  // NB: Freeing NULL safely empties the entire obstack.
+  inline void free (void * ptr) {
+    assert (isValid());
+    // Free every chunk until we find the one that this pointer is in.
+    // Then reset the current position to ptr.
+    while (currentChunk != NULL &&
+	   (((char *) currentChunk > (char *) ptr) ||
+	    ((char *) currentChunk->getLimit() < (char *) ptr))) {
+      ChunkHeader * pch = currentChunk;
+      currentChunk = currentChunk->getPrevChunk();
+      SuperHeap::free (pch);
+    }
+    if (currentChunk != NULL) {
+      currentBase = nextPos = (char *) ptr;
+      assert (isValid());
+    } else {
+      if (ptr != NULL) {
+	// Something bad has happened -- we tried to free an item that
+	// wasn't in any chunk.
+	abort();
+      } else {
+	// Get one chunk.
+	currentChunk = makeChunk (NULL, ChunkSize);
+	currentBase = nextPos = (char *) (currentChunk + 1);
+	assert (isValid());
+      }
+    }
+  }
+
+
+  inline void * getObjectBase (void) {
+    assert (isValid());
+    return currentBase;
+  }
+
+
+  inline void finalize (void) {
+    assert (isValid());
+    nextPos = (char *) align((int) nextPos);
+    currentBase = nextPos;
+    assert (isValid());
+  }
+
+
+private:
+
+
+  inline int objectSize (void) {
+    int diff = (int) (nextPos - currentBase);
+    assert (diff >= 0);
+    return diff;
+  }
+
+
+  int isValid (void) {
+    // Verify class invariants.
+#ifndef NDEBUG
+    bool c1 = (currentBase <= nextPos);
+    assert (c1);
+    bool c2 = (nextPos <= currentChunk->getLimit());
+    assert (c2);
+    bool c3 = ((char *) currentChunk <= currentChunk->getLimit());
+    assert (c3);
+    bool c4 = ((char *) currentChunk <= currentBase);
+    assert (c4);
+    bool c5 = (currentChunk != currentChunk->getPrevChunk());
+    assert (c5);
+    bool c6 = (objectSize() >= 0);
+    assert (c6);
+    return (c1 && c2 && c3 && c4 && c5 && c6);
+#else
+    return 1;
+#endif
+  }
+
+  // The header for every chunk.
+  class ChunkHeader {
+  public:
+    inline ChunkHeader (ChunkHeader * prev, size_t sz)
+      : _pastEnd ((char *) (this + 1) + sz),
+	_prevChunk (prev)
+    {}
+
+    // Return the end of the current chunk.
+    inline char * getLimit (void) { return _pastEnd; }
+
+    // Return the previous chunk.
+    inline ChunkHeader * getPrevChunk (void) { return _prevChunk; }
+
+  private:
+    // Just past the end of this chunk.
+    char * _pastEnd;
+
+    // Address of prior chunk.
+    ChunkHeader * _prevChunk;
+  };
+
+
+  inline static size_t align (int sz) {
+    return (sz + (sizeof(double) - 1)) & ~(sizeof(double) - 1);
+  }
+
+  // Make a new chunk of at least sz bytes.
+  inline ChunkHeader * makeChunk (ChunkHeader * ch, size_t sz) {
+    // Round up the allocation size to at least one chunk.
+    size_t allocSize
+      = align((sz > ChunkSize - sizeof(ChunkHeader)) ? sz : ChunkSize - sizeof(ChunkHeader));
+    // Make a new chunk.
+    void * ptr = SuperHeap::malloc (sizeof(ChunkHeader) + allocSize);
+    if (ptr == NULL) {
+      return NULL;
+    }
+    ChunkHeader * newChunk 
+      = new (ptr) ChunkHeader (ch, allocSize);
+    return newChunk;
+  }
+
+
+  // Copy the current object to a new chunk.
+  // sz = the minimum amount of extra space we need.
+  inline ChunkHeader * copyToNew (size_t sz) {
+    size_t obj_size = objectSize();
+    size_t new_size = obj_size + sz + (obj_size >> 3) + 100;
+    //size_t new_size = 2 * (obj_size + sz);
+    ChunkHeader * newChunk;
+#if 0
+    // This variable will hold the chunk to be deleted (if any).
+    ChunkHeader * deleteChunk = NULL;
+    // If this object was the only one in the chunk,
+    // link back past this chunk.
+    if (currentBase == (char *) (currentChunk + 1)) {
+      newChunk = makeChunk (currentChunk->getPrevChunk(), new_size);
+      deleteChunk = currentChunk;
+    } else {
+      newChunk = makeChunk (currentChunk, new_size);
+    }
+#else
+    newChunk = makeChunk (currentChunk, new_size);
+#endif
+    if (newChunk == NULL) {
+      currentChunk = NULL;
+      return NULL;
+    }
+    // Copy the current object to the new chunk.
+    memcpy ((char *) (newChunk + 1), currentBase, obj_size);
+    currentChunk = newChunk;
+    currentBase = (char *) (currentChunk + 1);
+    nextPos = currentBase + obj_size;
+#if 0
+    if (deleteChunk != NULL) {
+      SuperHeap::free (deleteChunk);
+    }
+#endif
+    return currentChunk;
+  }
+
+
+  // Current position in the current chunk.
+  char * currentBase;
+
+  // Where to add the next character to the current object.
+  char * nextPos;
+
+  // My current chunk.
+  ChunkHeader * currentChunk;
+
+};
+
+};
+
+#endif // __cplusplus
+
+#endif // _HLOBSTACK_H_
Index: /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/obstackreap.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/obstackreap.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/obstackreap.h	(revision 176)
@@ -0,0 +1,312 @@
+// -*- C++ -*-
+
+#ifndef _OBSTACKREAP_H_
+#define _OBSTACKREAP_H_
+
+#include <assert.h>
+
+/*
+
+  ObstackReap layers obstack functionality on top of reaps.
+
+  */
+
+#if WIN32
+#include <windows.h>
+#endif
+
+#include "dynarray.h"
+
+namespace ObstackReapNS {
+
+#if 0
+	template <class ObjType>
+  class DynamicArray {
+  public:
+    DynamicArray (void)
+      : internalArray (0),
+	internalArrayLength (0)
+    {}
+    
+    ~DynamicArray (void)
+    {
+      clear();
+    }
+    
+    // clear deletes everything in the array.
+
+    inline void clear (void) {
+      if (internalArray) {
+	delete [] internalArray;
+	internalArray = 0;
+	internalArrayLength = 0;
+	//printf ("\ninternalArrayLength %x = %d\n", this, internalArrayLength);
+      }
+    }
+
+    // Read-only access to an array element;
+    // asserts that this index is in range.
+
+    inline const ObjType& operator[] (int index) const {
+      assert (index < internalArrayLength);
+      assert (index >= 0);
+      return internalArray[index];
+    }
+
+    // Access a particular array index by reference,
+    // growing the array if necessary.
+
+    inline ObjType& operator[] (int index) {
+      assert (index >= 0);
+      if (index >= internalArrayLength) {
+
+	// This index is beyond the current size of the array.
+	// Grow the array by doubling and copying the old array into the new.
+
+	const int newSize = index * 2 + 1;
+	ObjType * arr = new ObjType[newSize];
+	// printf ("grow! %d to %d\n", internalArrayLength, newSize);
+#if MALLOC_TRACE
+	printf ("m %x %d\n", arr, newSize * sizeof(ObjType));
+#endif
+	if (internalArray) {
+	  memcpy (arr, internalArray, internalArrayLength * sizeof(ObjType));
+	  delete [] internalArray;
+#if MALLOC_TRACE
+	  printf ("f %x\n", internalArray);
+#endif
+	}
+	internalArray = arr;
+	internalArrayLength = newSize;
+	// printf ("\ninternalArrayLength %x = %d\n", this, internalArrayLength);
+      }
+      return internalArray[index];
+    }
+
+    // trim informs the array that it is now only nelts long
+    // as far as the client is concerned. This may trigger
+    // shrinking of the array.
+
+    inline void trim (int nelts) {
+
+      // Halve the array if the number of elements
+      // drops below one-fourth of the array size.
+
+      if (internalArray) {
+	if (nelts * 4 < internalArrayLength) {
+	  const int newSize = nelts * 2;
+	  ObjType * arr = new ObjType[newSize];
+	  // printf ("trim! %d to %d\n", internalArrayLength, newSize);
+#if MALLOC_TRACE
+	  printf ("m %x %d\n", arr, newSize * sizeof(ObjType));
+#endif
+	  memcpy (arr, internalArray, sizeof(ObjType) * nelts);
+	  delete [] internalArray;
+#if MALLOC_TRACE
+	  printf ("f %x\n", internalArray);
+#endif
+	  internalArray = arr;
+	  internalArrayLength = newSize;
+	}
+	assert (nelts <= internalArrayLength);
+      }
+    }
+
+
+  private:
+
+    // The pointer to the current array.
+
+    ObjType * internalArray;
+
+    // The length of the internal array, in elements.
+	
+    int internalArrayLength;
+  };
+#endif
+
+  template <class OBJTYPE>
+  class DynStack {
+  public:
+    DynStack (void)
+      : numItems (0)
+    {
+      items[0] = 0;
+    }
+
+    int length (void) const { return numItems; }
+
+    inline void push (OBJTYPE * ptr) {
+      numItems++;
+      items[numItems] = ptr;
+    }
+
+    inline OBJTYPE * pop (void) {
+      OBJTYPE * ptr = 0;
+      if (numItems > 0) {
+	ptr = items[numItems];
+	numItems--;
+	// The array has shrunk, so potentially trim it.
+	items.trim (numItems + 1);
+      }
+      return ptr;
+    }
+
+    inline OBJTYPE * top (void) {
+      OBJTYPE * ptr = NULL;
+      if (numItems > 0) {
+	ptr = items[numItems];
+      }
+      return ptr;
+    }
+
+    inline void clear (void) {
+      items.clear();
+    }
+  
+  private:
+  
+    // The number of items recorded above.
+    // 0 == no items.
+    // 1 == items[1] has the single item, etc.
+    // i.e., we waste entry zero.
+
+    int numItems;
+
+    // The array of remembered objects.
+
+    DynamicArray<OBJTYPE *> items;
+  };
+
+};
+
+
+// Layers on top of a reap.
+
+template <class ReapType>
+class ObstackReap {
+public:
+
+  ObstackReap (void)
+  {
+    currentReap = new ReapType;
+    initCurrentObject();
+  }
+
+  ~ObstackReap (void) {
+    ReapType * r;
+    while ((r = reapStack.pop())) {
+      delete r;
+    }
+    delete currentReap;
+    delete currentObject;
+  }
+  
+  inline void * malloc (size_t sz);
+  inline void freeAfter (void * ptr);
+  inline void freeAll (void);
+  inline void * getObjectBase (void);
+  inline void finalize (void);
+  inline void * grow (size_t sz);
+
+private:
+
+  inline void initCurrentObject (void);
+
+  // Hide free.
+  void free (void *);
+
+  enum { INITIAL_OBJECT_SIZE = 8 * sizeof(double) };
+
+  void * currentObject;
+  char * currentObjectPosition;
+  size_t currentObjectSize;
+  size_t actualObjectSize;
+  bool isCurrentObjectExposed;
+  ReapType * currentReap;
+  ObstackReapNS::DynStack<ReapType> reapStack;
+};
+
+
+template <class ReapType>
+void ObstackReap<ReapType>::initCurrentObject (void) {
+  currentObject = currentReap->malloc (INITIAL_OBJECT_SIZE);
+  currentObjectPosition = (char *) currentObject;
+  currentObjectSize = 0;
+  actualObjectSize = INITIAL_OBJECT_SIZE;
+  isCurrentObjectExposed = false;
+}
+
+template <class ReapType>
+void * ObstackReap<ReapType>::malloc (size_t sz) {
+  if (!isCurrentObjectExposed) {
+    return currentReap->malloc (sz);
+  } else {
+    void * ptr = currentReap->realloc (currentObject, sz);
+    reapStack.push (currentReap);
+    currentReap = new ReapType;
+    initCurrentObject();
+    return ptr;
+  }
+}
+
+template <class ReapType>
+void ObstackReap<ReapType>::freeAfter (void * ptr) {
+  while (currentReap && (!currentReap->find(ptr))) {
+    delete currentReap;
+    currentReap = reapStack.pop();
+  }
+}
+
+template <class ReapType>
+void ObstackReap<ReapType>::freeAll (void) {
+  while (currentReap) {
+    delete currentReap;
+    currentReap = reapStack.pop();
+  }
+  currentHeap = new ReapType;
+}
+
+
+template <class ReapType>
+inline void * ObstackReap<ReapType>::getObjectBase (void) {
+  isCurrentObjectExposed = true;
+  return currentObject;
+}
+
+template <class ReapType>
+inline void ObstackReap<ReapType>::finalize (void) {
+  if (isCurrentObjectExposed) {
+    reapStack.push (currentReap);
+    currentReap = new ReapType;
+  }
+  initCurrentObject();
+}
+
+template <class ReapType>
+inline void * ObstackReap<ReapType>::grow (size_t sz) {
+
+  const int requestedObjectSize = currentObjectSize + sz;
+
+  if (requestedObjectSize > actualObjectSize) {
+    cout << "resize!\n";
+    void * ptr = currentReap->realloc (currentObject, sz);
+    currentObjectPosition = (char *) ptr + (currentObjectPosition - (char *) currentObject);
+    if (isCurrentObjectExposed) {
+      reapStack.push (currentReap);
+      currentReap = new ReapType;
+    }
+    currentObject = ptr;
+  }
+
+  // Because calling grow can result in a new object,
+  // the current object can be considered no longer exposed (if it was before).
+
+  isCurrentObjectExposed = false;
+  currentObjectSize += sz;
+  char * oldPosition = currentObjectPosition;
+  currentObjectPosition += sz;
+  return oldPosition;
+}
+
+#endif
Index: /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/oneheap.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/oneheap.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/oneheap.h	(revision 176)
@@ -0,0 +1,74 @@
+// -*- C++ -*-
+
+/*
+
+  Heap Layers: An Extensible Memory Allocation Infrastructure
+  
+  Copyright (C) 2000-2003 by Emery Berger
+  http://www.cs.umass.edu/~emery
+  emery@cs.umass.edu
+  
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or
+  (at your option) any later version.
+  
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+  
+  You should have received a copy of the GNU General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+*/
+
+#ifndef _ONEHEAP_H_
+#define _ONEHEAP_H_
+
+//
+// Wrap a single instance of a heap.
+//
+
+namespace HL {
+
+template <class SuperHeap>
+class OneHeap {
+public:
+  OneHeap (void)
+  : theHeap (getHeap())
+  {}
+  
+  inline void * malloc (const size_t sz) {
+    return theHeap->malloc (sz);
+  }
+  inline void free (void * ptr) {
+    theHeap->free (ptr);
+  }
+  inline int remove (void * ptr) {
+    return theHeap->remove (ptr);
+  }
+  inline void clear (void) {
+    theHeap->clear();
+  }
+  inline size_t getSize (void * ptr) {
+    return theHeap->getSize (ptr);
+  }
+
+  enum { Alignment = SuperHeap::Alignment };
+
+private:
+
+  SuperHeap * theHeap;
+  
+  inline static SuperHeap * getHeap (void) {
+    static SuperHeap theHeap;
+    return &theHeap;
+  }
+//	SuperHeap theHeap;
+};
+
+}
+
+#endif
Index: /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/padheap.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/padheap.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/padheap.h	(revision 176)
@@ -0,0 +1,30 @@
+/* -*- C++ -*- */
+
+#ifndef _PADHEAP_H_
+#define _PADHEAP_H_
+
+#include <assert.h>
+
+// Pad object size requests.
+
+template <int CacheLineSize, class SuperHeap>
+class PadHeap : public SuperHeap {
+public:
+
+  inline void * malloc (size_t sz) {
+    return SuperHeap::malloc (roundup(sz));
+  }
+
+private:
+
+  inline size_t roundup (size_t sz) {
+    // NB: CacheLineSize MUST be a power of two.
+	// The assertion below checks this.
+	assert ((CacheLineSize & (CacheLineSize-1)) == 0);
+    size_t roundup = (sz + CacheLineSize - 1) & ~((int) CacheLineSize-1);
+	assert (roundup >= sz);
+    return roundup;
+  }
+};
+
+#endif
Index: /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/perclassheap.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/perclassheap.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/perclassheap.h	(revision 176)
@@ -0,0 +1,52 @@
+#ifndef _PERCLASSHEAP_H
+#define _PERCLASSHEAP_H
+
+#include <new>
+
+/**
+ * @class PerClassHeap
+ * @brief Enable the use of one heap for all class memory allocation.
+ * 
+ * This class contains one instance of the SuperHeap argument.  The
+ * example below shows how to make a subclass of Foo that uses a
+ * FreelistHeap to manage its memory, overloading operators new and
+ * delete.
+ * 
+ * <TT>
+ *   class NewFoo : public Foo, PerClassHeap<FreelistHeap<mallocHeap> > {};
+ * </TT>
+ */
+
+namespace HL {
+
+template <class SuperHeap>
+class PerClassHeap {
+public:
+  inline void * operator new (size_t sz) {
+    return getHeap()->malloc (sz);
+  }
+  inline void operator delete (void * ptr) {
+    getHeap()->free (ptr);
+  }
+  inline void * operator new[] (size_t sz) {
+    return getHeap()->malloc (sz);
+  }
+  inline void operator delete[] (void * ptr) {
+	  getHeap()->free (ptr);
+  }
+  // For some reason, g++ needs placement new to be overridden
+  // as well, at least in conjunction with use of the STL.
+  // Otherwise, this should be superfluous.
+  inline void * operator new (size_t sz, void * p) { return p; }
+  inline void * operator new[] (size_t sz, void * p) { return p; }
+
+private:
+  inline static SuperHeap * getHeap (void) {
+    static SuperHeap theHeap;
+    return &theHeap;
+  }
+};
+
+}
+
+#endif
Index: /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/phothreadheap.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/phothreadheap.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/phothreadheap.h	(revision 176)
@@ -0,0 +1,143 @@
+/* -*- C++ -*- */
+
+#ifndef _PHOThreadHeap_H_
+#define _PHOThreadHeap_H_
+
+#include <assert.h>
+
+static volatile int getThreadId (void);
+
+template <int NumHeaps, class super>
+class MarkThreadHeap : public super {
+public:
+
+  inline void * malloc (size_t sz) {
+    int tid = getThreadId() % NumHeaps;
+    void * ptr = super::malloc (sz);
+    if (ptr != NULL) {
+      super::setHeap(ptr, tid);
+      super::setPrevHeap(super::getNext(ptr), tid);
+    }
+    return ptr;
+  }
+};
+
+
+template <int NumHeaps, class super>
+class CheckThreadHeap : public super {
+public:
+
+  inline void * malloc (size_t sz) {
+    int tid = getThreadId() % NumHeaps;
+    void * ptr = super::malloc (sz);
+    if (ptr != NULL)
+      assert (super::getHeap(ptr) == tid);
+    return ptr;
+  }
+
+  inline void free (void * ptr) {
+    super::free (ptr);
+  }
+};
+
+
+
+/*
+
+A PHOThreadHeap comprises NumHeaps "per-thread" heaps.
+
+To pick a per-thread heap, the current thread id is hashed (mod NumHeaps).
+
+malloc gets memory from its hashed per-thread heap.
+free returns memory to its originating heap.
+
+NB: We assume that the thread heaps are 'locked' as needed.  */
+
+
+template <int NumHeaps, class super>
+class PHOThreadHeap { // : public MarkThreadHeap<NumHeaps, super> {
+public:
+
+  inline void * malloc (size_t sz) {
+    int tid = getThreadId() % NumHeaps;
+    void * ptr = selectHeap(tid)->malloc (sz);
+    return ptr;
+  }
+
+  inline void free (void * ptr) {
+    int tid = super::getHeap(ptr);
+    selectHeap(tid)->free (ptr);
+  }
+
+
+  inline int remove (void * ptr);
+#if 0
+  {
+    int tid = super::getHeap(ptr);
+    selectHeap(tid)->remove (ptr);
+  }
+#endif
+
+private:
+
+  // Access the given heap within the buffer.
+  MarkThreadHeap<NumHeaps, super> * selectHeap (int index) {
+    assert (index >= 0);
+    assert (index < NumHeaps);
+    return &ptHeaps[index];
+  }
+
+  MarkThreadHeap<NumHeaps, super> ptHeaps[NumHeaps];
+
+};
+
+
+// A platform-dependent way to get a thread id.
+
+// Include the necessary platform-dependent crud.
+#if defined(WIN32) || defined(__WIN32__) || defined(_WIN32)
+#ifndef WIN32
+#define WIN32 1
+#endif
+#include <windows.h>
+#include <process.h>
+#endif
+
+#if defined(__SVR4)
+extern "C" unsigned int lwp_self (void);
+#endif
+
+
+static volatile int getThreadId (void) {
+#if defined(WIN32)
+  // It looks like thread id's are always multiples of 4, so...
+  int tid = GetCurrentThreadId() >> 2;
+  // Now hash in some of the first bits.
+  //  return tid;
+  return (tid & ~(1024-1)) ^ tid;
+#endif
+#if defined(__BEOS__)
+  return find_thread(0);
+#endif
+#if defined(__linux)
+  // Consecutive thread id's in Linux are 1024 apart;
+  // dividing off the 1024 gives us an appropriate thread id.
+  return (int) pthread_self() >> 10; // (>> 10 = / 1024)
+#endif
+#if defined(__SVR4)
+  return (int) lwp_self();
+#endif
+#if defined(POSIX)
+  return (int) pthread_self();
+#endif
+#if USE_SPROC
+  // This hairiness has the same effect as calling getpid(),
+  // but it's MUCH faster since it avoids making a system call
+  // and just accesses the sproc-local data directly.
+  int pid = (int) PRDA->sys_prda.prda_sys.t_pid;
+  return pid;
+#endif
+}
+  
+
+#endif
Index: /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/profileheap.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/profileheap.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/profileheap.h	(revision 176)
@@ -0,0 +1,61 @@
+/* -*- C++ -*- */
+
+#ifndef _PROFILEHEAP_H_
+#define _PROFILEHEAP_H_
+
+
+#include <stdio.h>
+
+extern int memRequested;
+extern int maxMemRequested;
+
+// Maintain & print memory usage info.
+// Requires a superheap with the size() method (e.g., SizeHeap).
+
+template <class super, int HeapNumber>
+class ProfileHeap : public super {
+public:
+  
+  ProfileHeap (void)
+  {
+    memRequested = 0;
+    maxMemRequested = 0;
+  }
+
+  ~ProfileHeap (void)
+  {
+    if (maxMemRequested > 0) {
+      stats();
+    }
+  }
+
+  inline void * malloc (size_t sz) {
+    void * ptr = super::malloc (sz);
+    // Notice that we use the size reported by the allocator
+    // for the object rather than the requested size.
+    memRequested += super::getSize(ptr);
+    if (memRequested > maxMemRequested) {
+      maxMemRequested = memRequested;
+    }
+    return ptr;
+  }
+  
+  inline void free (void * ptr) {
+    memRequested -= super::getSize (ptr);
+    super::free (ptr);
+  }
+  
+private:
+  void stats (void) {
+    printf ("Heap: %d\n", HeapNumber);
+    printf ("Max memory requested = %d\n", maxMemRequested);
+    printf ("Memory still in use = %d\n", memRequested);
+  }
+
+  int memRequested;
+  int maxMemRequested;
+
+};
+
+
+#endif
Index: /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/sanitycheckheap.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/sanitycheckheap.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/sanitycheckheap.h	(revision 176)
@@ -0,0 +1,116 @@
+/* -*- C++ -*- */
+
+#include <map>
+#include "stlallocator.h"
+
+#ifndef _SANITYCHECKHEAP_H_
+#define _SANITYCHECKHEAP_H_
+
+/**
+* @class SanityCheckHeap
+* @brief Checks for memory allocation usage errors at runtime.
+* See the "error messages" for the kinds of errors this layer can catch.
+* @author Emery Berger
+*/
+
+#include "mallocheap.h"
+#include "zoneheap.h"
+#include "stlallocator.h"
+#include "mmapheap.h"
+
+namespace HL {
+
+template <class SuperHeap>
+class SanityCheckHeap : public SuperHeap {
+private:
+
+  /// Define a local allocator that lets us use the SuperHeap for the map.
+  /// This approach lets us use SanityCheckHeaps when we're replacing malloc.
+
+  // The objects are pairs, mapping void * pointers to sizes.
+  typedef std::pair<const void *, int> objType;
+
+  // The heap is a simple freelist heap.
+  typedef HL::FreelistHeap<HL::ZoneHeap<HL::MmapHeap, 16384> > heapType;
+
+  // And we wrap it up so it can be used as an STL allocator.
+  typedef HL::STLAllocator<objType, heapType> localAllocator;
+
+  typedef std::less<void *> localComparator;
+
+  /// A map of pointers to objects and their allocated sizes.
+  typedef std::map<void *, int, localComparator, localAllocator> mapType;
+  
+  /// A freed object has a special size, -1.
+  enum { FREED = -1 };
+  
+  /**
+   * @brief "Error messages", used in asserts.
+   * These must all equal zero.
+   */
+  enum { MALLOC_RETURNED_ALLOCATED_OBJECT = 0,
+	 FREE_CALLED_ON_OBJECT_I_NEVER_ALLOCATED = 0,
+	 FREE_CALLED_TWICE_ON_SAME_OBJECT = 0 };
+  
+public:
+
+  inline void * malloc (size_t sz) {
+    void * ptr = SuperHeap::malloc (sz);
+    if (ptr == NULL) {
+      return NULL;
+    }
+    // Fill the space with a known value.
+    memset (ptr, 'A', sz);
+    // Record this object as allocated.
+    mapType::iterator i;
+    // Look for this object in the map of allocated objects.
+    i = allocatedObjects.find (ptr);
+    if (i == allocatedObjects.end()) {
+      // We didn't find it (this is good).
+      // Add the tuple (ptr, sz).
+      allocatedObjects.insert (std::pair<void *, int>(ptr, sz));
+    } else {
+      // We found it.
+      // It really should have been freed.
+      if ((*i).second != FREED) {
+	// This object is still in use!
+	assert ( MALLOC_RETURNED_ALLOCATED_OBJECT );
+	return NULL;
+      } else {
+	// This object has been freed. Mark it as allocated.
+	(*i).second = sz;
+      }
+    }
+    return ptr;
+  }
+
+  inline void free (void * ptr) {
+    // Look for this object in the list of allocated objects.
+    mapType::iterator i;
+    i = allocatedObjects.find (ptr);
+    if (i == allocatedObjects.end()) {
+      assert ( FREE_CALLED_ON_OBJECT_I_NEVER_ALLOCATED );
+      return;
+    }
+    // We found the object. It should not have been freed already.
+    if ((*i).second == FREED) {
+      // Oops, this object WAS freed before.
+      assert ( FREE_CALLED_TWICE_ON_SAME_OBJECT );
+      return;
+    }
+    // Fill the space with a known value.
+    memset (ptr, 'F', (*i).second);
+    // Really free the pointer.
+    (*i).second = FREED;
+    SuperHeap::free (ptr);
+  }
+
+private:
+
+  /// A map of tuples: (obj address, size).
+  mapType allocatedObjects;
+};
+
+};
+
+#endif
Index: /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/sbrk.c
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/sbrk.c	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/sbrk.c	(revision 176)
@@ -0,0 +1,122 @@
+#include <assert.h>
+#include <windows.h>
+#include <process.h>
+
+/* Sbrk implementation for Win32 by Emery Berger, http://www.cs.utexas.edu/users/emery */
+
+void * sbrk (long size) {
+
+/* Reserve up to 1 GB of RAM */
+/*
+    We pre-reserve a very large chunk of memory
+    and commit pages as we go. */
+
+#define PRE_RESERVE 1024 * 1024 * 1024
+
+  static long remainingReserved = PRE_RESERVE;
+
+  static int initialized = 0;
+  static char * currentPosition = NULL;
+  static char * nextPage = NULL;
+  static long remainingCommitted = 0;
+  static long pageSize;
+  void * p;
+  
+  if (!initialized) {
+
+    /*
+      Do one-time initialization stuff:
+      get the page size from the system,
+      reserve a large range of memory,
+      and initialize the appropriate variables.
+
+    */
+
+    SYSTEM_INFO sSysInfo;
+    LPVOID base;
+    GetSystemInfo(&sSysInfo);
+    
+    pageSize = sSysInfo.dwPageSize;
+    
+    /* Reserve pages in the process's virtual address space. */
+    
+#if 1
+    base = VirtualAlloc(NULL, remainingReserved, MEM_RESERVE, PAGE_NOACCESS);
+#else
+    base = VirtualAlloc(NULL, remainingReserved, MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE);
+	remainingCommitted =  PRE_RESERVE;
+#endif
+
+    if (base == NULL )
+      exit (1); /* VirtualAlloc reserve failed */
+
+    currentPosition = nextPage = (char *) base;
+    initialized = 1;
+  }
+
+  if (size < 0) {
+
+#if 0
+  /* Uncommit pages if possible.
+       Round the size down to a multiple of the page size,
+       and decommit those pages.
+    */
+
+
+    int bytesToUncommit = (-size & ~(pageSize - 1));
+
+    if (bytesToUncommit > PRE_RESERVE - remainingReserved) {
+      /* Error -- the user has tried to free memory that we never
+	 even reserved. */
+      return currentPosition;
+    }
+
+    if (bytesToUncommit > 0) {
+
+      int result = VirtualFree (nextPage - bytesToUncommit, bytesToUncommit, MEM_DECOMMIT);
+      if (result == 0) {
+	/* Error -- don't change a thing. */
+	return currentPosition;
+      }
+      remainingCommitted -= bytesToUncommit;
+    }
+
+    currentPosition -= size;
+    remainingReserved += size;
+#endif
+    return currentPosition;
+
+  }
+
+  if (size > 0) {
+    void * p;
+    if (size > remainingCommitted) {
+
+      /* Commit some more pages.
+	 We round up to an even number of pages.
+	 Note that page size must be a power of two.
+      */
+
+      int bytesToCommit = (size - remainingCommitted + pageSize - 1) & ~(pageSize - 1); 
+      int * result;
+
+      result = VirtualAlloc((LPVOID) nextPage, bytesToCommit, MEM_COMMIT, PAGE_EXECUTE_READWRITE);
+
+      if (result == NULL )
+	exit (1); /* VirtualAlloc commit failed */
+
+      nextPage += bytesToCommit;
+      remainingCommitted += bytesToCommit;
+    }
+      
+    p = currentPosition;
+    currentPosition += size;
+    remainingCommitted -= size;
+    remainingReserved -= size;
+    return p;
+  }
+
+  assert (size == 0);
+  return currentPosition;
+
+}
Index: /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/sbrkheap.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/sbrkheap.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/sbrkheap.h	(revision 176)
@@ -0,0 +1,40 @@
+/* -*- C++ -*- */
+
+#ifndef _SBRKHEAP_H_
+#define _SBRKHEAP_H_
+
+#ifdef WIN32
+
+// If we're using Windows, we'll need to link in sbrk.c,
+// a replacement for sbrk().
+
+extern "C" void * sbrk (size_t sz);
+
+#endif
+
+/*
+ * @class SbrkHeap
+ * @brief A source heap that is a thin wrapper over sbrk.
+ *
+ * As it stands, memory cannot be returned to sbrk().
+ * This is not a significant limitation, since only memory
+ * at the end of the break point can ever be returned anyway.
+ */
+
+class SbrkHeap {
+public:
+  SbrkHeap (void)
+  {}
+
+  inline void * malloc (size_t sz) {
+    return sbrk(sz);
+  }
+  
+  inline void free (void *) { }
+  inline int remove (void *) { return 0; }
+};
+
+
+
+#endif
+
Index: /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/segheap.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/segheap.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/segheap.h	(revision 176)
@@ -0,0 +1,351 @@
+/* -*- C++ -*- */
+
+/*
+
+Heap Layers: An Extensible Memory Allocation Infrastructure
+  
+Copyright (C) 2000-2005 by Emery Berger
+http://www.cs.umass.edu/~emery
+emery@cs.umass.edu
+  
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+  
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+  
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+*/
+
+  /**
+   * @file segheap.h
+   * @brief Definitions of SegHeap and StrictSegHeap.
+   */
+
+#ifndef _SEGHEAP_H_
+#define _SEGHEAP_H_
+
+  /**
+   * @class SegHeap
+   * @brief A segregated-fits collection of (homogeneous) heaps.
+   * @author Emery Berger
+   *
+   * Note that one extra heap is used for objects that are "too big".
+   *
+   * @param NumBins The number of bins (subheaps).
+   * @param getSizeClass Function to compute size class from size.
+   * @param getClassMaxSize Function to compute the largest size for a given size class.
+   * @param LittleHeap The subheap class.
+   * @param BigHeap The parent class, used for "big" objects.
+   *
+   * Example:<BR>
+   * <TT>
+   *  int myFunc (size_t sz); // The size-to-class function.<BR>
+   *  size_t myFunc2 (int); // The class-to-size function.<P>
+   *  // The heap. Use freelists for these small objects,<BR>
+   *  // but defer to malloc for large objects.<P>
+   *
+   * SegHeap<4, myFunc, myFunc2, freelistHeap<mallocHeap>, mallocHeap> mySegHeap;
+   * </TT>
+   **/
+
+#include <assert.h>
+#include "bitstring.h"
+
+  namespace HL {
+
+    template <int NumBins,
+	      int (*getSizeClass) (const size_t),
+	      size_t (*getClassMaxSize) (const int),
+	      class LittleHeap,
+	      class BigHeap>
+    class SegHeap : public LittleHeap {
+    private:
+
+      typedef int (*scFunction) (const size_t);
+      typedef size_t (*csFunction) (const int);
+
+    public:
+
+      inline SegHeap (void)
+	: memoryHeld (0),
+	  maxObjectSize (((csFunction) getClassMaxSize) (NumBins - 1))
+      {
+	for (int i = 0; i < NUM_ULONGS; i++) {
+	  binmap[i] = 0;
+	}
+      }
+
+      inline ~SegHeap (void) {}
+
+      inline size_t getMemoryHeld (void) const {
+	return memoryHeld;
+      }
+
+      // new...
+      size_t getSize (void * ptr) {
+	return LittleHeap::getSize (ptr);
+      }
+
+      inline void * malloc (const size_t sz) {
+	void * ptr = NULL;
+	if (sz > maxObjectSize) {
+	  goto GET_MEMORY;
+	}
+
+	{
+	  const int sc = ((scFunction) getSizeClass)(sz);
+	  assert (sc >= 0);
+	  assert (sc < NumBins);
+	  int idx = sc;
+	  int block = idx2block (idx);
+	  unsigned long map = binmap[block];
+	  unsigned long bit = idx2bit (idx);
+    
+	  for (;;) {
+	    if (bit > map || bit == 0) {
+	      do {
+		if (++block >= NUM_ULONGS) {
+		  goto GET_MEMORY;
+		  // return bigheap.malloc (sz);
+		}
+	      } while ( (map = binmap[block]) == 0);
+
+	      idx = block << SHIFTS_PER_ULONG;
+	      bit = 1;
+	    }
+	
+	    while ((bit & map) == 0) {
+	      bit <<= 1;
+	      assert(bit != 0);
+	      idx++;
+	    }
+      
+	    assert (idx < NumBins);
+	    ptr = myLittleHeap[idx].malloc (sz);
+      
+	    if (ptr == NULL) {
+	      binmap[block] = map &= ~bit; // Write through
+	      idx++;
+	      bit <<= 1;
+	    } else {
+	      return ptr;
+	    }
+	  }
+	}
+
+      GET_MEMORY:
+	if (ptr == NULL) {
+	  // There was no free memory in any of the bins.
+	  // Get some memory.
+	  ptr = bigheap.malloc (sz);
+	}
+    
+	return ptr;
+      }
+
+
+      inline void free (void * ptr) {
+	// printf ("Free: %x (%d bytes)\n", ptr, getSize(ptr));
+	const size_t objectSize = getSize(ptr); // was bigheap.getSize(ptr)
+	if (objectSize > maxObjectSize) {
+	  // printf ("free up! (size class = %d)\n", objectSizeClass);
+	  bigheap.free (ptr);
+	} else {
+	  int objectSizeClass = ((scFunction) getSizeClass) (objectSize);
+	  assert (objectSizeClass >= 0);
+	  assert (objectSizeClass < NumBins);
+	  // Put the freed object into the right sizeclass heap.
+	  assert (getClassMaxSize(objectSizeClass) >= objectSize);
+#if 1
+	  while (((csFunction) getClassMaxSize)(objectSizeClass) > objectSize) {
+	    objectSizeClass--;
+	  }
+#endif
+	  assert (((csFunction) getClassMaxSize)(objectSizeClass) <= objectSize);
+	  if (objectSizeClass > 0) {
+	    assert (objectSize >= ((csFunction) getClassMaxSize)(objectSizeClass - 1));
+	  }
+
+
+	  myLittleHeap[objectSizeClass].free (ptr);
+	  mark_bin (objectSizeClass);
+	  memoryHeld += objectSize;
+	}
+      }
+
+
+      void clear (void) {
+	int i;
+	for (i = 0; i < NumBins; i++) {
+	  myLittleHeap[i].clear();
+	}
+	for (int j = 0; j < NUM_ULONGS; j++) {
+	  binmap[j] = 0;
+	}
+	// bitstring.clear();
+	bigheap.clear();
+	memoryHeld = 0;
+      }
+
+    private:
+
+      enum { BITS_PER_ULONG = 32 };
+      enum { SHIFTS_PER_ULONG = 5 };
+      enum { MAX_BITS = (NumBins + BITS_PER_ULONG - 1) & ~(BITS_PER_ULONG - 1) };
+
+
+    private:
+
+      static inline int idx2block (int i) {
+	int blk = i >> SHIFTS_PER_ULONG;
+	assert (blk < NUM_ULONGS);
+	assert (blk >= 0);
+	return blk;
+      }
+
+      static inline unsigned long idx2bit (int i) {
+	unsigned long bit = ((1U << ((i) & ((1U << SHIFTS_PER_ULONG)-1))));
+	return bit;
+      }
+
+
+    protected:
+
+      BigHeap bigheap;
+
+      enum { NUM_ULONGS = MAX_BITS / BITS_PER_ULONG };
+      unsigned long binmap[NUM_ULONGS];
+
+      inline int get_binmap (int i) const {
+	return binmap[i >> SHIFTS_PER_ULONG] & idx2bit(i);
+      }
+
+      inline void mark_bin (int i) {
+	binmap[i >> SHIFTS_PER_ULONG] |=  idx2bit(i);
+      }
+
+      inline void unmark_bin (int i) {
+	binmap[i >> SHIFTS_PER_ULONG] &= ~(idx2bit(i));
+      }
+
+      size_t memoryHeld;
+
+      const size_t maxObjectSize;
+
+      // The little heaps.
+      LittleHeap myLittleHeap[NumBins];
+
+    };
+
+  };
+
+
+/**
+ * @class StrictSegHeap
+ * @brief A "strict" segregated-fits collection of (homogeneous) heaps.
+ * 
+ * One extra heap is used for objects that are "too big".  Unlike
+ * SegHeap, StrictSegHeap does not perform splitting to satisfy memory
+ * requests. If no memory is available from the appropriate bin,
+ * malloc returns NULL.
+ *
+ * @sa SegHeap
+ *
+ * @param NumBins The number of bins (subheaps).
+ * @param getSizeClass Function to compute size class from size.
+ * @param getClassMaxSize Function to compute the largest size for a given size class.
+ * @param LittleHeap The subheap class.
+ * @param BigHeap The parent class, used for "big" objects.
+ */
+
+namespace HL {
+
+  template <int NumBins,
+	    int (*getSizeClass) (const size_t),
+	    size_t (*getClassMaxSize) (const int),
+	    class LittleHeap,
+	    class BigHeap>
+  class StrictSegHeap :
+    public SegHeap<NumBins, getSizeClass, getClassMaxSize, LittleHeap, BigHeap>
+  {
+  private:
+
+    typedef SegHeap<NumBins, getSizeClass, getClassMaxSize, LittleHeap, BigHeap> super;
+
+    typedef int (*scFunction) (const size_t);
+    typedef size_t (*csFunction) (const int);
+
+  public:
+
+    void freeAll (void) {
+      int i;
+      for (i = 0; i < NumBins; i++) {
+	const size_t sz = ((csFunction) getClassMaxSize)(i);
+	void * ptr;
+	while ((ptr = super::myLittleHeap[i].malloc (sz)) != NULL) {
+	  super::bigheap.free (ptr);
+	}
+      }
+      for (int j = 0; j < super::NUM_ULONGS; j++) {
+	super::binmap[j] = 0;
+      }
+      super::memoryHeld = 0;
+    }
+
+  
+    /**
+     * Malloc from exactly one available size.
+     * (don't look in every small heap, as in SegHeap).
+     */
+
+    inline void * malloc (const size_t sz) {
+      void * ptr = NULL;
+      if (sz <= super::maxObjectSize) {
+	const int sizeClass = ((scFunction) getSizeClass) (sz);
+	assert (sizeClass >= 0);
+	assert (sizeClass < NumBins);
+	ptr = super::myLittleHeap[sizeClass].malloc (sz);
+      }
+      if (!ptr) {
+	ptr = super::bigheap.malloc (sz);
+      }
+      return ptr;
+    }
+
+    inline void free (void * ptr) {
+      const size_t objectSize = super::getSize(ptr);
+      if (objectSize > super::maxObjectSize) {
+	super::bigheap.free (ptr);
+      } else {
+	int objectSizeClass = ((scFunction) getSizeClass) (objectSize);
+	assert (objectSizeClass >= 0);
+	assert (objectSizeClass < NumBins);
+	// Put the freed object into the right sizeclass heap.
+	assert (getClassMaxSize(objectSizeClass) >= objectSize);
+	while (((csFunction) getClassMaxSize)(objectSizeClass) > objectSize) {
+	  objectSizeClass--;
+	}
+	assert (((csFunction) getClassMaxSize)(objectSizeClass) <= objectSize);
+	if (objectSizeClass > 0) {
+	  assert (objectSize >= ((csFunction) getClassMaxSize)(objectSizeClass - 1));
+	}
+
+	super::myLittleHeap[objectSizeClass].free (ptr);
+	super::memoryHeld += objectSize;
+      }
+    }
+
+  };
+
+};
+
+
+#endif
Index: /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/sizeheap.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/sizeheap.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/sizeheap.h	(revision 176)
@@ -0,0 +1,129 @@
+/* -*- C++ -*- */
+
+/*
+
+  Heap Layers: An Extensible Memory Allocation Infrastructure
+  
+  Copyright (C) 2000-2003 by Emery Berger
+  http://www.cs.umass.edu/~emery
+  emery@cs.umass.edu
+  
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or
+  (at your option) any later version.
+  
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+  
+  You should have received a copy of the GNU General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+*/
+
+#ifndef _SIZEHEAP_H_
+#define _SIZEHEAP_H_
+
+/**
+ * @file sizeheap.h
+ * @brief Contains UseSizeHeap and SizeHeap.
+ */
+
+#include <assert.h>
+
+#include "addheap.h"
+
+#if 1
+
+/**
+ * @class UseSizeHeap
+ * @brief Adds a getSize method to access the size of an allocated object.
+ * @see SizeHeap
+ */
+
+namespace HL {
+
+template <class Super>
+class UseSizeHeap : public Super {
+public:
+  
+  inline UseSizeHeap (void) {}
+  
+  inline static size_t getSize (const void * ptr) {
+    return ((freeObject *) ptr - 1)->sz;
+  }
+
+protected:
+  union freeObject {
+    size_t sz;
+    double _dummy; // for alignment.
+  };
+};
+
+/**
+ * @class SizeHeap
+ * @brief Allocates extra room for the size of an object.
+ */
+
+template <class SuperHeap>
+class SizeHeap : public UseSizeHeap<SuperHeap> {
+  typedef typename UseSizeHeap<SuperHeap>::freeObject freeObject;
+public:
+  inline SizeHeap (void) {}
+  inline void * malloc (const size_t sz) {
+    // Add room for a size field.
+    freeObject * ptr = (freeObject *)
+      SuperHeap::malloc (sz + sizeof(freeObject));
+    // Store the requested size.
+    ptr->sz = sz;
+    return (void *) (ptr + 1);
+  }
+  inline void free (void * ptr) {
+    SuperHeap::free ((freeObject *) ptr - 1);
+  }
+};
+
+};
+
+#else
+
+template <class Super>
+class SizeHeap : public Super {
+public:
+  
+  inline void * malloc (size_t sz) {
+    // Add room for a size field.
+	  assert (sizeof(size_t) <= sizeof(double));
+    void * ptr = Super::malloc (sz + sizeof(double));
+    // Store the requested size.
+    *((size_t *) ptr) = sz;
+    return (void *) ((double *) ptr + 1);
+  }
+  
+  inline void free (void * ptr) {
+    void * origPtr = (void *) ((double *) ptr - 1);
+	Super::free (origPtr);
+  }
+
+  inline static size_t getSize (void * ptr) {
+    return *((size_t *) ((double *) ptr - 1));
+  }
+};
+
+
+
+template <class Super>
+class UseSizeHeap : public Super {
+public:
+  
+  inline static size_t getSize (void * ptr) {
+    return *((size_t *) ((double *) ptr - 1));
+  }
+};
+
+#endif
+
+#endif
Index: /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/sizeownerheap.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/sizeownerheap.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/sizeownerheap.h	(revision 176)
@@ -0,0 +1,89 @@
+/* -*- C++ -*- */
+
+/*
+
+  Heap Layers: An Extensible Memory Allocation Infrastructure
+  
+  Copyright (C) 2000-2003 by Emery Berger
+  http://www.cs.umass.edu/~emery
+  emery@cs.umass.edu
+  
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or
+  (at your option) any later version.
+  
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+  
+  You should have received a copy of the GNU General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+*/
+
+#ifndef _SIZEOWNERHEAP_H_
+#define _SIZEOWNERHEAP_H_
+
+#include <assert.h>
+
+#include "addheap.h"
+
+/**
+ * @class SizeOwnerHeap
+ * @brief Adds object size and owner heap information.
+ */
+
+namespace HL {
+
+template <class Heap>
+class SizeOwner {
+public:
+  union {
+    struct {
+      size_t size;
+      Heap * owner;
+    } s;
+    double dummy;
+  };
+};
+
+template <class Super>
+class SizeOwnerHeap : public AddHeap<SizeOwner<Super>, Super> {
+private:
+
+  typedef AddHeap<SizeOwner<Super>, Super> SuperHeap;
+
+public:
+  
+  inline void * malloc (size_t sz) {
+    void * ptr = SuperHeap::malloc (sz);
+    // Store the requested size.
+    SizeOwner<Super> * so = (SizeOwner<Super> *) ptr;
+    so->s.size = sz;
+    so->s.owner = this;
+    // Store the owner.
+    return (void *) (so + 1);
+  }
+  
+  inline void free (void * ptr) {
+    void * origPtr = (void *) ((SizeOwner<Super> *) ptr - 1);
+    SuperHeap::free (origPtr);
+  }
+
+  static inline Super * owner (void * ptr) {
+    SizeOwner<Super> * so = (SizeOwner<Super> *) ptr - 1;
+    return so->s.owner;
+  }
+
+  static inline size_t size (void * ptr) {
+    SizeOwner<Super> * so = (SizeOwner<Super> *) ptr - 1;
+    return so->s.size;
+  }
+};
+
+};
+
+#endif
Index: /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/sizethreadheap.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/sizethreadheap.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/sizethreadheap.h	(revision 176)
@@ -0,0 +1,95 @@
+/* -*- C++ -*- */
+
+#ifndef _SIZETHREADHEAP_H_
+#define _SIZETHREADHEAP_H_
+
+#include <assert.h>
+
+template <class Super>
+class SizeThreadHeap : public Super {
+public:
+  
+  inline void * malloc (size_t sz) {
+    // Add room for a size field & a thread field.
+	// Both of these must fit in a double.
+	assert (sizeof(st) <= sizeof(double));
+    st * ptr = (st *) Super::malloc (sz + sizeof(double));
+    // Store the requested size.
+    ptr->size = sz;
+	assert (getOrigPtr(ptr + 1) == ptr);
+    return (void *) (ptr + 1);
+  }
+  
+  inline void free (void * ptr) {
+    void * origPtr = (void *) getOrigPtr(ptr);
+    Super::free (origPtr);
+  }
+
+  static inline volatile int getThreadId (void);
+
+  static inline size_t& size (void * ptr) {
+		return getOrigPtr(ptr)->size;
+  }
+
+  static inline int& thread (void * ptr) {
+		return getOrigPtr(ptr)->tid;
+	}
+
+private:
+
+	typedef struct _st {
+		size_t size;
+		int tid;
+	} st;
+
+	static inline st * getOrigPtr (void * ptr) {
+		return (st *) ((double *) ptr - 1);
+	}
+
+};
+
+
+
+// A platform-dependent way to get a thread id.
+
+// Include the necessary platform-dependent crud.
+#if defined(WIN32) || defined(__WIN32__) || defined(_WIN32)
+#ifndef WIN32
+#define WIN32 1
+#endif
+#include <windows.h>
+#include <process.h>
+#endif
+
+template <class SuperHeap>
+inline volatile int
+SizeThreadHeap<SuperHeap>::getThreadId (void) {
+#if defined(WIN32)
+  return GetCurrentThreadId();
+#endif
+#if defined(__BEOS__)
+  return find_thread(0);
+#endif
+#if defined(__linux)
+  // Consecutive thread id's in Linux are 1024 apart;
+  // dividing off the 1024 gives us an appropriate thread id.
+  return (int) pthread_self() >> 10; // (>> 10 = / 1024)
+#endif
+#if defined(__SVR4)
+  return (int) lwp_self();
+#endif
+#if defined(POSIX)
+  return (int) pthread_self();
+#endif
+#if USE_SPROC
+  // This hairiness has the same effect as calling getpid(),
+  // but it's MUCH faster since it avoids making a system call
+  // and just accesses the sproc-local data directly.
+  int pid = (int) PRDA->sys_prda.prda_sys.t_pid;
+  return pid;
+#endif
+}
+  
+
+
+#endif
Index: /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/slopheap.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/slopheap.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/slopheap.h	(revision 176)
@@ -0,0 +1,114 @@
+// -*- C++ -*-
+
+/*
+
+Heap Layers: An Extensible Memory Allocation Infrastructure
+  
+Copyright (C) 2000-2003 by Emery Berger
+http://www.cs.umass.edu/~emery
+emery@cs.umass.edu
+  
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+  
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+  
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+*/
+
+
+#ifndef _SLOPHEAP_H_
+#define _SLOPHEAP_H_
+
+/**
+ * @class SlopHeap
+ * 
+ * SlopHeap is designed to guarantee that you always have an extra N bytes
+ * available after the most recent malloc. This is necessary for the current
+ * coalescing support, which can look past the last allocated object.
+ *
+ * @param SuperHeap The parent heap.
+ * @param SLOP The amount of extra memory required, in bytes.
+ */
+  
+namespace HL {
+  
+  template <class SuperHeap, int SLOP = 16>
+  class SlopHeap : public SuperHeap {
+  public:
+    SlopHeap (void)
+      : remaining (0),
+	ptr (NULL)
+    {}
+  
+    inline void * malloc (const size_t nbytes) {
+
+      // Put the usual case up front.
+      if (nbytes <= remaining) {
+	remaining -= nbytes;
+	char * p = ptr;
+	ptr += nbytes;
+	return (void *) p;
+      }
+    
+      //
+      // We don't have enough space to satisfy the current
+      // request, so get more memory.
+      //
+
+      return getMoreMemory(nbytes);
+    }
+  
+    inline void clear (void) {
+      ptr = NULL;
+      remaining = 0;
+      SuperHeap::clear ();
+    }
+
+    inline void free (void *) {}
+
+  private:
+
+    // Disabled.
+    inline int remove (void *);
+
+    void * getMoreMemory (size_t nbytes) {
+      char * newptr = (char *) SuperHeap::malloc (nbytes + SLOP);
+
+      if (newptr == NULL) {
+	return NULL;
+      }
+
+      //
+      // If this new memory is contiguous with the previous one,
+      // reclaim the "slop".
+      //
+    
+      if ((ptr != NULL) && (ptr + remaining + SLOP == newptr)) {
+	remaining += SLOP;
+      } else {
+	ptr = newptr;
+	remaining = 0;
+      }
+      char * p = ptr;
+      ptr += nbytes;
+
+      return (void *) p;
+    }
+
+    char * ptr;
+    size_t remaining;
+
+  };
+  
+}
+
+#endif
Index: /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/spinlock.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/spinlock.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/spinlock.h	(revision 176)
@@ -0,0 +1,261 @@
+/* -*- C++ -*- */
+
+/*
+
+  Heap Layers: An Extensible Memory Allocation Infrastructure
+  
+  Copyright (C) 2000-2006 by Emery Berger
+  http://www.cs.umass.edu/~emery
+  emery@cs.umass.edu
+  
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or
+  (at your option) any later version.
+  
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+  
+  You should have received a copy of the GNU General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+*/
+
+#ifndef _SPINLOCK_H_
+#define _SPINLOCK_H_
+
+#if defined(unix)
+#include <sched.h>
+#endif
+
+#if defined(__SVR4)
+#include <thread.h>
+#endif
+
+#if defined(__sgi)
+#include <mutex.h>
+#endif
+
+#if defined(__APPLE__)
+#include <libkern/OSAtomic.h>
+#endif
+
+#include "hldefines.h"
+#include "cpuinfo.h"
+
+#if defined(_MSC_VER)
+
+#if !defined(NO_INLINE)
+#pragma inline_depth(255)
+#define NO_INLINE __declspec(noinline)
+#define INLINE __forceinline
+#define inline __forceinline
+#endif // !defined(NO_INLINE)
+
+#else
+
+#endif // defined(_MSC_VER)
+
+
+#if defined(__SUNPRO_CC)
+// x86-interchange.il, x86_64-interchange.il contributed by Markus Bernhardt.
+extern "C" unsigned long MyInterlockedExchange (unsigned long * oldval,
+					      unsigned long newval);
+#endif
+
+#if defined(_WIN32) && !defined(_WIN64)
+#define _WIN32_WINNT 0x0500
+
+// NOTE: Below is the new "pause" instruction, which is inocuous for
+// previous architectures, but crucial for Intel chips with
+// hyperthreading.  See
+// http://www.usenix.org/events/wiess02/tech/full_papers/nakajima/nakajima.pdf
+// for discussion.
+
+#define _MM_PAUSE  {__asm{_emit 0xf3};__asm {_emit 0x90}}
+#include <windows.h>
+#else
+#define _MM_PAUSE
+#endif // defined(_WIN32) && !defined(_WIN64)
+
+extern volatile int anyThreadCreated;
+
+namespace HL {
+
+class SpinLockType {
+private:
+
+  enum { UNLOCKED = 0, LOCKED = 1 };
+
+public:
+  
+  SpinLockType (void)
+#if defined(__APPLE__)
+    : mutex (OS_SPINLOCK_INIT)
+#else
+    : mutex (UNLOCKED)
+#endif
+  {}
+  
+  ~SpinLockType (void)
+  {}
+
+  inline void lock (void) {
+    if (anyThreadCreated) {
+#if defined(__APPLE__)
+      OSSpinLockLock(&mutex);
+#else
+      // A yielding lock (with an initial spin).
+      if (MyInterlockedExchange (const_cast<unsigned long *>(&mutex), LOCKED)
+	  != UNLOCKED) {
+	contendedLock();
+      }
+#endif
+    } else {
+      mutex = LOCKED;
+    }
+  }
+
+ 
+  inline void unlock (void) {
+#if defined(__APPLE__)
+    OSSpinLockUnlock(&mutex);
+#else
+    if (anyThreadCreated) {
+#if defined(_WIN32) && !defined(_WIN64)
+      __asm {}
+#elif defined(__GNUC__)
+      asm volatile ("" : : : "memory");
+#endif
+    }
+    mutex = UNLOCKED;
+#endif
+  }
+
+
+#if !defined(__SUNPRO_CC)
+  inline static volatile unsigned long MyInterlockedExchange (unsigned long *,unsigned long); 
+#endif
+
+private:
+
+#if defined(__APPLE__)
+  OSSpinLock mutex;
+
+#else
+
+  NO_INLINE
+  void contendedLock (void) {
+    while (1) {
+      if (MyInterlockedExchange (const_cast<unsigned long *>(&mutex), LOCKED)
+	  == UNLOCKED) {
+	return;
+      }
+      while (mutex == LOCKED) {
+	_MM_PAUSE;
+	yieldProcessor();
+      }
+    }
+  }
+
+  // Is this system a multiprocessor?
+  inline bool onMultiprocessor (void) {
+    static CPUInfo cpuInfo;
+    return (cpuInfo.getNumProcessors() > 1);
+  }
+
+  inline void yieldProcessor (void) {
+#if defined(_WIN32)
+    Sleep(0);
+#elif defined(__SVR4)
+    thr_yield();
+#else
+    sched_yield();
+#endif
+  }
+
+  enum { MAX_SPIN_LIMIT = 1024 };
+
+  union {
+    volatile unsigned long mutex;
+  };
+#endif
+
+};
+
+}
+
+// Atomically:
+//   retval = *oldval;
+//   *oldval = newval;
+//   return retval;
+
+#if !defined(__SUNPRO_CC) && !defined(__APPLE__)
+inline volatile unsigned long 
+HL::SpinLockType::MyInterlockedExchange (unsigned long * oldval,
+				   unsigned long newval)
+{
+#if defined(_WIN32) && defined(_MSC_VER)
+  return InterlockedExchange ((volatile LONG *) oldval, newval);
+
+#elif defined(__sparc)
+  asm volatile ("swap [%1],%0"
+		:"=r" (newval)
+		:"r" (oldval), "0" (newval)
+		: "memory");
+  
+#elif defined(__i386__)
+  asm volatile ("lock; xchgl %0, %1"
+		: "=r" (newval)
+		: "m" (*oldval), "0" (newval)
+		: "memory");
+
+#elif defined(__sgi)
+  newval = test_and_set (oldval, newval);
+
+#elif defined(__x86_64__)
+  // Contributed by Kurt Roeckx.
+  asm volatile ("lock; xchgq %0, %1"
+		: "=r" (newval)
+		: "m" (*oldval), "0" (newval)
+		: "memory");
+
+#elif defined(__ppc) || defined(__powerpc__) || defined(PPC)
+  // PPC assembly contributed by Maged Michael.
+  int ret; 
+  asm volatile ( 
+		"La..%=0:    lwarx %0,0,%1 ;" 
+		"      cmpw  %0,%2;" 
+		"      beq La..%=1;" 
+		"      stwcx. %2,0,%1;" 
+		"      bne- La..%=0;" 
+		"La..%=1:    isync;" 
+                : "=&r"(ret) 
+                : "r"(oldval), "r"(newval) 
+                : "cr0", "memory"); 
+  return ret;
+
+#elif defined(__arm__)
+  // Contributed by Bo Granlund.
+  long result;
+  asm volatile (
+		       "\n\t"
+		       "swp     %0,%2,[%1] \n\t"
+		       ""
+		       : "=&r"(result)
+		       : "r"(oldval), "r"(newval)
+		       : "memory");
+  return (result);
+#else
+#error "No spin lock implementation is available for this platform."
+#endif
+  return newval;
+}
+
+
+#endif
+
+#endif // _SPINLOCK_H_
Index: /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/staticheap.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/staticheap.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/staticheap.h	(revision 176)
@@ -0,0 +1,80 @@
+// -*- C++ -*-
+
+/*
+
+  Heap Layers: An Extensible Memory Allocation Infrastructure
+  
+  Copyright (C) 2000-2003 by Emery Berger
+  http://www.cs.umass.edu/~emery
+  emery@cs.umass.edu
+  
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or
+  (at your option) any later version.
+  
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+  
+  You should have received a copy of the GNU General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+*/
+
+/*
+
+  StaticHeap: manage a fixed range of memory.
+
+*/
+
+#ifndef _STATICHEAP_H_
+#define _STATICHEAP_H_
+
+namespace HL {
+
+template <int MemorySize>
+class StaticHeap {
+public:
+
+  StaticHeap (void)
+    : ptr (&buf[0]),
+    remaining (MemorySize)
+  {}
+
+  enum { Alignment = 1 };
+
+  inline void * malloc (size_t sz) {
+    if (remaining < sz) {
+      return NULL;
+    }
+    void * p = ptr;
+    ptr += sz;
+    remaining -= sz;
+    return p;
+  }
+
+  void free (void *) {}
+  int remove (void *) { return 0; }
+
+  int isValid (void * ptr) {
+    return (((size_t) ptr >= (size_t) buf) &&
+	    ((size_t) ptr < (size_t) buf));
+  }
+
+private:
+
+  // Disable copying and assignment.
+  StaticHeap (const StaticHeap& treap);
+  StaticHeap& operator= (const StaticHeap& treap);
+
+  char buf[MemorySize];
+  char * ptr;
+  size_t remaining;
+};
+
+};
+
+#endif
Index: /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/stats.cpp
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/stats.cpp	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/stats.cpp	(revision 176)
@@ -0,0 +1,82 @@
+// Report stats.
+
+#include <stdio.h>
+
+#include "timer.h"
+
+struct mallinfo {
+  int arena;    /* non-mmapped space allocated from system */
+  int ordblks;  /* number of free chunks */
+  int smblks;   /* number of fastbin blocks */
+  int hblks;    /* number of mmapped regions */
+  int hblkhd;   /* space in mmapped regions */
+  int usmblks;  /* maximum total allocated space */
+  int fsmblks;  /* space available in freed fastbin blocks */
+  int uordblks; /* total allocated space */
+  int fordblks; /* total free space */
+  int keepcost; /* top-most, releasable (via malloc_trim) space */
+};
+
+#if 1
+extern "C" struct mallinfo dlmallinfo (void);
+#endif
+extern "C" void mstats (void); // for Kingsley malloc.
+extern "C" void dlmalloc_stats (void); // for Doug Lea malloc.
+extern "C" void * sbrk (long);
+extern "C" void malloc_stats (void); // for Doug Lea malloc.
+
+int masMem;// FIX ME
+
+
+int totalAllocated;
+int maxAllocated;
+int totalRequested;
+int maxRequested;
+
+class TimeItAll {
+public:
+	TimeItAll (void) {
+		totalAllocated = 0;
+		maxAllocated = 0;
+		t.start();
+		// FIX ME
+		masMem = 0;
+#ifdef WIN32
+		initSpace = (long) sbrk(0);
+		//initSpace = CommittedSpace();
+#endif
+	}
+
+	~TimeItAll (void) {
+		t.stop();
+#if 0
+		struct mallinfo mi = dlmallinfo();
+		printf ("Doug Lea Memory allocated = {total} %d, {non-mmapped} %d\n", mi.usmblks, mi.arena);
+#endif
+		double elapsed = (double) t;
+		printf ("Time elapsed = %f\n", elapsed);
+		printf ("Max allocated = %d\n", maxAllocated);
+		printf ("Max requested = %d\n", maxRequested);
+		printf ("Frag = %lf\n", (double) maxAllocated / (double) maxRequested);
+#ifdef WIN32
+		printf ("init space = %ld\n",  initSpace);
+		printf ("Sbrk report: %ld\n", (long) sbrk(0));
+#if 0
+		size_t diff = (size_t) wsbrk(8);
+		cout << "diff1 = " << diff << endl;
+		diff -= initSpace - 8;
+		cout << "diff = " << diff << endl;
+#endif
+#endif
+		malloc_stats();
+		fflush (stdout);
+//		dlmalloc_stats();
+	}
+private:
+	Timer t;
+#ifdef WIN32
+	long initSpace;
+#endif
+};
+
+TimeItAll timer;
Index: /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/stats.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/stats.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/stats.h	(revision 176)
@@ -0,0 +1,94 @@
+#ifndef _HLSTATS_H_
+#define _HLSTATS_H_
+
+#include <map>
+
+template <class SuperHeap>
+class InUseHeap : public SuperHeap {
+private:
+  typedef std::map<void *, int> mapType;
+public:
+  InUseHeap (void)
+    : inUse (0),
+      maxInUse (0)
+  {}
+  void * malloc (size_t sz) {
+    void * ptr = SuperHeap::malloc (sz);
+    if (ptr != NULL) {
+      inUse += sz;
+      if (maxInUse < inUse) {
+	maxInUse = inUse;
+      }
+      allocatedObjects.insert (std::pair<void *, int>(ptr, sz));
+    }
+    return ptr;
+  }
+  void free (void * ptr) {
+    mapType::iterator i;
+    i = allocatedObjects.find (ptr);
+    if (i == allocatedObjects.end()) {
+      // oops -- called free on object i didn't allocate.
+      assert (0);
+    }
+    inUse -= (*i).second;
+    allocatedObjects.erase (i);
+    SuperHeap::free (ptr);
+  }
+
+  int getInUse (void) const {
+    return inUse;
+  }
+  int getMaxInUse (void) const {
+    return maxInUse;
+  }
+private:
+  int inUse;
+  int maxInUse;
+  mapType allocatedObjects;
+};
+
+
+template <class SuperHeap>
+class AllocatedHeap : public SuperHeap {
+public:
+  AllocatedHeap (void)
+    : allocated (0),
+      maxAllocated (0)
+  {}
+  void * malloc (size_t sz) {
+    void * ptr = SuperHeap::malloc (sz);
+    if (ptr != NULL) {
+      allocated += getSize(ptr);
+      if (maxAllocated < allocated) {
+	maxAllocated = allocated;
+      }
+    }
+    return ptr;
+  }
+  void free (void * ptr) {
+    allocated -= getSize(ptr);
+    SuperHeap::free (ptr);
+  }
+
+  int getAllocated (void) const {
+    return allocated;
+  }
+  int getMaxAllocated (void) const {
+    return maxAllocated;
+  }
+private:
+  int allocated;
+  int maxAllocated;
+};
+
+
+template <class SuperHeap>
+class StatsHeap : public SuperHeap {
+public:
+  ~StatsHeap (void) {
+    printf ("In use = %d, allocated = %d\n", getInUse(), getAllocated());
+    printf ("Max in use = %d, max allocated = %d\n", getMaxInUse(), getMaxAllocated());
+  }
+};
+
+#endif
Index: /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/stlallocator.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/stlallocator.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/stlallocator.h	(revision 176)
@@ -0,0 +1,167 @@
+/* -*- C++ -*- */
+
+/*
+
+  Heap Layers: An Extensible Memory Allocation Infrastructure
+  
+  Copyright (C) 2000-2005 by Emery Berger
+  http://www.cs.umass.edu/~emery
+  emery@cs.umass.edu
+  
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or
+  (at your option) any later version.
+  
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+  
+  You should have received a copy of the GNU General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+*/
+
+#ifndef _STLALLOCATOR_H_
+#define _STLALLOCATOR_H_
+
+#include <stdio.h>
+#include <new>
+#include <stdlib.h>
+
+#include <memory> // STL
+
+using namespace std;
+
+/**
+ * @class STLAllocator
+ * @brief An allocator adapter for STL.
+ * 
+ * This mixin lets you use any Heap Layers allocator as the allocator
+ * for an STL container.
+ *
+ * Example:
+ * <TT>
+ *   typedef STLAllocator<int, MyHeapType> MyAllocator;<BR>
+ *   list<int, MyAllocator> l;<BR>
+ * </TT>
+ */
+
+namespace HL {
+
+template <class T, class Super>
+class STLAllocator : public Super {
+public:
+
+  typedef T value_type;
+  typedef std::size_t size_type;
+  typedef std::ptrdiff_t difference_type;
+  typedef T * pointer;
+  typedef const T * const_pointer;
+  typedef T& reference;
+  typedef const T& const_reference;
+
+  STLAllocator (void) {}
+  virtual ~STLAllocator (void) {}
+
+  STLAllocator (const STLAllocator& s)
+    : Super (s)
+  {}
+
+#if defined(_WIN32)
+  char * _Charalloc (size_type n) {
+    return (char *) allocate (n);
+  }
+#endif
+
+#if defined(__SUNPRO_CC)
+  inline void * allocate (size_type n,
+			  const void * = 0) {
+    if (n) {
+      return reinterpret_cast<void *>(Super::malloc (sizeof(T) * n));
+    } else {
+      return (void *) 0;
+    }
+  }
+#else
+  inline pointer allocate (size_type n,
+			  const void * = 0) {
+    if (n) {
+      return reinterpret_cast<pointer>(Super::malloc (sizeof(T) * n));
+    } else {
+      return 0;
+    }
+  }
+#endif
+
+  inline void deallocate (void * p, size_type) {
+    Super::free (p);
+  }
+
+  inline void deallocate (pointer p, size_type) {
+    Super::free (p);
+  }
+  
+  pointer address (reference x) const { return &x; }
+  const_pointer address (const_reference x) const { return &x; }
+
+  void construct (pointer p, const T& val) { new (p) T (val); }
+  void destroy (pointer p) { p->~T(); }
+
+  /// Make the maximum size be the largest possible object.
+  size_type max_size(void) const
+  {
+    size_type n = (size_type)(-1);
+    return (n > 0 ? n : (size_type)(n));
+  }
+
+  template <class U> STLAllocator( const STLAllocator<U, Super> &) {}
+  template <class U> struct rebind { typedef STLAllocator<U,Super> other; };
+
+};
+
+  template <typename T, class S>
+  inline bool operator!=(const STLAllocator<T,S>& a, const STLAllocator<T,S>& b) {
+    return (&a != &b);
+  }
+
+  template <typename T, class S>
+  inline bool operator==(const STLAllocator<T,S>& a, const STLAllocator<T,S>& b) {
+    return (&a == &b);
+  }
+
+#if 0
+
+  #include <memory> // STL
+  #include <stdlib.h>
+
+  template <typename T, class Super>
+  class STLAllocator : public std::allocator<T>, public Super {
+  public:
+    inline T * allocate (std::size_t n,
+			 const void * = 0) {
+      if (n) {
+	return reinterpret_cast<T *>(Super::malloc (sizeof(T) * n));
+      } else {
+	return 0;
+      }
+    }
+    
+    inline void deallocate (void * p, std::size_t) {
+      Super::free (p);
+    }
+    
+    inline void deallocate (T * p, std::size_t) {
+      Super::free (p);
+    }
+    
+  };
+
+#endif
+
+}
+
+
+#endif
Index: /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/threadheap.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/threadheap.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/threadheap.h	(revision 176)
@@ -0,0 +1,128 @@
+/* -*- C++ -*- */
+
+#ifndef _THREADHEAP_H_
+#define _THREADHEAP_H_
+
+#include <assert.h>
+#include <new>
+
+#if !defined(_WIN32)
+#include <pthread.h>
+#endif
+
+#if defined(__SVR4) // Solaris
+extern "C" unsigned int lwp_self(void);
+#endif
+
+/*
+
+  A ThreadHeap comprises NumHeaps "per-thread" heaps.
+
+  To pick a per-thread heap, the current thread id is hashed (mod NumHeaps).
+
+  malloc gets memory from its hashed per-thread heap.
+  free returns memory to its hashed per-thread heap.
+
+  (This allows the per-thread heap to determine the return
+  policy -- 'pure private heaps', 'private heaps with ownership',
+  etc.)
+
+  NB: We assume that the thread heaps are 'locked' as needed.  */
+
+namespace HL {
+
+template <int NumHeaps, class PerThreadHeap>
+class ThreadHeap : public PerThreadHeap {
+public:
+
+  inline void * malloc (size_t sz) {
+    int tid = getThreadId() % NumHeaps;
+    assert (tid >= 0);
+    assert (tid < NumHeaps);
+    return getHeap(tid)->malloc (sz);
+  }
+
+  inline void free (void * ptr) {
+    int tid = getThreadId() % NumHeaps;
+    assert (tid >= 0);
+    assert (tid < NumHeaps);
+    getHeap(tid)->free (ptr);
+  }
+
+  inline size_t getSize (void * ptr) {
+    int tid = getThreadId() % NumHeaps;
+    assert (tid >= 0);
+    assert (tid < NumHeaps);
+    return getHeap(tid)->getSize (ptr);
+  }
+
+    
+private:
+
+  // Access the given heap within the buffer.
+  inline PerThreadHeap * getHeap (int index) {
+    assert (index >= 0);
+    assert (index < NumHeaps);
+    return &ptHeaps[index];
+  }
+
+  // Get a suitable thread id number.
+  inline static volatile int getThreadId (void);
+
+  PerThreadHeap ptHeaps[NumHeaps];
+
+};
+
+}
+
+
+// A platform-dependent way to get a thread id.
+
+// Include the necessary platform-dependent crud.
+#if defined(WIN32) || defined(__WIN32__) || defined(_WIN32)
+#ifndef WIN32
+#define WIN32 1
+#endif
+#include <windows.h>
+#include <process.h>
+#endif
+
+template <int NumHeaps, class PerThreadHeap>
+inline volatile int
+HL::ThreadHeap<NumHeaps, PerThreadHeap>::getThreadId (void) {
+#if defined(WIN32)
+  // It looks like thread id's are always multiples of 4, so...
+  int tid = GetCurrentThreadId() >> 2;
+  // Now hash in some of the first bits.
+//  return (tid & ~(1024-1)) ^ tid;
+  return tid;
+#endif
+#if defined(__BEOS__)
+  return find_thread(0);
+#endif
+#if defined(__linux)
+  // Consecutive thread id's in Linux are 1024 apart;
+  // dividing off the 1024 gives us an appropriate thread id.
+  return (int) pthread_self() >> 10; // (>> 10 = / 1024)
+#endif
+#if defined(__SVR4)
+  //  printf ("lwp_self = %d\n", (int) lwp_self());
+  return (int) lwp_self();
+#endif
+#if defined(__APPLE__)
+  return (int) pthread_self();
+#endif
+#if defined(POSIX)
+  return (int) pthread_self();
+#endif
+#if USE_SPROC
+  // This hairiness has the same effect as calling getpid(),
+  // but it's MUCH faster since it avoids making a system call
+  // and just accesses the sproc-local data directly.
+  int pid = (int) PRDA->sys_prda.prda_sys.t_pid;
+  return pid;
+#endif
+}
+  
+
+#endif
Index: /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/threadspecificheap.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/threadspecificheap.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/threadspecificheap.h	(revision 176)
@@ -0,0 +1,102 @@
+/* -*- C++ -*- */
+
+#ifndef _THREADHEAP_H_
+#define _THREADHEAP_H_
+
+#include <assert.h>
+#include <new.h>
+
+/*
+
+  A ThreadHeap comprises NumHeaps "per-thread" heaps.
+
+  To pick a per-thread heap, the current thread id is hashed (mod NumHeaps).
+
+  malloc gets memory from its hashed per-thread heap.
+  free returns memory to its hashed per-thread heap.
+
+  (This allows the per-thread heap to determine the return
+  policy -- 'pure private heaps', 'private heaps with ownership',
+  etc.)
+
+  NB: We assume that the thread heaps are 'locked' as needed.  */
+
+
+template <int NumHeaps, class PerThreadHeap>
+class ThreadHeap : public PerThreadHeap {
+public:
+
+  ThreadHeap (void)
+  {
+  }
+
+  inline void * malloc (size_t sz) {
+    int tid = getThreadId() % NumHeaps;
+    return getHeap(tid)->malloc (sz);
+  }
+
+  inline void free (void * ptr) {
+    int tid = getThreadId() % NumHeaps;
+    getHeap(tid)->free (ptr);
+  }
+
+
+private:
+
+  // Access the given heap within the buffer.
+  PerThreadHeap * getHeap (int index) {
+    assert (index >= 0);
+    assert (index < NumHeaps);
+	return &ptHeaps[index];
+  }
+
+  // Get a suitable thread id number.
+  inline static volatile int getThreadId (void);
+
+  PerThreadHeap ptHeaps[NumHeaps];
+
+};
+
+
+// A platform-dependent way to get a thread id.
+
+// Include the necessary platform-dependent crud.
+#if defined(WIN32) || defined(__WIN32__) || defined(_WIN32)
+#ifndef WIN32
+#define WIN32 1
+#endif
+#include <windows.h>
+#include <process.h>
+#endif
+
+template <int NumHeaps, class PerThreadHeap>
+inline volatile int
+ThreadHeap<NumHeaps, PerThreadHeap>::getThreadId (void) {
+#if WIN32
+  return GetCurrentThreadId();
+#endif
+#if defined(__BEOS__)
+  return find_thread(0);
+#endif
+#if defined(__linux)
+  // Consecutive thread id's in Linux are 1024 apart;
+  // dividing off the 1024 gives us an appropriate thread id.
+  return (int) pthread_self() >> 10; // (>> 10 = / 1024)
+#endif
+#if defined(__SVR4)
+  return (int) lwp_self();
+#endif
+#if defined(POSIX)
+  return (int) pthread_self();
+#endif
+#if USE_SPROC
+  // This hairiness has the same effect as calling getpid(),
+  // but it's MUCH faster since it avoids making a system call
+  // and just accesses the sproc-local data directly.
+  int pid = (int) PRDA->sys_prda.prda_sys.t_pid;
+  return pid;
+#endif
+}
+  
+
+#endif
Index: /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/traceheap.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/traceheap.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/traceheap.h	(revision 176)
@@ -0,0 +1,222 @@
+/* -*- C++ -*- */
+
+#ifndef _TRACEHEAP_H_
+#define _TRACEHEAP_H_
+
+#include <stdlib.h>
+
+#ifdef WIN32
+#include <io.h>
+#endif
+
+#include <fcntl.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <string.h>
+#include <stdio.h>
+
+// An object that manages direct writing to a file.
+
+class FileObject {
+public:
+
+  FileObject (void)
+    : isOpen (0)
+  {}
+ 
+  ~FileObject (void) {
+    close();
+  }
+ 
+  void open (char * fname)
+  {
+#if 1
+    file = fopen(fname, "w+");
+#else
+#ifdef WIN32
+    file = _open(fname, _O_WRONLY | _O_CREAT, _S_IREAD | _S_IWRITE);
+#else
+    file = ::open(fname, O_WRONLY | O_CREAT, S_IREAD | S_IWRITE);
+#endif
+#endif
+  }
+ 
+  int is_open (void) {
+    return isOpen;
+  }
+ 
+  void close (void)
+  {
+    if (isOpen) {
+#if 1
+      fclose (file);
+#else
+#ifdef WIN32
+      _close (file);
+#else
+      ::close (file);
+#endif
+#endif
+      isOpen = 0;
+    }
+  }
+ 
+ 
+  friend FileObject& operator<<(FileObject& f, int n) {
+    //          fprintf (f.file, "%d", n);
+    char buf[255];
+    sprintf (buf, "%d", n);
+    f.writeString (buf);
+    return f;
+  }
+ 
+  friend FileObject& operator<<(FileObject& f, char * s) {
+    //                      fprintf (f.file, "%s", s);
+    char buf[255];
+    sprintf (buf, "%s", s);
+    f.writeString (buf);
+    return f;
+  }
+ 
+  friend FileObject& operator<<(FileObject& f, void * s) {
+    //                      fprintf (f.file, "%p", s);
+    char buf[255];
+    sprintf (buf, "%p", s);
+    f.writeString (buf);
+    return f;
+  }
+ 
+private:
+
+  void writeString (char * buf) {
+#if 1
+	  fprintf(file, buf);
+#else
+#ifdef WIN32
+    _write (file, buf, strlen(buf));
+#else
+    write (file, buf, strlen(buf));
+#endif
+#endif
+  }
+
+#if 1
+  FILE * file;
+#else
+  int file;
+#endif
+
+  bool isOpen;
+
+};
+
+
+// The TraceHeap itself.
+// Traces malloc & free calls.
+ 
+template <class Super, int Number>
+class TraceHeap : public Super {
+public:
+
+  TraceHeap (void)
+  {
+    if (!theFile().is_open()) {
+      char fname[255];
+      sprintf (fname, "trace-%d", Number);
+      theFile().open (fname);
+      printf ("OPEN %s\n", fname);
+    }
+    getRefs()++;
+  }
+ 
+  ~TraceHeap (void)
+  {
+    //                      theFile() << ::std::flush;
+    --getRefs();
+    if (getRefs() == 0) {
+      if (theFile().is_open())
+	theFile().close();
+    }
+  }
+ 
+  inline void * malloc (size_t sz) {
+    void * ptr = Super::malloc (sz);
+    theFile() << "M " << Number << "\t" << sz << "\t" << ptr << "\n";
+    return ptr;
+  }
+  
+  inline void free (void * ptr) {
+    theFile() << "F " << Number << "\t" << ptr << "\n";
+    Super::free (ptr);
+  }
+ 
+private:
+ 
+  FileObject& theFile (void) {
+    static FileObject f;
+    return f;
+  }
+ 
+  int& getRefs (void) {
+    static int refs = 0;
+    return refs;
+  }
+ 
+};
+ 
+ 
+#endif
+
+#if 0
+/* -*- C++ -*- */
+#ifndef _TRACEHEAP_H_
+#define _TRACEHEAP_H_
+// #include <iostream.h>
+//#include <fstream.h>
+#include <fstream>
+#include <map>
+
+template <class Super, int Number>
+class TraceHeap : public Super {
+public:
+  
+  TraceHeap (void)
+  {
+    if (!theFile().is_open()) {
+      printf ("OPEN\n");
+      theFile().open ("trace");
+    }
+    getRefs()++;
+  }
+  ~TraceHeap (void)
+  {
+    theFile() << ::std::flush;
+    --getRefs();
+    if (getRefs() == 0) {
+      if (theFile().is_open())
+	theFile().close();
+    }
+  }
+  inline void * malloc (size_t sz) {
+    void * ptr = Super::malloc (sz);
+    theFile() << "M\t" << sz << "\t" << ptr << "\n";
+    return ptr;
+  }
+  
+  inline void free (void * ptr) {
+    theFile() << "F\t" << ptr << "\n";
+    Super::free (ptr);
+  }
+private:
+  std::ofstream& theFile (void) {
+    static std::ofstream f;
+    return f;
+  }
+  int& getRefs (void) {
+    static int refs = 0;
+    return refs;
+  }
+};
+
+#endif
+#endif
Index: /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/tryheap.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/tryheap.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/tryheap.h	(revision 176)
@@ -0,0 +1,26 @@
+#ifndef _TRYHEAP_H_
+#define _TRYHEAP_H_
+
+template <class Heap1, class Heap2>
+class TryHeap : public Heap2 {
+public:
+  TryHeap (void)
+  {}
+
+  inline void * malloc (size_t sz) {
+    void * ptr = heap1.malloc (sz);
+    if (ptr == NULL)
+      ptr = Heap2::malloc (sz);
+    return ptr;
+  }
+
+  inline void free (void * ptr) {
+    heap1.free (ptr);
+  }
+
+private:
+	Heap1 heap1;
+};
+
+
+#endif
Index: /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/unique.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/unique.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/unique.h	(revision 176)
@@ -0,0 +1,109 @@
+/* -*- C++ -*- */
+
+#ifndef _UNIQUEHEAP_H_
+#define _UNIQUEHEAP_H_
+
+#include <stdlib.h>
+#include <new>
+
+/**
+ *
+ * @class UniqueHeap
+ * @brief Instantiates one instance of a class used for every malloc & free.
+ * @author Emery Berger
+ *
+ */
+
+template <class SuperHeap, class Child = int>
+class UniqueHeap {
+public:
+
+  /**
+   * Ensure that the super heap gets created,
+   * and add a reference for every instance of unique heap.
+   */
+  UniqueHeap (void) 
+  {
+    volatile SuperHeap * forceCreationOfSuperHeap = getSuperHeap();
+    addRef();
+  }
+
+  /**
+   * @brief Delete one reference to the unique heap.
+   * When the number of references goes to zero,
+   * delete the super heap.
+   */
+  ~UniqueHeap (void) {
+    int r = delRef();
+    if (r <= 0) {
+      getSuperHeap()->SuperHeap::~SuperHeap();
+    }
+  }
+
+  // The remaining public methods are just
+  // thin wrappers that route calls to the static object.
+
+  inline void * malloc (size_t sz) {
+    return getSuperHeap()->malloc (sz);
+  }
+  
+  inline void free (void * ptr) {
+    getSuperHeap()->free (ptr);
+  }
+  
+  inline size_t getSize (void * ptr) {
+    return getSuperHeap()->getSize (ptr);
+  }
+
+  inline int remove (void * ptr) {
+    return getSuperHeap()->remove (ptr);
+  }
+
+  inline void clear (void) {
+    getSuperHeap()->clear();
+  }
+
+#if 0
+  inline int getAllocated (void) {
+    return getSuperHeap()->getAllocated();
+  }
+
+  inline int getMaxAllocated (void) {
+    return getSuperHeap()->getMaxAllocated();
+  }
+
+  inline int getMaxInUse (void) {
+    return getSuperHeap()->getMaxInUse();
+  }
+#endif
+
+private:
+
+  /// Add one reference.
+  void addRef (void) {
+    getRefs() += 1;
+  }
+
+  /// Delete one reference count.
+  int delRef (void) {
+    getRefs() -= 1;
+    return getRefs();
+  }
+
+  /// Internal accessor for reference count.
+  int& getRefs (void) {
+    static int numRefs = 0;
+    return numRefs;
+  }
+
+  SuperHeap * getSuperHeap (void) {
+    static char superHeapBuffer[sizeof(SuperHeap)];
+    static SuperHeap * aSuperHeap = (SuperHeap *) (new ((char *) &superHeapBuffer) SuperHeap);
+    return aSuperHeap;
+  }
+
+  void doNothing (Child *) {}
+};
+
+
+#endif // _UNIQUE_H_
Index: /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/util/bitindex.cpp
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/util/bitindex.cpp	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/util/bitindex.cpp	(revision 176)
@@ -0,0 +1,38 @@
+#include "bitindex.h"
+
+// Definitions of static members of BitIndex.
+
+int BitIndex::index32[32];
+unsigned long BitIndex::on[32];
+unsigned long BitIndex::off[32];
+unsigned long BitIndex::lgtable[16];
+
+// Implementations.
+
+BitIndex::BitIndex (void)
+{
+  setup();
+}
+
+
+void BitIndex::setup (void)
+{
+  int t[] = { 0, 0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3};
+  int i;
+  for (i = 0; i < 32; i++) {
+    index32[ (debruijn32 << i) >> 27 ] = i;
+  }
+  for (i = 0; i < 16; i++) {
+    lgtable[i] = t[i];
+  }
+  for (i = 0; i < 32; i++) {
+    on[i] = 1 << i;
+    off[i] = ~on[i];
+  }
+}
+
+
+
+// One instance of BitIndex so everything will work.
+
+static BitIndex _hiddenBitIndex;
Index: /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/util/bitindex.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/util/bitindex.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/util/bitindex.h	(revision 176)
@@ -0,0 +1,107 @@
+/* -*- C++ -*- */
+
+/**
+ * @file bitindex.h
+ *
+ * Bit-access operations, including msb and lsb.
+ * @author Emery Berger (emery@cs.umass.edu)
+*/
+
+// lsb is due to Leiserson, Prokop, Randall (MIT).
+// msb is also a fast implementation of floor(lg_2).
+
+#ifndef _BITINDEX_H_
+#define _BITINDEX_H_
+
+#include <assert.h>
+
+namespace HL {
+
+class BitIndex {
+private:
+  
+  enum { debruijn32 = 0x077CB531UL };
+  static int index32[32];
+  static unsigned long lgtable[16];
+  static unsigned long on[32];
+  static unsigned long off[32];
+
+  void setup (void);
+
+public:
+
+  BitIndex (void);
+  ~BitIndex (void) {}
+
+  // Set bit_index in b (to 1).
+  static void set (unsigned long &b, int index)
+    {
+      assert (index >= 0);
+      assert (index < 32);
+      b |= on[index];
+    }
+
+  // Reset bit_index in b (set it to 0).
+  static void reset (unsigned long &b, int index)
+    {
+      assert (index >= 0);
+      assert (index < 32);
+      b &= off[index];
+    }
+
+  // Find the least-significant bit.
+  static int lsb (unsigned long b)
+    {
+      //#if 0
+#if 0 // i386
+      // Intel x86 code.
+      register unsigned long index = 0;
+      if (b > 0) {
+	asm ("bsfl %1, %0" : "=r" (index) : "r" (b));
+      }
+      return index;
+#else
+      b &= (unsigned long) -((signed long) b);
+      b *= debruijn32;
+      b >>= 27;
+      return index32[b];
+#endif
+    }
+
+  // Find the most-significant bit.
+  static int msb (unsigned long b)
+    {
+#if 0 // i386
+      // Intel x86 code.
+      register unsigned long index = 0;
+      if (b > 0) {
+	asm ("bsrl %1, %0" : "=r" (index) : "r" (b));
+      }
+      return index;
+#else
+      int l = 0;
+      // b < 2^32
+      if (b >= 65536) {
+	l += 16;
+	b >>= 16;
+      }
+      // b < 2^16
+      if (b >= 256) {
+	l += 8;
+	b >>= 8;
+      }
+      // b < 2^8
+      if (b >= 16) {
+	l += 4;
+	b >>= 4;
+      }
+      return l + lgtable[b];
+#endif
+    }
+
+  
+};
+
+};
+
+#endif
Index: /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/util/bitstring.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/util/bitstring.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/util/bitstring.h	(revision 176)
@@ -0,0 +1,218 @@
+// -*- C++ -*-
+
+/*
+
+  Heap Layers: An Extensible Memory Allocation Infrastructure
+  
+  Copyright (C) 2000-2004 by Emery Berger
+  http://www.cs.umass.edu/~emery
+  emery@cs.umass.edu
+  
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or
+  (at your option) any later version.
+  
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+  
+  You should have received a copy of the GNU General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+*/
+
+/**
+ * @file bitstring.h
+ * @brief A bit string data structure for use in memory allocators.
+ * @author Emery Berger <http://www.cs.umass.edu/~emery>
+ */
+
+#ifndef _BITSTRING_H_
+#define _BITSTRING_H_
+
+#include <assert.h>
+
+template <int N>
+class BitString {
+public:
+
+  BitString (void) {
+    clear();
+  }
+
+  inline void clear (void) {
+    for (int i = 0; i < NUM_ULONGS; i++) {
+      B[i] = ALL_ALLOCATED;
+    }
+    firstPos = 0;
+  }
+
+  // Bit = 1 == allocated.    
+  int allocate (int length, int alignment) {
+    // Start at the first entry.
+    for (int bitPos = firstPos; bitPos < N; ) {
+      // If the whole entry here is allocated,
+      // skip to the next one.
+      if (B[bitPos >> SHIFTS_PER_ULONG] == ALL_ALLOCATED) {
+	bitPos = ((bitPos >> SHIFTS_PER_ULONG) + 1) << SHIFTS_PER_ULONG;
+	// Adjust for alignment if needed.
+	while ((bitPos % alignment) != 0) {
+	  bitPos++;
+	}
+	continue;
+      }
+      // If this bit is set, skip to the next one.
+      if (get(bitPos)) {
+	bitPos += alignment;
+	continue;
+      }
+      // Got something free -- let's see if we have a run of the requisite length.
+      bool gotOne = true;
+      for (int j = 0; j < length; j++) {
+	if (get(bitPos + j)) {
+	  gotOne = false;
+	  bitPos += j;
+	  // Adjust for alignment if needed.
+	  while ((bitPos % alignment) != 0) {
+	    bitPos++;
+	  }
+	  break;
+	}
+      }
+      if (gotOne) {
+	// We found one - claim it!
+	for (int j = 0; j < length; j++) {
+	  set(bitPos + j);
+	}
+	return bitPos;
+      }
+    }
+    // Error - none found.
+    return -1;
+  }
+
+  void free (int bitPos, int length) {
+    for (int j = bitPos; j < bitPos + length; j++) {
+      reset (j);
+    }
+  }
+
+#if 0
+  inline int first (void) const {
+    for (int i = 0; i < NUM_ULONGS; i++) {
+      if (B[i] > 0) {
+	unsigned long index = 1U << (BITS_PER_ULONG-1);
+	for (int j = 0; j < BITS_PER_ULONG; j++) {
+	  if (B[i] & index) {
+	    return j + i * BITS_PER_ULONG;
+	  }
+	  index >>= 1;
+	}
+      }
+    }
+    return -1;
+  }
+#endif
+
+  inline int firstAfter (const int index) const {
+#if 0
+    for (int i = index; i < N; i++ ) {
+      int ind = i >> SHIFTS_PER_ULONG;
+      if (B[ind] & (1U << (i & (BITS_PER_ULONG - 1)))) {
+	return i;
+      }
+    }
+    return -1;
+#else
+    int indmask = index - (index >> SHIFTS_PER_ULONG) * BITS_PER_ULONG;
+    for (int i = index >> SHIFTS_PER_ULONG; i < NUM_ULONGS; i++) {
+      if (B[i]) {
+	unsigned long bitval = B[i];
+	bitval &= ~((1 << (indmask & (BITS_PER_ULONG - 1))) - 1);
+	if (bitval) {
+	  return (i * BITS_PER_ULONG + lsb(bitval));
+	}
+      }
+      indmask = indmask - BITS_PER_ULONG;
+      if (indmask < 0) {
+	indmask = 0;
+      }
+    }
+    return -1;
+#endif
+  }
+
+  inline bool get (const int index) const {
+    assert (index >= 0);
+    assert (index < N);
+    int ind = index >> SHIFTS_PER_ULONG;
+    assert (ind >= 0);
+    assert (ind < NUM_ULONGS);
+    return (B[ind] & (1U << (index & (BITS_PER_ULONG - 1))));
+  }
+
+  inline void set (const int index) {
+    assert (index >= 0);
+    assert (index < N);
+    int ind = index >> SHIFTS_PER_ULONG;
+    assert (ind >= 0);
+    assert (ind < NUM_ULONGS);
+    B[ind] |= (1U << (index & (BITS_PER_ULONG - 1)));
+    if (index < firstPos) {
+      firstPos = index;
+    }
+  }
+
+  inline void reset (const int index) {
+    assert (index >= 0);
+    assert (index < N);
+    int ind = index >> SHIFTS_PER_ULONG;
+    assert (ind >= 0);
+    assert (ind < NUM_ULONGS);
+    B[ind] &= ~(1U << (index & (BITS_PER_ULONG - 1)));
+  }
+
+  unsigned long operator() (int index) {
+    assert (index >= 0);
+    assert (index < NUM_ULONGS);
+    return B[index];
+  }
+
+
+private:
+
+#if 1 //  (sizeof(unsigned long),4)
+  enum { BITS_PER_ULONG = 32 };
+  enum { SHIFTS_PER_ULONG = 5 };
+#else
+  enum { BITS_PER_ULONG = 64 };
+  enum { SHIFTS_PER_ULONG = 6 };
+#endif
+
+  enum { ALL_ALLOCATED = (unsigned long) -1 };
+  enum { MAX_BITS = (N + BITS_PER_ULONG - 1) & ~(BITS_PER_ULONG - 1) };
+  enum { NUM_ULONGS = MAX_BITS / BITS_PER_ULONG };
+
+  unsigned long B[NUM_ULONGS];
+
+  /// The first set position.
+  int firstPos;
+
+  inline static int lsb (unsigned long b) {
+    static const int index32[32] = { 0, 1, 28, 2, 29, 14, 24, 3, 30, 22, 20, 15, 25, 17, 4, 8, 31, 27, 13, 23, 21, 19, 16, 7, 26, 12, 18, 6, 11, 5, 10, 9 };
+    const unsigned long debruijn32 = 0x077CB531UL;
+    b &= (unsigned long) -((signed long) b);
+    b *= debruijn32;
+    b >>= 27;
+    assert (b >= 0);
+    assert (b < 32);
+    return index32[b];
+  }
+
+};
+
+
+#endif
Index: /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/util/cpuinfo.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/util/cpuinfo.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/util/cpuinfo.h	(revision 176)
@@ -0,0 +1,232 @@
+// -*- C++ -*-
+
+/*
+
+  Heap Layers: An Extensible Memory Allocation Infrastructure
+  
+  Copyright (C) 2000-2003 by Emery Berger
+  http://www.cs.umass.edu/~emery
+  emery@cs.umass.edu
+  
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or
+  (at your option) any later version.
+  
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+  
+  You should have received a copy of the GNU General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+*/
+
+
+
+#ifndef _CPUINFO_H_
+#define _CPUINFO_H_
+
+#if defined(_WIN32)
+#include <windows.h>
+#include <process.h>
+#else
+#include <unistd.h>
+#endif
+
+
+#if !defined(_WIN32)
+#include <pthread.h>
+#endif
+
+#if defined(__SVR4) // Solaris
+#include <sys/lwp.h>
+extern "C" unsigned int lwp_self(void);
+#include <thread.h>
+extern "C" int _thr_self(void);
+#endif
+
+#if defined(__linux)
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <string.h>
+#include <unistd.h>
+#endif
+
+#if defined(__APPLE__)
+#include <sys/types.h>
+#include <sys/sysctl.h>
+#endif
+
+#if defined(__sgi)
+#include <sys/types.h>
+#include <sys/sysmp.h>
+#include <sys/sysinfo.h>
+#endif
+
+#if defined(hpux)
+#include <sys/mpctl.h>
+#endif
+
+#if defined(_WIN32)
+extern __declspec(thread) int localThreadId;
+#endif
+
+#if defined(__SVR4) && defined(MAP_ALIGN)
+extern volatile int anyThreadStackCreated;
+#endif
+
+namespace HL {
+
+/**
+ * @class CPUInfo
+ * @author Emery Berger <http://www.cs.umass.edu/~emery>
+ *
+ * @brief Architecture-independent wrapper to get number of CPUs. 
+ */
+
+class CPUInfo {
+public:
+  CPUInfo (void)
+  {}
+
+  inline static int getNumProcessors (void) {
+    static int _numProcessors = computeNumProcessors();
+    return _numProcessors;
+  }
+
+  static inline int getThreadId (void);
+  inline static int computeNumProcessors (void);
+
+};
+
+
+int CPUInfo::computeNumProcessors (void)
+{
+  static int np = 0;
+  if (!np) {
+#if defined(__linux)
+  // Ugly workaround.  Linux's sysconf indirectly calls malloc() (at
+  // least on multiprocessors).  So we just read the info from the
+  // proc file ourselves and count the occurrences of the word
+  // "processor".
+  
+  // We only parse the first 32K of the CPU file.  By my estimates,
+  // that should be more than enough for at least 64 processors.
+  enum { MAX_PROCFILE_SIZE = 32768 };
+  char line[MAX_PROCFILE_SIZE];
+  int fd = open ("/proc/cpuinfo", O_RDONLY);
+  if (!fd) {
+    return 1;
+  } else {
+    read (fd, line, MAX_PROCFILE_SIZE);
+    char * str = line;
+    np = 0;
+    while (str) {
+      str = strstr(str, "processor");
+      if (str) {
+	np++;
+	str++;
+      }
+    }
+    close (fd);
+    return np;
+  }
+#elif defined(_WIN32)
+  SYSTEM_INFO infoReturn[1];
+  GetSystemInfo (infoReturn);
+  np = (int) (infoReturn->dwNumberOfProcessors);
+  return np;
+#elif defined(__sgi)
+  np = (int) sysmp(MP_NAPROCS);
+  return np;
+#elif defined(hpux)
+  np = mpctl(MPC_GETNUMSPUS, NULL, NULL); // or pthread_num_processors_np()?
+  return np;
+#elif defined(_SC_NPROCESSORS_ONLN)
+  np = (int) (sysconf(_SC_NPROCESSORS_ONLN));
+  return np;
+#elif defined(__APPLE__)
+  size_t size = sizeof( np ); 
+  int name[] = { CTL_HW, HW_NCPU };
+  if ( ::sysctl( name, 2, & np, & size, 0, 0 ) ||
+       ( size != sizeof( np ) ) ) {
+     np = 2;
+  }
+  return np;
+#else
+  np = 2;
+  // Unsupported platform.
+  // Pretend we have at least two processors. This approach avoids the risk of assuming
+  // we're on a uniprocessor, which might lead clever allocators to avoid using atomic
+  // operations for all locks.
+  return np;
+#endif
+  } else {
+    return np;
+  }
+}
+
+  // Note: when stacksize arg is NULL for pthread_attr_setstacksize [Solaris],
+// stack size is 1 MB for 32-bit arch, 2 MB for 64-bit arch.
+// pthread_attr_getstacksize
+// pthread_attr_setstackaddr
+// pthread_attr_getstackaddr
+// PTHREAD_STACK_SIZE is minimum.
+// or should we just assume we have __declspec(thread) or __thread?
+
+#if defined(USE_THREAD_KEYWORD)
+  extern __thread int localThreadId;
+#endif
+
+
+int CPUInfo::getThreadId (void) {
+#if defined(__SVR4)
+  size_t THREAD_STACK_SIZE;
+  if (sizeof(size_t) <= 4) {
+    THREAD_STACK_SIZE = 1048576;
+  } else {
+    // 64-bits.
+    THREAD_STACK_SIZE = 1048576 * 2;
+  }
+  if (0) { // !anyThreadStackCreated) {
+    // We know a priori that all stack variables
+    // are on different stacks. Since no one has created
+    // a special one, we are in control, and thus all stacks
+    // are 1 MB in size and on 1 MB boundaries.
+    // (Actually: 1 MB for 32-bits, 2 MB for 64-bits.)
+    char buf;
+    return (((size_t) &buf) & ~(THREAD_STACK_SIZE-1)) >> 20;
+  } else {
+    return (int) pthread_self();
+  }
+#elif defined(_WIN32)
+  // It looks like thread id's are always multiples of 4, so...
+  return GetCurrentThreadId() >> 2;
+#elif defined(__BEOS__)
+  return find_thread(0);
+#elif defined(USE_THREAD_KEYWORD)
+  return localThreadId;
+#elif defined(__linux) || defined(PTHREAD_KEYS_MAX)
+  // Consecutive thread id's in Linux are 1024 apart;
+  // dividing off the 1024 gives us an appropriate thread id.
+  return (int) pthread_self() >> 10; // >> 20; // FIX ME 10 // (>> 10 = / 1024)
+#elif defined(POSIX) // FIX ME??
+  return (int) pthread_self();
+#elif USE_SPROC
+  // This hairiness has the same effect as calling getpid(),
+  // but it's MUCH faster since it avoids making a system call
+  // and just accesses the sproc-local data directly.
+  int pid = (int) PRDA->sys_prda.prda_sys.t_pid;
+  return pid;
+#else
+  return 0;
+#endif
+}
+
+}
+
+#endif
Index: /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/util/dllist.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/util/dllist.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/util/dllist.h	(revision 176)
@@ -0,0 +1,114 @@
+// -*- C++ -*-
+
+/*
+
+  Heap Layers: An Extensible Memory Allocation Infrastructure
+  
+  Copyright (C) 2000-2003 by Emery Berger
+  http://www.cs.umass.edu/~emery
+  emery@cs.umass.edu
+  
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or
+  (at your option) any later version.
+  
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+  
+  You should have received a copy of the GNU General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+*/
+
+#ifndef _DLLIST_H_
+#define _DLLIST_H_
+
+#include <assert.h>
+
+/**
+ *
+ * @class DLList
+ * @brief A "memory neutral" doubly-linked list.
+ * @author Emery Berger
+ */
+
+namespace HL {
+
+class DLList {
+public:
+
+  inline DLList (void) {
+    clear();
+  }
+
+  class Entry;
+  
+  /// Clear the list.
+  inline void clear (void) {
+    head.setPrev (&head);
+    head.setNext (&head);
+  }
+
+  /// Is the list empty?
+  inline bool isEmpty (void) const {
+    return (head.getNext() == &head);
+  }
+
+  /// Get the head of the list.
+  inline Entry * get (void) {
+    const Entry * e = head.next;
+    if (e == &head) {
+      return NULL;
+    }
+    head.next = e->next;
+    head.next->prev = &head;
+    return (Entry *) e;
+  }
+
+  /// Remove one item from the list.
+  inline void remove (Entry * e) {
+    e->remove();
+  }
+
+  /// Insert an entry into the head of the list.
+  inline void insert (Entry * e) {
+    e->insert (&head, head.next);
+  }
+
+  /// An entry in the list.
+  class Entry {
+  public:
+    //  private:
+    inline void setPrev (Entry * p) { assert (p != NULL); prev = p; }
+    inline void setNext (Entry * p) { assert (p != NULL); next = p; }
+    inline Entry * getPrev (void) const { return prev; }
+    inline Entry * getNext (void) const { return next; }
+    inline void remove (void) const {
+      prev->setNext(next);
+      next->setPrev(prev);
+    }
+    inline void insert (Entry * p, Entry * n) {
+      prev = p;
+      next = n;
+      p->setNext (this);
+      n->setPrev (this);
+    }
+    Entry * prev;
+    Entry * next;
+  };
+
+
+private:
+
+  /// The head of the list.
+  Entry head;
+
+};
+
+};
+
+#endif
Index: /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/util/dynarray.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/util/dynarray.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/util/dynarray.h	(revision 176)
@@ -0,0 +1,140 @@
+/*
+
+  Heap Layers: An Extensible Memory Allocation Infrastructure
+  
+  Copyright (C) 2000-2003 by Emery Berger
+  http://www.cs.umass.edu/~emery
+  emery@cs.umass.edu
+  
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or
+  (at your option) any later version.
+  
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+  
+  You should have received a copy of the GNU General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+*/
+
+#ifndef _DYNARRAY_H_
+#define _DYNARRAY_H_
+
+#include <assert.h>
+#include <stdlib.h>
+
+/**
+ * @class DynamicArray
+ * @brief A dynamic array that grows to fit any index for assignment.
+ *
+ * This array also features a clear() method,
+ * to free the entire array, and a trim(n) method,
+ * which tells the array it is no bigger than n elements.
+ */
+
+namespace HL {
+
+template <class ObjType>
+class DynamicArray {
+public:
+  DynamicArray (void)
+    : internalArray (NULL),
+      internalArrayLength (0)
+  {}
+
+  ~DynamicArray (void)
+  {
+    clear();
+  }
+
+  /// Clear deletes everything in the array.
+  inline void clear (void) {
+    if (internalArray != NULL) {
+      delete internalArray;
+      internalArray = NULL;
+      internalArrayLength = 0;
+      //printf ("\ninternalArrayLength %x = %d\n", this, internalArrayLength);
+    }
+  }
+
+  /// Read-only access to an array element; asserts that index is in range.
+  inline const ObjType& operator[] (int index) const {
+    assert (index < internalArrayLength);
+    assert (index >= 0);
+    return internalArray[index];
+  }
+
+  /// Access an array index by reference, growing the array if necessary.
+  inline ObjType& operator[] (int index) {
+    assert (index >= 0);
+    if (index >= internalArrayLength) {
+
+      // This index is beyond the current size of the array.
+      // Grow the array by doubling and copying the old array into the new.
+
+      const int newSize = index * 2 + 1;
+      ObjType * arr = new ObjType[newSize];
+#if MALLOC_TRACE
+      printf ("m %x %d\n", arr, newSize * sizeof(ObjType));
+#endif
+      if (internalArray != NULL) {
+	memcpy (arr, internalArray, internalArrayLength * sizeof(ObjType));
+	delete internalArray;
+#if MALLOC_TRACE
+	printf ("f %x\n", internalArray);
+#endif
+      }
+      internalArray = arr;
+      internalArrayLength = newSize;
+      //printf ("\ninternalArrayLength %x = %d\n", this, internalArrayLength);
+    }
+    return internalArray[index];
+  }
+
+  /**
+   * Trim informs the array that it is now only nelts long
+   * as far as the client is concerned. This may trigger
+   * shrinking of the array.
+   */
+  inline void trim (int nelts) {
+
+    // Halve the array if the number of elements
+    // drops below one-fourth of the array size.
+
+    if (internalArray != NULL) {
+      if (nelts * 4 < internalArrayLength) {
+	const int newSize = nelts * 2;
+	ObjType * arr = new ObjType[newSize];
+#if MALLOC_TRACE
+	printf ("m %x %d\n", arr, newSize * sizeof(ObjType));
+#endif
+	memcpy (arr, internalArray, sizeof(ObjType) * nelts);
+	delete internalArray;
+#if MALLOC_TRACE
+	printf ("f %x\n", internalArray);
+#endif
+	internalArray = arr;
+	internalArrayLength = newSize;
+      }
+      assert (nelts <= internalArrayLength);
+    }
+  }
+
+
+private:
+
+  /// The pointer to the current array.
+  ObjType * internalArray;
+
+  /// The length of the internal array, in elements.
+  int internalArrayLength;
+};
+
+};
+
+#endif
Index: /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/util/fred.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/util/fred.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/util/fred.h	(revision 176)
@@ -0,0 +1,96 @@
+// -*- C++ -*-
+
+#ifndef _FRED_H_
+#define _FRED_H_
+
+/// A thread-wrapper of childlike simplicity :).
+
+#if defined(_WIN32)
+
+  #include <windows.h>
+  #include <process.h>
+
+#elif defined(__SVR4)
+
+  #include <thread.h>
+  #include <pthread.h>
+  #include <unistd.h>
+
+#else
+
+  #include <pthread.h>
+  #include <unistd.h>
+
+#endif
+
+namespace HL {
+
+  extern "C" typedef void * (*ThreadFunctionType) (void *);
+
+class Fred {
+public:
+
+  Fred (void) {
+#if !defined(_WIN32)
+    pthread_attr_init (&attr);
+#endif
+  }
+
+  ~Fred (void) {
+#if !defined(_WIN32)
+    pthread_attr_destroy (&attr);
+#endif
+  }
+
+  void create (ThreadFunctionType function, void * arg) {
+#if defined(_WIN32)
+    t = CreateThread (0, 0, (LPTHREAD_START_ROUTINE) *function, (LPVOID) arg, 0, 0);
+#else
+    pthread_create (&t, &attr, function, arg);
+#endif
+  }
+
+  void join (void) {
+#if defined(_WIN32)
+    WaitForSingleObject (t, INFINITE);
+#else
+    pthread_join (t, NULL);
+#endif
+  }
+
+  static void yield (void) {
+#if defined(_WIN32)
+    Sleep (0);
+#elif defined(__SVR4)
+    thr_yield();
+#else
+    sched_yield();
+#endif
+  }
+
+
+  static void setConcurrency (int n) {
+#if defined(_WIN32)
+#elif defined(__SVR4)
+    thr_setconcurrency (n);
+#else
+    pthread_setconcurrency (n);
+#endif
+  }
+
+
+private:
+#if defined(_WIN32)
+  typedef HANDLE FredType;
+#else
+  typedef pthread_t FredType;
+  pthread_attr_t attr;
+#endif
+
+  FredType t;
+};
+
+}
+
+
+#endif
Index: /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/util/guard.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/util/guard.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/util/guard.h	(revision 176)
@@ -0,0 +1,26 @@
+// -*- C++ -*-
+
+#ifndef _GUARD_H_
+#define _GUARD_H_
+
+namespace HL {
+
+  template <class LockType>
+  class Guard {
+  public:
+    inline Guard (LockType& l)
+      : _lock (l)
+      {
+	_lock.lock();
+      }
+
+    inline ~Guard (void) {
+      _lock.unlock();
+    }
+  private:
+    LockType& _lock;
+  };
+
+}
+
+#endif
Index: /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/util/hash.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/util/hash.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/util/hash.h	(revision 176)
@@ -0,0 +1,26 @@
+#ifndef _HL_HASH_H_
+#define _HL_HASH_H_
+
+#include <stdlib.h>
+
+namespace HL {
+  template <typename Key>
+    extern size_t hash (Key k);
+  
+  template <>
+    inline size_t hash (void * v) {
+    return (size_t) v;
+  }
+  
+  template <>
+    inline size_t hash (const void * v) {
+    return (size_t) ((size_t) v);
+  }
+  
+  template <>
+    inline size_t hash (int v) {
+    return (size_t) v;
+  }
+};
+
+#endif
Index: /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/util/myhashmap.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/util/myhashmap.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/util/myhashmap.h	(revision 176)
@@ -0,0 +1,110 @@
+// -*- C++ -*-
+
+#ifndef _HL_MYHASHMAP_H_
+#define _HL_MYHASHMAP_H_
+
+#include <assert.h>
+#include "hash.h"
+
+namespace HL {
+
+template <typename Key,
+	  typename Value,
+	  class Allocator>
+class MyHashMap {
+
+public:
+
+  MyHashMap (int size = INITIAL_NUM_BINS)
+    : num_bins (size)
+  {
+    bins = new (alloc.malloc (sizeof(ListNodePtr) * num_bins)) ListNodePtr;
+    for (int i = 0 ; i < num_bins; i++) {
+      bins[i] = NULL;
+    }
+  }
+
+  void set (Key k, Value v) {
+    int binIndex = (unsigned int) hash(k) % num_bins;
+    ListNode * l = bins[binIndex];
+    while (l != NULL) {
+      if (l->key == k) {
+	l->value = v;
+	return;
+      }
+      l = l->next;
+    }
+    // Didn't find it.
+    insert (k, v);
+  }
+
+  Value get (Key k) {
+    int binIndex = (unsigned int) hash(k) % num_bins;
+    ListNode * l = bins[binIndex];
+    while (l != NULL) {
+      if (l->key == k) {
+	return l->value;
+      }
+      l = l->next;
+    }
+    // Didn't find it.
+    return 0;
+  }
+
+  void erase (Key k) {
+    int binIndex = (unsigned int) hash(k) % num_bins;
+    ListNode * curr = bins[binIndex];
+    ListNode * prev = NULL;
+    while (curr != NULL) {
+      if (curr->key == k) {
+	// Found it.
+	if (curr != bins[binIndex]) {
+	  assert (prev->next == curr);
+	  prev->next = prev->next->next;
+	  alloc.free (curr);
+	} else {
+	  ListNode * n = bins[binIndex]->next;
+	  alloc.free (bins[binIndex]);
+	  bins[binIndex] = n;
+	}
+	return;
+      }
+      prev = curr;
+      curr = curr->next;
+    }
+  }
+
+
+private:
+
+  void insert (Key k, Value v) {
+    int binIndex = (unsigned int) hash(k) % num_bins;
+    ListNode * l = new (alloc.malloc (sizeof(ListNode))) ListNode;
+    l->key = k;
+    l->value = v;
+    l->next = bins[binIndex];
+    bins[binIndex] = l;
+  }
+
+  enum { INITIAL_NUM_BINS = 511 };
+
+  class ListNode {
+  public:
+    ListNode (void)
+      : next (NULL)
+    {}
+    Key key;
+    Value value;
+    ListNode * next;
+  };
+
+  int num_bins;
+
+  typedef ListNode * ListNodePtr;
+  ListNodePtr * bins;
+  Allocator alloc;
+};
+
+};
+
+#endif
Index: /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/util/posixlock.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/util/posixlock.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/util/posixlock.h	(revision 176)
@@ -0,0 +1,73 @@
+/* -*- C++ -*- */
+
+/*
+
+  Heap Layers: An Extensible Memory Allocation Infrastructure
+  
+  Copyright (C) 2000-2003 by Emery Berger
+  http://www.cs.umass.edu/~emery
+  emery@cs.umass.edu
+  
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or
+  (at your option) any later version.
+  
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+  
+  You should have received a copy of the GNU General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+*/
+
+#ifndef _POSIXLOCK_H_
+#define _POSIXLOCK_H_
+
+#if !defined(_WIN32)
+
+#include <pthread.h>
+
+/**
+ * @class PosixLockType
+ * @brief Locking using POSIX mutex objects.
+ */
+
+namespace HL {
+
+class PosixLockType {
+public:
+
+  PosixLockType (void)
+  {
+    pthread_mutex_init (&mutex, NULL);
+  }
+  
+  ~PosixLockType (void)
+  {
+    pthread_mutex_destroy (&mutex);
+  }
+  
+  void lock (void) {
+    pthread_mutex_lock (&mutex);
+  }
+  
+  void unlock (void) {
+    pthread_mutex_unlock (&mutex);
+  }
+  
+private:
+  union {
+    pthread_mutex_t mutex;
+    double _dummy[sizeof(pthread_mutex_t)/sizeof(double) + 1];
+  };
+};
+
+}
+
+#endif
+
+#endif
Index: /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/util/recursivelock.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/util/recursivelock.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/util/recursivelock.h	(revision 176)
@@ -0,0 +1,66 @@
+/* -*- C++ -*- */
+
+#ifndef _RECURSIVELOCK_H_
+#define _RECURSIVELOCK_H_
+
+/**
+ * @class RecursiveLockType
+ * @brief Implements a recursive lock using some base lock representation.
+ * @param BaseLock The base lock representation.
+ */
+
+namespace HL {
+
+template <class BaseLock>
+class RecursiveLockType : public BaseLock {
+public:
+
+  inline RecursiveLockType (void);
+
+  inline void lock (void);
+  inline void unlock (void);
+
+private:
+  int tid;	/// The lock owner's thread id. -1 if unlocked.
+  int count;	/// The recursion depth of the lock.
+};
+
+
+};
+
+template <class BaseLock>
+HL::RecursiveLockType<BaseLock>::RecursiveLockType (void)
+  : tid (-1),
+    count (0)
+{}
+
+template <class BaseLock>
+void HL::RecursiveLockType<BaseLock>::lock (void) {
+  int currthread = GetCurrentThreadId();
+  if (tid == currthread) {
+    count++;
+  } else {
+    BaseLock::lock();
+    tid = currthread;
+    count++;
+  }
+}
+
+template <class BaseLock>
+void HL::RecursiveLockType<BaseLock>::unlock (void) {
+  int currthread = GetCurrentThreadId();
+  if (tid == currthread) {
+    count--;
+    if (count == 0) {
+      tid = -1;
+      BaseLock::unlock();
+    }
+  } else {
+    // We tried to unlock it but we didn't lock it!
+    // This should never happen.
+    assert (0);
+    abort();
+  }
+}
+
+#endif
Index: /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/util/sassert.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/util/sassert.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/util/sassert.h	(revision 176)
@@ -0,0 +1,30 @@
+#ifndef _SASSERT_H_
+#define _SASSERT_H_
+
+/**
+ * @class  sassert
+ * @brief  Implements compile-time assertion checking.
+ * @author Emery Berger <http://www.cs.umass.edu/~emery>
+ *
+ * @code
+ *   sassert<(1+1 == 2)> CheckOnePlusOneIsTwo;
+ * @endcode
+ *
+ * This code is part of the Hoard distribution and is governed by its license.
+ * <http://www.hoard.org>
+ *
+ */
+
+namespace HL {
+
+  template <int assertion>
+    class sassert;
+
+  template<> class sassert<1> {
+  public:
+    enum { VALUE = 1 };
+  };
+
+}
+
+#endif
Index: /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/util/sllist.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/util/sllist.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/util/sllist.h	(revision 176)
@@ -0,0 +1,103 @@
+// -*- C++ -*-
+
+/*
+
+  Heap Layers: An Extensible Memory Allocation Infrastructure
+  
+  Copyright (C) 2000-2003 by Emery Berger
+  http://www.cs.umass.edu/~emery
+  emery@cs.umass.edu
+  
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or
+  (at your option) any later version.
+  
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+  
+  You should have received a copy of the GNU General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+*/
+
+#ifndef _SLLIST_H_
+#define _SLLIST_H_
+
+#include <assert.h>
+
+/**
+ * @class SLList
+ * @brief A "memory neutral" singly-linked list.
+ * @author Emery Berger
+ */
+
+namespace HL {
+
+  class SLList {
+  public:
+    
+    inline SLList (void) {
+      clear();
+    }
+
+    class Entry;
+  
+    /// Clear the list.
+    inline void clear (void) {
+      head.next = NULL;
+    }
+
+    /// Get the head of the list.
+    inline Entry * get (void) {
+      const Entry * e = head.next;
+      if (e == NULL) {
+	return NULL;
+      }
+      head.next = e->next;
+      return (Entry *) e;
+    }
+
+  private:
+
+    /**
+     * @brief Remove one item from the list.
+     * @warning This method aborts the program if called.
+     */
+    inline void remove (Entry *) {
+      abort();
+    }
+
+  public:
+
+    /// Inserts an entry into the head of the list.
+    inline void insert (Entry * e) {
+      e->next = head.next;
+      head.next = e;
+    }
+
+    /// An entry in the list.
+    class Entry {
+    public:
+      inline Entry (void)
+	: next (NULL)
+      {}
+      //  private:
+      //    Entry * prev;
+    public:
+      Entry * next;
+    };
+
+  private:
+
+    /// The head of the list.
+    Entry head;
+
+  };
+
+}
+
+#endif
Index: /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/util/sparc-interchange.il
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/util/sparc-interchange.il	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/util/sparc-interchange.il	(revision 176)
@@ -0,0 +1,7 @@
+.inline MyInterlockedExchange,8
+ 
+mov %o0,%o2
+mov %o1,%o0
+swap [%o2],%o0
+ 
+.end
Index: /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/util/timer.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/util/timer.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/util/timer.h	(revision 176)
@@ -0,0 +1,368 @@
+/* -*- C++ -*- */
+
+/*
+
+  Heap Layers: An Extensible Memory Allocation Infrastructure
+  
+  Copyright (C) 2000-2003 by Emery Berger
+  http://www.cs.umass.edu/~emery
+  emery@cs.umass.edu
+  
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or
+  (at your option) any later version.
+  
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+  
+  You should have received a copy of the GNU General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+*/
+
+#include <assert.h>
+#include <stdio.h>
+
+
+#ifndef _TIMER_H_
+#define _TIMER_H_
+
+/**
+ * @class Timer
+ * @brief A portable class for high-resolution timing.
+ *
+ * This class simplifies timing measurements across a number of platforms.
+ * 
+ * @code
+ *  Timer t;
+ *  t.start();
+ *  // do some work
+ *  t.stop();
+ *  cout << "That took " << (double) t << " seconds." << endl;
+ * @endcode
+ *
+ */
+
+#ifdef __APPLE__
+#include <sys/time.h>
+#endif
+
+#if defined(linux) && defined(__GNUG__) && defined(__i386__)
+
+#include <stdio.h>
+#include <limits.h>
+#include <time.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <string.h>
+
+static void getTime (unsigned long& tlo, unsigned long& thi) {
+  asm volatile ("rdtsc"
+		: "=a"(tlo),
+		"=d" (thi));
+}
+
+
+static double getFrequency (void) {
+  static double freq = 0.0;
+  static bool initialized = false;
+  unsigned long LTime0, LTime1, HTime0, HTime1;
+  if (!initialized) { 
+
+    // Compute MHz directly.
+    // Wait for approximately one second.
+    
+    getTime (LTime0, HTime0);
+    //    printf ("waiting...\n");
+    sleep (1);
+    // printf ("done.\n");
+    getTime (LTime1, HTime1);
+
+    freq = (double)(LTime1 - LTime0) + (double)(UINT_MAX)*(double)(HTime1 - HTime0);
+    if (LTime1 < LTime0) {
+      freq -= (double)UINT_MAX;
+    }
+    initialized = true;
+
+  } else {
+    // printf ("wha?\n");
+  }
+  return freq;
+}
+
+// FIX ME
+#include <iostream>
+using namespace std;
+
+namespace HL {
+
+class Timer {
+public:
+  Timer (void)
+    : timeElapsed (0.0)
+  {
+    _frequency = getFrequency();
+    //    printf ("wooo!\n");
+    //  printf ("freq = %lf\n", frequency);
+  }
+  void start (void) {
+    getTime (currentLo, currentHi);
+  }
+  void stop (void) {
+    unsigned long lo, hi;
+    getTime (lo, hi);
+    double now = (double) hi * 4294967296.0 + lo;
+    double prev = (double) currentHi * 4294967296.0 + currentLo;
+    timeElapsed = (now - prev) / _frequency;
+  }
+
+  operator double (void) {
+    return timeElapsed;
+  }
+
+private:
+  double timeElapsed;
+  unsigned long currentLo, currentHi;
+  double _frequency;
+};
+
+};
+
+#else
+
+
+#ifdef __SVR4 // Solaris
+#include <sys/time.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <sys/procfs.h>
+#include <stdio.h>
+#endif // __SVR4
+
+#include <time.h>
+
+#if defined(unix) || defined(__linux)
+#include <sys/time.h>
+#include <unistd.h>
+#endif
+
+
+#ifdef __sgi
+#include <sys/types.h>
+#include <sys/times.h>
+#include <limits.h>
+#endif
+
+
+#if defined(_WIN32)
+#include <windows.h>
+#endif
+
+
+#if defined(__BEOS__)
+#include <OS.h>
+#endif
+
+
+namespace HL {
+
+class Timer {
+
+public:
+
+  /// Initializes the timer.
+  Timer (void)
+#if !defined(_WIN32)
+    : _starttime (0),
+      _elapsedtime (0)
+#endif
+  {
+  }
+
+  /// Start the timer.
+  void start (void) { _starttime = _time(); }
+
+  /// Stop the timer.
+  void stop (void) { _elapsedtime += _time() - _starttime; }
+
+  /// Reset the timer.
+  void reset (void) { _starttime = _elapsedtime; }
+
+#if 0
+  // Set the timer.
+  void set (double secs) { _starttime = 0; _elapsedtime = _sectotime (secs);}
+#endif
+
+  /// Return the number of seconds elapsed.
+  operator double (void) { return _timetosec (_elapsedtime); }
+
+  static double currentTime (void) { TimeType t; t = _time(); return _timetosec (t); }
+
+
+private:
+
+  // The _timer variable will be different depending on the OS.
+  // We try to use the best timer available.
+
+#ifdef __sgi
+#define TIMER_FOUND
+
+  long _starttime, _elapsedtime;
+
+  long _time (void) {
+    struct tms t;
+    long ticks = times (&t);
+    return ticks;
+  }
+
+  static double _timetosec (long t) {
+    return ((double) (t) / CLK_TCK);
+  }
+
+  static long _sectotime (double sec) {
+    return (long) sec * CLK_TCK;
+  }
+#endif
+
+#ifdef __SVR4 // Solaris
+#define TIMER_FOUND
+  typedef hrtime_t TimeType;
+  TimeType	_starttime, _elapsedtime;
+
+  static TimeType _time (void) {
+    return gethrtime();
+  }
+
+  static TimeType _sectotime (double sec) { return (hrtime_t) (sec * 1.0e9); }
+
+  static double _timetosec (TimeType& t) {
+    return ((double) (t) / 1.0e9);
+  }
+#endif // __SVR4
+
+#if defined(MAC) || defined(macintosh)
+#define TIMER_FOUND
+  double		_starttime, _elapsedtime;
+
+  double _time (void) {
+    return get_Mac_microseconds();
+  }
+
+  double _timetosec (hrtime_t& t) {
+    return t;
+  }
+#endif // MAC
+
+#ifdef _WIN32
+#define TIMER_FOUND
+
+#ifndef __GNUC__
+  class TimeType {
+  public:
+    TimeType (void)
+    {
+      largeInt.QuadPart = 0;
+    }
+    operator double& (void) { return (double&) largeInt.QuadPart; }
+    operator LARGE_INTEGER& (void) { return largeInt; }
+    double timeToSec (void) {
+      return (double) largeInt.QuadPart / getFreq();
+    }
+  private:
+    double getFreq (void) {
+      QueryPerformanceFrequency (&freq);
+      return (double) freq.QuadPart;
+    }
+
+    LARGE_INTEGER largeInt;
+    LARGE_INTEGER freq;
+  };
+
+  TimeType _starttime, _elapsedtime;
+
+  static TimeType _time (void) {
+    TimeType t;
+    int r = QueryPerformanceCounter (&((LARGE_INTEGER&) t));
+    assert (r);
+    return t;
+  }
+
+  static double _timetosec (TimeType& t) {
+    return t.timeToSec();
+  }
+#else
+  typedef DWORD TimeType;
+  DWORD _starttime, _elapsedtime;
+  static DWORD _time (void) {
+    return GetTickCount();
+  }
+
+  static double _timetosec (DWORD& t) {
+    return (double) t / 100000.0;
+  }
+  static unsigned long _sectotime (double sec) {
+    return (unsigned long)(sec);
+  }
+#endif
+#endif // _WIN32
+
+
+#ifdef __BEOS__
+#define TIMER_FOUND
+  bigtime_t _starttime, _elapsedtime;
+  bigtime_t _time(void) {
+    return system_time();
+  }
+  double _timetosec (bigtime_t& t) {
+    return (double) t / 1000000.0;
+  }
+  
+  bigtime_t _sectotime (double sec) {
+    return (bigtime_t)(sec * 1000000.0);
+  }
+#endif // __BEOS__
+
+#ifndef TIMER_FOUND
+
+  typedef long TimeType;
+  TimeType _starttime, _elapsedtime;
+
+  static TimeType _time (void) {
+    struct timeval t;
+    gettimeofday (&t, NULL);
+    return t.tv_sec * 1000000 + t.tv_usec;
+  }
+
+  static double _timetosec (TimeType t) {
+    return ((double) (t) / 1000000.0);
+  }
+
+  static TimeType _sectotime (double sec) {
+    return (TimeType) (sec * 1000000.0);
+  }
+
+#endif // TIMER_FOUND
+
+#undef TIMER_FOUND
+
+};
+
+
+#ifdef __SVR4 // Solaris
+class VirtualTimer : public Timer {
+public:
+  hrtime_t _time (void) {
+    return gethrvtime();
+  }
+};  
+#endif
+
+};
+
+#endif
+
+#endif
Index: /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/util/winlock.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/util/winlock.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/util/winlock.h	(revision 176)
@@ -0,0 +1,95 @@
+/* -*- C++ -*- */
+
+#ifndef _WINLOCK_H_
+#define _WINLOCK_H_
+
+#if defined(_WIN32)
+
+#include <windows.h>
+
+/**
+ * @class WinLockType
+ * @brief Locking using Win32 mutexes.
+ *
+ * Note that this lock type detects whether we are running on a
+ * multiprocessor.  If not, then we do not use atomic operations.
+ */
+
+#if 1
+
+namespace HL {
+
+class WinLockType {
+public:
+
+  WinLockType (void)
+    : mutex (0)
+  {}
+
+  ~WinLockType (void)
+  {
+    mutex = 0;
+  }
+
+  inline void lock (void) {
+#if 1
+    // We're on a multiprocessor - use atomic operations.
+    while (InterlockedExchange ((long *) &mutex, 1) != 0) 
+      Sleep (0);
+#endif
+  }
+
+  inline void unlock (void) {
+    mutex = 0;
+    // InterlockedExchange (&mutex, 0);
+  }
+
+private:
+  unsigned int mutex;
+  bool onMultiprocessor (void) {
+    SYSTEM_INFO infoReturn[1];
+    GetSystemInfo (infoReturn);
+    if (infoReturn->dwNumberOfProcessors == 1) {
+      return FALSE;
+    } else {
+      return TRUE;
+    }
+  }
+};
+
+};
+
+#else
+
+#include <windows.h>
+
+class WinLockType {
+public:
+
+  WinLockType (void)
+  {
+    InitializeCriticalSection(&mutex);
+  }
+
+  ~WinLockType (void)
+  {
+    DeleteCriticalSection(&mutex);
+  }
+
+  inline void lock (void) {
+    EnterCriticalSection(&mutex);
+  }
+
+  inline void unlock (void) {
+    LeaveCriticalSection(&mutex);
+  }
+
+private:
+  CRITICAL_SECTION mutex;
+};
+
+#endif
+
+#endif
+
+#endif
Index: /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/util/x86-interchange.il
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/util/x86-interchange.il	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/util/x86-interchange.il	(revision 176)
@@ -0,0 +1,8 @@
+.inline MyInterlockedExchange,0
+ 
+movl (%esp),%ecx
+movl 4(%esp),%eax
+lock
+xchgl %eax,(%ecx)
+ 
+.end
Index: /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/util/x86_64-interchange.il
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/util/x86_64-interchange.il	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/util/x86_64-interchange.il	(revision 176)
@@ -0,0 +1,7 @@
+.inline MyInterlockedExchange,0
+ 
+movq %rsi,%rax
+lock
+xchgq %rax,(%rdi)
+
+.end
Index: /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/utility.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/utility.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/utility.h	(revision 176)
@@ -0,0 +1,102 @@
+/* -*- C++ -*- */
+
+#ifndef _UTILITY_H_
+#define _UTILITY_H_
+
+/**
+ * @file utility.h
+ * @brief Convenient wrappers that let us new up & delete objects from heaps.
+ *
+ * 
+ * Example:<BR>
+ * <TT>
+ *
+ * Heap h;<BR>
+ * <BR> 
+ * Foo * foo;<BR>
+ * newObject (foo,h);    		// instead of: foo = new Foo;<BR>
+ * deleteObject (foo,h);     		// instead of: delete foo;<BR>
+ * <BR>
+ * Foo * foo2;<BR>
+ * newArray (foo2, 10, h); 		// instead of: foo2 = new Foo[10];<BR>
+ * deleteArray (foo2, h);     		// instead of: delete [] foo2;<BR>
+ *
+*/
+
+#include <new.h>
+
+
+// Construct an object on a given heap.
+class newObject {
+public:
+  template <class Heap, class Object>
+  inline void operator() (Object*& o, Heap& h) const {
+    o = new (h.malloc (sizeof(Object))) Object;
+  }
+
+  template <class Heap, class Object, class A1>
+  inline void operator() (Object*& o, const A1& a1, Heap& h) const {
+    o = new (h.malloc (sizeof(Object))) Object (a1);
+  }
+
+  template <class Heap, class Object, class A1, class A2>
+  inline void operator() (Object*& o, const A1& a1, const A2& a2, Heap& h) const {
+    o = new (h.malloc (sizeof(Object))) Object (a1, a2);
+  }
+
+  template <class Heap, class Object, class A1, class A2, class A3>
+  inline void operator() (Object*& o, const A1& a1, const A2& a2, const A3& a3, Heap& h) const {
+    o = new (h.malloc (sizeof(Object))) Object (a1, a2, a3);
+  }
+};
+
+
+// Delete an object to a given heap.
+class deleteObject {
+public:
+  template <class Heap, class Object>
+  inline void operator()(Object*& o, Heap& h) {
+    o->~Object();
+    h.free (o);
+  }
+};
+
+
+class newArray {
+public:
+  template <class Heap, class Object>
+  inline void operator() (Object*& o, unsigned int n, Heap& h) const {
+    // Store the number of array elements in the beginning of the space.
+    double * ptr = (double *) h.malloc (sizeof(Object) * n + sizeof(double));
+    *((unsigned int *) ptr) = n;
+    // Initialize every element.
+    ptr++;
+    Object * ptr2 = (Object *) ptr;
+	// Save the pointer to the start of the array.
+	o = ptr2;
+	// Now iterate and construct every object in place.
+    for (unsigned int i = 0; i < n; i++) {
+      new ((void *) ptr2) Object;
+      ptr2++;
+    }
+  }
+};
+
+
+class deleteArray {
+public:
+  template <class Heap, class Object>
+  inline void operator()(Object*& o, Heap& h) const {
+    unsigned int n = *((unsigned int *) ((double *) o - 1));
+    Object * optr = o;
+    // Call the destructor on every element in the array.
+    for (unsigned int i = 0; i < n; i++) {
+      optr->~Object();
+      optr++;
+    }
+	// Free the array.
+    h.free ((void *) ((double *) o - 1));
+  }
+};
+
+#endif
Index: /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/wrapper.cpp
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/wrapper.cpp	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/wrapper.cpp	(revision 176)
@@ -0,0 +1,320 @@
+/* -*- C++ -*- */
+
+/*
+
+  Heap Layers: An Extensible Memory Allocation Infrastructure
+  
+  Copyright (C) 2000-2007 by Emery Berger
+  http://www.cs.umass.edu/~emery
+  emery@cs.umass.edu
+  
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or
+  (at your option) any later version.
+  
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+  
+  You should have received a copy of the GNU General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+*/
+
+/*
+ * @file   wrapper.cpp
+ * @brief  Replaces malloc with appropriate calls to TheCustomHeapType.
+ * @author Emery Berger <http://www.cs.umass.edu/~emery>
+ */
+
+#include <string.h> // for memcpy
+
+#if defined(__APPLE__)
+#include <malloc/malloc.h>
+#elif defined(__FreeBSD__)
+#include <stdlib.h>
+#else
+#include <malloc.h> // for memalign
+#endif
+
+#ifdef _WIN32
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+// Disable warnings about long (> 255 chars) identifiers.
+#pragma warning(disable:4786)
+// Set inlining to the maximum possible depth.
+#pragma inline_depth(255)
+#pragma warning(disable: 4074)	// initializers put in compiler reserved area
+#pragma init_seg(compiler)
+
+#pragma comment(linker, "/merge:.CRT=.data")
+
+#pragma comment(linker, "/disallowlib:libc.lib")
+#pragma comment(linker, "/disallowlib:libcd.lib")
+#pragma comment(linker, "/disallowlib:libcmt.lib")
+#pragma comment(linker, "/disallowlib:libcmtd.lib")
+#pragma comment(linker, "/disallowlib:msvcrtd.lib")
+
+#else
+#include <errno.h>
+#endif
+
+#if !defined(CUSTOM_PREFIX)
+#define CUSTOM_PREFIX(n) n
+#endif
+
+#define CUSTOM_MALLOC(x)     CUSTOM_PREFIX(malloc)(x)
+#define CUSTOM_FREE(x)       CUSTOM_PREFIX(free)(x)
+#define CUSTOM_REALLOC(x,y)  CUSTOM_PREFIX(realloc)(x,y)
+#define CUSTOM_CALLOC(x,y)   CUSTOM_PREFIX(calloc)(x,y)
+#define CUSTOM_MEMALIGN(x,y) CUSTOM_PREFIX(memalign)(x,y)
+#define CUSTOM_GETSIZE(x)    CUSTOM_PREFIX(malloc_usable_size)(x)
+#define CUSTOM_MALLOPT(x,y)  CUSTOM_PREFIX(mallopt)(x,y)
+#define CUSTOM_VALLOC(x)     CUSTOM_PREFIX(valloc)(x)
+#define CUSTOM_PVALLOC(x)    CUSTOM_PREFIX(pvalloc)(x)
+
+#if defined(_WIN32)
+#define MYCDECL __cdecl
+#if !defined(NO_INLINE)
+#define NO_INLINE __declspec(noinline)
+#endif
+#pragma inline_depth(255)
+
+#if !defined(NDEBUG)
+#define __forceinline inline
+#endif
+
+#else
+#define MYCDECL
+#endif
+
+/***** generic malloc functions *****/
+
+extern "C" void * MYCDECL CUSTOM_MALLOC (size_t sz)
+{
+  TheCustomHeapType * theCustomHeap = getCustomHeap();
+  void * ptr = theCustomHeap->malloc (sz);
+  return ptr;
+}
+
+extern "C" void * MYCDECL CUSTOM_CALLOC (size_t nelem, size_t elsize)
+{
+  size_t n = nelem * elsize;
+  void * ptr = CUSTOM_MALLOC (n);
+  // Zero out the malloc'd block.
+  if (ptr != NULL) {
+    memset (ptr, 0, n);
+  }
+  return ptr;
+}
+
+
+#if !defined(_WIN32)
+extern "C" void * MYCDECL CUSTOM_MEMALIGN (size_t alignment, size_t size);
+
+extern "C" int posix_memalign (void **memptr, size_t alignment, size_t size)
+{
+  // Check for non power-of-two alignment.
+  if ((alignment == 0) ||
+      (alignment & (alignment - 1)))
+    {
+      return EINVAL;
+    }
+  void * ptr = CUSTOM_MEMALIGN (alignment, size);
+  if (!ptr) {
+    return ENOMEM;
+  } else {
+    *memptr = ptr;
+    return 0;
+  }
+}
+#endif
+
+
+extern "C" void * MYCDECL CUSTOM_MEMALIGN (size_t alignment, size_t size)
+{
+  // NOTE: This function is deprecated.
+  if (alignment == sizeof(double)) {
+    return CUSTOM_MALLOC (size);
+  } else {
+    void * ptr = CUSTOM_MALLOC (size + 2 * alignment);
+    void * alignedPtr = (void *) (((size_t) ptr + alignment - 1) & ~(alignment - 1));
+    return alignedPtr;
+  }
+}
+
+extern "C" size_t MYCDECL CUSTOM_GETSIZE (void * ptr)
+{
+  TheCustomHeapType * theCustomHeap = getCustomHeap();
+  if (ptr == NULL) {
+    return 0;
+  }
+  return theCustomHeap->getSize(ptr);
+}
+
+extern "C" void MYCDECL CUSTOM_FREE (void * ptr)
+{
+  TheCustomHeapType * theCustomHeap = getCustomHeap();
+  theCustomHeap->free (ptr);
+}
+
+extern "C" void * MYCDECL CUSTOM_REALLOC (void * ptr, size_t sz)
+{
+  if (ptr == NULL) {
+    ptr = CUSTOM_MALLOC (sz);
+    return ptr;
+  }
+  if (sz == 0) {
+    CUSTOM_FREE (ptr);
+    return NULL;
+  }
+
+  size_t objSize = CUSTOM_GETSIZE (ptr);
+
+  void * buf = CUSTOM_MALLOC ((size_t) (sz));
+
+  if (buf != NULL) {
+    if (objSize == CUSTOM_GETSIZE(buf)) {
+      // The objects are the same actual size.
+      // Free the new object and return the original.
+      CUSTOM_FREE (buf);
+      return ptr;
+    }
+    // Copy the contents of the original object
+    // up to the size of the new block.
+    size_t minSize = (objSize < sz) ? objSize : sz;
+    memcpy (buf, ptr, minSize);
+  }
+
+  // Free the old block.
+  CUSTOM_FREE (ptr);
+
+  // Return a pointer to the new one.
+  return buf;
+}
+
+#if defined(linux)
+extern "C" char * MYCDECL CUSTOM_PREFIX(strndup) (const char * s, size_t sz)
+{
+  char * newString = NULL;
+  if (s != NULL) {
+    size_t cappedLength = strnlen (s, sz);
+    if ((newString = (char *) CUSTOM_MALLOC(cappedLength + 1))) {
+      strncpy(newString, s, cappedLength);
+      newString[cappedLength] = '\0';
+    }
+  }
+  return newString;
+}
+#endif
+
+extern "C" char * MYCDECL CUSTOM_PREFIX(strdup) (const char * s)
+{
+  char * newString = NULL;
+  if (s != NULL) {
+    if ((newString = (char *) CUSTOM_MALLOC(strlen(s) + 1))) {
+      strcpy(newString, s);
+    }
+  }
+  return newString;
+}
+
+#if !defined(_WIN32)
+#include <dlfcn.h>
+#include <limits.h>
+
+#if !defined(RTLD_NEXT)
+#define RTLD_NEXT ((void *) -1)
+#endif
+
+
+typedef char * getcwdFunction (char *, size_t);
+
+extern "C"  char * MYCDECL CUSTOM_PREFIX(getcwd) (char * buf, size_t size)
+{
+  static getcwdFunction * real_getcwd
+    = (getcwdFunction *) dlsym (RTLD_NEXT, "getcwd");
+  
+  if (!buf) {
+    if (size == 0) {
+      size = PATH_MAX;
+    }
+    buf = (char *) CUSTOM_PREFIX(malloc)(size);
+  }
+  return (real_getcwd)(buf, size);
+}
+
+#endif
+
+
+void * operator new (size_t sz)
+{
+  void * ptr = CUSTOM_MALLOC (sz);
+  if (ptr == NULL) {
+    throw std::bad_alloc();
+  } else {
+    return ptr;
+  }
+}
+
+void operator delete (void * ptr)
+{
+  CUSTOM_FREE (ptr);
+}
+
+#if !defined(__SUNPRO_CC) || __SUNPRO_CC > 0x420
+void * operator new (size_t sz, const std::nothrow_t&) throw() {
+  return CUSTOM_MALLOC(sz);
+} 
+
+void * operator new[] (size_t size) 
+{
+  void * ptr = CUSTOM_MALLOC(size);
+  if (ptr == NULL) {
+    throw std::bad_alloc();
+  } else {
+    return ptr;
+  }
+}
+
+void * operator new[] (size_t sz, const std::nothrow_t&) throw() {
+  return CUSTOM_MALLOC (sz);
+} 
+
+void operator delete[] (void * ptr)
+{
+  CUSTOM_FREE (ptr);
+}
+
+#endif
+
+
+/***** replacement functions for GNU libc extensions to malloc *****/
+
+// A stub function to ensure that we capture mallopt.
+// It does nothing and always returns a failure value (0).
+extern "C" int MYCDECL CUSTOM_MALLOPT (int number, int value)
+{
+  number = number;
+  value = value;
+  // Always fail.
+  return 0;
+}
+
+// NOTE: for convenience, we assume page size = 8192.
+
+extern "C" void * MYCDECL CUSTOM_VALLOC (size_t sz)
+{
+  return CUSTOM_MEMALIGN (8192, sz);
+}
+
+
+extern "C" void * MYCDECL CUSTOM_PVALLOC (size_t sz)
+{
+  // Rounds up to the next pagesize and then calls valloc. Hoard
+  // doesn't support aligned memory requests.
+  return CUSTOM_VALLOC ((sz + 8191) & ~8191);
+}
Index: /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/xallocHeap.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/xallocHeap.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/xallocHeap.h	(revision 176)
@@ -0,0 +1,125 @@
+/* -*- C++ -*- */
+
+/*
+
+  Heap Layers: An Extensible Memory Allocation Infrastructure
+  
+  Copyright (C) 2000-2005 by Emery Berger
+  http://www.cs.umass.edu/~emery
+  emery@cs.umass.edu
+  
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or
+  (at your option) any later version.
+  
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+  
+  You should have received a copy of the GNU General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+*/
+
+#ifndef _XALLOCHEAP_H_
+#define _XALLOCHEAP_H_
+
+namespace HL {
+
+template <int ArenaSize, class SuperHeap>
+class XallocHeap : public SuperHeap {
+
+public:
+
+  inline XallocHeap (void) {
+    start_of_array = (char *) SuperHeap::malloc (ArenaSize);
+    end_of_array = start_of_array + align(sizeof(Nuggie));
+    size_lval(end_of_array) = 0;
+    last_block = NULL;
+  }
+
+  inline ~XallocHeap (void) {
+    SuperHeap::free (start_of_array);
+  }
+
+  inline void * malloc (size_t size) {
+    char * old_end_of_array = end_of_array;
+    end_of_array += align(size + sizeof(Nuggie));
+    if (old_end_of_array + size >= start_of_array + ArenaSize) {
+      // We're out of memory.
+      return NULL;
+    }
+    size_lval(end_of_array) = end_of_array - old_end_of_array;
+    clear_use(end_of_array);  /* this is not necessary, cause it will be zero */
+    set_use(old_end_of_array);
+    last_block = old_end_of_array;
+    return old_end_of_array;
+  }
+
+  inline void free (void * ptr) {
+    char * p = (char *) ptr;
+    char * q;
+    /* At this point we could check that the in_use bit for this block
+       is set, and also check that the size is right */
+    clear_use(p);  /* mark this block as unused */
+    if (p == last_block) {
+	while (1) {
+	    q = prev_block(p);
+	    if (q == p) {
+		last_block = NULL;
+		end_of_array = p;
+		break;  /* only happens when we get to the beginning */
+	    }
+	    if (in_use(q)) {
+		last_block = q;
+		end_of_array = p;
+		break;
+	    }
+	    p = q;
+	}
+    }
+  }
+
+private:
+
+  static inline size_t& size_lval (char * x) {
+    return (((Nuggie *)(((char *)x) - sizeof(Nuggie)))->size);
+  }
+
+  static inline char * prev_block (char * x) {
+    return (((char *) x) - (size_lval(x) & (~1)));
+  }
+
+  static inline int in_use (char * x) {
+    return (size_lval(x) & (1));
+  }
+
+  static inline void set_use (char * x) {
+    (size_lval(x) |= (1));
+  }
+
+  static inline void clear_use (char * x) {
+    (size_lval(x) &= (~1));
+  }
+
+  class Nuggie {
+  public:
+    size_t size;
+  };
+
+  inline static size_t align (int sz) {
+    return (sz + (sizeof(double) - 1)) & ~(sizeof(double) - 1);
+  }
+
+  char * end_of_array;
+  char * start_of_array;
+  char * last_block;
+};
+
+};
+
+
+#endif
Index: /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/zoneheap.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/zoneheap.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/heaplayers/zoneheap.h	(revision 176)
@@ -0,0 +1,117 @@
+/* -*- C++ -*- */
+
+/**
+ * @class ZoneHeap
+ * @brief A zone (or arena, or region) based allocator.
+ * @author Emery Berger
+ * @date June 2000
+ *
+ * Uses the superclass to obtain large chunks of memory that are only
+ * returned when the heap itself is destroyed.
+ *
+*/
+
+#ifndef _ZONEHEAP_H_
+#define _ZONEHEAP_H_
+
+#include <assert.h>
+
+namespace HL {
+
+  template <class Super, size_t ChunkSize>
+  class ZoneHeap : public Super {
+  public:
+
+    ZoneHeap (void)
+      : sizeRemaining (-1),
+	currentArena (NULL),
+	pastArenas (NULL)
+    {}
+
+    ~ZoneHeap (void)
+    {
+      // printf ("deleting arenas!\n");
+      // Delete all of our arenas.
+      Arena * ptr = pastArenas;
+      while (ptr != NULL) {
+	void * oldPtr = (void *) ptr;
+	ptr = ptr->nextArena;
+	//printf ("deleting %x\n", ptr);
+	Super::free (oldPtr);
+      }
+      if (currentArena != NULL)
+	//printf ("deleting %x\n", currentArena);
+	Super::free (currentArena);
+    }
+
+    inline void * malloc (size_t sz) {
+      void * ptr = zoneMalloc (sz);
+      return ptr;
+    }
+
+    /// Free in a zone allocator is a no-op.
+    inline void free (void *) {}
+
+    /// Remove in a zone allocator is a no-op.
+    inline int remove (void *) { return 0; }
+
+
+  private:
+
+    inline static size_t align (int sz) {
+      return (sz + (sizeof(double) - 1)) & ~(sizeof(double) - 1);
+    }
+
+    inline void * zoneMalloc (size_t sz) {
+      void * ptr;
+      // Round up size to an aligned value.
+      sz = align (sz);
+      // Get more space in our arena if there's not enough room in this one.
+      if ((currentArena == NULL) || (sizeRemaining < (int) sz)) {
+	// First, add this arena to our past arena list.
+	if (currentArena != NULL) {
+	  currentArena->nextArena = pastArenas;
+	  pastArenas = currentArena;
+	}
+	// Now get more memory.
+	size_t allocSize = ChunkSize;
+	if (allocSize < sz) {
+	  allocSize = sz;
+	}
+	currentArena =
+	  (Arena *) Super::malloc (allocSize + sizeof(Arena));
+	if (currentArena == NULL) {
+	  return NULL;
+	}
+	currentArena->arenaSpace = (char *) (currentArena + 1);
+	currentArena->nextArena = NULL;
+	sizeRemaining = ChunkSize;
+      }
+      // Bump the pointer and update the amount of memory remaining.
+      sizeRemaining -= sz;
+      ptr = currentArena->arenaSpace;
+      currentArena->arenaSpace += sz;
+      assert (ptr != NULL);
+      return ptr;
+    }
+  
+    class Arena {
+    public:
+      Arena * nextArena;
+      char * arenaSpace;
+      double _dummy; // For alignment.
+    };
+    
+    /// Space left in the current arena.
+    long sizeRemaining;
+
+    /// The current arena.
+    Arena * currentArena;
+
+    /// A linked list of past arenas.
+    Arena * pastArenas;
+  };
+
+}
+
+#endif
Index: /proiecte/swift/trunk/lib/hoard-371/src/heapmanager.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/heapmanager.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/heapmanager.h	(revision 176)
@@ -0,0 +1,93 @@
+// -*- C++ -*-
+
+#ifndef _HEAPMANAGER_H_
+#define _HEAPMANAGER_H_
+
+#include <stdlib.h>
+
+#include "guard.h"
+#include "cpuinfo.h"
+
+namespace Hoard {
+
+  template <typename LockType,
+	    typename HeapType>
+  class HeapManager : public HeapType {
+  public:
+
+    HeapManager (void)
+    {
+      HL::Guard<LockType> g (heapLock);
+      
+      /// Initialize all heap maps (nothing yet assigned).
+      int i;
+      for (i = 0; i < HeapType::MaxThreads; i++) {
+	HeapType::setTidMap (i, 0);
+      }
+      for (i = 0; i < HeapType::MaxHeaps; i++) {
+	HeapType::setInusemap (i, 0);
+      }
+    }
+
+    /// Set this thread's heap id to 0.
+    void chooseZero (void) {
+      HL::Guard<LockType> g (heapLock);
+      HeapType::setTidMap ((int) HL::CPUInfo::getThreadId() % MaxThreads, 0);
+    }
+
+    int findUnusedHeap (void) {
+
+      HL::Guard<LockType> g (heapLock);
+      
+      unsigned int tid_original = HL::CPUInfo::getThreadId();
+      unsigned int tid = tid_original % HeapType::MaxThreads;
+      
+      int i = 0;
+      while ((i < HeapType::MaxHeaps) && (HeapType::getInusemap(i)))
+	i++;
+      if (i >= HeapType::MaxHeaps) {
+	// Every heap is in use: pick heap one.
+	i = 0;
+      }
+      
+      HeapType::setInusemap (i, 1);
+      HeapType::setTidMap (tid, i);
+      
+      return i;
+    }
+
+    void releaseHeap (void) {
+      // Decrement the ref-count on the current heap.
+      
+      HL::Guard<LockType> g (heapLock);
+      
+      // Statically ensure that the number of threads is a power of two.
+      enum { VerifyPowerOfTwo = 1 / ((HeapType::MaxThreads & ~(HeapType::MaxThreads-1))) };
+      
+      int tid = HL::CPUInfo::getThreadId() & (HeapType::MaxThreads - 1);
+      int heapIndex = HeapType::getTidMap (tid);
+      
+      HeapType::setInusemap (heapIndex, 0);
+      
+      // Prevent underruns (defensive programming).
+      
+      if (HeapType::getInusemap (heapIndex) < 0) {
+	HeapType::setInusemap (heapIndex, 0);
+      }
+    }
+    
+    
+  private:
+    
+    // Disable copying.
+    
+    HeapManager (const HeapManager&);
+    HeapManager& operator= (const HeapManager&);
+    
+    /// The lock, to ensure mutual exclusion.
+    LockType heapLock;
+  };
+
+};
+
+#endif
Index: /proiecte/swift/trunk/lib/hoard-371/src/hoard.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/hoard.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/hoard.h	(revision 176)
@@ -0,0 +1,156 @@
+// -*- C++ -*-
+
+/*
+
+  Heap Layers: An Extensible Memory Allocation Infrastructure
+  
+  Copyright (c) 1998-2006 Emery Berger, The University of Texas at Austin
+  http://www.cs.umass.edu/~emery
+  emery@cs.umass.edu
+  
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or
+  (at your option) any later version.
+  
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+  
+  You should have received a copy of the GNU General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+*/
+
+#ifndef _HOARD_H_
+#define _HOARD_H_
+
+#include "hldefines.h"
+
+// The minimum allocation grain for a given object -
+// that is, we carve objects out of chunks of this size.
+#define SUPERBLOCK_SIZE 65536
+
+// The number of 'emptiness classes'; see the ASPLOS paper for details.
+#define EMPTINESS_CLASSES 8
+
+
+// Hoard-specific Heap Layers
+
+#include "check.h"
+#include "fixedrequestheap.h"
+#include "hoardmanager.h"
+#include "addheaderheap.h"
+#include "threadpoolheap.h"
+#include "redirectfree.h"
+#include "ignoreinvalidfree.h"
+#include "conformantheap.h"
+#include "hoardsuperblock.h"
+#include "lockmallocheap.h"
+#include "alignedsuperblockheap.h"
+#include "alignedmmap.h"
+#include "globalheap.h"
+
+// Generic Heap Layers
+
+#include "ansiwrapper.h"
+#include "debugheap.h"
+#include "lockedheap.h"
+#include "winlock.h"
+#include "bins4k.h"
+#include "bins8k.h"
+#include "bins16k.h"
+#include "bins64k.h"
+#include "oneheap.h"
+#include "freelistheap.h"
+#include "threadheap.h"
+#include "hybridheap.h"
+#include "posixlock.h"
+#include "spinlock.h"
+
+
+#if defined(_WIN32)
+typedef HL::WinLockType TheLockType;
+#elif defined(__APPLE__) 
+// Spin lock not working on Mac yet.
+typedef HL::PosixLockType TheLockType;
+#else
+typedef HL::SpinLockType TheLockType;
+#endif
+
+namespace Hoard {
+
+  typedef GlobalHeap<SUPERBLOCK_SIZE, EMPTINESS_CLASSES, TheLockType> TheGlobalHeap;
+  
+  class hoardThresholdFunctionClass {
+  public:
+    inline static bool function (int u, int a, size_t objSize) {
+      /*
+	Returns 1 iff we've crossed the emptiness threshold:
+	
+	U < A - 2S   &&   U < EMPTINESS_CLASSES-1/EMPTINESS_CLASSES * A
+	
+      */
+      bool r = ((EMPTINESS_CLASSES * u) < ((EMPTINESS_CLASSES-1) * a)) && ((u < a - (2 * SUPERBLOCK_SIZE) / (int) objSize));
+      return r;
+    }
+  };
+  
+  
+  class SmallHeap;
+  
+  typedef HoardSuperblock<TheLockType, SUPERBLOCK_SIZE, SmallHeap> SmallSuperblockType;
+  
+  // The heap that manages small objects.
+  class SmallHeap : 
+    public ConformantHeap<
+    HoardManager<AlignedSuperblockHeap<TheLockType, SUPERBLOCK_SIZE>,
+		 TheGlobalHeap,
+		 SmallSuperblockType,
+		 EMPTINESS_CLASSES,
+		 TheLockType,
+		 hoardThresholdFunctionClass,
+		 SmallHeap> > {};
+
+  class BigHeap;
+
+  typedef HoardSuperblock<TheLockType, SUPERBLOCK_SIZE, BigHeap> BigSuperblockType;
+
+  // The heap that manages large objects.
+  class BigHeap :
+    public ConformantHeap<HL::LockedHeap<TheLockType,
+					 AddHeaderHeap<BigSuperblockType,
+						       SUPERBLOCK_SIZE,
+						       AlignedMmap<SUPERBLOCK_SIZE> > > >
+  {};
+
+
+  enum { BigObjectSize = 
+	 HL::bins<SmallSuperblockType::Header, SUPERBLOCK_SIZE>::BIG_OBJECT };
+
+  class PerThreadHoardHeap :
+    public RedirectFree<LockMallocHeap<SmallHeap>,
+			SmallSuperblockType> {};
+
+  template <int N, int NH>
+  class HoardHeap :
+    public HL::ANSIWrapper<
+    IgnoreInvalidFree<
+      HL::HybridHeap<Hoard::BigObjectSize,
+		     ThreadPoolHeap<N, NH, Hoard::PerThreadHoardHeap>,
+		     Hoard::BigHeap> > >
+  {
+  public:
+    
+    enum { BIG_OBJECT = Hoard::BigObjectSize };
+    
+    HL::sassert<sizeof(Hoard::BigSuperblockType::Header)
+      == sizeof(Hoard::SmallSuperblockType::Header)> ensureSameSizeHeaders;
+  };
+
+};
+
+
+#endif
Index: /proiecte/swift/trunk/lib/hoard-371/src/hoarddetours.cpp
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/hoarddetours.cpp	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/hoarddetours.cpp	(revision 176)
@@ -0,0 +1,331 @@
+/**
+ * @file hoarddetours.cpp
+ * @brief Hooks to Hoard for Detours.
+ * @author Emery Berger <http://www.cs.umass.edu/~emery>
+ */
+
+/*
+   To compile, run compile-detours.cmd, or do the following:
+
+   cl /I.. /LD /MD /DNDEBUG /Ox /Zp8 /Oa /G6 /Oy /I/detours/include hoarddetours.cpp  \detours\lib\detours.lib /link /subsystem:console /entry:_DllMainCRTStartup@12 /force:multiple
+
+   To use (via withdll.exe, from Detours):
+
+   detours\withdll -d:hoarddetours.dll myexecutable.exe
+
+  */
+
+#include "VERSION.h"
+
+#define CUSTOM_PREFIX(n) hoard##n
+
+#if !defined(_WIN32)
+#error "This file is for Windows only."
+#endif
+
+#define WIN32_LEAN_AND_MEAN
+#define _WIN32_WINNT 0x0500
+#define NT
+
+#include <windows.h>
+#include <stdio.h>
+#include <malloc.h>
+#include "detours.h"
+
+#if defined(_WIN32)
+#pragma inline_depth(255)
+#endif
+
+#include "cpuinfo.h"
+#include "hoard.h"
+
+volatile int anyThreadCreated = 0;
+
+const int MaxThreads = 512;
+const int NumHeaps = 64;
+
+using namespace Hoard;
+
+class TheCustomHeapType : public HoardHeap<MaxThreads, NumHeaps> {};
+
+inline static TheCustomHeapType * getCustomHeap (void) {
+  static char thBuf[sizeof(TheCustomHeapType)];
+  static TheCustomHeapType * th = new (thBuf) TheCustomHeapType;
+  return th;
+}
+
+// Allocate exactly one object.
+static void * objectAllocated = (void *) 0x1;
+
+extern "C" {
+  DETOUR_TRAMPOLINE(void __cdecl real_onexit (void (*f)(void)),
+		    onexit);
+
+  DETOUR_TRAMPOLINE(void __cdecl real_exit (int code),
+		    exit);
+
+  DETOUR_TRAMPOLINE(void *  __cdecl real_malloc (size_t sz),
+		    malloc);
+  
+  DETOUR_TRAMPOLINE(void *  __cdecl real_realloc (void * ptr, size_t sz),
+		    realloc);
+  
+  DETOUR_TRAMPOLINE(void *  __cdecl real_calloc (size_t sz, size_t n),
+		    calloc);
+  
+  DETOUR_TRAMPOLINE(void *  __cdecl real_free (void * ptr),
+		    free);
+  
+  DETOUR_TRAMPOLINE(size_t  __cdecl real_msize (void * ptr),
+		    _msize);
+
+  DETOUR_TRAMPOLINE(void * __cdecl real_expand(void * memblock, size_t size),
+		    _expand);
+
+  DETOUR_TRAMPOLINE(char *  __cdecl real_strdup (const char * s),
+		    strdup);
+
+}
+
+/* Detours */
+
+#include "wrapper.cpp"
+
+// We use Hoard to manage small objects and the original allocator
+// to manage large objects.
+
+static const int HOARD_MAX_EXIT_FUNCTIONS = 512;
+static int exitCount = 0;
+
+typedef void (*exitFunctionType) (void);
+exitFunctionType exitFunctionBuffer[HOARD_MAX_EXIT_FUNCTIONS];
+
+extern "C" void my_onexit (void (*function)(void)) {
+  if (exitCount < HOARD_MAX_EXIT_FUNCTIONS) {
+    exitFunctionBuffer[exitCount] = function;
+    exitCount++;
+  }
+}
+
+extern "C" void my_exit (int code) {
+  while (exitCount > 0) {
+    exitCount--;
+    (exitFunctionBuffer[exitCount])();
+  }
+  real_exit (code);
+}
+
+extern "C" void my_cexit (void) {
+  my_exit (0);
+}
+
+extern "C" void * my_expand (void * memblock, size_t size)
+{
+  // Disable by always returning NULL (the error condition for _expand).
+  return NULL;
+}
+
+
+/* Install Detours trampolines. */
+
+#define REPLACE(module,x,fn) \
+{ \
+  PBYTE p; \
+  p = DetourFindFunction ((module), (x)); \
+  if (p) { \
+    DetourFunction (p, (PBYTE) (fn));  \
+  } \
+}
+
+#define REMOVE(module,x,fn) \
+{ \
+  PBYTE p; \
+  p = DetourFindFunction ((module), (x)); \
+  if (p) { \
+    DetourRemove (p, (PBYTE) (fn));  \
+  } \
+}
+
+
+void trampolineInstall (HMODULE hModule,
+			bool insert)
+{
+  typedef PBYTE (__stdcall *drtype)(PBYTE, PBYTE);
+  typedef BOOL (__stdcall *dfwtype)(PBYTE, PBYTE);
+  PBYTE p;
+  drtype dr;
+  dfwtype dfw;
+
+  if (insert) {
+    dfw = &DetourFunctionWithTrampoline;
+    dr = &DetourFunction;
+  } else {
+    dfw = &DetourRemove;
+    dr = (drtype) &DetourRemove;
+  }
+
+  (*dfw) ((PBYTE) real_realloc, (PBYTE) CUSTOM_PREFIX(realloc));
+  (*dfw) ((PBYTE) real_calloc,  (PBYTE) CUSTOM_PREFIX(calloc));
+  (*dfw) ((PBYTE) real_msize,   (PBYTE) CUSTOM_PREFIX(malloc_usable_size));
+  (*dfw) ((PBYTE) real_strdup,  (PBYTE) CUSTOM_PREFIX(strdup));
+  (*dfw) ((PBYTE) real_malloc,  (PBYTE) CUSTOM_PREFIX(malloc));
+  (*dfw) ((PBYTE) real_free,    (PBYTE) CUSTOM_PREFIX(free));
+  (*dfw) ((PBYTE) real_expand,  (PBYTE) my_expand);
+  (*dfw) ((PBYTE) real_onexit,  (PBYTE) my_onexit);
+  (*dfw) ((PBYTE) real_exit,  (PBYTE) my_exit);
+
+  char dllName[MAX_PATH];
+
+  for (HINSTANCE hInst = NULL; (hInst = DetourEnumerateModules(hInst)) != NULL; ) {
+    GetModuleFileName(hInst, dllName, MAX_PATH);
+
+    // Replace the memory allocation calls in the MSVCR library.
+   
+    if ((strstr(dllName, "MSVCR") != 0) || (strstr(dllName, "msvcr") != 0)) {
+
+      // operator new, new[], delete, delete[]
+      // see undname
+
+      // operator new
+      p = DetourFindFunction (dllName, "??2@YAPAXI@Z");
+      if (p) (*dr)(p, (PBYTE) CUSTOM_PREFIX(malloc));
+
+      // operator new[]
+      p = DetourFindFunction (dllName, "??_U@YAPAXI@Z");
+      if (p) (*dr)(p, (PBYTE) CUSTOM_PREFIX(malloc));
+      
+      // operator delete
+      p = DetourFindFunction (dllName, "??3@YAXPAX@Z");
+      if (p) (*dr)(p, (PBYTE) CUSTOM_PREFIX(free));
+
+      // operator delete[]
+      p = DetourFindFunction (dllName, "??_V@YAXPAX@Z");
+      if (p) (*dr)(p, (PBYTE) CUSTOM_PREFIX(free));
+
+      p = DetourFindFunction (dllName, "realloc");
+      if (p) (*dr)(p, (PBYTE) CUSTOM_PREFIX(realloc));
+      
+      p = DetourFindFunction (dllName, "calloc");
+      if (p) (*dr)(p, (PBYTE) CUSTOM_PREFIX(calloc));
+      
+      p = DetourFindFunction (dllName, "_msize");
+      if (p) (*dr)(p, (PBYTE) CUSTOM_PREFIX(malloc_usable_size));
+      
+      p = DetourFindFunction (dllName, "strdup");
+      if (p) (*dr)(p, (PBYTE) CUSTOM_PREFIX(strdup));
+      
+      p = DetourFindFunction (dllName, "malloc");
+      if (p) (*dr)(p, (PBYTE) CUSTOM_PREFIX(malloc));
+      
+      p = DetourFindFunction (dllName, "free");
+      if (p) (*dr)(p, (PBYTE) CUSTOM_PREFIX(free));
+      
+      p = DetourFindFunction (dllName, "_expand");
+      if (p) (*dr)(p, (PBYTE) my_expand);
+
+      p = DetourFindFunction (dllName, "_onexit");
+      if (p) (*dr)(p, (PBYTE) my_onexit);
+
+      p = DetourFindFunction (dllName, "exit");
+      if (p) (*dr)(p, (PBYTE) my_exit);
+
+      p = DetourFindFunction (dllName, "_cexit");
+      if (p) (*dr)(p, (PBYTE) my_cexit);
+    }
+  }
+}
+
+void trampolineWith (HMODULE hModule) {
+  trampolineInstall (hModule, true);
+}
+
+
+#if defined(_WIN32)
+#pragma warning(disable:4273)
+#endif
+
+static void initializeMaps (void) {
+  int i;
+  for (i = 0; i < TheCustomHeapType::MaxThreads; i++) {
+    getCustomHeap()->setTidMap(i, 0);
+  }
+  for (i = 0; i < TheCustomHeapType::MaxHeaps; i++) {
+    getCustomHeap()->setInusemap (i, 0);
+  }
+}
+
+static void findUnusedHeap (void) {
+  // Find an unused heap.
+  
+  int tid = HL::CPUInfo::getThreadId() % TheCustomHeapType::MaxThreads;
+
+  int i = 0;
+  while ((i < TheCustomHeapType::MaxHeaps) && (getCustomHeap()->getInusemap(i)))
+    i++;
+  if (i >= TheCustomHeapType::MaxHeaps) {
+    // Every heap is in use: pick a random victim.
+    i = (int) ( TheCustomHeapType::MaxHeaps * ((double) rand() / (double) RAND_MAX));
+  }
+  int v = getCustomHeap()->getInusemap(i);
+
+  getCustomHeap()->setInusemap (i, 1);
+  getCustomHeap()->setTidMap (tid, i);
+}
+
+static void releaseHeap (void) {
+  // Decrement the ref-count on the current heap.
+
+  enum { VerifyPowerOfTwo = 1 / ((TheCustomHeapType::MaxThreads & ~(TheCustomHeapType::MaxThreads-1))) };
+
+  int tid = HL::CPUInfo::getThreadId() & (TheCustomHeapType::MaxThreads - 1);
+  int heapIndex = getCustomHeap()->getTidMap (tid);
+
+  //  printf ("thread %d releasing heap %d\n", tid, heapIndex);
+ 
+  int v = getCustomHeap()->getInusemap (heapIndex);
+  getCustomHeap()->setInusemap (heapIndex, 0);
+
+  // Prevent underruns (defensive programming).
+
+  if (getCustomHeap()->getInusemap (heapIndex) < 0) {
+    getCustomHeap()->setInusemap (heapIndex, 0);
+  }
+}
+
+
+BOOL APIENTRY DllMain (HINSTANCE hModule,
+		       DWORD dwReason,
+		       PVOID lpReserved)
+{
+  int i;
+  int tid;
+  static int np = HL::CPUInfo::computeNumProcessors();
+  char dllName[MAX_PATH];
+  switch (dwReason) {
+  case DLL_PROCESS_ATTACH:
+    fprintf (stderr, "This software uses the Hoard scalable memory allocator (version " HOARD_VERSION_STRING ", Detours).\nCopyright (C) 2005 Emery Berger, The University of Texas at Austin,\nand the University of Massachusetts Amherst.\nFor more information, see http://www.hoard.org\n");
+    initializeMaps();
+    trampolineWith (hModule);
+    break;
+  case DLL_PROCESS_DETACH:
+    // Notice that we haven't replaced all heap calls. Here's one.
+    objectAllocated = (void *) real_malloc(1);
+    break;
+  case DLL_THREAD_ATTACH:
+    anyThreadCreated = 1;
+    if (np == 1) {
+      getCustomHeap()->setTidMap ((int) HL::CPUInfo::getThreadId() % TheCustomHeapType::MaxThreads, 0);
+    } else {
+      findUnusedHeap();
+    }
+    break;
+  case DLL_THREAD_DETACH:
+    if (np != 1) {
+      releaseHeap();
+    }
+    break;
+  }
+  return TRUE;
+}
+
+
Index: /proiecte/swift/trunk/lib/hoard-371/src/hoardmanager.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/hoardmanager.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/hoardmanager.h	(revision 176)
@@ -0,0 +1,396 @@
+// -*- C++ -*-
+
+/*
+
+  Heap Layers: An Extensible Memory Allocation Infrastructure
+  
+  Copyright (C) 2000-2007 by Emery Berger
+  http://www.cs.umass.edu/~emery
+  emery@cs.umass.edu
+  
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or
+  (at your option) any later version.
+  
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+  
+  You should have received a copy of the GNU General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+*/
+
+#ifndef _HOARDMANAGER_H_
+#define _HOARDMANAGER_H_
+
+#include <stdlib.h>
+#include <new>
+
+// Hoard-specific Heap Layers
+#include "sassert.h"
+#include "statistics.h"
+#include "emptyclass.h"
+#include "array.h"
+#include "manageonesuperblock.h"
+
+
+// Generic Heap Layers
+#include "bins.h"
+#include "basehoardmanager.h"
+#include "emptyhoardmanager.h"
+#include "guard.h"
+#include "hldefines.h"
+
+using namespace HL;
+
+/**
+ *
+ * @class HoardManager
+ * @brief Manages superblocks by emptiness, returning them to the parent heap when empty enough.
+ * @author Emery Berger <http://www.cs.umass.edu/~emery>
+ *
+ **/
+
+namespace Hoard {
+
+template <class SourceHeap,
+	  class ParentHeap,
+	  class SuperblockType_,
+	  int EmptinessClasses,
+	  class LockType,
+          class thresholdFunctionClass,
+          class HeapType>
+class HoardManager : public BaseHoardManager<SuperblockType_>,
+                     public thresholdFunctionClass
+{
+public:
+
+  HoardManager (void)
+    : _magic (MAGIC_NUMBER)
+  {}
+
+  virtual ~HoardManager (void) {}
+
+  typedef SuperblockType_ SuperblockType;
+
+  /// This heap guarantees only double-word alignment.
+  enum { Alignment = sizeof(double) };
+
+
+  MALLOC_FUNCTION INLINE void * malloc (size_t sz)
+  {
+    Check<HoardManager, sanityCheck> check (this);
+    const int binIndex = binType::getSizeClass(sz);
+    size_t realSize = binType::getClassSize (binIndex);
+    assert (realSize >= sz);
+
+    // Iterate until we succeed in allocating memory.
+    void * ptr = getObject (binIndex, realSize);
+    if (ptr) {
+      return ptr;
+    } else {
+      return slowPathMalloc (realSize);
+    }
+  }
+
+
+  /// Put a superblock on this heap.
+  NO_INLINE void put (SuperblockType * s, size_t sz) {
+    HL::Guard<LockType> l (_theLock);
+
+    assert (s->getOwner() != this);
+    Check<HoardManager, sanityCheck> check (this);
+
+    const int binIndex = binType::getSizeClass(sz);
+
+    // Check to see whether this superblock puts us over.
+    Statistics& stats = _stats(binIndex);
+    int a = stats.getAllocated() + s->getTotalObjects();
+    int u = stats.getInUse() + (s->getTotalObjects() - s->getObjectsFree());
+
+    if (thresholdFunctionClass::function (u, a, sz)) {
+      // We've crossed the threshold function,
+      // so we move this superblock up to the parent.
+      _ph.put (reinterpret_cast<typename ParentHeap::SuperblockType *>(s), sz);
+    } else {
+      unlocked_put (s, sz);
+    }
+  }
+
+
+  /// Get an empty (or nearly-empty) superblock.
+  NO_INLINE SuperblockType * get (size_t sz, HeapType * dest) {
+    HL::Guard<LockType> l (_theLock);
+    Check<HoardManager, sanityCheck> check (this);
+    const int binIndex = binType::getSizeClass (sz);
+    SuperblockType * s = _otherBins(binIndex).get();
+    if (s) {
+      assert (s->isValidSuperblock());
+      
+      // Update the statistics, removing objects in use and allocated for s.
+      decStatsSuperblock (s, binIndex);
+      s->setOwner (dest);
+    }
+    // printf ("getting sb %x (size %d) on %x\n", (void *) s, sz, (void *) this);
+    return s;
+  }
+
+  /// Return one object to its superblock and update stats.
+  INLINE void free (void * ptr) {
+    Check<HoardManager, sanityCheck> check (this);
+
+    // Get the corresponding superblock.
+    SuperblockType * s = SuperHeap::getSuperblock (ptr);
+ 
+    assert (s->getOwner() == this);
+
+    // Find out which bin it belongs to.
+    // Note that we assume that all pointers have been correctly
+    // normalized at this point.
+    assert (s->normalize (ptr) == ptr);
+
+    const size_t sz = s->getObjectSize ();
+    const int binIndex = binType::getSizeClass (sz);
+
+    // Free the object.
+    _otherBins(binIndex).free (ptr);
+
+
+    // Update statistics.
+    Statistics& stats = _stats(binIndex);
+    int u = stats.getInUse();
+    const int a = stats.getAllocated();
+    // FIX ME    assert (u > 0);
+    if (u > 0)
+      u--;
+    stats.setInUse (u);
+
+    // Free up a superblock if we've crossed the emptiness threshold.
+
+    if (thresholdFunctionClass::function (u, a, sz)) {
+
+      slowPathFree (binIndex, u, a);
+
+    }
+  }
+
+  INLINE void lock (void) {
+    _theLock.lock();
+  }
+
+  INLINE void unlock (void) {
+    _theLock.unlock();
+  }
+
+private:
+
+  typedef BaseHoardManager<SuperblockType_> SuperHeap;
+
+  enum { SuperblockSize = sizeof(SuperblockType_) };
+
+  /// Ensure that the superblock size is a power of two.
+  HL::sassert<((SuperblockSize & (SuperblockSize-1)) == 0)> verifyPowerOfTwo;
+
+  enum { MAGIC_NUMBER = 0xfeeddadd };
+
+  /// A magic number used for debugging.
+  const unsigned long _magic;
+
+  inline int isValid (void) const {
+    return (_magic == MAGIC_NUMBER);
+  }
+
+  sassert<sizeof(typename SuperblockType::Header) % sizeof(double) == 0>
+    verifyHeaderRightSize;
+
+
+  /// The type of the bin manager.
+  typedef HL::bins<typename SuperblockType::Header, SuperblockSize> binType;
+
+  /// How many bins do we need to maintain?
+  enum { NumBins = binType::NUM_BINS };
+
+  NO_INLINE void slowPathFree (int binIndex, int u, int a) {
+    // We've crossed the threshold.
+    // Remove a superblock and give it to the 'parent heap.'
+    Check<HoardManager, sanityCheck> check (this);
+    
+    //	printf ("HoardManager: this = %x, getting a superblock\n", this);
+    
+    SuperblockType * sb = _otherBins(binIndex).get ();
+    
+    // We should always get one.
+    assert (sb);
+    if (sb) {
+
+      const size_t sz = binType::getClassSize (binIndex);
+      Statistics& stats = _stats(binIndex);
+      int totalObjects = sb->getTotalObjects();
+      stats.setInUse (u - (totalObjects - sb->getObjectsFree()));
+      stats.setAllocated (a - totalObjects);
+
+      // Give it to the parent heap.
+      ///////// NOTE: We change the superblock type here!
+      ///////// THIS HAD BETTER BE SAFE!
+      _ph.put (reinterpret_cast<typename ParentHeap::SuperblockType *>(sb), sz);
+      assert (sb->isValidSuperblock());
+
+    }
+  }
+
+
+  NO_INLINE void unlocked_put (SuperblockType * s, size_t sz) {
+    if (!s || !s->isValidSuperblock()) {
+      return;
+    }
+
+    Check<HoardManager, sanityCheck> check (this);
+
+    const int binIndex = binType::getSizeClass(sz);
+
+    // Now put it on this heap.
+    s->setOwner (reinterpret_cast<HeapType *>(this));
+    _otherBins(binIndex).put (s);
+
+    // Update the heap statistics with the allocated and in use stats
+    // for the superblock.
+
+    addStatsSuperblock (s, binIndex);
+    assert (s->isValidSuperblock());
+
+  }
+
+  void addStatsSuperblock (SuperblockType * s, int binIndex) {
+    Statistics& stats = _stats(binIndex);
+    
+    int a = stats.getAllocated();
+    int u = stats.getInUse();
+    int totalObjects = s->getTotalObjects();
+    stats.setInUse (u + (totalObjects - s->getObjectsFree()));
+    stats.setAllocated (a + totalObjects);
+  }
+
+
+  void decStatsSuperblock (SuperblockType * s, int binIndex) {
+    Statistics& stats = _stats(binIndex);
+    
+    int a = stats.getAllocated();
+    int u = stats.getInUse();
+    int totalObjects = s->getTotalObjects();
+    stats.setInUse (u - (totalObjects - s->getObjectsFree()));
+    stats.setAllocated (a - totalObjects);
+  }
+
+  MALLOC_FUNCTION NO_INLINE void * slowPathMalloc (size_t sz) {
+    const int binIndex = binType::getSizeClass (sz);
+    size_t realSize = binType::getClassSize (binIndex);
+    assert (realSize >= sz);
+    for (;;) {
+      Check<HoardManager, sanityCheck> check (this);
+      void * ptr = getObject (binIndex, realSize);
+      if (ptr) {
+	return ptr;
+      } else {
+	Check<HoardManager, sanityCheck> check (this);
+	// Return null if we can't allocate another superblock.
+	if (!getAnotherSuperblock (realSize)) {
+	  //	  fprintf (stderr, "HoardManager::malloc - no memory.\n");
+	  return 0;
+	}
+      }
+    }
+  }
+
+  /// Get one object of a particular size.
+  MALLOC_FUNCTION INLINE void * getObject (int binIndex, size_t sz) {
+    Check<HoardManager, sanityCheck> check (this);
+    void * ptr = _otherBins(binIndex).malloc (sz);
+    if (ptr) {
+      // We got one. Update stats.
+      int u = _stats(binIndex).getInUse();
+      _stats(binIndex).setInUse (u+1);
+    }
+    return ptr;
+  }
+
+  friend class sanityCheck;
+
+  class sanityCheck {
+  public:
+    inline static void precondition (HoardManager * h) {
+      checkInvariant(h);
+    }
+    inline static void postcondition (HoardManager * h) {
+      checkInvariant(h);
+    }
+  private:
+    inline static void checkInvariant (HoardManager * h) {
+      assert (h->isValid());
+    }
+  };
+
+public:
+
+  NO_INLINE void * getAnotherSuperblock (size_t sz) {
+
+    // NB: This function should be on the slow path.
+
+    SuperblockType * sb = NULL;
+
+    // Try the parent heap.
+    // NOTE: We change the superblock type here!
+    sb = reinterpret_cast<SuperblockType *>(_ph.get (sz, reinterpret_cast<ParentHeap *>(this)));
+
+    if (sb) {
+      if (!sb->isValidSuperblock()) {
+	// As above - drop any invalid superblocks.
+	sb = NULL;
+      }
+
+    } else {
+      // Nothing - get memory from the source.
+      void * ptr = _sourceHeap.malloc (SuperblockSize);
+      if (!ptr) {
+	return 0;
+      }
+      sb = new (ptr) SuperblockType (sz);
+    }
+
+    // Put the superblock into its appropriate bin.
+    if (sb) {
+      unlocked_put (sb, sz);
+    }
+    return sb;
+  }
+
+private:
+
+  LockType _theLock;
+
+  /// Usage statistics for each bin.
+  Array<NumBins, Statistics> _stats;
+
+  typedef SuperblockType * SuperblockTypePointer;
+
+  typedef EmptyClass<SuperblockType, EmptinessClasses> OrganizedByEmptiness;
+
+  typedef ManageOneSuperblock<OrganizedByEmptiness> BinManager;
+
+  /// Bins that hold superblocks for each size class.
+  Array<NumBins, BinManager> _otherBins;
+
+  /// The parent heap.
+  ParentHeap _ph;
+
+  /// Where memory comes from.
+  SourceHeap _sourceHeap;
+
+};
+
+}
+
+#endif
Index: /proiecte/swift/trunk/lib/hoard-371/src/hoardsuperblock.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/hoardsuperblock.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/hoardsuperblock.h	(revision 176)
@@ -0,0 +1,173 @@
+// -*- C++ -*-
+
+#ifndef _HOARDSUPERBLOCK_H_
+#define _HOARDSUPERBLOCK_H_
+
+#include <assert.h>
+#include <stdlib.h>
+
+#include "hldefines.h"
+#include "freesllist.h"
+#include "hoardsuperblockheader.h"
+
+namespace Hoard {
+
+  template <class LockType,
+	    int SuperblockSize,
+	    typename HeapType>
+  class HoardSuperblock {
+  public:
+
+    HoardSuperblock (size_t sz)
+      : _header (sz, BufferSize)
+    {
+      assert (_header.isValid());
+    }
+    
+    /// @brief Find the start of the superblock by bitmasking.
+    /// @note  All superblocks <em>must</em> be naturally aligned, and powers of two.
+    static inline HoardSuperblock * getSuperblock (void * ptr) {
+      return (HoardSuperblock *)
+	(((size_t) ptr) & ~((size_t) SuperblockSize-1));
+    }
+
+    INLINE size_t getSize (void * ptr) const {
+      assert (_header.isValid());
+      if (inRange (ptr)) {
+	return _header.getSize (ptr);
+      } else {
+	return 0;
+      }
+    }
+
+
+    INLINE size_t getObjectSize (void) const {
+      return _header.getObjectSize();
+    }
+
+    MALLOC_FUNCTION INLINE void * malloc (size_t sz) {
+      sz = sz; // avoid warning
+      assert (_header.isValid());
+      void * ptr = _header.malloc();
+      if (ptr) {
+	assert (inRange (ptr));
+      }
+      return ptr;
+    }
+
+    INLINE void free (void * ptr) {
+      assert (_header.isValid());
+      if (inRange (ptr)) {
+	// Pointer is in range.
+	_header.free (ptr);
+      } else {
+	// Invalid free.
+      }
+    }
+    
+    void clear (void) {
+      _header.clear();
+    }
+    
+    // ----- below here are non-conventional heap methods ----- //
+    
+    INLINE bool isValidSuperblock (void) const {
+      assert (_header.isValid());
+      bool b = _header.isValid();
+      return b;
+    }
+    
+    INLINE int getTotalObjects (void) const {
+      assert (_header.isValid());
+      return _header.getTotalObjects();
+    }
+    
+    /// Return the number of free objects in this superblock.
+    INLINE int getObjectsFree (void) const {
+      assert (_header.isValid());
+      assert (_header.getObjectsFree() >= 0);
+      assert (_header.getObjectsFree() <= _header.getTotalObjects());
+      return _header.getObjectsFree();
+    }
+    
+    inline void lock (void) {
+      assert (_header.isValid());
+      _header.lock();
+    }
+    
+    inline void unlock (void) {
+      assert (_header.isValid());
+      _header.unlock();
+    }
+    
+    inline HeapType * getOwner (void) const {
+      assert (_header.isValid());
+      return _header.getOwner();
+    }
+
+    inline void setOwner (HeapType * o) {
+      assert (_header.isValid());
+      assert (o != NULL);
+      _header.setOwner (o);
+    }
+    
+    inline HoardSuperblock * getNext (void) const {
+      assert (_header.isValid());
+      return _header.getNext();
+    }
+
+    inline HoardSuperblock * getPrev (void) const {
+      assert (_header.isValid());
+      return _header.getPrev();
+    }
+    
+    inline void setNext (HoardSuperblock * f) {
+      assert (_header.isValid());
+      assert (f != this);
+      _header.setNext (f);
+    }
+    
+    inline void setPrev (HoardSuperblock * f) {
+      assert (_header.isValid());
+      assert (f != this);
+      _header.setPrev (f);
+    }
+    
+    INLINE bool inRange (void * ptr) const {
+      // Returns true iff the pointer is valid.
+      const size_t ptrValue = (size_t) ptr;
+      return ((ptrValue >= (size_t) _buf) &&
+	      (ptrValue <= (size_t) &_buf[BufferSize]));
+    }
+    
+    INLINE void * normalize (void * ptr) const {
+      void * ptr2 = _header.normalize (ptr);
+      assert (inRange (ptr));
+      assert (inRange (ptr2));
+      return ptr2;
+    }
+    
+    typedef Hoard::HoardSuperblockHeader<LockType, SuperblockSize, HeapType> Header;
+    
+  private:
+    
+    
+    // Disable copying and assignment.
+    
+    HoardSuperblock (const HoardSuperblock&);
+    HoardSuperblock& operator=(const HoardSuperblock&);
+    
+    enum { BufferSize = SuperblockSize - sizeof(Header) };
+    
+    /// The metadata.
+    Header _header;
+
+    
+    /// The actual buffer. MUST immediately follow the header!
+    char _buf[BufferSize];
+  };
+
+}
+
+
+#endif
Index: /proiecte/swift/trunk/lib/hoard-371/src/hoardsuperblockheader.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/hoardsuperblockheader.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/hoardsuperblockheader.h	(revision 176)
@@ -0,0 +1,219 @@
+// -*- C++ -*-
+
+#ifndef _HOARDSUPERBLOCKHEADER_H_
+#define _HOARDSUPERBLOCKHEADER_H_
+
+#include <stdlib.h>
+
+namespace Hoard {
+
+template <class LockType,
+	  int SuperblockSize,
+	  typename HeapType>
+class HoardSuperblock;
+
+template <class LockType,
+	  int SuperblockSize,
+	  typename HeapType>
+class HoardSuperblockHeader {
+public:
+
+  HoardSuperblockHeader (size_t sz, size_t bufferSize)
+    : magicNumber (MAGIC_NUMBER),
+      objectSize (sz),
+      objectSizeIsPowerOfTwo (!(sz & (sz - 1)) && sz),
+      totalObjects (bufferSize / sz),
+      owner (NULL),
+      prev (NULL),
+      next (NULL),
+      reapableObjects (bufferSize / sz),
+      objectsFree (bufferSize / sz),
+      start ((char *) (this + 1)),
+      position (start)
+  {
+  }
+  
+  inline void * malloc (void) {
+    assert (isValid());
+    void * ptr = reapAlloc();
+    if (!ptr) {
+      ptr = freeListAlloc();
+    }
+    assert ((size_t) ptr % sizeof(double) == 0);
+    return ptr;
+  }
+
+  inline void free (void * ptr) {
+    assert (isValid());
+    freeList.insert (reinterpret_cast<FreeSLList::Entry *>(ptr));
+    objectsFree++;
+    if (objectsFree == totalObjects) {
+      clear();
+    }
+  }
+
+  void clear (void) {
+    assert (isValid());
+    // Clear out the freelist.
+    freeList.clear();
+    // All the objects are now free.
+    objectsFree = totalObjects;
+    reapableObjects = totalObjects;
+    position = start;
+  }
+
+  /// @brief Returns the actual start of the object.
+  INLINE void * normalize (void * ptr) const {
+    assert (isValid());
+    size_t offset = (size_t) ptr - (size_t) start;
+    void * p;
+
+    // Optimization note: the modulo operation (%) is *really* slow on
+    // some architectures (notably x86-64). To reduce its overhead, we
+    // optimize for the case when the size request is a power of two,
+    // which is often enough to make a difference.
+
+    if (objectSizeIsPowerOfTwo) {
+      p = (void *) ((size_t) ptr - (offset & (objectSize - 1)));
+    } else {
+      p = (void *) ((size_t) ptr - (offset % objectSize));
+    }
+    return p;
+  }
+
+
+  size_t getSize (void * ptr) const {
+    assert (isValid());
+    size_t offset = (size_t) ptr - (size_t) start;
+    size_t newSize;
+    if (objectSizeIsPowerOfTwo) {
+      newSize = objectSize - (offset & (objectSize - 1));
+    } else {
+      newSize = objectSize - (offset % objectSize);
+    }
+    return newSize;
+  }
+
+  size_t getObjectSize (void) const {
+    return objectSize;
+  }
+
+  int getTotalObjects (void) const {
+    return totalObjects;
+  }
+
+  int getObjectsFree (void) const {
+    return objectsFree;
+  }
+
+  HeapType * getOwner (void) const {
+    return owner;
+  }
+
+  void setOwner (HeapType * o) {
+    owner = o;
+  }
+
+  bool isValid (void) const {
+    return (magicNumber == MAGIC_NUMBER);
+  }
+
+  HoardSuperblock<LockType, SuperblockSize, HeapType> * getNext (void) const {
+    return next;
+  }
+
+  HoardSuperblock<LockType, SuperblockSize, HeapType> * getPrev (void) const {
+    return prev;
+  }
+
+  void setNext (HoardSuperblock<LockType, SuperblockSize, HeapType> * n) {
+    next = n;
+  }
+
+  void setPrev (HoardSuperblock<LockType, SuperblockSize, HeapType> * p) {
+    prev = p;
+  }
+
+  void lock (void) {
+    theLock.lock();
+  }
+
+  void unlock (void) {
+    theLock.unlock();
+  }
+
+private:
+
+  MALLOC_FUNCTION INLINE void * reapAlloc (void) {
+    assert (isValid());
+    assert (position);
+    // Reap mode.
+    if (reapableObjects > 0) {
+      char * ptr = position;
+      position = ptr + objectSize;
+      reapableObjects--;
+      objectsFree--;
+      return ptr;
+    } else {
+      return NULL;
+    }
+  }
+
+  MALLOC_FUNCTION INLINE void * freeListAlloc (void) {
+    assert (isValid());
+    // Freelist mode.
+    char * ptr = reinterpret_cast<char *>(freeList.get());
+    if (ptr) {
+      assert (objectsFree >= 1);
+      objectsFree--;
+    }
+    return ptr;
+  }
+
+  enum { MAGIC_NUMBER = 0xcafed00d };
+
+  const size_t magicNumber;
+
+  /// The object size.
+  const size_t objectSize;
+
+  const bool objectSizeIsPowerOfTwo;
+
+  /// Total objects in the superblock.
+  const int totalObjects;
+
+  /// The lock.
+  LockType theLock;
+
+  /// The owner of this superblock.
+  HeapType * owner;
+
+  /// The preceding superblock in a linked list.
+  HoardSuperblock<LockType, SuperblockSize, HeapType> * prev;
+
+  /// The succeeding superblock in a linked list.
+  HoardSuperblock<LockType, SuperblockSize, HeapType> * next;
+    
+  /// The number of objects available to be 'reap'ed.
+  int reapableObjects;
+
+  /// The number of objects available for (re)use.
+  int objectsFree;
+
+  /// The start of reap allocation.
+  char * start;
+
+  /// The list of freed objects.
+  FreeSLList freeList;
+
+  /// The cursor into the buffer following the header.
+  char * position;
+
+private:
+
+  double _dummy; // for alignment
+};
+
+};
+
+#endif
Index: /proiecte/swift/trunk/lib/hoard-371/src/ignoreinvalidfree.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/ignoreinvalidfree.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/ignoreinvalidfree.h	(revision 176)
@@ -0,0 +1,45 @@
+// -*- C++ -*-
+
+#ifndef _IGNOREINVALIDFREE_H_
+#define _IGNOREINVALIDFREE_H_
+
+#include "hldefines.h"
+
+namespace Hoard {
+
+// A class that checks to see if the object to be freed is inside a
+// valid superblock. If not, it drops the object on the floor. We do
+// this in the name of robustness (turning a segfault or data
+// corruption into a potential memory leak) and because on some
+// systems, it's impossible to catch the first few allocated objects.
+
+template <class S>
+class IgnoreInvalidFree : public S {
+public:
+  INLINE void free (void * ptr) {
+    typename S::SuperblockType * s = S::getSuperblock (ptr);
+    if (!s || (!s->isValidSuperblock())) {
+      // We encountered an invalid free, so we drop it.
+      return;
+    }
+    S::free (ptr);
+  }
+
+  INLINE size_t getSize (void * ptr) {
+    typename S::SuperblockType * s = S::getSuperblock (ptr);
+    if (!s || (!s->isValidSuperblock())) {
+      return 0;
+    }
+    return S::getSize (ptr);
+  }
+
+private:
+
+  // A special value that is placed into deallocated objects.
+  enum { ALREADY_FREED_VALUE = 0xDeadBeef };
+
+};
+
+};
+
+#endif
Index: /proiecte/swift/trunk/lib/hoard-371/src/libhoard.cpp
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/libhoard.cpp	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/libhoard.cpp	(revision 176)
@@ -0,0 +1,164 @@
+/* -*- C++ -*- */
+
+/*
+  The Hoard Multiprocessor Memory Allocator
+  www.hoard.org
+
+  Author: Emery Berger, http://www.cs.umass.edu/~emery
+ 
+  Copyright (c) 1998-2006 Emery Berger, The University of Texas at Austin
+
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or
+  (at your option) any later version.
+  
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+  
+  You should have received a copy of the GNU General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+*/
+
+/*
+ * @file   libhoard.cpp
+ * @brief  This file replaces malloc etc. in your application.
+ * @author Emery Berger <http://www.cs.umass.edu/~emery>
+ */
+
+#include <new>
+
+// The undef below ensures that any pthread_* calls get strong
+// linkage.  Otherwise, our versions here won't replace them.  It is
+// IMPERATIVE that this line appear before any files get included.
+
+#undef __GXX_WEAK__ 
+
+#if defined(_WIN32)
+#define WIN32_LEAN_AND_MEAN
+
+// Maximize the degree of inlining.
+#pragma inline_depth(255)
+
+// Turn inlining hints into requirements.
+#define inline __forceinline
+#pragma warning(disable:4273)
+#endif
+
+#if HOARD_NO_LOCK_OPT
+// Disable lock optimization.
+volatile int anyThreadCreated = 1;
+#else
+// The normal case. See heaplayers/spinlock.h.
+volatile int anyThreadCreated = 0;
+#endif
+
+namespace Hoard {
+
+  /// The maximum amount of memory that each TLAB may hold, in bytes.
+  enum { MAX_MEMORY_PER_TLAB = 256 * 1024 };
+  
+  /// The maximum number of threads supported (sort of).
+  enum { MaxThreads = 1024 };
+  
+  /// The maximum number of heaps supported.
+  enum { NumHeaps = 128 };
+  
+  /// Size, in bytes, of the largest object we will cache on a
+  /// thread-local allocation buffer.
+  enum { LargestSmallObject = 256 };
+  
+  // HOARD_MMAP_PROTECTION_MASK defines the protection flags used for
+  // freshly-allocated memory. The default case is that heap memory is
+  // NOT executable, thus preventing the class of attacks that inject
+  // executable code on the heap.
+  // 
+  // While this is not recommended, you can define HL_EXECUTABLE_HEAP as
+  // 1 in heaplayers/hldefines.h if you really need to (i.e., you're
+  // doing dynamic code generation into malloc'd space).
+  
+#if HL_EXECUTABLE_HEAP
+#define HOARD_MMAP_PROTECTION_MASK (PROT_READ | PROT_WRITE | PROT_EXEC)
+#else
+#define HOARD_MMAP_PROTECTION_MASK (PROT_READ | PROT_WRITE)
+#endif
+
+}
+
+#include "ansiwrapper.h"
+#include "cpuinfo.h"
+#include "hoard.h"
+#include "heapmanager.h"
+#include "tlab.h"
+
+//
+// The base Hoard heap.
+//
+
+namespace Hoard {
+
+  class HoardHeapType :
+    public HeapManager<TheLockType, HoardHeap<MaxThreads, NumHeaps> > {
+  };
+
+  // Just an abbreviation.
+  typedef HoardHeapType::SuperblockType::Header TheHeader;
+
+  //
+  // The thread-local 'allocation buffers' (TLABs), which is a bit of a
+  // misnomer since these are actually separate heaps in their own
+  // right.
+  //
+  
+  typedef ThreadLocalAllocationBuffer<HL::bins<TheHeader, SUPERBLOCK_SIZE>::NUM_BINS,
+				      HL::bins<TheHeader, SUPERBLOCK_SIZE>::getSizeClass,
+				      HL::bins<TheHeader, SUPERBLOCK_SIZE>::getClassSize,
+				      LargestSmallObject,
+				      MAX_MEMORY_PER_TLAB,
+				      HoardHeapType::SuperblockType,
+				      SUPERBLOCK_SIZE,
+				      HoardHeapType> TLABBase;
+
+  class TLAB : public TLABBase {
+  public:
+    TLAB (HoardHeapType * h)
+      : TLABBase (h)
+    {}
+
+  };
+
+}
+
+using namespace Hoard;
+
+typedef TLAB TheCustomHeapType;
+
+/// Maintain a single instance of the main Hoard heap.
+
+inline static HoardHeapType * getMainHoardHeap (void) {
+  // This function is C++ magic that ensures that the heap is
+  // initialized before its first use. First, allocate a static buffer
+  // to hold the heap.
+  static double thBuf[sizeof(HoardHeapType) / sizeof(double) + 1];
+
+  // Now initialize the heap into that buffer.
+  static HoardHeapType * th = new (thBuf) HoardHeapType;
+  return th;
+}
+
+// Compute the version of gcc we're compiling with (if any).
+#define GCC_VERSION (__GNUC__ * 10000 \
+                     + __GNUC_MINOR__ * 100 \
+                     + __GNUC_PATCHLEVEL__)
+
+#include "userealtls.cpp"
+
+//
+// Finally, get the replacements for the rest of the malloc family.
+//
+
+#include "wrapper.cpp"
Index: /proiecte/swift/trunk/lib/hoard-371/src/libhoard.def
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/libhoard.def	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/libhoard.def	(revision 176)
@@ -0,0 +1,338 @@
+EXPORTS 
+??$hash@PAX@HL@@YAIPAX@Z
+??0?$ANSIWrapper@V?$IgnoreInvalidFree@V?$HybridHeap@$0HPMA@V?$ThreadPoolHeap@$0EAA@$0IA@VPerThreadHoardHeap@Hoard@@@Hoard@@VBigHeap@2@@HL@@@Hoard@@@HL@@QAE@XZ
+??0?$AlignedMmapInstance@$0BAAAA@@Hoard@@QAE@XZ
+??0?$AlignedSuperblockHeap@VWinLockType@HL@@$0BAAAA@@Hoard@@QAE@XZ
+??0?$AlignedSuperblockHeapHelper@VWinLockType@HL@@$0BAAAA@@Hoard@@QAE@XZ
+??0?$Array@$0DH@V?$ManageOneSuperblock@V?$EmptyClass@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@Hoard@@@Hoard@@$07@Hoard@@@Hoard@@@Hoard@@QAE@XZ
+??0?$Array@$0DH@V?$ManageOneSuperblock@V?$EmptyClass@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@VSmallHeap@Hoard@@@Hoard@@$07@Hoard@@@Hoard@@@Hoard@@QAE@XZ
+??0?$Array@$0DH@VDLList@HL@@@Hoard@@QAE@XZ
+??0?$Array@$0DH@VStatistics@Hoard@@@Hoard@@QAE@XZ
+??0?$Array@$0IA@VPerThreadHoardHeap@Hoard@@@Hoard@@QAE@XZ
+??0?$BaseHoardManager@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@Hoard@@@Hoard@@@@QAE@XZ
+??0?$BaseHoardManager@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@VSmallHeap@Hoard@@@Hoard@@@@QAE@XZ
+??0?$BumpAlloc@$0BAAAA@VMmapAlloc@Hoard@@@Hoard@@QAE@XZ
+??0?$Check@V?$EmptyClass@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@Hoard@@@Hoard@@$07@Hoard@@VMyChecker@12@@@QAE@PAV?$EmptyClass@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@Hoard@@@Hoard@@$07@Hoard@@@Z
+??0?$Check@V?$EmptyClass@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@VSmallHeap@Hoard@@@Hoard@@$07@Hoard@@VMyChecker@12@@@QAE@PAV?$EmptyClass@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@VSmallHeap@Hoard@@@Hoard@@$07@Hoard@@@Z
+??0?$Check@V?$HoardManager@V?$AlignedSuperblockHeap@VWinLockType@HL@@$0BAAAA@@Hoard@@V?$EmptyHoardManager@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@Hoard@@@Hoard@@@@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@Hoard@@@2@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@2@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@2@@Hoard@@VsanityCheck@12@@@QAE@PAV?$HoardManager@V?$AlignedSuperblockHeap@VWinLockType@HL@@$0BAAAA@@Hoard@@V?$EmptyHoardManager@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@Hoard@@@Hoard@@@@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@Hoard@@@2@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@2@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@2@@Hoard@@@Z
+??0?$Check@V?$HoardManager@V?$AlignedSuperblockHeap@VWinLockType@HL@@$0BAAAA@@Hoard@@V?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@2@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@VSmallHeap@Hoard@@@2@$07VWinLockType@HL@@VhoardThresholdFunctionClass@2@VSmallHeap@2@@Hoard@@VsanityCheck@12@@@QAE@PAV?$HoardManager@V?$AlignedSuperblockHeap@VWinLockType@HL@@$0BAAAA@@Hoard@@V?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@2@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@VSmallHeap@Hoard@@@2@$07VWinLockType@HL@@VhoardThresholdFunctionClass@2@VSmallHeap@2@@Hoard@@@Z
+??0?$ConformantHeap@V?$HoardManager@V?$AlignedSuperblockHeap@VWinLockType@HL@@$0BAAAA@@Hoard@@V?$EmptyHoardManager@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@Hoard@@@Hoard@@@@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@Hoard@@@2@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@2@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@2@@Hoard@@@Hoard@@QAE@XZ
+??0?$ConformantHeap@V?$HoardManager@V?$AlignedSuperblockHeap@VWinLockType@HL@@$0BAAAA@@Hoard@@V?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@2@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@VSmallHeap@Hoard@@@2@$07VWinLockType@HL@@VhoardThresholdFunctionClass@2@VSmallHeap@2@@Hoard@@@Hoard@@QAE@XZ
+??0?$ConformantHeap@V?$LockedHeap@VWinLockType@HL@@V?$AddHeaderHeap@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@VBigHeap@Hoard@@@Hoard@@$0BAAAA@V?$AlignedMmap@$0BAAAA@@2@@Hoard@@@HL@@@Hoard@@QAE@XZ
+??0?$ConformantHeap@V?$LockedHeap@VWinLockType@HL@@V?$FixedRequestHeap@$0BAAAA@V?$SuperblockStore@$0BAAAA@@Hoard@@@Hoard@@@HL@@@Hoard@@QAE@XZ
+??0?$EmptyClass@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@Hoard@@@Hoard@@$07@Hoard@@QAE@XZ
+??0?$EmptyClass@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@VSmallHeap@Hoard@@@Hoard@@$07@Hoard@@QAE@XZ
+??0?$EmptyHoardManager@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@Hoard@@@Hoard@@@@QAE@XZ
+??0?$FixedRequestHeap@$0BAAAA@V?$SuperblockStore@$0BAAAA@@Hoard@@@Hoard@@QAE@XZ
+??0?$FreelistHeap@V?$BumpAlloc@$0BAAAA@VMmapAlloc@Hoard@@@Hoard@@@HL@@QAE@XZ
+??0?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@QAE@XZ
+??0?$Guard@VSmallHeap@Hoard@@@HL@@QAE@AAVSmallHeap@Hoard@@@Z
+??0?$Guard@VWinLockType@HL@@@HL@@QAE@AAVWinLockType@1@@Z
+??0?$HeapManager@VWinLockType@HL@@V?$HoardHeap@$0EAA@$0IA@@Hoard@@@Hoard@@QAE@XZ
+??0?$HoardHeap@$0EAA@$0IA@@Hoard@@QAE@XZ
+??0?$HoardManager@V?$AlignedSuperblockHeap@VWinLockType@HL@@$0BAAAA@@Hoard@@V?$EmptyHoardManager@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@Hoard@@@Hoard@@@@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@Hoard@@@2@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@2@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@2@@Hoard@@QAE@XZ
+??0?$HoardManager@V?$AlignedSuperblockHeap@VWinLockType@HL@@$0BAAAA@@Hoard@@V?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@2@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@VSmallHeap@Hoard@@@2@$07VWinLockType@HL@@VhoardThresholdFunctionClass@2@VSmallHeap@2@@Hoard@@QAE@XZ
+??0?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@VSmallHeap@Hoard@@@Hoard@@QAE@I@Z
+??0?$HoardSuperblockHeader@VWinLockType@HL@@$0BAAAA@VBigHeap@Hoard@@@Hoard@@QAE@II@Z
+??0?$HoardSuperblockHeader@VWinLockType@HL@@$0BAAAA@VSmallHeap@Hoard@@@Hoard@@QAE@II@Z
+??0?$HybridHeap@$0HPMA@V?$ThreadPoolHeap@$0EAA@$0IA@VPerThreadHoardHeap@Hoard@@@Hoard@@VBigHeap@2@@HL@@QAE@XZ
+??0?$IgnoreInvalidFree@V?$HybridHeap@$0HPMA@V?$ThreadPoolHeap@$0EAA@$0IA@VPerThreadHoardHeap@Hoard@@@Hoard@@VBigHeap@2@@HL@@@Hoard@@QAE@XZ
+??0?$LockMallocHeap@VSmallHeap@Hoard@@@Hoard@@QAE@XZ
+??0?$LockedHeap@VWinLockType@HL@@V?$AddHeaderHeap@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@VBigHeap@Hoard@@@Hoard@@$0BAAAA@V?$AlignedMmap@$0BAAAA@@2@@Hoard@@@HL@@QAE@XZ
+??0?$LockedHeap@VWinLockType@HL@@V?$FixedRequestHeap@$0BAAAA@V?$SuperblockStore@$0BAAAA@@Hoard@@@Hoard@@@HL@@QAE@XZ
+??0?$ManageOneSuperblock@V?$EmptyClass@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@Hoard@@@Hoard@@$07@Hoard@@@Hoard@@QAE@XZ
+??0?$ManageOneSuperblock@V?$EmptyClass@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@VSmallHeap@Hoard@@@Hoard@@$07@Hoard@@@Hoard@@QAE@XZ
+??0?$MyHashMap@PAXIVSourceHeap@?$AlignedMmapInstance@$0BAAAA@@Hoard@@@HL@@QAE@H@Z
+??0?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@Hoard@@QAE@XZ
+??0?$RedirectFree@V?$LockMallocHeap@VSmallHeap@Hoard@@@Hoard@@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@VSmallHeap@Hoard@@@2@@Hoard@@QAE@XZ
+??0?$SuperblockStore@$0BAAAA@@Hoard@@QAE@XZ
+??0?$ThreadLocalAllocationBuffer@$0DH@$1?getSizeClass@?$bins@V?$HoardSuperblockHeader@VWinLockType@HL@@$0BAAAA@VSmallHeap@Hoard@@@Hoard@@$0BAAAA@@HL@@SAHI@Z$1?getClassSize@23@SAIH@Z$0BAA@$0EAAAA@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@VSmallHeap@Hoard@@@Hoard@@$0BAAAA@VHoardHeapType@6@@Hoard@@QAE@PAVHoardHeapType@1@@Z
+??0?$ThreadPoolHeap@$0EAA@$0IA@VPerThreadHoardHeap@Hoard@@@Hoard@@QAE@XZ
+??0BigHeap@Hoard@@QAE@XZ
+??0DLList@HL@@QAE@XZ
+??0Entry@FreeSLList@@QAE@XZ
+??0FreeSLList@@QAE@XZ
+??0HoardHeapType@Hoard@@QAE@XZ
+??0ListNode@?$MyHashMap@PAXIVSourceHeap@?$AlignedMmapInstance@$0BAAAA@@Hoard@@@HL@@QAE@XZ
+??0PerThreadHoardHeap@Hoard@@QAE@XZ
+??0SmallHeap@Hoard@@QAE@XZ
+??0SourceHeap@?$AlignedMmapInstance@$0BAAAA@@Hoard@@QAE@XZ
+??0Statistics@Hoard@@QAE@XZ
+??0TLAB@Hoard@@QAE@PAVHoardHeapType@1@@Z
+??0WinLockType@HL@@QAE@XZ
+??0bad_alloc@std@@QAE@ABV01@@Z
+??0bad_alloc@std@@QAE@XZ
+??1?$ANSIWrapper@V?$IgnoreInvalidFree@V?$HybridHeap@$0HPMA@V?$ThreadPoolHeap@$0EAA@$0IA@VPerThreadHoardHeap@Hoard@@@Hoard@@VBigHeap@2@@HL@@@Hoard@@@HL@@QAE@XZ
+??1?$AlignedSuperblockHeap@VWinLockType@HL@@$0BAAAA@@Hoard@@QAE@XZ
+??1?$AlignedSuperblockHeapHelper@VWinLockType@HL@@$0BAAAA@@Hoard@@QAE@XZ
+??1?$Array@$0IA@VPerThreadHoardHeap@Hoard@@@Hoard@@QAE@XZ
+??1?$BaseHoardManager@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@Hoard@@@Hoard@@@@UAE@XZ
+??1?$BaseHoardManager@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@VSmallHeap@Hoard@@@Hoard@@@@UAE@XZ
+??1?$Check@V?$EmptyClass@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@Hoard@@@Hoard@@$07@Hoard@@VMyChecker@12@@@QAE@XZ
+??1?$Check@V?$EmptyClass@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@VSmallHeap@Hoard@@@Hoard@@$07@Hoard@@VMyChecker@12@@@QAE@XZ
+??1?$Check@V?$HoardManager@V?$AlignedSuperblockHeap@VWinLockType@HL@@$0BAAAA@@Hoard@@V?$EmptyHoardManager@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@Hoard@@@Hoard@@@@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@Hoard@@@2@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@2@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@2@@Hoard@@VsanityCheck@12@@@QAE@XZ
+??1?$Check@V?$HoardManager@V?$AlignedSuperblockHeap@VWinLockType@HL@@$0BAAAA@@Hoard@@V?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@2@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@VSmallHeap@Hoard@@@2@$07VWinLockType@HL@@VhoardThresholdFunctionClass@2@VSmallHeap@2@@Hoard@@VsanityCheck@12@@@QAE@XZ
+??1?$ConformantHeap@V?$HoardManager@V?$AlignedSuperblockHeap@VWinLockType@HL@@$0BAAAA@@Hoard@@V?$EmptyHoardManager@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@Hoard@@@Hoard@@@@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@Hoard@@@2@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@2@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@2@@Hoard@@@Hoard@@UAE@XZ
+??1?$ConformantHeap@V?$HoardManager@V?$AlignedSuperblockHeap@VWinLockType@HL@@$0BAAAA@@Hoard@@V?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@2@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@VSmallHeap@Hoard@@@2@$07VWinLockType@HL@@VhoardThresholdFunctionClass@2@VSmallHeap@2@@Hoard@@@Hoard@@UAE@XZ
+??1?$ConformantHeap@V?$LockedHeap@VWinLockType@HL@@V?$AddHeaderHeap@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@VBigHeap@Hoard@@@Hoard@@$0BAAAA@V?$AlignedMmap@$0BAAAA@@2@@Hoard@@@HL@@@Hoard@@QAE@XZ
+??1?$ConformantHeap@V?$LockedHeap@VWinLockType@HL@@V?$FixedRequestHeap@$0BAAAA@V?$SuperblockStore@$0BAAAA@@Hoard@@@Hoard@@@HL@@@Hoard@@QAE@XZ
+??1?$EmptyHoardManager@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@Hoard@@@Hoard@@@@UAE@XZ
+??1?$Guard@VSmallHeap@Hoard@@@HL@@QAE@XZ
+??1?$Guard@VWinLockType@HL@@@HL@@QAE@XZ
+??1?$HeapManager@VWinLockType@HL@@V?$HoardHeap@$0EAA@$0IA@@Hoard@@@Hoard@@QAE@XZ
+??1?$HoardHeap@$0EAA@$0IA@@Hoard@@QAE@XZ
+??1?$HoardManager@V?$AlignedSuperblockHeap@VWinLockType@HL@@$0BAAAA@@Hoard@@V?$EmptyHoardManager@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@Hoard@@@Hoard@@@@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@Hoard@@@2@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@2@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@2@@Hoard@@UAE@XZ
+??1?$HoardManager@V?$AlignedSuperblockHeap@VWinLockType@HL@@$0BAAAA@@Hoard@@V?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@2@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@VSmallHeap@Hoard@@@2@$07VWinLockType@HL@@VhoardThresholdFunctionClass@2@VSmallHeap@2@@Hoard@@UAE@XZ
+??1?$HoardSuperblockHeader@VWinLockType@HL@@$0BAAAA@VSmallHeap@Hoard@@@Hoard@@QAE@XZ
+??1?$HybridHeap@$0HPMA@V?$ThreadPoolHeap@$0EAA@$0IA@VPerThreadHoardHeap@Hoard@@@Hoard@@VBigHeap@2@@HL@@QAE@XZ
+??1?$IgnoreInvalidFree@V?$HybridHeap@$0HPMA@V?$ThreadPoolHeap@$0EAA@$0IA@VPerThreadHoardHeap@Hoard@@@Hoard@@VBigHeap@2@@HL@@@Hoard@@QAE@XZ
+??1?$LockMallocHeap@VSmallHeap@Hoard@@@Hoard@@UAE@XZ
+??1?$LockedHeap@VWinLockType@HL@@V?$AddHeaderHeap@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@VBigHeap@Hoard@@@Hoard@@$0BAAAA@V?$AlignedMmap@$0BAAAA@@2@@Hoard@@@HL@@QAE@XZ
+??1?$LockedHeap@VWinLockType@HL@@V?$FixedRequestHeap@$0BAAAA@V?$SuperblockStore@$0BAAAA@@Hoard@@@Hoard@@@HL@@QAE@XZ
+??1?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@Hoard@@UAE@XZ
+??1?$RedirectFree@V?$LockMallocHeap@VSmallHeap@Hoard@@@Hoard@@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@VSmallHeap@Hoard@@@2@@Hoard@@QAE@XZ
+??1?$ThreadLocalAllocationBuffer@$0DH@$1?getSizeClass@?$bins@V?$HoardSuperblockHeader@VWinLockType@HL@@$0BAAAA@VSmallHeap@Hoard@@@Hoard@@$0BAAAA@@HL@@SAHI@Z$1?getClassSize@23@SAIH@Z$0BAA@$0EAAAA@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@VSmallHeap@Hoard@@@Hoard@@$0BAAAA@VHoardHeapType@6@@Hoard@@QAE@XZ
+??1?$ThreadPoolHeap@$0EAA@$0IA@VPerThreadHoardHeap@Hoard@@@Hoard@@QAE@XZ
+??1BigHeap@Hoard@@QAE@XZ
+??1PerThreadHoardHeap@Hoard@@QAE@XZ
+??1SmallHeap@Hoard@@UAE@XZ
+??1WinLockType@HL@@QAE@XZ
+??1bad_alloc@std@@UAE@XZ
+??2@YAPAXI@Z
+??2@YAPAXIABUnothrow_t@std@@@Z
+??2@YAPAXIPAX@Z
+??3@YAXPAX@Z
+??R?$Array@$09PAV?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@Hoard@@@Hoard@@@Hoard@@QAEAAPAV?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@Hoard@@@1@H@Z
+??R?$Array@$09PAV?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@VSmallHeap@Hoard@@@Hoard@@@Hoard@@QAEAAPAV?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@VSmallHeap@Hoard@@@1@H@Z
+??R?$Array@$0DH@V?$ManageOneSuperblock@V?$EmptyClass@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@Hoard@@@Hoard@@$07@Hoard@@@Hoard@@@Hoard@@QAEAAV?$ManageOneSuperblock@V?$EmptyClass@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@Hoard@@@Hoard@@$07@Hoard@@@1@H@Z
+??R?$Array@$0DH@V?$ManageOneSuperblock@V?$EmptyClass@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@VSmallHeap@Hoard@@@Hoard@@$07@Hoard@@@Hoard@@@Hoard@@QAEAAV?$ManageOneSuperblock@V?$EmptyClass@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@VSmallHeap@Hoard@@@Hoard@@$07@Hoard@@@1@H@Z
+??R?$Array@$0DH@VDLList@HL@@@Hoard@@QAEAAVDLList@HL@@H@Z
+??R?$Array@$0DH@VStatistics@Hoard@@@Hoard@@QAEAAVStatistics@1@H@Z
+??R?$Array@$0EAA@H@Hoard@@QAEAAHH@Z
+??R?$Array@$0EAA@H@Hoard@@QBEABHH@Z
+??R?$Array@$0IA@H@Hoard@@QAEAAHH@Z
+??R?$Array@$0IA@H@Hoard@@QBEABHH@Z
+??R?$Array@$0IA@VPerThreadHoardHeap@Hoard@@@Hoard@@QAEAAVPerThreadHoardHeap@1@H@Z
+??R?$ExactlyOne@V?$AlignedMmapInstance@$0BAAAA@@Hoard@@@Hoard@@QAEAAV?$AlignedMmapInstance@$0BAAAA@@1@XZ
+??_G?$BaseHoardManager@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@Hoard@@@Hoard@@@@UAEPAXI@Z
+??_G?$BaseHoardManager@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@VSmallHeap@Hoard@@@Hoard@@@@UAEPAXI@Z
+??_G?$ConformantHeap@V?$HoardManager@V?$AlignedSuperblockHeap@VWinLockType@HL@@$0BAAAA@@Hoard@@V?$EmptyHoardManager@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@Hoard@@@Hoard@@@@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@Hoard@@@2@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@2@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@2@@Hoard@@@Hoard@@UAEPAXI@Z
+??_G?$ConformantHeap@V?$HoardManager@V?$AlignedSuperblockHeap@VWinLockType@HL@@$0BAAAA@@Hoard@@V?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@2@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@VSmallHeap@Hoard@@@2@$07VWinLockType@HL@@VhoardThresholdFunctionClass@2@VSmallHeap@2@@Hoard@@@Hoard@@UAEPAXI@Z
+??_G?$EmptyHoardManager@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@Hoard@@@Hoard@@@@UAEPAXI@Z
+??_G?$HoardManager@V?$AlignedSuperblockHeap@VWinLockType@HL@@$0BAAAA@@Hoard@@V?$EmptyHoardManager@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@Hoard@@@Hoard@@@@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@Hoard@@@2@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@2@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@2@@Hoard@@UAEPAXI@Z
+??_G?$HoardManager@V?$AlignedSuperblockHeap@VWinLockType@HL@@$0BAAAA@@Hoard@@V?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@2@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@VSmallHeap@Hoard@@@2@$07VWinLockType@HL@@VhoardThresholdFunctionClass@2@VSmallHeap@2@@Hoard@@UAEPAXI@Z
+??_G?$LockMallocHeap@VSmallHeap@Hoard@@@Hoard@@UAEPAXI@Z
+??_G?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@Hoard@@UAEPAXI@Z
+??_GSmallHeap@Hoard@@UAEPAXI@Z
+??_Gbad_alloc@std@@UAEPAXI@Z
+??_H@YGXPAXIHP6EPAX0@Z@Z
+??_I@YGXPAXIHP6EX0@Z@Z
+??_U@YAPAXI@Z
+??_U@YAPAXIABUnothrow_t@std@@@Z
+??_V@YAXPAX@Z
+?addStatsSuperblock@?$HoardManager@V?$AlignedSuperblockHeap@VWinLockType@HL@@$0BAAAA@@Hoard@@V?$EmptyHoardManager@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@Hoard@@@Hoard@@@@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@Hoard@@@2@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@2@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@2@@Hoard@@AAEXPAV?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@Hoard@@@2@H@Z
+?addStatsSuperblock@?$HoardManager@V?$AlignedSuperblockHeap@VWinLockType@HL@@$0BAAAA@@Hoard@@V?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@2@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@VSmallHeap@Hoard@@@2@$07VWinLockType@HL@@VhoardThresholdFunctionClass@2@VSmallHeap@2@@Hoard@@AAEXPAV?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@VSmallHeap@Hoard@@@2@H@Z
+?align@?$ANSIWrapper@V?$IgnoreInvalidFree@V?$HybridHeap@$0HPMA@V?$ThreadPoolHeap@$0EAA@$0IA@VPerThreadHoardHeap@Hoard@@@Hoard@@VBigHeap@2@@HL@@@Hoard@@@HL@@CAII@Z
+?align@?$AlignedMmapInstance@$0BAAAA@@Hoard@@CAPADPAD@Z
+?chooseZero@?$HeapManager@VWinLockType@HL@@V?$HoardHeap@$0EAA@$0IA@@Hoard@@@Hoard@@QAEXXZ
+?clear@?$HoardSuperblockHeader@VWinLockType@HL@@$0BAAAA@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@Hoard@@@Hoard@@QAEXXZ
+?clear@?$HoardSuperblockHeader@VWinLockType@HL@@$0BAAAA@VSmallHeap@Hoard@@@Hoard@@QAEXXZ
+?clear@?$ThreadLocalAllocationBuffer@$0DH@$1?getSizeClass@?$bins@V?$HoardSuperblockHeader@VWinLockType@HL@@$0BAAAA@VSmallHeap@Hoard@@@Hoard@@$0BAAAA@@HL@@SAHI@Z$1?getClassSize@23@SAIH@Z$0BAA@$0EAAAA@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@VSmallHeap@Hoard@@@Hoard@@$0BAAAA@VHoardHeapType@6@@Hoard@@QAEXXZ
+?clear@DLList@HL@@QAEXXZ
+?clear@FreeSLList@@QAEXXZ
+?computeNumProcessors@CPUInfo@HL@@SAHXZ
+?decStatsSuperblock@?$HoardManager@V?$AlignedSuperblockHeap@VWinLockType@HL@@$0BAAAA@@Hoard@@V?$EmptyHoardManager@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@Hoard@@@Hoard@@@@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@Hoard@@@2@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@2@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@2@@Hoard@@AAEXPAV?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@Hoard@@@2@H@Z
+?erase@?$MyHashMap@PAXIVSourceHeap@?$AlignedMmapInstance@$0BAAAA@@Hoard@@@HL@@QAEXPAX@Z
+?findUnusedHeap@?$HeapManager@VWinLockType@HL@@V?$HoardHeap@$0EAA@$0IA@@Hoard@@@Hoard@@QAEHXZ
+?free@?$ANSIWrapper@V?$IgnoreInvalidFree@V?$HybridHeap@$0HPMA@V?$ThreadPoolHeap@$0EAA@$0IA@VPerThreadHoardHeap@Hoard@@@Hoard@@VBigHeap@2@@HL@@@Hoard@@@HL@@QAEXPAX@Z
+?free@?$AddHeaderHeap@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@VBigHeap@Hoard@@@Hoard@@$0BAAAA@V?$AlignedMmap@$0BAAAA@@2@@Hoard@@QAEXPAX@Z
+?free@?$AlignedMmap@$0BAAAA@@Hoard@@QAEXPAX@Z
+?free@?$AlignedMmapInstance@$0BAAAA@@Hoard@@QAEXPAX@Z
+?free@?$BaseHoardManager@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@Hoard@@@Hoard@@@@UAEXPAX@Z
+?free@?$BaseHoardManager@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@VSmallHeap@Hoard@@@Hoard@@@@UAEXPAX@Z
+?free@?$EmptyClass@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@Hoard@@@Hoard@@$07@Hoard@@QAEXPAX@Z
+?free@?$EmptyClass@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@VSmallHeap@Hoard@@@Hoard@@$07@Hoard@@QAEXPAX@Z
+?free@?$EmptyHoardManager@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@Hoard@@@Hoard@@@@UAEXPAX@Z
+?free@?$FreelistHeap@V?$BumpAlloc@$0BAAAA@VMmapAlloc@Hoard@@@Hoard@@@HL@@QAEXPAX@Z
+?free@?$HoardManager@V?$AlignedSuperblockHeap@VWinLockType@HL@@$0BAAAA@@Hoard@@V?$EmptyHoardManager@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@Hoard@@@Hoard@@@@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@Hoard@@@2@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@2@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@2@@Hoard@@UAEXPAX@Z
+?free@?$HoardManager@V?$AlignedSuperblockHeap@VWinLockType@HL@@$0BAAAA@@Hoard@@V?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@2@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@VSmallHeap@Hoard@@@2@$07VWinLockType@HL@@VhoardThresholdFunctionClass@2@VSmallHeap@2@@Hoard@@UAEXPAX@Z
+?free@?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@Hoard@@@Hoard@@QAEXPAX@Z
+?free@?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@VSmallHeap@Hoard@@@Hoard@@QAEXPAX@Z
+?free@?$HoardSuperblockHeader@VWinLockType@HL@@$0BAAAA@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@Hoard@@@Hoard@@QAEXPAX@Z
+?free@?$HoardSuperblockHeader@VWinLockType@HL@@$0BAAAA@VSmallHeap@Hoard@@@Hoard@@QAEXPAX@Z
+?free@?$HybridHeap@$0HPMA@V?$ThreadPoolHeap@$0EAA@$0IA@VPerThreadHoardHeap@Hoard@@@Hoard@@VBigHeap@2@@HL@@QAEXPAX@Z
+?free@?$IgnoreInvalidFree@V?$HybridHeap@$0HPMA@V?$ThreadPoolHeap@$0EAA@$0IA@VPerThreadHoardHeap@Hoard@@@Hoard@@VBigHeap@2@@HL@@@Hoard@@QAEXPAX@Z
+?free@?$LockedHeap@VWinLockType@HL@@V?$AddHeaderHeap@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@VBigHeap@Hoard@@@Hoard@@$0BAAAA@V?$AlignedMmap@$0BAAAA@@2@@Hoard@@@HL@@QAEXPAX@Z
+?free@?$ManageOneSuperblock@V?$EmptyClass@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@Hoard@@@Hoard@@$07@Hoard@@@Hoard@@QAEXPAX@Z
+?free@?$ManageOneSuperblock@V?$EmptyClass@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@VSmallHeap@Hoard@@@Hoard@@$07@Hoard@@@Hoard@@QAEXPAX@Z
+?free@?$RedirectFree@V?$LockMallocHeap@VSmallHeap@Hoard@@@Hoard@@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@VSmallHeap@Hoard@@@2@@Hoard@@SAXPAX@Z
+?free@?$ThreadLocalAllocationBuffer@$0DH@$1?getSizeClass@?$bins@V?$HoardSuperblockHeader@VWinLockType@HL@@$0BAAAA@VSmallHeap@Hoard@@@Hoard@@$0BAAAA@@HL@@SAHI@Z$1?getClassSize@23@SAIH@Z$0BAA@$0EAAAA@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@VSmallHeap@Hoard@@@Hoard@@$0BAAAA@VHoardHeapType@6@@Hoard@@QAEXPAX@Z
+?free@?$ThreadPoolHeap@$0EAA@$0IA@VPerThreadHoardHeap@Hoard@@@Hoard@@QAEXPAX@Z
+?freeListAlloc@?$HoardSuperblockHeader@VWinLockType@HL@@$0BAAAA@VSmallHeap@Hoard@@@Hoard@@AAEPAXXZ
+?function@bogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@SA_NHHI@Z
+?function@hoardThresholdFunctionClass@Hoard@@SA_NHHI@Z
+?get@?$EmptyClass@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@Hoard@@@Hoard@@$07@Hoard@@QAEPAV?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@Hoard@@@2@XZ
+?get@?$EmptyClass@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@VSmallHeap@Hoard@@@Hoard@@$07@Hoard@@QAEPAV?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@VSmallHeap@Hoard@@@2@XZ
+?get@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@QAEPAV?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@V?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@2@IPAX@Z
+?get@?$HoardManager@V?$AlignedSuperblockHeap@VWinLockType@HL@@$0BAAAA@@Hoard@@V?$EmptyHoardManager@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@Hoard@@@Hoard@@@@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@Hoard@@@2@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@2@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@2@@Hoard@@QAEPAV?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@Hoard@@@2@IPAV?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@2@@Z
+?get@?$ManageOneSuperblock@V?$EmptyClass@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@Hoard@@@Hoard@@$07@Hoard@@@Hoard@@QAEPAV?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@Hoard@@@2@XZ
+?get@?$ManageOneSuperblock@V?$EmptyClass@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@VSmallHeap@Hoard@@@Hoard@@$07@Hoard@@@Hoard@@QAEPAV?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@VSmallHeap@Hoard@@@2@XZ
+?get@?$MyHashMap@PAXIVSourceHeap@?$AlignedMmapInstance@$0BAAAA@@Hoard@@@HL@@QAEIPAX@Z
+?get@DLList@HL@@QAEPAVEntry@12@XZ
+?get@FreeSLList@@QAEPAVEntry@1@XZ
+?getAllocated@Statistics@Hoard@@QBEHXZ
+?getAnotherSuperblock@?$HoardManager@V?$AlignedSuperblockHeap@VWinLockType@HL@@$0BAAAA@@Hoard@@V?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@2@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@VSmallHeap@Hoard@@@2@$07VWinLockType@HL@@VhoardThresholdFunctionClass@2@VSmallHeap@2@@Hoard@@QAEPAXI@Z
+?getClassSize@?$bins@V?$HoardSuperblockHeader@VWinLockType@HL@@$0BAAAA@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@Hoard@@@Hoard@@$0BAAAA@@HL@@SAIH@Z
+?getClassSize@?$bins@V?$HoardSuperblockHeader@VWinLockType@HL@@$0BAAAA@VSmallHeap@Hoard@@@Hoard@@$0BAAAA@@HL@@SAIH@Z
+?getCustomHeap@@YAPAVTLAB@Hoard@@XZ
+?getFullness@?$EmptyClass@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@Hoard@@@Hoard@@$07@Hoard@@CAHPAV?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@Hoard@@@2@@Z
+?getFullness@?$EmptyClass@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@VSmallHeap@Hoard@@@Hoard@@$07@Hoard@@CAHPAV?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@VSmallHeap@Hoard@@@2@@Z
+?getHeap@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@CAPAV?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@2@XZ
+?getHeap@?$ThreadPoolHeap@$0EAA@$0IA@VPerThreadHoardHeap@Hoard@@@Hoard@@QAEAAVPerThreadHoardHeap@2@XZ
+?getInUse@Statistics@Hoard@@QBEHXZ
+?getInusemap@?$ThreadPoolHeap@$0EAA@$0IA@VPerThreadHoardHeap@Hoard@@@Hoard@@QBEHH@Z
+?getNext@?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@Hoard@@@Hoard@@QBEPAV12@XZ
+?getNext@?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@VSmallHeap@Hoard@@@Hoard@@QBEPAV12@XZ
+?getNext@?$HoardSuperblockHeader@VWinLockType@HL@@$0BAAAA@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@Hoard@@@Hoard@@QBEPAV?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@Hoard@@@2@XZ
+?getNext@?$HoardSuperblockHeader@VWinLockType@HL@@$0BAAAA@VSmallHeap@Hoard@@@Hoard@@QBEPAV?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@VSmallHeap@Hoard@@@2@XZ
+?getNext@Entry@DLList@HL@@QBEPAV123@XZ
+?getObject@?$HoardManager@V?$AlignedSuperblockHeap@VWinLockType@HL@@$0BAAAA@@Hoard@@V?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@2@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@VSmallHeap@Hoard@@@2@$07VWinLockType@HL@@VhoardThresholdFunctionClass@2@VSmallHeap@2@@Hoard@@AAEPAXHI@Z
+?getObjectSize@?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@VSmallHeap@Hoard@@@Hoard@@QBEIXZ
+?getObjectSize@?$HoardSuperblockHeader@VWinLockType@HL@@$0BAAAA@VSmallHeap@Hoard@@@Hoard@@QBEIXZ
+?getObjectsFree@?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@Hoard@@@Hoard@@QBEHXZ
+?getObjectsFree@?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@VSmallHeap@Hoard@@@Hoard@@QBEHXZ
+?getObjectsFree@?$HoardSuperblockHeader@VWinLockType@HL@@$0BAAAA@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@Hoard@@@Hoard@@QBEHXZ
+?getObjectsFree@?$HoardSuperblockHeader@VWinLockType@HL@@$0BAAAA@VSmallHeap@Hoard@@@Hoard@@QBEHXZ
+?getOwner@?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@VSmallHeap@Hoard@@@Hoard@@QBEPAVSmallHeap@2@XZ
+?getOwner@?$HoardSuperblockHeader@VWinLockType@HL@@$0BAAAA@VSmallHeap@Hoard@@@Hoard@@QBEPAVSmallHeap@2@XZ
+?getPrev@?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@Hoard@@@Hoard@@QBEPAV12@XZ
+?getPrev@?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@VSmallHeap@Hoard@@@Hoard@@QBEPAV12@XZ
+?getPrev@?$HoardSuperblockHeader@VWinLockType@HL@@$0BAAAA@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@Hoard@@@Hoard@@QBEPAV?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@Hoard@@@2@XZ
+?getPrev@?$HoardSuperblockHeader@VWinLockType@HL@@$0BAAAA@VSmallHeap@Hoard@@@Hoard@@QBEPAV?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@VSmallHeap@Hoard@@@2@XZ
+?getSize@?$BaseHoardManager@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@VSmallHeap@Hoard@@@Hoard@@@@SAIPAX@Z
+?getSize@?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@Hoard@@@Hoard@@QBEIPAX@Z
+?getSize@?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@VSmallHeap@Hoard@@@Hoard@@QBEIPAX@Z
+?getSize@?$HoardSuperblockHeader@VWinLockType@HL@@$0BAAAA@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@Hoard@@@Hoard@@QBEIPAX@Z
+?getSize@?$HoardSuperblockHeader@VWinLockType@HL@@$0BAAAA@VSmallHeap@Hoard@@@Hoard@@QBEIPAX@Z
+?getSize@?$RedirectFree@V?$LockMallocHeap@VSmallHeap@Hoard@@@Hoard@@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@VSmallHeap@Hoard@@@2@@Hoard@@QAEIPAX@Z
+?getSize@?$ThreadLocalAllocationBuffer@$0DH@$1?getSizeClass@?$bins@V?$HoardSuperblockHeader@VWinLockType@HL@@$0BAAAA@VSmallHeap@Hoard@@@Hoard@@$0BAAAA@@HL@@SAHI@Z$1?getClassSize@23@SAIH@Z$0BAA@$0EAAAA@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@VSmallHeap@Hoard@@@Hoard@@$0BAAAA@VHoardHeapType@6@@Hoard@@SAIPAX@Z
+?getSize@?$ThreadPoolHeap@$0EAA@$0IA@VPerThreadHoardHeap@Hoard@@@Hoard@@QAEIPAX@Z
+?getSizeClass@?$bins@V?$HoardSuperblockHeader@VWinLockType@HL@@$0BAAAA@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@Hoard@@@Hoard@@$0BAAAA@@HL@@SAHI@Z
+?getSizeClass@?$bins@V?$HoardSuperblockHeader@VWinLockType@HL@@$0BAAAA@VSmallHeap@Hoard@@@Hoard@@$0BAAAA@@HL@@SAHI@Z
+?getSuperblock@?$BaseHoardManager@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@Hoard@@@Hoard@@@@SAPAV?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@Hoard@@@Hoard@@PAX@Z
+?getSuperblock@?$BaseHoardManager@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@VSmallHeap@Hoard@@@Hoard@@@@SAPAV?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@VSmallHeap@Hoard@@@Hoard@@PAX@Z
+?getSuperblock@?$EmptyClass@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@Hoard@@@Hoard@@$07@Hoard@@SAPAV?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@Hoard@@@2@PAX@Z
+?getSuperblock@?$EmptyClass@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@VSmallHeap@Hoard@@@Hoard@@$07@Hoard@@SAPAV?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@VSmallHeap@Hoard@@@2@PAX@Z
+?getSuperblock@?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@Hoard@@@Hoard@@SAPAV12@PAX@Z
+?getSuperblock@?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@VSmallHeap@Hoard@@@Hoard@@SAPAV12@PAX@Z
+?getSuperblock@?$RedirectFree@V?$LockMallocHeap@VSmallHeap@Hoard@@@Hoard@@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@VSmallHeap@Hoard@@@2@@Hoard@@QAEPAV?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@VSmallHeap@Hoard@@@2@PAX@Z
+?getSuperblock@?$ThreadLocalAllocationBuffer@$0DH@$1?getSizeClass@?$bins@V?$HoardSuperblockHeader@VWinLockType@HL@@$0BAAAA@VSmallHeap@Hoard@@@Hoard@@$0BAAAA@@HL@@SAHI@Z$1?getClassSize@23@SAIH@Z$0BAA@$0EAAAA@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@VSmallHeap@Hoard@@@Hoard@@$0BAAAA@VHoardHeapType@6@@Hoard@@SAPAV?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@VSmallHeap@Hoard@@@2@PAX@Z
+?getThreadId@CPUInfo@HL@@SAHXZ
+?getTidMap@?$ThreadPoolHeap@$0EAA@$0IA@VPerThreadHoardHeap@Hoard@@@Hoard@@QBEHH@Z
+?getTotalObjects@?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@Hoard@@@Hoard@@QBEHXZ
+?getTotalObjects@?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@VSmallHeap@Hoard@@@Hoard@@QBEHXZ
+?getTotalObjects@?$HoardSuperblockHeader@VWinLockType@HL@@$0BAAAA@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@Hoard@@@Hoard@@QBEHXZ
+?getTotalObjects@?$HoardSuperblockHeader@VWinLockType@HL@@$0BAAAA@VSmallHeap@Hoard@@@Hoard@@QBEHXZ
+?inRange@?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@Hoard@@@Hoard@@QBE_NPAX@Z
+?inRange@?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@VSmallHeap@Hoard@@@Hoard@@QBE_NPAX@Z
+?initializeCustomHeap@@YAPAVTLAB@Hoard@@XZ
+?insert@?$MyHashMap@PAXIVSourceHeap@?$AlignedMmapInstance@$0BAAAA@@Hoard@@@HL@@AAEXPAXI@Z
+?insert@DLList@HL@@QAEXPAVEntry@12@@Z
+?insert@Entry@DLList@HL@@QAEXPAV123@0@Z
+?insert@FreeSLList@@QAEXPAX@Z
+?isEmpty@DLList@HL@@QBE_NXZ
+?isValid@?$HoardSuperblockHeader@VWinLockType@HL@@$0BAAAA@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@Hoard@@@Hoard@@QBE_NXZ
+?isValid@?$HoardSuperblockHeader@VWinLockType@HL@@$0BAAAA@VSmallHeap@Hoard@@@Hoard@@QBE_NXZ
+?isValidSuperblock@?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@Hoard@@@Hoard@@QBE_NXZ
+?isValidSuperblock@?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@VSmallHeap@Hoard@@@Hoard@@QBE_NXZ
+?lock@?$BaseHoardManager@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@Hoard@@@Hoard@@@@UAEXXZ
+?lock@?$BaseHoardManager@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@VSmallHeap@Hoard@@@Hoard@@@@UAEXXZ
+?lock@?$EmptyHoardManager@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@Hoard@@@Hoard@@@@UAEXXZ
+?lock@?$HoardManager@V?$AlignedSuperblockHeap@VWinLockType@HL@@$0BAAAA@@Hoard@@V?$EmptyHoardManager@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@Hoard@@@Hoard@@@@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@Hoard@@@2@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@2@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@2@@Hoard@@UAEXXZ
+?lock@?$HoardManager@V?$AlignedSuperblockHeap@VWinLockType@HL@@$0BAAAA@@Hoard@@V?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@2@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@VSmallHeap@Hoard@@@2@$07VWinLockType@HL@@VhoardThresholdFunctionClass@2@VSmallHeap@2@@Hoard@@UAEXXZ
+?lock@?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@VSmallHeap@Hoard@@@Hoard@@QAEXXZ
+?lock@?$HoardSuperblockHeader@VWinLockType@HL@@$0BAAAA@VSmallHeap@Hoard@@@Hoard@@QAEXXZ
+?lock@WinLockType@HL@@QAEXXZ
+?malloc@?$ANSIWrapper@V?$IgnoreInvalidFree@V?$HybridHeap@$0HPMA@V?$ThreadPoolHeap@$0EAA@$0IA@VPerThreadHoardHeap@Hoard@@@Hoard@@VBigHeap@2@@HL@@@Hoard@@@HL@@QAEPAXI@Z
+?malloc@?$AddHeaderHeap@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@VBigHeap@Hoard@@@Hoard@@$0BAAAA@V?$AlignedMmap@$0BAAAA@@2@@Hoard@@QAEPAXI@Z
+?malloc@?$AlignedMmap@$0BAAAA@@Hoard@@QAEPAXI@Z
+?malloc@?$AlignedMmapInstance@$0BAAAA@@Hoard@@QAEPAXI@Z
+?malloc@?$BumpAlloc@$0BAAAA@VMmapAlloc@Hoard@@@Hoard@@QAEPAXI@Z
+?malloc@?$FixedRequestHeap@$0BAAAA@V?$SuperblockStore@$0BAAAA@@Hoard@@@Hoard@@QAEPAXI@Z
+?malloc@?$FreelistHeap@V?$BumpAlloc@$0BAAAA@VMmapAlloc@Hoard@@@Hoard@@@HL@@QAEPAXI@Z
+?malloc@?$HoardManager@V?$AlignedSuperblockHeap@VWinLockType@HL@@$0BAAAA@@Hoard@@V?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@2@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@VSmallHeap@Hoard@@@2@$07VWinLockType@HL@@VhoardThresholdFunctionClass@2@VSmallHeap@2@@Hoard@@QAEPAXI@Z
+?malloc@?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@VSmallHeap@Hoard@@@Hoard@@QAEPAXI@Z
+?malloc@?$HoardSuperblockHeader@VWinLockType@HL@@$0BAAAA@VSmallHeap@Hoard@@@Hoard@@QAEPAXXZ
+?malloc@?$HybridHeap@$0HPMA@V?$ThreadPoolHeap@$0EAA@$0IA@VPerThreadHoardHeap@Hoard@@@Hoard@@VBigHeap@2@@HL@@QAEPAXI@Z
+?malloc@?$LockMallocHeap@VSmallHeap@Hoard@@@Hoard@@QAEPAXI@Z
+?malloc@?$LockedHeap@VWinLockType@HL@@V?$AddHeaderHeap@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@VBigHeap@Hoard@@@Hoard@@$0BAAAA@V?$AlignedMmap@$0BAAAA@@2@@Hoard@@@HL@@QAEPAXI@Z
+?malloc@?$LockedHeap@VWinLockType@HL@@V?$FixedRequestHeap@$0BAAAA@V?$SuperblockStore@$0BAAAA@@Hoard@@@Hoard@@@HL@@QAEPAXI@Z
+?malloc@?$ManageOneSuperblock@V?$EmptyClass@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@VSmallHeap@Hoard@@@Hoard@@$07@Hoard@@@Hoard@@QAEPAXI@Z
+?malloc@?$RedirectFree@V?$LockMallocHeap@VSmallHeap@Hoard@@@Hoard@@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@VSmallHeap@Hoard@@@2@@Hoard@@QAEPAXI@Z
+?malloc@?$SuperblockStore@$0BAAAA@@Hoard@@QAEPAXI@Z
+?malloc@?$ThreadLocalAllocationBuffer@$0DH@$1?getSizeClass@?$bins@V?$HoardSuperblockHeader@VWinLockType@HL@@$0BAAAA@VSmallHeap@Hoard@@@Hoard@@$0BAAAA@@HL@@SAHI@Z$1?getClassSize@23@SAIH@Z$0BAA@$0EAAAA@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@VSmallHeap@Hoard@@@Hoard@@$0BAAAA@VHoardHeapType@6@@Hoard@@QAEPAXI@Z
+?malloc@?$ThreadPoolHeap@$0EAA@$0IA@VPerThreadHoardHeap@Hoard@@@Hoard@@QAEPAXI@Z
+?malloc@MmapAlloc@Hoard@@QAEPAXI@Z
+?map@MmapWrapper@HL@@SAPAXI@Z
+?normalize@?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@VSmallHeap@Hoard@@@Hoard@@QBEPAXPAX@Z
+?normalize@?$HoardSuperblockHeader@VWinLockType@HL@@$0BAAAA@VSmallHeap@Hoard@@@Hoard@@QBEPAXPAX@Z
+?put@?$EmptyClass@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@Hoard@@@Hoard@@$07@Hoard@@QAEXPAV?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@Hoard@@@2@@Z
+?put@?$EmptyClass@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@VSmallHeap@Hoard@@@Hoard@@$07@Hoard@@QAEXPAV?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@VSmallHeap@Hoard@@@2@@Z
+?put@?$EmptyHoardManager@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@Hoard@@@Hoard@@@@QAEXPAV?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@Hoard@@@Hoard@@I@Z
+?put@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@QAEXPAXI@Z
+?put@?$HoardManager@V?$AlignedSuperblockHeap@VWinLockType@HL@@$0BAAAA@@Hoard@@V?$EmptyHoardManager@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@Hoard@@@Hoard@@@@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@Hoard@@@2@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@2@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@2@@Hoard@@QAEXPAV?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@Hoard@@@2@I@Z
+?put@?$ManageOneSuperblock@V?$EmptyClass@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@Hoard@@@Hoard@@$07@Hoard@@@Hoard@@QAEXPAV?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@Hoard@@@2@@Z
+?put@?$ManageOneSuperblock@V?$EmptyClass@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@VSmallHeap@Hoard@@@Hoard@@$07@Hoard@@@Hoard@@QAEXPAV?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@VSmallHeap@Hoard@@@2@@Z
+?reapAlloc@?$HoardSuperblockHeader@VWinLockType@HL@@$0BAAAA@VSmallHeap@Hoard@@@Hoard@@AAEPAXXZ
+?refill@?$BumpAlloc@$0BAAAA@VMmapAlloc@Hoard@@@Hoard@@AAEXI@Z
+?releaseHeap@?$HeapManager@VWinLockType@HL@@V?$HoardHeap@$0EAA@$0IA@@Hoard@@@Hoard@@QAEXXZ
+?set@?$MyHashMap@PAXIVSourceHeap@?$AlignedMmapInstance@$0BAAAA@@Hoard@@@HL@@QAEXPAXI@Z
+?setAllocated@Statistics@Hoard@@QAEXH@Z
+?setInUse@Statistics@Hoard@@QAEXH@Z
+?setInusemap@?$ThreadPoolHeap@$0EAA@$0IA@VPerThreadHoardHeap@Hoard@@@Hoard@@QAEXHH@Z
+?setNext@?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@Hoard@@@Hoard@@QAEXPAV12@@Z
+?setNext@?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@VSmallHeap@Hoard@@@Hoard@@QAEXPAV12@@Z
+?setNext@?$HoardSuperblockHeader@VWinLockType@HL@@$0BAAAA@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@Hoard@@@Hoard@@QAEXPAV?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@Hoard@@@2@@Z
+?setNext@?$HoardSuperblockHeader@VWinLockType@HL@@$0BAAAA@VSmallHeap@Hoard@@@Hoard@@QAEXPAV?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@VSmallHeap@Hoard@@@2@@Z
+?setNext@Entry@DLList@HL@@QAEXPAV123@@Z
+?setOwner@?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@Hoard@@@Hoard@@QAEXPAV?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@2@@Z
+?setOwner@?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@VSmallHeap@Hoard@@@Hoard@@QAEXPAVSmallHeap@2@@Z
+?setOwner@?$HoardSuperblockHeader@VWinLockType@HL@@$0BAAAA@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@Hoard@@@Hoard@@QAEXPAV?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@2@@Z
+?setOwner@?$HoardSuperblockHeader@VWinLockType@HL@@$0BAAAA@VSmallHeap@Hoard@@@Hoard@@QAEXPAVSmallHeap@2@@Z
+?setPrev@?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@Hoard@@@Hoard@@QAEXPAV12@@Z
+?setPrev@?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@VSmallHeap@Hoard@@@Hoard@@QAEXPAV12@@Z
+?setPrev@?$HoardSuperblockHeader@VWinLockType@HL@@$0BAAAA@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@Hoard@@@Hoard@@QAEXPAV?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@Hoard@@@2@@Z
+?setPrev@?$HoardSuperblockHeader@VWinLockType@HL@@$0BAAAA@VSmallHeap@Hoard@@@Hoard@@QAEXPAV?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@VSmallHeap@Hoard@@@2@@Z
+?setPrev@Entry@DLList@HL@@QAEXPAV123@@Z
+?setTidMap@?$ThreadPoolHeap@$0EAA@$0IA@VPerThreadHoardHeap@Hoard@@@Hoard@@QAEXHH@Z
+?slowGetSizeClass@?$bins@V?$HoardSuperblockHeader@VWinLockType@HL@@$0BAAAA@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@Hoard@@@Hoard@@$0BAAAA@@HL@@CAII@Z
+?slowGetSizeClass@?$bins@V?$HoardSuperblockHeader@VWinLockType@HL@@$0BAAAA@VSmallHeap@Hoard@@@Hoard@@$0BAAAA@@HL@@CAII@Z
+?slowMallocPath@?$ManageOneSuperblock@V?$EmptyClass@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@VSmallHeap@Hoard@@@Hoard@@$07@Hoard@@@Hoard@@AAEPAXI@Z
+?slowPath@?$HybridHeap@$0HPMA@V?$ThreadPoolHeap@$0EAA@$0IA@VPerThreadHoardHeap@Hoard@@@Hoard@@VBigHeap@2@@HL@@AAEPAXI@Z
+?slowPathFree@?$HoardManager@V?$AlignedSuperblockHeap@VWinLockType@HL@@$0BAAAA@@Hoard@@V?$EmptyHoardManager@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@Hoard@@@Hoard@@@@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@Hoard@@@2@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@2@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@2@@Hoard@@AAEXHHH@Z
+?slowPathFree@?$HoardManager@V?$AlignedSuperblockHeap@VWinLockType@HL@@$0BAAAA@@Hoard@@V?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@2@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@VSmallHeap@Hoard@@@2@$07VWinLockType@HL@@VhoardThresholdFunctionClass@2@VSmallHeap@2@@Hoard@@AAEXHHH@Z
+?slowPathMalloc@?$HoardManager@V?$AlignedSuperblockHeap@VWinLockType@HL@@$0BAAAA@@Hoard@@V?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@2@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@VSmallHeap@Hoard@@@2@$07VWinLockType@HL@@VhoardThresholdFunctionClass@2@VSmallHeap@2@@Hoard@@AAEPAXI@Z
+?transfer@?$EmptyClass@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@Hoard@@@Hoard@@$07@Hoard@@AAEXPAV?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@Hoard@@@2@HH@Z
+?transfer@?$EmptyClass@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@VSmallHeap@Hoard@@@Hoard@@$07@Hoard@@AAEXPAV?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@VSmallHeap@Hoard@@@2@HH@Z
+?unlock@?$BaseHoardManager@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@Hoard@@@Hoard@@@@UAEXXZ
+?unlock@?$BaseHoardManager@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@VSmallHeap@Hoard@@@Hoard@@@@UAEXXZ
+?unlock@?$EmptyHoardManager@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@Hoard@@@Hoard@@@@UAEXXZ
+?unlock@?$HoardManager@V?$AlignedSuperblockHeap@VWinLockType@HL@@$0BAAAA@@Hoard@@V?$EmptyHoardManager@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@Hoard@@@Hoard@@@@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@Hoard@@@2@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@2@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@2@@Hoard@@UAEXXZ
+?unlock@?$HoardManager@V?$AlignedSuperblockHeap@VWinLockType@HL@@$0BAAAA@@Hoard@@V?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@2@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@VSmallHeap@Hoard@@@2@$07VWinLockType@HL@@VhoardThresholdFunctionClass@2@VSmallHeap@2@@Hoard@@UAEXXZ
+?unlock@?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@VSmallHeap@Hoard@@@Hoard@@QAEXXZ
+?unlock@?$HoardSuperblockHeader@VWinLockType@HL@@$0BAAAA@VSmallHeap@Hoard@@@Hoard@@QAEXXZ
+?unlock@WinLockType@HL@@QAEXXZ
+?unlocked_put@?$HoardManager@V?$AlignedSuperblockHeap@VWinLockType@HL@@$0BAAAA@@Hoard@@V?$EmptyHoardManager@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@Hoard@@@Hoard@@@@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@Hoard@@@2@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@2@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@2@@Hoard@@AAEXPAV?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@V?$ProcessHeap@$0BAAAA@$07VWinLockType@HL@@VbogusThresholdFunctionClass@?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@Hoard@@@Hoard@@@2@I@Z
+?unlocked_put@?$HoardManager@V?$AlignedSuperblockHeap@VWinLockType@HL@@$0BAAAA@@Hoard@@V?$GlobalHeap@$0BAAAA@$07VWinLockType@HL@@@2@V?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@VSmallHeap@Hoard@@@2@$07VWinLockType@HL@@VhoardThresholdFunctionClass@2@VSmallHeap@2@@Hoard@@AAEXPAV?$HoardSuperblock@VWinLockType@HL@@$0BAAAA@VSmallHeap@Hoard@@@2@I@Z
+?unmap@MmapWrapper@HL@@SAXPAXI@Z
+?yield@Fred@HL@@SAXXZ
+calloc
+free
+malloc
+malloc_usable_size
+mallopt
+memalign
+pvalloc
+realloc
+strdup
+valloc
Index: /proiecte/swift/trunk/lib/hoard-371/src/lockmallocheap.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/lockmallocheap.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/lockmallocheap.h	(revision 176)
@@ -0,0 +1,24 @@
+#ifndef _LOCKMALLOCHEAP_H_
+#define _LOCKMALLOCHEAP_H_
+
+#include "hldefines.h"
+
+
+// Just lock malloc (unlike LockedHeap, which locks both malloc and
+// free). Meant to be combined with something like RedirectFree, which will
+// implement free.
+
+namespace Hoard {
+
+template <typename Heap>
+class LockMallocHeap : public Heap {
+public:
+  MALLOC_FUNCTION INLINE void * malloc (size_t sz) {
+    HL::Guard<Heap> l (*this);
+    return Heap::malloc (sz);
+  }
+};
+
+}
+
+#endif
Index: /proiecte/swift/trunk/lib/hoard-371/src/manageonesuperblock.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/manageonesuperblock.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/manageonesuperblock.h	(revision 176)
@@ -0,0 +1,104 @@
+// -*- C++ -*-
+
+/**
+ * @file manageonesuperblock.h
+ * @author Emery Berger <http://www.cs.umass.edu/~emery>
+ */
+
+
+#ifndef _MANAGEONESUPERBLOCK_H_
+#define _MANAGEONESUPERBLOCK_H_
+
+/**
+ * @class  ManageOneSuperblock
+ * @brief  A layer that caches exactly one superblock, thus avoiding costly lookups.
+ * @author Emery Berger <http://www.cs.umass.edu/~emery>
+ */
+
+namespace Hoard {
+
+template <class SuperHeap>
+class ManageOneSuperblock : public SuperHeap {
+public:
+
+  typedef typename SuperHeap::SuperblockType SuperblockType;
+
+  /// Get memory from the current superblock.
+  inline void * malloc (size_t sz) {
+    if (_current) {
+      void * ptr = _current->malloc (sz);
+      if (ptr) {
+	assert (_current->getSize(ptr) >= sz);
+	return ptr;
+      }
+    }
+    return slowMallocPath (sz);
+  }
+
+  /// Try to free the pointer to this superblock first.
+  inline void free (void * ptr) {
+    SuperblockType * s = SuperHeap::getSuperblock (ptr);
+    if (s == _current) {
+      _current->free (ptr);
+    } else {
+      SuperHeap::free (ptr);
+    }
+  }
+
+  /// Get the current superblock and remove it.
+  SuperblockType * get (void) {
+    if (_current) {
+      SuperblockType * s = _current;
+      _current = NULL;
+      return s;
+    } else {
+      // There's none cached, so just get one from the superheap.
+      return SuperHeap::get();
+    }
+  }
+
+  /// Put the superblock into the cache.
+  inline void put (SuperblockType * s) {
+    if (!s || (s == _current) || (!s->isValidSuperblock())) {
+      // Ignore if we already are holding this superblock, of if we
+      // got a NULL pointer, or if it's invalid.
+      return;
+    }
+    if (_current) {
+      // We have one already -- push it out.
+      SuperHeap::put (_current);
+    }
+    _current = s;
+  }
+
+private:
+
+  /// Obtain a superblock and return an object from it.
+  void * slowMallocPath (size_t sz) {
+    void * ptr = NULL;
+    while (!ptr) {
+      if (_current) {
+	ptr = _current->malloc (sz);
+	if (ptr) {
+	  return ptr;
+	} else {
+	  SuperHeap::put (_current);
+	}
+      }
+      _current = SuperHeap::get();
+      if (!_current) {
+	return NULL;
+      }
+      ptr = _current->malloc (sz);
+    }
+    return ptr;
+  }
+
+  /// The current superblock.
+  SuperblockType * _current;
+
+};
+
+}
+
+#endif
Index: /proiecte/swift/trunk/lib/hoard-371/src/mmapalloc.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/mmapalloc.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/mmapalloc.h	(revision 176)
@@ -0,0 +1,29 @@
+// -*- C++ -*-
+
+#ifndef _MMAPALLOC_H_
+#define _MMAPALLOC_H_
+
+#include <stdio.h>
+
+#include "mmapwrapper.h"
+
+/**
+ * @class MmapAlloc
+ * @brief Obtains memory from Mmap but doesn't allow it to be freed.
+ * @author Emery Berger <http://www.cs.umass.edu/~emery>
+ */
+
+namespace Hoard {
+
+class MmapAlloc {
+public:
+  void * malloc (size_t sz) {
+    void * ptr = HL::MmapWrapper::map (sz);
+    return ptr;
+  }
+
+};
+
+}
+
+#endif
Index: /proiecte/swift/trunk/lib/hoard-371/src/processheap.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/processheap.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/processheap.h	(revision 176)
@@ -0,0 +1,47 @@
+// -*- C++ -*-
+
+#ifndef _PROCESSHEAP_H_
+#define _PROCESSHEAP_H_
+
+#include <stdlib.h>
+
+#include "alignedsuperblockheap.h"
+#include "conformantheap.h"
+#include "emptyhoardmanager.h"
+#include "hoardmanager.h"
+#include "hoardsuperblock.h"
+
+namespace Hoard {
+
+  template <size_t SuperblockSize,
+	    int EmptinessClasses,
+	    class LockType,
+	    class ThresholdClass>
+  class ProcessHeap :
+    public ConformantHeap<
+    HoardManager<AlignedSuperblockHeap<LockType, SuperblockSize>,
+		 EmptyHoardManager<HoardSuperblock<LockType, SuperblockSize, ProcessHeap<SuperblockSize, EmptinessClasses, LockType, ThresholdClass> > >,
+		 HoardSuperblock<LockType, SuperblockSize, ProcessHeap<SuperblockSize, EmptinessClasses, LockType, ThresholdClass> >,
+		 EmptinessClasses,
+		 LockType,
+		 ThresholdClass,
+		 ProcessHeap<SuperblockSize, EmptinessClasses, LockType, ThresholdClass> > > {
+  
+public:
+  
+  ProcessHeap (void) {}
+    
+  // Disable allocation from this heap.
+  inline void * malloc (size_t);
+
+private:
+
+  // Prevent copying or assignment.
+  ProcessHeap (const ProcessHeap&);
+  ProcessHeap& operator=(const ProcessHeap&);
+
+};
+
+};
+
+#endif
Index: /proiecte/swift/trunk/lib/hoard-371/src/rebuild-libhoarddef.cmd
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/rebuild-libhoarddef.cmd	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/rebuild-libhoarddef.cmd	(revision 176)
@@ -0,0 +1,13 @@
+: We need to execute this if we change libhoard.cpp.
+@echo off
+cl /I../../heaplayers -I../../heaplayers/util /c /MD /DNDEBUG /Ox /Zp8 /Oy libhoard.cpp
+nm -g libhoard.obj > @@@.@@@ 2>NUL
+grep ' T ?' @@@.@@@ > @@@.@@1 2>NUL
+grep ' T \_' @@@.@@@ > @@@.@@2 2>NUL
+echo EXPORTS > libhoard.def
+sed 's/.* T //' @@@.@@1 | grep -v DllMain >> libhoard.def 2>NUL
+sed 's/.* T \_//' @@@.@@2 | grep -v DllMain >> libhoard.def 2>NUL
+erase @@@.@@@
+erase @@@.@@1
+erase @@@.@@2
+ 
Index: /proiecte/swift/trunk/lib/hoard-371/src/redirectfree.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/redirectfree.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/redirectfree.h	(revision 176)
@@ -0,0 +1,110 @@
+// -*- C++ -*-
+
+/*
+
+  Heap Layers: An Extensible Memory Allocation Infrastructure
+  
+  Copyright (C) 2000-2003 by Emery Berger
+  http://www.cs.umass.edu/~emery
+  emery@cs.umass.edu
+  
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or
+  (at your option) any later version.
+  
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+  
+  You should have received a copy of the GNU General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+*/
+
+#ifndef _REDIRECTFREE_H_
+#define _REDIRECTFREE_H_
+
+#include "fred.h"
+#include "guard.h"
+
+namespace Hoard {
+
+/**
+ * @class RedirectFree
+ * @brief Routes free calls to the Superblock's owner heap.
+ * @note  We also lock the heap on calls to malloc.
+ */
+
+template <class Heap,
+	  typename SuperblockType_>
+class RedirectFree {
+public:
+
+  enum { Alignment = (int) Heap::Alignment };
+
+  typedef SuperblockType_ SuperblockType;
+
+  inline void * malloc (size_t sz) {
+    return _theHeap.malloc (sz);
+  }
+
+  size_t getSize (void * ptr) {
+    return Heap::getSize (ptr);
+  }
+
+  SuperblockType * getSuperblock (void * ptr) {
+    return Heap::getSuperblock (ptr);
+  }
+
+  /// Free the given object, obeying the required locking protocol.
+  static inline void free (void * ptr) {
+    // Get the superblock header.
+    SuperblockType * s = reinterpret_cast<SuperblockType *>(Heap::getSuperblock (ptr));
+
+    assert (s->isValidSuperblock());
+
+    // Find out who the owner is.
+
+    typedef BaseHoardManager<SuperblockType> * baseHeapType;
+    baseHeapType owner;
+
+    s->lock();
+
+    // By acquiring the lock on the superblock (above),
+    // we prevent it from moving up to a higher heap.
+    // This eventually pins it down in one heap,
+    // so this loop is guaranteed to terminate.
+    // (It should generally take no more than two iterations.)
+
+    for (;;) {
+      owner = reinterpret_cast<baseHeapType>(s->getOwner());
+      assert (owner != NULL);
+      assert (owner->isValid());
+      // Lock the owner. If ownership changed between these two lines,
+      // we'll detect it and try again.
+      owner->lock();
+      if (owner == reinterpret_cast<baseHeapType>(s->getOwner())) {
+	owner->free (ptr);
+	owner->unlock();
+	s->unlock();
+	return;
+      }
+      owner->unlock();
+
+      // Sleep a little.
+      HL::Fred::yield();
+    }
+  }
+
+private:
+
+  Heap _theHeap;
+
+};
+
+}
+
+#endif
Index: /proiecte/swift/trunk/lib/hoard-371/src/statistics.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/statistics.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/statistics.h	(revision 176)
@@ -0,0 +1,31 @@
+#ifndef _STATISTICS_H_
+#define _STATISTICS_H_
+
+#include <assert.h>
+
+namespace Hoard {
+
+class Statistics {
+public:
+  Statistics (void)
+    : _inUse (0),
+      _allocated (0)
+  {}
+  
+  inline int getInUse (void) const { assert (_inUse >= 0); return _inUse; }
+  inline int getAllocated (void) const { assert (_allocated >= 0); return _allocated; }
+  inline void setInUse (int u) { assert (u >= 0); assert (_inUse >= 0); _inUse = u; }
+  inline void setAllocated (int a) { assert (a >= 0); assert (_allocated >= 0); _allocated = a; }
+  
+private:
+  
+  /// The number of objects in use.
+  int _inUse;
+  
+  /// The number of objects allocated.
+  int _allocated;
+};
+
+}
+
+#endif
Index: /proiecte/swift/trunk/lib/hoard-371/src/threadpoolheap.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/threadpoolheap.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/threadpoolheap.h	(revision 176)
@@ -0,0 +1,102 @@
+// -*- C++ -*-
+
+#ifndef _THREADPOOLHEAP_H_
+#define _THREADPOOLHEAP_H_
+
+#include <assert.h>
+
+#include "array.h"
+#include "cpuinfo.h"
+
+extern volatile int anyThreadCreated;
+
+namespace Hoard {
+
+  template <int NumThreads,
+	    int NumHeaps,
+	    class PerThreadHeap_>
+  class ThreadPoolHeap : public PerThreadHeap_ {
+  public:
+    
+    typedef PerThreadHeap_ PerThreadHeap;
+    
+    enum { MaxThreads = NumThreads };
+    enum { NumThreadsMask = NumThreads - 1};
+    enum { NumHeapsMask = NumHeaps - 1};
+    
+    HL::sassert<((NumHeaps & NumHeapsMask) == 0)> verifyPowerOfTwoHeaps;
+    HL::sassert<((NumThreads & NumThreadsMask) == 0)> verifyPowerOfTwoThreads;
+    
+    enum { MaxHeaps = NumHeaps };
+    
+    ThreadPoolHeap (void)
+    {
+      // Note: The tidmap values should be set externally.
+      int j = 0;
+      for (int i = 0; i < NumThreads; i++) {
+	setTidMap(i, j % NumHeaps);
+	j++;
+      }
+    }
+    
+    inline PerThreadHeap& getHeap (void) {
+      int tid;
+      if (anyThreadCreated) {
+	tid = HL::CPUInfo::getThreadId();
+      } else {
+	tid = 0;
+      }
+      int heapno = _tidMap(tid & NumThreadsMask);
+      return _heap(heapno);
+    }
+    
+    inline void * malloc (size_t sz) {
+      return getHeap().malloc (sz);
+    }
+    
+    inline void free (void * ptr) {
+      getHeap().free (ptr);
+    }
+    
+    inline void clear (void) {
+      getHeap().clear();
+    }
+    
+    inline size_t getSize (void * ptr) {
+      return PerThreadHeap::getSize (ptr);
+    }
+    
+    void setTidMap (int index, int value) {
+      assert ((value >= 0) && (value < MaxHeaps));
+      _tidMap(index) = value;
+    }
+    
+    int getTidMap (int index) const {
+      return _tidMap(index); 
+    }
+    
+    void setInusemap (int index, int value) {
+      _inUseMap(index) = value;
+    }
+    
+    int getInusemap (int index) const {
+      return _inUseMap(index);
+    }
+    
+    
+  private:
+    
+    /// Which heap is assigned to which thread, indexed by thread.
+    Array<MaxThreads, int> _tidMap;
+    
+    /// Which heap is in use (a reference count).
+    Array<MaxHeaps, int> _inUseMap;
+    
+    /// The array of heaps we choose from.
+    Array<MaxHeaps, PerThreadHeap> _heap;
+    
+  };
+  
+}
+
+#endif
Index: /proiecte/swift/trunk/lib/hoard-371/src/tlab.h
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/tlab.h	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/tlab.h	(revision 176)
@@ -0,0 +1,148 @@
+// -*- C++ -*-
+
+/**
+ *
+ * @class  ThreadLocalAllocationBuffer
+ * @author Emery Berger <http://www.cs.umass.edu/~emery>
+ * @brief  An allocator, meant to be used for thread-local allocation.
+ */
+
+#include "dllist.h"
+#include "array.h"
+
+namespace Hoard {
+
+template <int NumBins,
+	  int (*getSizeClass) (size_t),
+	  size_t (*getClassSize) (const int),
+	  int LargestObject,
+	  int LocalHeapThreshold,
+	  class SuperblockType,
+	  int SuperblockSize,
+	  class ParentHeap>
+
+class ThreadLocalAllocationBuffer {
+
+public:
+
+  ThreadLocalAllocationBuffer (ParentHeap * parent)
+    : _parentHeap (parent),
+      _localHeapBytes (0)
+  {
+  }
+
+  ~ThreadLocalAllocationBuffer (void) {
+    clear();
+  }
+
+  inline static size_t getSize (void * ptr) {
+    return getSuperblock(ptr)->getSize (ptr);
+  }
+
+  inline void * malloc (size_t sz) {
+#if 1
+    if (sz < 2 * sizeof(size_t)) {
+      sz = 2 * sizeof(size_t);
+    }
+    sz = align (sz);
+#endif
+    // Get memory from the local heap,
+    // and deduct that amount from the local heap bytes counter.
+    if (sz <= LargestObject) {
+      int c = getSizeClass (sz);
+      void * ptr = _localHeap(c).get();
+      if (ptr) {
+	_localHeapBytes -= sz; 
+	assert (getSize(ptr) >= sz);
+	return ptr;
+      }
+    }
+
+    // No more local memory (for this size, at least).
+    // Now get the memory from our parent.
+    void * ptr = _parentHeap->malloc (sz);
+    return ptr;
+  }
+
+
+  inline void free (void * ptr) {
+    if (!ptr) {
+      return;
+    }
+    const SuperblockType * s = getSuperblock (ptr);
+    // If this isn't a valid superblock, just return.
+
+    if (s->isValidSuperblock()) {
+
+      ptr = s->normalize (ptr);
+      const size_t sz = s->getObjectSize ();
+
+      if (sz <= LargestObject) {
+	// Free small objects locally.
+
+	assert (getSize(ptr) >= sizeof(HL::DLList::Entry *));
+	int c = getSizeClass (sz);
+
+	_localHeap(c).insert ((HL::DLList::Entry *) ptr);
+	_localHeapBytes += sz;
+	  
+	// If we have too much memory stored locally,
+	// give it all back.
+	
+	if (_localHeapBytes > LocalHeapThreshold) {
+	  clear();
+	}
+
+      } else {
+	// Free it to the parent.
+	_parentHeap->free (ptr);
+      }
+
+    } else {
+#if 0
+      char buf[255];
+      sprintf (buf, "illegal ptr = %x.\n", ptr);
+      printf (buf);
+#endif
+    }
+  }
+
+  void clear (void) {
+    // Free every object to the 'parent' heap.
+    for (int i = NumBins-1; i >= 0; i--) {
+      while (!_localHeap(i).isEmpty()) {
+	HL::DLList::Entry * e = _localHeap(i).get();
+	_parentHeap->free (e);
+      }
+    }
+    _localHeapBytes = 0;
+  }
+
+  static inline SuperblockType * getSuperblock (void * ptr) {
+    return SuperblockType::getSuperblock (ptr);
+  }
+
+private:
+
+  inline static size_t align (size_t sz) {
+    return (sz + (sizeof(double) - 1)) & ~(sizeof(double) - 1);
+  }
+  
+
+  // Disable assignment and copying.
+
+  ThreadLocalAllocationBuffer (const ThreadLocalAllocationBuffer&);
+  ThreadLocalAllocationBuffer& operator=(const ThreadLocalAllocationBuffer&);
+
+  /// This heap's 'parent' (where to go for more memory).
+  ParentHeap * _parentHeap;
+
+  /// The number of bytes we currently have on this thread.
+  int _localHeapBytes;
+
+  /// The local heap itself.
+  Array<NumBins, HL::DLList> _localHeap;
+
+};
+
+}
Index: /proiecte/swift/trunk/lib/hoard-371/src/userealtls.cpp
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/userealtls.cpp	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/userealtls.cpp	(revision 176)
@@ -0,0 +1,291 @@
+/**
+ * @file userealtls.cpp
+ * @author Emery Berger <http://www.cs.umass.edu/~emery>
+ *
+ * This file leverages compiler support for thread-local variables for
+ * access to thread-local heaps. It also intercepts thread completions
+ * to flush these local heaps, returning any unused memory to the
+ * global Hoard heap. On Windows, this happens in DllMain. On Unix
+ * platforms, we interpose our own versions of pthread_create and
+ * pthread_exit.
+*/
+
+#include "VERSION.h"
+
+#if defined(_WIN32)
+DWORD LocalTLABIndex;
+#endif
+
+#include <new>
+
+// For now, we only use thread-local variables (__thread)
+//   (a) for Linux x86-32 platforms with gcc version > 3.3.0, and
+//   (b) when compiling with the SunPro compilers.
+
+#if ((GCC_VERSION >= 30300) && !defined(__x86_64) && !defined(__SVR4) && !defined(__MACH__)) \
+    || defined(__SUNPRO_CC)
+#define USE_THREAD_KEYWORD 1
+#endif
+
+
+#if defined(USE_THREAD_KEYWORD)
+
+static __thread double tlabBuffer[sizeof(TheCustomHeapType) / sizeof(double) + 1];
+
+static __thread TheCustomHeapType * theTLAB = NULL;
+
+static TheCustomHeapType * initializeCustomHeap (void) {
+  new ((char *) &tlabBuffer) TheCustomHeapType (getMainHoardHeap());
+  return (theTLAB = (TheCustomHeapType *) &tlabBuffer);
+}
+
+inline TheCustomHeapType * getCustomHeap (void) {
+  // The pointer to the TLAB itself.
+  theTLAB = (theTLAB ? theTLAB : initializeCustomHeap());
+  return theTLAB;
+}
+
+#else
+
+#if !defined(_WIN32)
+static pthread_key_t theHeapKey;
+static pthread_once_t key_once = PTHREAD_ONCE_INIT;
+
+static void deleteThatHeap (void * p) {
+  // Called when the thread goes away - reclaims the heap.
+  TheCustomHeapType * heap = (TheCustomHeapType *) p;
+  heap->~TheCustomHeapType();
+  getMainHoardHeap()->free ((void *) heap);
+}
+
+static void make_heap_key (void)
+{
+  if (pthread_key_create (&theHeapKey, deleteThatHeap) != 0) {
+    // This should never happen.
+  }
+}
+
+static void createKey (void) {
+  // Ensure that the key is initialized.
+  pthread_once (&key_once, make_heap_key);
+}
+
+#endif
+
+
+static TheCustomHeapType * initializeCustomHeap (void)
+{
+#if !defined(_WIN32)
+  createKey();
+  assert (pthread_getspecific (theHeapKey) == NULL);
+#endif
+  // Allocate a per-thread heap.
+  TheCustomHeapType * heap;
+  size_t sz = sizeof(TheCustomHeapType) + sizeof(double);
+  void * mh = getMainHoardHeap()->malloc(sz);
+  heap = new ((char *) mh) TheCustomHeapType (getMainHoardHeap());
+
+  // Store it in the appropriate thread-local area.
+#if defined(_WIN32)
+  TlsSetValue (LocalTLABIndex, heap);
+#else
+  int r = pthread_setspecific (theHeapKey, (void *) heap);
+  assert (!r);
+#endif
+
+  return heap;
+}
+
+
+inline TheCustomHeapType * getCustomHeap (void) {
+  TheCustomHeapType * heap;
+#if defined(_WIN32)
+  heap = (TheCustomHeapType *) TlsGetValue (LocalTLABIndex);
+#else
+  createKey();
+  heap = (TheCustomHeapType *) pthread_getspecific (theHeapKey);
+#endif
+  if (heap == NULL)  {
+    heap = initializeCustomHeap();
+  }
+  return heap;
+}
+
+
+
+#endif
+
+//
+// Intercept thread creation and destruction to flush the TLABs.
+//
+
+#if defined(_WIN32)
+
+#ifndef HOARD_PRE_ACTION
+#define HOARD_PRE_ACTION
+#endif
+
+#ifndef HOARD_POST_ACTION
+#define HOARD_POST_ACTION
+#endif
+
+#include <stdio.h>
+
+#ifndef CUSTOM_DLLNAME
+#define CUSTOM_DLLNAME DllMain
+#endif
+
+extern "C" {
+
+BOOL WINAPI CUSTOM_DLLNAME (HANDLE hinstDLL, DWORD fdwReason, LPVOID lpreserved)
+{
+  int i;
+  int tid;
+  static int np = HL::CPUInfo::computeNumProcessors();
+
+  switch (fdwReason) {
+
+  case DLL_PROCESS_ATTACH:
+    {
+      LocalTLABIndex = TlsAlloc();
+      if (LocalTLABIndex == TLS_OUT_OF_INDEXES) {
+	// Not sure what to do here!
+      }
+      HOARD_PRE_ACTION;
+      getCustomHeap();
+    }
+    break;
+
+  case DLL_THREAD_ATTACH:
+    if (np == 1) {
+      // We have exactly one processor - just assign the thread to
+      // heap 0.
+      getMainHoardHeap()->chooseZero();
+    } else {
+      getMainHoardHeap()->findUnusedHeap();
+    }
+    getCustomHeap();
+    break;
+
+  case DLL_THREAD_DETACH:
+    {
+      // Dump the memory from the TLAB.
+      getCustomHeap()->clear();
+
+      TheCustomHeapType *heap
+	= (TheCustomHeapType *) TlsGetValue(LocalTLABIndex);
+
+      if (np != 1) {
+	// If we're on a multiprocessor box, relinquish the heap
+	// assigned to this thread.
+	getMainHoardHeap()->releaseHeap();
+      }
+
+      if (heap != 0) {
+	TlsSetValue (LocalTLABIndex, 0);
+      }
+    }
+    break;
+
+  case DLL_PROCESS_DETACH:
+    HOARD_POST_ACTION;
+    break;
+
+  default:
+    return TRUE;
+  }
+
+  return TRUE;
+}
+
+}
+
+#else
+
+extern "C" {
+
+typedef void * (*threadFunctionType) (void *);
+
+typedef
+int (*pthread_create_function) (pthread_t *thread,
+				const pthread_attr_t *attr,
+				threadFunctionType start_routine,
+				void *arg);
+}
+
+// A special routine we call on thread exits to free up some resources.
+static void exitRoutine (void) {
+  // Clear the TLAB's buffer.
+  getCustomHeap()->clear();
+
+  // Relinquish the assigned heap.
+  getMainHoardHeap()->releaseHeap();
+}
+
+
+extern "C" {
+
+static void * startMeUp (void * a)
+{
+  getCustomHeap();
+  getMainHoardHeap()->findUnusedHeap();
+
+  pair<threadFunctionType, void *> * z
+    = (pair<threadFunctionType, void *> *) a;
+
+  threadFunctionType f = z->first;
+  void * arg = z->second;
+  void * result = (*f)(arg);
+  exitRoutine();
+  delete z;
+  return result;
+}
+
+}
+
+#include <dlfcn.h>
+
+
+extern "C" int pthread_create (pthread_t *thread,
+			       const pthread_attr_t *attr,
+			       void * (*start_routine) (void *),
+			       void * arg)
+#if !defined(__SUNPRO_CC)
+  throw ()
+#endif
+{
+  // A pointer to the library version of pthread_create.
+  static pthread_create_function real_pthread_create = NULL;
+
+  // Force initialization of the TLAB before our first thread is created.
+  volatile static TheCustomHeapType * t = getCustomHeap();
+
+#if defined(linux)
+  char fname[] = "pthread_create";
+#else
+  char fname[] = "_pthread_create";
+#endif
+
+  // Instantiate the pointer to pthread_create, if it hasn't been
+  // instantiated yet.
+
+  if (real_pthread_create == NULL) {
+    real_pthread_create = (pthread_create_function) dlsym (RTLD_NEXT, fname);
+    if (real_pthread_create == NULL) {
+      fprintf (stderr, "Could not find the pthread_create function!\n");
+      fprintf (stderr, "Please report this problem to emery@cs.umass.edu.\n");
+      abort();
+    }
+  }
+
+  anyThreadCreated = 1;
+
+  pair<threadFunctionType, void *> * args =
+    new pair<threadFunctionType, void *> (start_routine, arg);
+
+  int result = (*real_pthread_create)(thread, attr, startMeUp, args);
+
+  return result;
+}
+
+#endif
Index: /proiecte/swift/trunk/lib/hoard-371/src/usewinhoard.cpp
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/usewinhoard.cpp	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/usewinhoard.cpp	(revision 176)
@@ -0,0 +1,48 @@
+/* -*- C++ -*- */
+
+/*
+  The Hoard Multiprocessor Memory Allocator
+  www.hoard.org
+
+  Author: Emery Berger, http://www.cs.umass.edu/~emery
+ 
+  Copyright (c) 1998-2006 Emery Berger, The University of Texas at Austin
+
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or
+  (at your option) any later version.
+  
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+  
+  You should have received a copy of the GNU General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+*/
+
+// Link this code with your executable to use winhoard.
+
+#include <windows.h>
+#if defined(_WIN64)
+#pragma comment(linker, "/include:ReferenceHoard")
+#else
+#pragma comment(linker, "/include:_ReferenceHoard")
+#endif
+
+#include <stdio.h>
+
+extern "C" {
+
+  __declspec(dllimport) int ReferenceHoardStub;
+  
+  void ReferenceHoard (void)
+  {
+    LoadLibraryA ("winhoard.dll");
+    ReferenceHoardStub = 1; 
+  }
+
+}
Index: /proiecte/swift/trunk/lib/hoard-371/src/winhoard.cpp
===================================================================
--- /proiecte/swift/trunk/lib/hoard-371/src/winhoard.cpp	(revision 176)
+++ /proiecte/swift/trunk/lib/hoard-371/src/winhoard.cpp	(revision 176)
@@ -0,0 +1,214 @@
+/* -*- C++ -*- */
+
+/*
+  The Hoard Multiprocessor Memory Allocator
+  www.hoard.org
+
+  Author: Emery Berger, http://www.cs.umass.edu/~emery
+ 
+  Copyright (c) 1998-2006 Emery Berger, The University of Texas at Austin
+
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or
+  (at your option) any later version.
+  
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+  
+  You should have received a copy of the GNU General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+*/
+
+#ifdef _DEBUG
+#error "This library must be compiled in release mode."
+#endif	
+
+/*
+
+  Compile with compile-winhoard.cmd.
+
+ */
+
+
+#include <windows.h>
+
+#define WIN32_LEAN_AND_MEAN
+
+#if (_WIN32_WINNT < 0x0500)
+#define _WIN32_WINNT 0x0500
+#endif
+
+#pragma inline_depth(255)
+
+#pragma warning(disable: 4273)
+#pragma warning(disable: 4098)  // Library conflict.
+#pragma warning(disable: 4355)  // 'this' used in base member initializer list.
+#pragma warning(disable: 4074)	// initializers put in compiler reserved area.
+
+void (*hoard_memcpy_ptr)(void *dest, const void *src, size_t count);
+void (*hoard_memset_ptr)(void *dest, int c, size_t count);
+
+const char *RlsCRTLibraryName[] = {"MSVCR71.DLL", "MSVCR80.DLL", "MSVCR90.DLL" };
+const int RlsCRTLibraryNameLength = 3;
+
+#define IAX86_NEARJMP_OPCODE	  0xe9
+#define MakeIAX86Offset(to,from)  ((unsigned)((char*)(to)-(char*)(from)) - 5)
+
+typedef struct
+{
+  const char *import;		// import name of patch routine
+  FARPROC replacement;		// pointer to replacement function
+  FARPROC original;		// pointer to original function
+  unsigned char codebytes[5];	// 5 bytes of original code storage
+} PATCH;
+
+
+static bool PatchMeIn (void);
+
+#define CUSTOM_PREFIX(n) hoard_##n
+#define HOARD_PRE_ACTION {PatchMeIn();}
+#define HOARD_POST_ACTION {HeapAlloc (GetProcessHeap(), 0, 1); }
+
+// DisableThreadLibraryCalls ((HMODULE)hinstDLL); 
+
+#define CUSTOM_DLLNAME HoardDllMain
+
+#include "libhoard.cpp"
+
+// Intercept the exit functions.
+
+static const int HOARD_MAX_EXIT_FUNCTIONS = 255;
+static int exitCount = 0;
+
+extern "C" {
+
+  __declspec(dllexport) int ReferenceHoardStub;
+
+  typedef void (*exitFunctionType) (void);
+  exitFunctionType exitFunctionBuffer[255];
+
+  void hoard_onexit (void (*function)(void)) {
+    if (exitCount < HOARD_MAX_EXIT_FUNCTIONS) {
+      exitFunctionBuffer[exitCount] = function;
+      exitCount++;
+    }
+  }
+
+  void hoard_exit (int code) {
+    while (exitCount > 0) {
+      exitCount--;
+      (exitFunctionBuffer[exitCount])();
+    }
+  }
+
+  void * hoard_expand (void * ptr) {
+    return NULL;
+  }
+
+}
+
+
+/* ------------------------------------------------------------------------ */
+
+static PATCH rls_patches[] = 
+  {
+    // RELEASE CRT library routines supported by this memory manager.
+
+    {"_expand",		(FARPROC) hoard_expand,	   0},
+    {"_onexit",         (FARPROC) hoard_onexit,    0},
+    {"_exit",           (FARPROC) hoard_exit,      0},
+
+    // operator new, new[], delete, delete[].
+
+#ifdef _WIN64
+
+    {"??2@YAPEAX_K@Z",  (FARPROC) hoard_malloc,    0},
+    {"??_U@YAPEAX_K@Z", (FARPROC) hoard_malloc,    0},
+    {"??3@YAXPEAX@Z",   (FARPROC) hoard_free,      0},
+    {"??_V@YAXPEAX@Z",  (FARPROC) hoard_free,      0},
+
+#else
+
+    {"??2@YAPAXI@Z",    (FARPROC) hoard_malloc,    0},
+    {"??_U@YAPAXI@Z",   (FARPROC) hoard_malloc,    0},
+    {"??3@YAXPAX@Z",    (FARPROC) hoard_free,      0},
+    {"??_V@YAXPAX@Z",   (FARPROC) hoard_free,      0},
+
+#endif
+
+    // the nothrow variants new, new[].
+
+    {"??2@YAPAXIABUnothrow_t@std@@@Z",  (FARPROC) hoard_malloc, 0},
+    {"??_U@YAPAXIABUnothrow_t@std@@@Z", (FARPROC) hoard_malloc, 0},
+
+    {"_msize",	(FARPROC) hoard_malloc_usable_size,		0},
+    {"calloc",	(FARPROC) hoard_calloc,		0},
+    {"malloc",	(FARPROC) hoard_malloc,		0},
+    {"realloc",	(FARPROC) hoard_realloc,		0},
+    {"free",	(FARPROC) hoard_free,              0},
+  };
+
+
+static void PatchIt (PATCH *patch)
+{
+  // Change rights on CRT Library module to execute/read/write.
+
+  MEMORY_BASIC_INFORMATION mbi_thunk;
+  VirtualQuery((void*)patch->original, &mbi_thunk, 
+	       sizeof(MEMORY_BASIC_INFORMATION));
+  VirtualProtect(mbi_thunk.BaseAddress, mbi_thunk.RegionSize, 
+		 PAGE_EXECUTE_READWRITE, &mbi_thunk.Protect);
+
+  // Patch CRT library original routine:
+  // 	save original 5 code bytes for exit restoration
+  //		write jmp <patch_routine> (5 bytes long) to original.
+
+  memcpy(patch->codebytes, patch->original, sizeof(patch->codebytes));
+  unsigned char *patchloc = (unsigned char*)patch->original;
+  *patchloc++ = IAX86_NEARJMP_OPCODE;
+  *(unsigned*)patchloc = MakeIAX86Offset(patch->replacement, patch->original);
+	
+  // Reset CRT library code to original page protection.
+
+  VirtualProtect(mbi_thunk.BaseAddress, mbi_thunk.RegionSize, 
+		 mbi_thunk.Protect, &mbi_thunk.Protect);
+}
+
+
+static bool PatchMeIn (void)
+{
+  bool patchedIn = false;
+
+  // acquire the module handles for the CRT libraries (release and debug)
+  for (int i = 0; i < RlsCRTLibraryNameLength; i++) {
+
+    HMODULE RlsCRTLibrary = GetModuleHandle(RlsCRTLibraryName[i]);
+
+    HMODULE DefCRTLibrary = 
+      RlsCRTLibrary;
+
+    // assign function pointers for required CRT support functions
+    if (DefCRTLibrary) {
+      hoard_memcpy_ptr = (void(*)(void*,const void*,size_t))
+	GetProcAddress(DefCRTLibrary, "memcpy");
+      hoard_memset_ptr = (void(*)(void*,int,size_t))
+	GetProcAddress(DefCRTLibrary, "memset");
+    }
+
+    // patch all relevant Release CRT Library entry points
+    if (RlsCRTLibrary) {
+      for (int i = 0; i < sizeof(rls_patches) / sizeof(*rls_patches); i++) {
+	if (rls_patches[i].original = GetProcAddress(RlsCRTLibrary, rls_patches[i].import)) {
+	  PatchIt(&rls_patches[i]);
+	  patchedIn = true;
+	}
+      }
+    }
+  }
+  return patchedIn;
+}
Index: /proiecte/swift/trunk/src/CMakeLists.txt
===================================================================
--- /proiecte/swift/trunk/src/CMakeLists.txt	(revision 176)
+++ /proiecte/swift/trunk/src/CMakeLists.txt	(revision 176)
@@ -0,0 +1,11 @@
+include_directories (${CMAKE_SOURCE_DIR}/include/) 
+
+add_library (swift-workstealing STATIC
+  swift_allocator.c
+  swift_backoff.c
+  swift_context.c
+  swift_deque.c
+  swift_dfg.c
+  swift_scheduler.c
+  swift_thread.c
+)
Index: /proiecte/swift/trunk/src/swift_allocator.c
===================================================================
--- /proiecte/swift/trunk/src/swift_allocator.c	(revision 176)
+++ /proiecte/swift/trunk/src/swift_allocator.c	(revision 176)
@@ -0,0 +1,101 @@
+/*
+ * swift_allocator.c
+ *
+ * (c) 2009 Ionut Rosoiu <ionut.rosoiu@gmail.com>
+ *
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include "swift_assert.h"
+#include "swift_allocator.h"
+#include "swift_log.h"
+
+inline
+void* swift_malloc_system(size_t size) {
+	void *ret = malloc(size);
+
+	swift_assert(ret);
+
+	return ret;
+}
+
+inline
+void swift_free_system(void *addr) {
+	free(addr);
+}
+
+inline
+void* swift_malloc(swift_thread_t *thread, size_t size) {
+	//TODO: check
+	void *ret;
+
+#ifdef SWIFT_USE_CUSTOM_ALLOCATOR
+	swift_allocator_list_t **b, *elem;
+	size_t sz;
+
+	/* allocate space for the allocator's list */
+	size += sizeof(swift_allocator_list_t);
+	size = SWIFT_MEM_ALIGN(size);
+
+	for (b = thread->buckets, sz = SWIFT_MALLOC_ALIGN;
+		 sz < size;
+		 sz <<= 1, b++) {
+	}
+
+	elem = *b;
+	if (elem) {
+		/* reuse from the bucket */
+		*b = elem->next;
+		SWIFT_LOG(INFO, "get %d from bucket %p  --> elem=%p\n", sz, (void*)b, (void*) elem);
+
+	} else {
+		/* get from the heap */
+		elem = thread->heap_top;
+		thread->heap_top = ((char*)thread->heap_top + SWIFT_MEM_ALIGN(sz));
+
+		SWIFT_LOG(INFO, "get %d from heap for bucket %p --> elem=%p\n", sz, (void*)b,  (void*)elem);
+	}
+
+	/* store from what bucket this came from */
+	elem->next = b;
+
+	swift_assert((void*)elem < thread->heap_limit);
+
+	ret = elem;
+	ret = (void*) ((char*)ret + SWIFT_MEM_ALIGN(sizeof(swift_allocator_list_t)));
+
+	SWIFT_LOG(INFO, "malloc return %p\n", ret);
+#else
+	ret = malloc(size);
+#endif
+
+	return ret;
+}
+
+inline
+void swift_free(swift_thread_t *thread, void *addr) {
+#ifdef SWIFT_USE_CUSTOM_ALLOCATOR
+	swift_allocator_list_t *elem;
+	swift_allocator_list_t **b;
+
+	elem = (swift_allocator_list_t*) ((char*)addr - SWIFT_MEM_ALIGN(sizeof(swift_allocator_list_t)));
+
+	/* get the bucket this element came from */
+	b = elem->next;
+
+	SWIFT_LOG(INFO, "return addr=%p to bucket %p (*b=%p) --> elem=%p\n", addr, (void*)b, (void*)*b, (void*)elem);
+
+	/* return to the bucket */
+	elem->next = *b;
+	*b = elem;
+#else
+	//free(addr);
+#endif
+}
+
+inline
+void swift_retire_frame(swift_thread_t *thread, swift_frame_t *frame) {
+	/* drop into the pool */
+	swift_free(thread, frame);
+}
Index: /proiecte/swift/trunk/src/swift_backoff.c
===================================================================
--- /proiecte/swift/trunk/src/swift_backoff.c	(revision 176)
+++ /proiecte/swift/trunk/src/swift_backoff.c	(revision 176)
@@ -0,0 +1,25 @@
+/*
+ * swift_backoff.c
+ *
+ * (c) 2009 Ionut Rosoiu <ionut.rosoiu@gmail.com>
+ *
+ */
+
+#include "swift_backoff.h"
+#include "swift_log.h"
+#define _POSIX_C_SOURCE 199309L
+#include <time.h>
+
+void swift_backoff(swift_thread_t *thread) {
+	struct timespec req, rem;
+
+	//TODO: limit backoff (or cycle)
+	req.tv_sec = 0;
+	req.tv_nsec = thread->last_sleep_time;
+
+	while (nanosleep(&req, &rem) == -1) {
+		req = rem;
+	}
+
+	thread->last_sleep_time = (thread->last_sleep_time << 1) % 100L;
+}
Index: /proiecte/swift/trunk/src/swift_context.c
===================================================================
--- /proiecte/swift/trunk/src/swift_context.c	(revision 176)
+++ /proiecte/swift/trunk/src/swift_context.c	(revision 176)
@@ -0,0 +1,77 @@
+/*
+ * swift_context.c
+ *
+ * (c) 2009 Ionut Rosoiu <ionut.rosoiu@gmail.com>
+ *
+ */
+
+#include "swift_context.h"
+#include <stdlib.h>
+#include <string.h>
+
+void swift_context_init(swift_context_t *context, swift_size_t nprocs) {
+	//TODO: check
+	swift_thread_t *thread;
+	int i;
+#ifdef SWIFT_USE_CUSTOM_ALLOCATOR
+	int j;
+#endif
+
+	context->thread_num = nprocs;
+	context->parallel_finished = 0;
+
+	context->threads = (swift_thread_t*) swift_malloc_system(nprocs * sizeof(swift_thread_t));
+
+	//TODO: check
+	for (i=0; i<nprocs; i++) {
+		thread = &context->threads[i];
+
+#ifdef SWIFT_USE_CUSTOM_ALLOCATOR
+		thread->heap = swift_malloc_system(SWIFT_HEAP_SIZE);
+		thread->buckets = (swift_allocator_list_t**) swift_malloc_system(SWIFT_BUCKET_COUNT * sizeof(void*));
+		swift_assert(thread->heap && thread->buckets);
+
+		thread->heap_top = thread->heap;
+		thread->heap_limit = ((char*)thread->heap + SWIFT_HEAP_SIZE);
+
+		for (j=0; j<SWIFT_BUCKET_COUNT; j++) {
+			thread->buckets[j] = NULL;
+		}
+#endif
+
+		swift_deque_init(thread,
+						 &thread->workque,
+						 SWIFT_DEQUE_SIZE);
+
+		//TODO: check
+		thread->context = context;
+		thread->id = i;
+		thread->stats = 0;
+		thread->stop = 0;
+		thread->round_robin_id = i;
+		thread->last_sleep_time = i * 10 + 1;
+		thread->frame_no = 0;
+	}
+}
+
+void swift_context_destroy(swift_context_t *context) {
+	int i;
+#ifdef SWIFT_USE_CUSTOM_ALLOCATOR
+	int j;
+#endif
+
+	for (i=0; i<context->thread_num; i++) {
+		swift_deque_destroy(&context->threads[i], &context->threads[i].workque);
+
+#ifdef SWIFT_USE_CUSTOM_ALLOCATOR
+		for (j=0; j<SWIFT_BUCKET_COUNT; j++) {
+			context->threads[i].buckets[j] = NULL;
+		}
+		swift_free_system(context->threads[i].buckets);
+#endif
+
+	}
+
+	swift_free_system(context->threads);
+}
+
Index: /proiecte/swift/trunk/src/swift_deque.c
===================================================================
--- /proiecte/swift/trunk/src/swift_deque.c	(revision 176)
+++ /proiecte/swift/trunk/src/swift_deque.c	(revision 176)
@@ -0,0 +1,148 @@
+/*
+ * swift_deque.c
+ *
+ * (c) 2009 Ionut Rosoiu <ionut.rosoiu@gmail.com>
+ *
+ */
+
+#include "swift_deque.h"
+#include <stdio.h>
+
+void swift_deque_init(swift_thread_t *thread, swift_deque_t *q, swift_size_t size) {
+	//automatically resized to a power of two
+	//SWIFT_CHECK(size & (size-1), SWIFT_RETURN_WITH_STATUS(SWIFT_INVALID_PARAM));
+
+	if (size & (size-1)) {
+		/* round up to a power of two */
+		swift_size_t newSize = 1;
+
+		while (size) {
+			size >>= 1;
+			newSize <<= 1;
+		}
+
+		size = newSize;
+	}
+
+	q->size = size;
+	q->size_mask = size - 1;
+	q->top = q->bottom = q->top_cached = 0;
+	q->elements = (swift_frame_t**) swift_malloc(thread, size * sizeof(swift_frame_t*));
+}
+
+void swift_deque_push(swift_deque_t *q, swift_frame_t *frame, swift_status_t *status) {
+	swift_dword_t t, b;
+	SWIFT_CHECK(NULL != q, SWIFT_RETURN_WITH_STATUS(SWIFT_INVALID_PARAM));
+
+	b = q->bottom;
+	/* avoid some cache misses by using this local variable */
+	t = q->top_cached;
+
+	if (b - t >= q->size_mask) { /* size_mask = size - 1 */
+		/* because we've used a cached value, we might have a false positive */
+		t = q->top;
+		q->top_cached = t;
+
+		if (b - t >= q->size_mask) {
+			//TODO: handle reallocation (...and ALL the problems that come along...)
+			// for the moment fail this case
+			*status = SWIFT_DEQUE_FULL;
+			return;
+		}
+	}
+
+	/* push the new value at the bottom */
+	q->elements[b & q->size_mask] = frame;
+	q->bottom = b + 1;
+
+	*status = SWIFT_SUCCESS;
+}
+
+swift_frame_t* swift_deque_pop(swift_deque_t *q, swift_status_t *status) {
+	swift_frame_t *ret = NULL;
+	swift_dword_t b, t;
+	long size;
+
+	SWIFT_CHECK(NULL != q, *status = SWIFT_INVALID_PARAM; return NULL);
+
+	b = q->bottom;
+
+	b--;
+	q->bottom = b;
+
+	/* top must be read _after_ bottom is written (i.e. incremented) */
+	swift_memory_write_barrier();
+
+	t = q->top;
+	q->top_cached = t;
+
+	size = (long)(b - t);
+
+	if (size < 0) {
+		q->bottom = t;
+
+		*status = SWIFT_DEQUE_EMPTY;
+		return NULL;
+	}
+
+	/* get a reference to the element to return */
+	ret = q->elements[b & q->size_mask];
+
+	/* enough active elements left in the array */
+	if (size > 0) {
+		return ret;
+	}
+
+	/* check to see if the last element was concurrently stolen */
+	if (! SWIFT_CAS(q->top, t, t+1)) {
+		/* someone has stolen our element */
+		*status = SWIFT_DEQUE_EMPTY;
+		ret = NULL;
+	}
+
+	/* the array is empty and q->top is t+1; adjust bottom */
+	q->bottom = t + 1;
+	q->top_cached = t + 1;
+
+	return ret;
+}
+
+swift_frame_t* swift_deque_steal(swift_deque_t *q, swift_status_t *status) {
+	swift_dword_t t, b;
+	swift_frame_t *ret = NULL;
+
+	SWIFT_CHECK(NULL != q, *status = SWIFT_INVALID_PARAM; return NULL);
+
+	t = q->top;
+
+	/* a read barrier is needed to guarantee a consistent view of the memory
+	 * see also the write_barrier() in the pop()
+	 */
+	swift_memory_read_barrier();
+
+	b = q->bottom;
+
+	if ((long)(b - t) <= 0) {
+		*status = SWIFT_DEQUE_EMPTY;
+		return NULL;
+	}
+
+	/* get a reference to the element _before_ trying the CAS
+	 * (i.e. _before_ checking we've won the race);
+	 * if not, in case we win, we might get a reference to a newly
+	 * push()-ed element instead of the current one
+	 */
+	ret = q->elements[t & q->size_mask];
+
+	if (! SWIFT_CAS(q->top, t, t+1)) {
+		*status = SWIFT_DEQUE_ABORT;
+		return NULL;
+	}
+
+	*status = SWIFT_SUCCESS;
+	return ret;
+}
+
+void swift_deque_destroy(swift_thread_t *thread, swift_deque_t *q) {
+	swift_free(thread, q->elements);
+}
Index: /proiecte/swift/trunk/src/swift_dfg.c
===================================================================
--- /proiecte/swift/trunk/src/swift_dfg.c	(revision 176)
+++ /proiecte/swift/trunk/src/swift_dfg.c	(revision 176)
@@ -0,0 +1,11 @@
+/*
+ * swift_dfg.c
+ *
+ * (c) 2009 Ionut Rosoiu <ionut.rosoiu@gmail.com>
+ *
+ */
+
+#include "swift_dfg.h"
+#include "swift_atomic.h"
+#include "swift_thread.h"
+
Index: /proiecte/swift/trunk/src/swift_scheduler.c
===================================================================
--- /proiecte/swift/trunk/src/swift_scheduler.c	(revision 176)
+++ /proiecte/swift/trunk/src/swift_scheduler.c	(revision 176)
@@ -0,0 +1,127 @@
+/*
+ * swift_scheduler.c
+ *
+ * (c) 2009 Ionut Rosoiu <ionut.rosoiu@gmail.com>
+ *
+ */
+
+#include "swift_scheduler.h"
+#include <stdlib.h>
+#include <sched.h>
+
+inline
+swift_thread_t* swift_get_steal_target(swift_context_t *context, swift_thread_t* thread)
+{
+	/* round robin */
+	++thread->round_robin_id;
+	thread->round_robin_id %= context->thread_num;
+
+	if (thread->round_robin_id == thread->id) {
+		++thread->round_robin_id;
+		thread->round_robin_id %= context->thread_num;
+	}
+
+	return &context->threads[thread->round_robin_id];
+}
+
+inline
+swift_frame_t* swift_get_frame(swift_context_t *context, swift_thread_t *thread)
+{
+	swift_frame_t *frame = NULL;
+	swift_thread_t *target = NULL;
+	swift_status_t status;
+
+	/* 1. get a frame from the bottom of the workqueue */
+	SWIFT_LOG(INFO, "[%d] get_frame_try_deq\n", thread->id);
+	frame = swift_deque_pop(&thread->workque, &status);
+	if (frame) {
+		SWIFT_LOG_FRAME_INFO_STR("deq_bottom", thread, frame);
+		goto exit;
+	}
+
+	/* 2. try to steal a frame */
+	target = swift_get_steal_target(context, thread);
+	SWIFT_LOG(INFO, "[%d] get_frame_try_steal %d\n", thread->id, target->id);
+	do {
+		frame = swift_deque_steal(&target->workque, &status);
+	} while (status == SWIFT_DEQUE_ABORT);
+
+	if (frame) {
+		SWIFT_LOG_FRAME_INFO_STR("-STOLEN-", thread, frame);
+		goto exit;
+	}
+
+	//FIXME: experimental!
+	sched_yield();
+
+exit:
+	return frame;
+}
+
+inline
+void swift_scheduler_execute(swift_thread_t *thread)
+{
+	swift_frame_t *frame;
+
+	// execute some work
+	SWIFT_LOG(INFO, "[%d] sched_exec\n", thread->id);
+	frame = swift_get_frame(thread->context, thread);
+
+	if (frame) {
+		SWIFT_LOG_FRAME_INFO_STR("scheduler_execute", thread, frame);
+		frame->closure(thread, frame);
+	}
+	//else {
+	//	swift_backoff(thread, status);
+	//	SWIFT_LOG(INFO, "[%d] slept %u\n", thread->id, thread->last_sleep_time);
+	//}
+}
+
+inline
+void swift_signal_frame_done(swift_thread_t *thread, swift_frame_t *frame)
+{
+	swift_status_t status;
+
+	SWIFT_LOG_FRAME_INFO_STR("frame_done_signal_sync", thread, frame);
+
+	/* signal sync */
+	// decrement the number of frames needed to be sync'd
+	SWIFT_ATOMIC_DECR(*frame->sync_frames_remaining);
+
+	// this is the last frame for the sync
+#ifdef LOGGING_ON
+	// if this is the last frame before the sync, signal sync done
+	if (SWIFT_CAS(*frame->sync_frames_remaining, 0, 0)) {
+		SWIFT_LOG_FRAME_INFO_STR("frame_done_signal_sync_FINAL", thread, frame);
+	}
+#endif
+
+	/* signal dependencies */
+	if (frame->dependencies_frame) {
+		swift_frame_t *f = frame->dependencies_frame;
+		SWIFT_LOG_FRAME_INFO_STR("frame_done_signal_deps", thread, frame);
+
+		SWIFT_ATOMIC_DECR(f->dependencies_no);
+
+		// this is the last frame for the dependent frame
+		if (SWIFT_CAS(f->dependencies_no, 0, 0)) {
+			SWIFT_LOG_FRAME_INFO_STR("frame_done_signal_deps_FINAL", thread, frame);
+			swift_deque_push(&thread->workque, f, &status);
+		}
+	}
+}
+
+inline
+void swift_frame_done(swift_context_t *context, swift_thread_t *thread, swift_frame_t *frame)
+{
+
+	/* the last frame for the parallel region */
+	if (SWIFT_FRAME_IS_END_PARALLEL(frame)) {
+		SWIFT_LOG_FRAME_INFO_STR("--LAST FRAME DONE!--", thread, frame);
+		thread->context->parallel_finished = 1;
+	}
+
+	thread->stats += 1;
+
+	swift_retire_frame(thread, frame);
+}
Index: /proiecte/swift/trunk/src/swift_thread.c
===================================================================
--- /proiecte/swift/trunk/src/swift_thread.c	(revision 176)
+++ /proiecte/swift/trunk/src/swift_thread.c	(revision 176)
@@ -0,0 +1,20 @@
+/*
+ * swift_thread.c
+ *
+ * (c) 2009 Ionut Rosoiu <ionut.rosoiu@gmail.com>
+ *
+ */
+
+#include "swift_thread.h"
+
+void swift_thread_start(swift_thread_t *thread,
+						swift_entrypoint_t func) {
+
+	//TODO: check
+	pthread_create(&thread->thread, NULL, func, thread);
+}
+
+void swift_thread_wait(swift_thread_t *thread) {
+	//TODO: check
+	pthread_join(thread->thread, NULL);
+}
Index: /proiecte/swift/trunk/test/CMakeLists.txt
===================================================================
--- /proiecte/swift/trunk/test/CMakeLists.txt	(revision 176)
+++ /proiecte/swift/trunk/test/CMakeLists.txt	(revision 176)
@@ -0,0 +1,45 @@
+include_directories (${CMAKE_SOURCE_DIR}/include/) 
+
+link_directories (${CMAKE_BINARY_DIR}/src/ 
+                  /usr/lib) 
+
+add_executable (test_deque                     test_deque.c)
+target_link_libraries(test_deque               swift-workstealing pthread)
+
+# Fibonacci
+
+add_executable (fibo_serial                    fibo_serial.c)
+set_target_properties(fibo_serial              PROPERTIES COMPILE_FLAGS "-fno-omit-frame-pointer")
+
+add_executable (fibo_stack_2spawns             fibo_stack_2spawns.c)
+target_link_libraries(fibo_stack_2spawns       swift-workstealing pthread)
+
+add_executable(fibo_omp                        fibo_omp.c)
+set_target_properties(fibo_omp                 PROPERTIES COMPILE_FLAGS "-fopenmp" LINK_FLAGS "-fopenmp")
+
+# Quicksort
+
+add_executable(qsort_gen                       qsort_gen.c qsort_common.c)
+
+add_executable(qsort_serial                    qsort_serial.c qsort_common.c)
+set_target_properties(qsort_serial             PROPERTIES COMPILE_FLAGS "-fno-omit-frame-pointer")
+
+add_executable(qsort_ws                        qsort_ws.c qsort_common.c)
+target_link_libraries(qsort_ws                 swift-workstealing pthread)
+
+add_executable(qsort_omp_par                   qsort_omp_par.c qsort_common.c)
+set_target_properties(qsort_omp_par            PROPERTIES COMPILE_FLAGS "-fopenmp" LINK_FLAGS "-fopenmp")
+
+add_executable(qsort_omp_task                  qsort_omp_task.c qsort_common.c)
+set_target_properties(qsort_omp_task           PROPERTIES COMPILE_FLAGS "-fopenmp" LINK_FLAGS "-fopenmp")
+
+
+
+#add_executable (fibo                          fibo.c)
+#target_link_libraries(fibo                    swift-workstealing pthread)
+
+#add_executable (fibo_2spawn                   fibo_2spawn.c)
+#target_link_libraries(fibo_2spawn             swift-workstealing pthread)
+
+#add_executable (fibo_2spawns_no_ksync         fibo_2spawns_no_ksync.c)
+#target_link_libraries(fibo_2spawns_no_ksync   swift-workstealing pthread)
Index: /proiecte/swift/trunk/test/copy of fibo.c
===================================================================
--- /proiecte/swift/trunk/test/copy of fibo.c	(revision 176)
+++ /proiecte/swift/trunk/test/copy of fibo.c	(revision 176)
@@ -0,0 +1,232 @@
+/*
+ * swift_context.c
+ *
+ * (c) 2009 Ionut Rosoiu <ionut.rosoiu@gmail.com>
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "swift.h"
+
+/* datastructures for the two closures */
+typedef struct sum_data {
+	int r1;
+	int r2;
+	int *r;
+} sum_data_t;
+
+typedef struct fibo_data {
+	int n;
+	int *r;
+} fibo_data_t;
+
+/* forward declaration for the fibo() */
+void fibo(swift_thread_t *thread, swift_frame_t *frame);
+
+/* sum(r1, r2, *r) */
+void sum(swift_thread_t *thread, swift_frame_t *frame) {
+	swift_status_t status;
+	sum_data_t *data = frame->private_data;
+
+	SWIFT_LOG_FRAME_INFO_STR("\nsum() ", thread, frame);
+	*data->r = data->r1 + data->r2;
+
+	SWIFT_LOG(INFO, "[%d] sum(%d, %d)=%d\n", thread->id, data->r1, data->r2, *data->r);
+	swift_signal_frame_done(thread, frame, &status);
+}
+
+/* the function that is called when fibo() ends execution */
+inline void fibo_end(swift_thread_t *thread, swift_frame_t *frame) {
+	swift_status_t status;
+
+	SWIFT_LOG_FRAME_INFO_STR("fibo_end", thread, frame);
+
+	swift_signal_frame_done(thread, frame, &status);
+}
+
+/* void fibo(int r, shared_w int* r) */
+void fibo(swift_thread_t *thread, swift_frame_t *frame) {
+	fibo_data_t *data = frame->private_data;
+	swift_status_t status;
+	swift_size_t n;
+	// sync
+	swift_sync_info_t *sync_frame = NULL;
+
+	SWIFT_LOG_FRAME_INFO_STR("\nfibo() ", thread, frame);
+
+	if (data->n < 2) {
+		*data->r = data->n;
+
+	} else {
+		// fibo(n-1) data
+		swift_frame_t *frame1;
+		fibo_data_t *data1;
+
+		// fibo(n-2) data
+		swift_frame_t *frame2;
+		fibo_data_t *data2;
+
+		// sum() data
+		swift_frame_t *frame3;
+		sum_data_t *data3;
+
+		sync_frame = (swift_sync_info_t*) swift_malloc(sizeof(swift_sync_info_t), &status);
+		swift_sync_frame_init(sync_frame, 3, &status);
+
+		// sum() private data
+		data3 = (sum_data_t*) swift_malloc(sizeof(sum_data_t), &status);
+		data3->r = data->r;
+
+		/* spawn fibo(n-1, r1); */
+		frame1 = (swift_frame_t*) swift_malloc(sizeof(swift_frame_t), &status);
+		frame1->creator_id = thread->id;
+		frame1->closure = fibo;
+		frame1->dbg = data->n - 1;
+
+		data1 = (fibo_data_t*) swift_malloc(sizeof(fibo_data_t), &status);
+		data1->n = data->n - 1;
+		data1->r = &data3->r1;
+		frame1->private_data = data1;
+
+		SWIFT_WRITE_FRAME_INFO(frame1, thread->id, 'f', thread->frame_no++);
+		// sync related
+		frame1->finished_handler = fibo_end;
+		frame1->sync_info = sync_frame;
+
+		/* spawn fibo(n-2, r2); */
+		frame2 = (swift_frame_t*) swift_malloc(sizeof(swift_frame_t), &status);
+		frame2->creator_id = thread->id;
+		frame2->closure = fibo;
+		frame2->dbg = data->n - 2;
+
+		data2 = (fibo_data_t*) swift_malloc(sizeof(fibo_data_t), &status);
+		data2->n = data->n - 2;
+		data2->r = &data3->r2;
+		frame2->private_data = data2;
+
+		SWIFT_WRITE_FRAME_INFO(frame2, thread->id, 'f', thread->frame_no++);
+		frame2->finished_handler = fibo_end;
+		frame2->sync_info = sync_frame;
+
+		/* spawn sum(r1, r2, r); */
+		frame3 = (swift_frame_t*) swift_malloc(sizeof(swift_frame_t), &status);
+		frame3->creator_id = thread->id;
+		frame3->closure = sum;
+		frame3->dbg = -data->n;
+		frame3->private_data = data3;
+
+		frame3->dependencies_no = 2;
+		SWIFT_WRITE_FRAME_INFO(frame3, thread->id, 's', thread->frame_no++);
+		frame3->finished_handler = NULL;
+		frame3->sync_info = sync_frame;
+
+		// 3 depends on 1 and 2
+		frame1->dependencies_frame = frame3;
+		frame2->dependencies_frame = frame3;
+		frame3->dependencies_frame = NULL;
+
+		// add 1 & 2 in the workque (3 will be added when 1&2 finish)
+		swift_deque_push(&thread->workque, &thread->workqueTopUpperBound, frame1, &status);
+		swift_deque_push(&thread->workque, &thread->workqueTopUpperBound, frame2, &status);
+	}
+
+	/* ksync; */
+	if (sync_frame) {
+		while ((n = SWIFT_ATOMIC_READ(sync_frame->sync_frames_remaining))) {
+			SWIFT_LOG(INFO, "[%d] %s rem=%d c=%d f=%c.%d (%d)\n", thread->id, "@sync", n,
+						SWIFT_PROC(frame->info), SWIFT_FRAME_NAME(frame->info),
+						frame->dbg, SWIFT_FRAME_ID(frame->info));
+			swift_scheduler_execute(thread, &status);
+		}
+	}
+
+	if (frame->finished_handler) {
+		frame->finished_handler(thread, frame);
+	}
+
+	SWIFT_LOG(INFO, "[%d] __fibo(%d)=%d\n", thread->id, data->n, *data->r);
+
+	swift_retire_frame(frame, &status);
+	if (sync_frame) {
+		swift_mutex_destroy(&sync_frame->sync_mutex, &status);
+		swift_free(sync_frame, &status);
+	}
+
+	SWIFT_LOG(INFO, "[%d] backoff\n", thread->id);
+	swift_backoff(thread, &status);
+}
+
+void* thread_start(void *arg) {
+	swift_thread_t *thread = arg;
+	swift_status_t status;
+
+	SWIFT_LOG(INFO, "_____started %d\n", thread->id);
+	swift_scheduler_execute(thread, &status);
+	SWIFT_LOG(INFO, "_____finished %d\n", thread->id);
+
+	return arg;
+}
+
+int main(int argc, char **argv) {
+	swift_context_t context;
+	swift_status_t status;
+	swift_frame_t *frame;
+	fibo_data_t *data;
+	int i, r;
+	int nthreads, n;
+
+	if (argc != 3) {
+		fprintf(stderr, "usage: %s Nthreads N\n", argv[0]);
+		abort();
+	}
+
+	nthreads = strtol(argv[1], NULL, 10);
+	n = strtol(argv[2], NULL, 10);
+
+	SWIFT_LOG(INFO, "Started nthreads=%d n=%d\n", nthreads, n);
+
+	/* initialize the context */
+	swift_context_init(&context, nthreads, &status);
+
+	/* push the first frame */
+	frame = (swift_frame_t*) swift_malloc(sizeof(swift_frame_t), &status);
+	frame->creator_id = 0;
+	frame->closure = fibo;
+	frame->dbg = n;
+
+	data = (fibo_data_t*) swift_malloc(sizeof(fibo_data_t), &status);
+	data->n = n;
+	data->r = &r;
+	frame->private_data = data;
+
+	SWIFT_WRITE_FRAME_INFO(frame, 0, 'f', context.threads[0].frame_no++);
+	SWIFT_LOG_FRAME_INFO((&context.threads[0]), frame);
+
+	// no wait frame
+	frame->dependencies_no = 0;
+	frame->dependencies_frame = NULL;
+	frame->finished_handler = NULL;
+	frame->sync_info = NULL;
+
+	swift_deque_push(&context.threads[0].workque, &context.threads[0].workqueTopUpperBound, frame, &status);
+	SWIFT_LOG(INFO, "pushed first frame\n");
+
+	/* start the threads */
+	for (i=0; i<nthreads; i++) {
+		swift_thread_start(&context.threads[i], thread_start, &status);
+	}
+
+	/* wait for the threads to finish */
+	for (i=0; i<nthreads; i++) {
+		SWIFT_LOG(INFO, "_____waiting %d\n", i);
+		swift_thread_wait(&context.threads[i], &status);
+		SWIFT_LOG(INFO, "_____waiting %d done\n", i);
+	}
+
+	/* check the result */
+	printf("computed result for fibo(%d)=%d\n", n, r);
+	swift_context_destroy(&context, &status);
+
+	return 0;
+}
Index: /proiecte/swift/trunk/test/fibo.c
===================================================================
--- /proiecte/swift/trunk/test/fibo.c	(revision 176)
+++ /proiecte/swift/trunk/test/fibo.c	(revision 176)
@@ -0,0 +1,225 @@
+/*
+ * swift_context.c
+ *
+ * (c) 2009 Ionut Rosoiu <ionut.rosoiu@gmail.com>
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "swift.h"
+
+/* datastructures for the two closures */
+typedef struct sum_data {
+	int r1;
+	int r2;
+	int *r;
+	char _pad[SWIFT_CACHE_LINE_SIZE - sizeof(int)];
+} sum_data_t;
+
+typedef struct fibo_data {
+	int n;
+	int *r;
+	// sync related
+	swift_size_t sync_frames_remaining;
+	char _pad[SWIFT_CACHE_LINE_SIZE - sizeof(swift_size_t)];
+} fibo_data_t;
+
+/* forward declaration for the fibo() */
+void fibo(swift_thread_t *thread, swift_frame_t *frame);
+
+/* sum(r1, r2, *r) */
+void sum(swift_thread_t *thread, swift_frame_t *frame) {
+	swift_status_t status;
+	sum_data_t *data = frame->private_data;
+
+	SWIFT_LOG_FRAME_INFO_STR("\nsum() ", thread, frame);
+	*data->r = data->r1 + data->r2;
+
+	SWIFT_LOG(INFO, "[%d] sum(%d, %d)=%d\n", thread->id, data->r1, data->r2, *data->r);
+	swift_signal_frame_done(thread, frame, &status);
+}
+
+/* void fibo(int r, shared_w int* r) */
+void fibo(swift_thread_t *thread, swift_frame_t *frame) {
+	fibo_data_t *data = frame->private_data;
+	swift_status_t status;
+	swift_size_t n;
+
+	SWIFT_LOG_FRAME_INFO_STR("\nfibo() ", thread, frame);
+
+	if (data->n < 2) {
+		*data->r = data->n;
+		data->sync_frames_remaining = 0;
+
+	} else {
+		// fibo(n-1) data
+		swift_frame_t *frame1;
+		fibo_data_t *data1;
+
+		// fibo(n-2) data
+		swift_frame_t *frame2;
+		fibo_data_t *data2;
+
+		// sum() data
+		swift_frame_t *frame3;
+		sum_data_t *data3;
+
+		// sum() frame & private data
+		frame3 = (swift_frame_t*) swift_malloc(thread, sizeof(swift_frame_t) + sizeof(sum_data_t), &status);
+		data3 = (sum_data_t*) ((char*)frame3 + sizeof(swift_frame_t));
+		data3->r = data->r;
+
+		/* spawn fibo(n-1, r1); */
+		frame1 = (swift_frame_t*) swift_malloc(thread, sizeof(swift_frame_t) + sizeof(fibo_data_t), &status);
+		frame1->closure = fibo;
+#ifdef LOGGING_ON
+		frame1->creator_id = thread->id;
+		frame1->dbg = data->n - 1;
+#endif
+
+		data1 = (fibo_data_t*) ((char*)frame1 + sizeof(swift_frame_t));
+		data1->n = data->n - 1;
+		data1->r = &data3->r1;
+		frame1->private_data = data1;
+
+		SWIFT_WRITE_FRAME_INFO(frame1, thread->id, 'f', thread->frame_no++);
+		// sync related
+		frame1->sync_frames_remaining = &data->sync_frames_remaining;
+
+		/* spawn fibo(n-2, r2); */
+		frame2 = (swift_frame_t*) swift_malloc(thread, sizeof(swift_frame_t) + sizeof(fibo_data_t), &status);
+		frame2->closure = fibo;
+#ifdef LOGGING_ON
+		frame2->creator_id = thread->id;
+		frame2->dbg = data->n - 2;
+#endif
+
+		data2 = (fibo_data_t*) ((char*)frame2 + sizeof(swift_frame_t));
+		data2->n = data->n - 2;
+		data2->r = &data3->r2;
+		frame2->private_data = data2;
+
+		SWIFT_WRITE_FRAME_INFO(frame2, thread->id, 'f', thread->frame_no++);
+		frame2->sync_frames_remaining = &data->sync_frames_remaining;
+
+		/* spawn sum(r1, r2, r); */
+		frame3->closure = sum;
+#ifdef LOGGING_ON
+		frame3->creator_id = thread->id;
+		frame3->dbg = -data->n;
+#endif
+		frame3->private_data = data3;
+
+		frame3->dependencies_no = 2;
+		SWIFT_WRITE_FRAME_INFO(frame3, thread->id, 's', thread->frame_no++);
+		frame3->sync_frames_remaining = &data->sync_frames_remaining;
+
+		// 3 depends on 1 and 2
+		frame1->dependencies_frame = frame3;
+		frame2->dependencies_frame = frame3;
+		frame3->dependencies_frame = NULL;
+
+		// this frame awaits for 1,2,3 to finish
+		data->sync_frames_remaining = 3;
+
+		// add 1 & 2 in the workque (3 will be added when 1 & 2 finish)
+		swift_deque_push(&thread->workque, frame1, &status);
+		swift_deque_push(&thread->workque, frame2, &status);
+	}
+
+	/* ksync; */
+	while ((n = SWIFT_ATOMIC_READ(data->sync_frames_remaining))) {
+		SWIFT_LOG(INFO, "[%d] %s rem=%d c=%d f=%c.%d (%d)\n", thread->id, "@sync", n,
+					SWIFT_PROC(frame->info), SWIFT_FRAME_NAME(frame->info),
+					frame->dbg, SWIFT_FRAME_ID(frame->info));
+		swift_scheduler_execute(thread, &status);
+	}
+
+	SWIFT_LOG(INFO, "[%d] __fibo(%d)=%d\n", thread->id, data->n, *data->r);
+
+	swift_signal_frame_done(thread, frame, &status);
+	swift_frame_done(thread->context, thread, frame, &status);
+}
+
+void* thread_start(void *arg) {
+	swift_thread_t *thread = arg;
+	swift_status_t status;
+
+	SWIFT_LOG(INFO, "_____started thread %d\n", thread->id);
+
+	while (! thread->context->parallel_finished) {
+		swift_scheduler_execute(thread, &status);
+	}
+
+	//SWIFT_LOG(INFO, "_____finished thread %d: %d frames processed\n", thread->id, thread->stats);
+	printf("_____finished thread %d: %d frames processed\n", thread->id, thread->stats);
+
+	return arg;
+}
+
+int main(int argc, char **argv) {
+	swift_context_t context;
+	swift_status_t status;
+	swift_frame_t *frame;
+	fibo_data_t *data;
+	int i, r;
+	int nthreads, n;
+
+	if (argc != 3) {
+		fprintf(stderr, "usage: %s Nthreads N\n", argv[0]);
+		abort();
+	}
+
+	nthreads = strtol(argv[1], NULL, 10);
+	n = strtol(argv[2], NULL, 10);
+
+	SWIFT_LOG(INFO, "Started nthreads=%d n=%d\n", nthreads, n);
+
+	/* initialize the context */
+	swift_context_init(&context, nthreads, &status);
+
+	/* push the first frame */
+	frame = (swift_frame_t*) swift_malloc(&context.threads[0], sizeof(swift_frame_t) + sizeof(fibo_data_t), &status);
+	SWIFT_FRAME_SET_END_PARALLEL(frame);
+	frame->closure = fibo;
+#ifdef LOGGING_ON
+	frame->creator_id = 0;
+	frame->dbg = n;
+#endif
+
+	data = (fibo_data_t*) ((char*)frame + sizeof(swift_frame_t));
+	data->n = n;
+	data->r = &r;
+	frame->private_data = data;
+
+	SWIFT_WRITE_FRAME_INFO(frame, 0, 'f', context.threads[0].frame_no++);
+	SWIFT_LOG_FRAME_INFO((&context.threads[0]), frame);
+
+	// no wait frame
+	frame->dependencies_no = 0;
+	frame->dependencies_frame = NULL;
+	frame->sync_frames_remaining = &data->sync_frames_remaining;
+
+	swift_deque_push(&context.threads[0].workque, frame, &status);
+	SWIFT_LOG(INFO, "pushed first frame\n");
+
+
+	/* start the threads */
+	for (i=0; i<nthreads; i++) {
+		swift_thread_start(&context.threads[i], thread_start, &status);
+	}
+
+	/* wait for the threads to finish */
+	for (i=0; i<nthreads; i++) {
+		SWIFT_LOG(INFO, "_____waiting %d\n", i);
+		swift_thread_wait(&context.threads[i], &status);
+		SWIFT_LOG(INFO, "_____waiting %d done\n", i);
+	}
+
+	/* check the result */
+	printf("computed result for fibo(%d)=%d\n", n, r);
+	swift_context_destroy(&context, &status);
+
+	return 0;
+}
Index: /proiecte/swift/trunk/test/fibo_2spawn.c
===================================================================
--- /proiecte/swift/trunk/test/fibo_2spawn.c	(revision 176)
+++ /proiecte/swift/trunk/test/fibo_2spawn.c	(revision 176)
@@ -0,0 +1,184 @@
+/*
+ * swift_context.c
+ *
+ * (c) 2009 Ionut Rosoiu <ionut.rosoiu@gmail.com>
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "swift.h"
+
+typedef struct fibo_data {
+	int n;
+	int *r;
+	// sync related
+	swift_size_t sync_frames_remaining;
+	char _pad[SWIFT_CACHE_LINE_SIZE - sizeof(swift_size_t)];
+} fibo_data_t;
+
+/* forward declaration for the fibo() */
+void fibo(swift_thread_t *thread, swift_frame_t *frame);
+
+
+/* void fibo(int r, shared_w int* r) */
+void fibo(swift_thread_t *thread, swift_frame_t *frame) {
+	fibo_data_t *data = frame->private_data;
+	swift_status_t status;
+	swift_size_t n;
+
+	SWIFT_LOG_FRAME_INFO_STR("\nfibo() ", thread, frame);
+
+	if (data->n < 2) {
+		*data->r = data->n;
+		data->sync_frames_remaining = 0;
+
+	} else {
+		// fibo(n-1) data
+		swift_frame_t *frame1;
+		fibo_data_t *data1;
+
+		// fibo(n-2) data
+		swift_frame_t *frame2;
+		fibo_data_t *data2;
+
+		int r1, r2;
+
+		/* spawn fibo(n-1, r1); */
+		frame1 = (swift_frame_t*) swift_malloc(thread, sizeof(swift_frame_t) + sizeof(fibo_data_t), &status);
+		frame1->closure = fibo;
+#ifdef LOGGING_ON
+		frame1->creator_id = thread->id;
+		frame1->dbg = data->n - 1;
+#endif
+
+		data1 = (fibo_data_t*) ((char*)frame1 + sizeof(swift_frame_t));
+		data1->n = data->n - 1;
+		data1->r = &r1;
+		frame1->private_data = data1;
+
+		SWIFT_WRITE_FRAME_INFO(frame1, thread->id, 'f', thread->frame_no++);
+		// sync related
+		frame1->dependencies_frame = NULL;
+		frame1->sync_frames_remaining = &data->sync_frames_remaining;
+
+		/* spawn fibo(n-2, r2); */
+		frame2 = (swift_frame_t*) swift_malloc(thread, sizeof(swift_frame_t) + sizeof(fibo_data_t), &status);
+		frame2->closure = fibo;
+#ifdef LOGGING_ON
+		frame2->creator_id = thread->id;
+		frame2->dbg = data->n - 2;
+#endif
+
+		data2 = (fibo_data_t*) ((char*)frame2 + sizeof(swift_frame_t));
+		data2->n = data->n - 2;
+		data2->r = &r2;
+		frame2->private_data = data2;
+
+		SWIFT_WRITE_FRAME_INFO(frame2, thread->id, 'f', thread->frame_no++);
+		frame2->dependencies_frame = NULL;
+		frame2->sync_frames_remaining = &data->sync_frames_remaining;
+
+		// wait for 1,2 to finish
+		data->sync_frames_remaining = 2;
+
+		// add 1 & 2 in the workque
+		swift_deque_push(&thread->workque, frame1, &status);
+		swift_deque_push(&thread->workque, frame2, &status);
+
+		/* ksync; */
+		while ((n = SWIFT_ATOMIC_READ(data->sync_frames_remaining))) {
+			SWIFT_LOG(INFO, "[%d] %s rem=%d c=%d f=%c.%d (%d)\n", thread->id, "@sync", n,
+					        SWIFT_PROC(frame->info), SWIFT_FRAME_NAME(frame->info),
+							frame->dbg, SWIFT_FRAME_ID(frame->info));
+			swift_scheduler_execute(thread, &status);
+		}
+
+		*data->r = r1 + r2;
+	}
+
+	SWIFT_LOG(INFO, "[%d] __fibo(%d)=%d\n", thread->id, data->n, *data->r);
+
+	swift_signal_frame_done(thread, frame, &status);
+	swift_frame_done(thread->context, thread, frame, &status);
+}
+
+void* thread_start(void *arg) {
+	swift_thread_t *thread = arg;
+	swift_status_t status;
+
+	SWIFT_LOG(INFO, "_____started thread %d\n", thread->id);
+
+	while (! thread->context->parallel_finished) {
+		swift_scheduler_execute(thread, &status);
+	}
+
+	SWIFT_LOG(INFO, "_____finished thread %d: %d frames processed\n", thread->id, thread->stats);
+	printf("_____finished thread %d: %d frames processed\n", thread->id, thread->stats);
+
+	return arg;
+}
+
+int main(int argc, char **argv) {
+	swift_context_t context;
+	swift_status_t status;
+	swift_frame_t *frame;
+	fibo_data_t *data;
+	int i, r;
+	int nthreads, n;
+
+	if (argc != 3) {
+		fprintf(stderr, "usage: %s Nthreads N\n", argv[0]);
+		abort();
+	}
+
+	nthreads = strtol(argv[1], NULL, 10);
+	n = strtol(argv[2], NULL, 10);
+
+	SWIFT_LOG(INFO, "Started nthreads=%d n=%d\n", nthreads, n);
+
+	/* initialize the context */
+	swift_context_init(&context, nthreads, &status);
+
+	/* push the first frame */
+	frame = (swift_frame_t*) swift_malloc(&context.threads[0], sizeof(swift_frame_t) + sizeof(fibo_data_t), &status);
+	SWIFT_FRAME_SET_END_PARALLEL(frame);
+	frame->creator_id = 0;
+	frame->closure = fibo;
+	frame->dbg = n;
+
+	data = (fibo_data_t*) ((char*)frame + sizeof(swift_frame_t));
+	data->n = n;
+	data->r = &r;
+	frame->private_data = data;
+
+	SWIFT_WRITE_FRAME_INFO(frame, 0, 'f', context.threads[0].frame_no++);
+	SWIFT_LOG_FRAME_INFO((&context.threads[0]), frame);
+
+	// no wait frame
+	frame->dependencies_no = 0;
+	frame->dependencies_frame = NULL;
+	frame->sync_frames_remaining = &data->sync_frames_remaining; // doesn't matter
+
+	swift_deque_push(&context.threads[0].workque, frame, &status);
+	SWIFT_LOG(INFO, "pushed first frame\n");
+
+
+	/* start the threads */
+	for (i=0; i<nthreads; i++) {
+		swift_thread_start(&context.threads[i], thread_start, &status);
+	}
+
+	/* wait for the threads to finish */
+	for (i=0; i<nthreads; i++) {
+		SWIFT_LOG(INFO, "_____waiting %d\n", i);
+		swift_thread_wait(&context.threads[i], &status);
+		SWIFT_LOG(INFO, "_____waiting %d done\n", i);
+	}
+
+	/* check the result */
+	printf("computed result for fibo(%d)=%d\n", n, r);
+	swift_context_destroy(&context, &status);
+
+	return 0;
+}
Index: /proiecte/swift/trunk/test/fibo_2spawns_no_ksync.c
===================================================================
--- /proiecte/swift/trunk/test/fibo_2spawns_no_ksync.c	(revision 176)
+++ /proiecte/swift/trunk/test/fibo_2spawns_no_ksync.c	(revision 176)
@@ -0,0 +1,180 @@
+/*
+ * swift_context.c
+ *
+ * (c) 2009 Ionut Rosoiu <ionut.rosoiu@gmail.com>
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "swift.h"
+
+int N;
+
+typedef struct fibo_data {
+	int n;
+	int *r;
+	// sync related
+	swift_size_t sync_frames_remaining;
+	char _pad[SWIFT_CACHE_LINE_SIZE - sizeof(swift_size_t)];
+} fibo_data_t;
+
+/* forward declaration for the fibo() */
+void fibo(swift_thread_t *thread, swift_frame_t *frame);
+
+
+/* void fibo(int r, shared_w int* r) */
+void fibo(swift_thread_t *thread, swift_frame_t *frame) {
+	fibo_data_t *data = frame->private_data;
+	swift_status_t status;
+	swift_size_t n;
+
+	SWIFT_LOG_FRAME_INFO_STR("\nfibo() ", thread, frame);
+
+	if (data->n < 2) {
+		*data->r = data->n;
+		data->sync_frames_remaining = 0;
+
+	} else {
+		// fibo(n-1) data
+		swift_frame_t *frame1;
+		fibo_data_t *data1;
+
+		// fibo(n-2) data
+		swift_frame_t *frame2;
+		fibo_data_t *data2;
+
+		int r1, r2;
+
+		/* spawn fibo(n-1, r1); */
+		frame1 = (swift_frame_t*) swift_malloc(thread, sizeof(swift_frame_t) + sizeof(fibo_data_t), &status);
+		frame1->closure = fibo;
+#ifdef LOGGING_ON
+		frame1->creator_id = thread->id;
+		frame1->dbg = data->n - 1;
+#endif
+
+		data1 = (fibo_data_t*) ((char*)frame1 + sizeof(swift_frame_t));
+		data1->n = data->n - 1;
+		data1->r = &r1;
+		frame1->private_data = data1;
+
+		SWIFT_WRITE_FRAME_INFO(frame1, thread->id, 'f', thread->frame_no++);
+		// sync related
+		frame1->dependencies_frame = NULL;
+		frame1->sync_frames_remaining = &data->sync_frames_remaining;
+
+		/* spawn fibo(n-2, r2); */
+		frame2 = (swift_frame_t*) swift_malloc(thread, sizeof(swift_frame_t) + sizeof(fibo_data_t), &status);
+		frame2->closure = fibo;
+#ifdef LOGGING_ON
+		frame2->creator_id = thread->id;
+		frame2->dbg = data->n - 2;
+#endif
+
+		data2 = (fibo_data_t*) ((char*)frame2 + sizeof(swift_frame_t));
+		data2->n = data->n - 2;
+		data2->r = &r2;
+		frame2->private_data = data2;
+
+		SWIFT_WRITE_FRAME_INFO(frame2, thread->id, 'f', thread->frame_no++);
+		frame2->dependencies_frame = NULL;
+		frame2->sync_frames_remaining = &data->sync_frames_remaining;
+
+		// wait for 1,2 to finish
+		data->sync_frames_remaining = 2;
+
+		// add 1 & 2 in the workque
+		swift_deque_push(&thread->workque, frame1, &status);
+		swift_deque_push(&thread->workque, frame2, &status);
+
+		*data->r = r1 + r2;
+	}
+
+	SWIFT_LOG(INFO, "[%d] __fibo(%d)=%d\n", thread->id, data->n, *data->r);
+
+	swift_signal_frame_done(thread, frame, &status);
+	swift_frame_done(thread->context, thread, frame, &status);
+}
+
+void* thread_start(void *arg) {
+	swift_thread_t *thread = arg;
+	swift_status_t status;
+	int i = 0;
+
+	SWIFT_LOG(INFO, "_____started thread %d\n", thread->id);
+
+	while (i++ <= N) {
+		swift_scheduler_execute(thread, &status);
+	}
+
+	SWIFT_LOG(INFO, "_____finished thread %d: %d frames processed\n", thread->id, thread->stats);
+	printf("_____finished thread %d: %d frames processed\n", thread->id, thread->stats);
+
+	return arg;
+}
+
+int main(int argc, char **argv) {
+	swift_context_t context;
+	swift_status_t status;
+	swift_frame_t *frame;
+	fibo_data_t *data;
+	int i, r;
+	int nthreads, n;
+
+	if (argc != 3) {
+		fprintf(stderr, "usage: %s Nthreads N\n", argv[0]);
+		abort();
+	}
+
+	nthreads = strtol(argv[1], NULL, 10);
+	n = strtol(argv[2], NULL, 10);
+	N = n;
+
+	SWIFT_LOG(INFO, "Started nthreads=%d n=%d\n", nthreads, n);
+
+	/* initialize the context */
+	swift_context_init(&context, nthreads, &status);
+
+	/* push the first frame */
+	frame = (swift_frame_t*) swift_malloc(&context.threads[0], sizeof(swift_frame_t) + sizeof(fibo_data_t), &status);
+	SWIFT_FRAME_SET_END_PARALLEL(frame);
+	frame->creator_id = 0;
+	frame->closure = fibo;
+	frame->dbg = n;
+
+	data = (fibo_data_t*) ((char*)frame + sizeof(swift_frame_t));
+	data->n = n;
+	data->r = &r;
+	frame->private_data = data;
+
+	SWIFT_WRITE_FRAME_INFO(frame, 0, 'f', context.threads[0].frame_no++);
+	SWIFT_LOG_FRAME_INFO((&context.threads[0]), frame);
+
+	// no wait frame
+	frame->dependencies_no = 0;
+	frame->dependencies_frame = NULL;
+	frame->sync_frames_remaining = &data->sync_frames_remaining; // doesn't matter
+
+	swift_deque_push(&context.threads[0].workque, frame, &status);
+	SWIFT_LOG(INFO, "pushed first frame\n");
+
+
+	/* start the threads */
+	for (i=0; i<nthreads; i++) {
+		swift_thread_start(&context.threads[i], thread_start, &status);
+	}
+
+	/* wait for the threads to finish */
+	for (i=0; i<nthreads; i++) {
+		SWIFT_LOG(INFO, "_____waiting %d\n", i);
+		swift_thread_wait(&context.threads[i], &status);
+		SWIFT_LOG(INFO, "_____waiting %d done\n", i);
+	}
+
+	/* check the result */
+	printf("computed result for fibo(%d)=%d\n", n, r);
+	swift_context_destroy(&context, &status);
+
+	return 0;
+}
Index: /proiecte/swift/trunk/test/fibo_omp.c
===================================================================
--- /proiecte/swift/trunk/test/fibo_omp.c	(revision 176)
+++ /proiecte/swift/trunk/test/fibo_omp.c	(revision 176)
@@ -0,0 +1,57 @@
+/*
+ * swift_context.c
+ *
+ * (c) 2009 Ionut Rosoiu <ionut.rosoiu@gmail.com>
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <omp.h>
+#include "swift_compiler.h"
+
+int  sum(int r1, int r2)
+{
+    return r1 + r2;
+}
+
+int  fibo(int n)
+{
+    int x, y;
+    
+    if (n < 2) {
+        return n;
+   }
+   
+    #pragma omp task shared(x)
+    x = fibo(n - 1);
+    
+    #pragma omp task shared(y)
+    y = fibo(n - 2);
+    
+    #pragma omp taskwait
+   return x + y;
+}
+
+int main(int argc, char **argv) {
+	int n, r;
+
+	if (argc != 2) {
+		fprintf(stderr, "usage: %s N\n", argv[0]);
+		abort();
+	}
+
+	n = strtol(argv[1], NULL, 10);
+    
+    #pragma omp parallel
+    {
+        #pragma omp single
+        {
+        r = fibo(n);
+        }
+    }
+
+	fprintf(stderr, "computed result for fibo(%d)=%d\n", n, r);
+
+	return 0;
+}
Index: /proiecte/swift/trunk/test/fibo_serial.c
===================================================================
--- /proiecte/swift/trunk/test/fibo_serial.c	(revision 176)
+++ /proiecte/swift/trunk/test/fibo_serial.c	(revision 176)
@@ -0,0 +1,44 @@
+/*
+ * swift_context.c
+ *
+ * (c) 2009 Ionut Rosoiu <ionut.rosoiu@gmail.com>
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "swift_compiler.h"
+
+int NO_INLINE sum(int r1, int r2)
+{
+	return r1 + r2;
+}
+
+int NO_INLINE fibo(int n)
+{
+	if (n < 2) {
+		return n;
+	} else {
+		int r1, r2;
+
+		r1 = fibo(n-1);
+		r2 = fibo(n-2);
+		return sum(r1, r2);
+	}
+}
+
+int main(int argc, char **argv) {
+	int n, r;
+
+	if (argc != 2) {
+		fprintf(stderr, "usage: %s N\n", argv[0]);
+		abort();
+	}
+
+	n = strtol(argv[1], NULL, 10);
+	r = fibo(n);
+
+	fprintf(stderr, "computed result for fibo(%d)=%d\n", n, r);
+
+	return 0;
+}
Index: /proiecte/swift/trunk/test/fibo_stack_2spawns.c
===================================================================
--- /proiecte/swift/trunk/test/fibo_stack_2spawns.c	(revision 176)
+++ /proiecte/swift/trunk/test/fibo_stack_2spawns.c	(revision 176)
@@ -0,0 +1,200 @@
+/*
+ * swift_context.c
+ *
+ * (c) 2009 Ionut Rosoiu <ionut.rosoiu@gmail.com>
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "swift.h"
+
+int N;
+
+typedef struct fibo_data {
+	int n;
+	int *r;
+	// sync related
+	swift_size_t sync_frames_remaining;
+	char _pad[SWIFT_CACHE_LINE_SIZE - sizeof(swift_size_t)];
+} fibo_data_t;
+
+/* forward declaration for the fibo() */
+void fibo(swift_thread_t *thread, swift_frame_t *frame);
+
+
+/* void fibo(int r, shared_w int* r) */
+void fibo(swift_thread_t *thread, swift_frame_t *frame) {
+	fibo_data_t *data = frame->private_data;
+	swift_status_t status;
+	swift_size_t n;
+
+	SWIFT_LOG_FRAME_INFO_STR("\nfibo() ", thread, frame);
+
+	if (data->n < 2) {
+		*data->r = data->n;
+		data->sync_frames_remaining = 0;
+
+	} else {
+		// fibo(n-1) data
+		swift_frame_t frame1;
+		fibo_data_t data1;
+
+		// fibo(n-2) data
+		swift_frame_t frame2;
+		fibo_data_t data2;
+
+		int r1, r2;
+
+		/* spawn fibo(n-1, r1); */
+		frame1.closure = fibo;
+		frame1.flags = 0;
+#ifdef LOGGING_ON
+		frame1.creator_id = thread->id;
+		frame1.dbg = data->n - 1;
+#endif
+		data1.n = data->n - 1;
+		data1.r = &r1;
+		frame1.private_data = &data1;
+
+		SWIFT_WRITE_FRAME_INFO((&frame1), thread->id, 'f', thread->frame_no++);
+		// sync related
+		frame1.dependencies_frame = NULL;
+		frame1.sync_frames_remaining = &data->sync_frames_remaining;
+
+		/* spawn fibo(n-2, r2); */
+		frame2.closure = fibo;
+		frame2.flags = 0;
+#ifdef LOGGING_ON
+		frame2.creator_id = thread->id;
+		frame2.dbg = data->n - 2;
+#endif
+
+		data2.n = data->n - 2;
+		data2.r = &r2;
+		frame2.private_data = &data2;
+
+		SWIFT_WRITE_FRAME_INFO((&frame2), thread->id, 'f', thread->frame_no++);
+		frame2.dependencies_frame = NULL;
+		frame2.sync_frames_remaining = &data->sync_frames_remaining;
+
+		// wait for 1,2 to finish
+		data->sync_frames_remaining = 2;
+
+		// add 1 & 2 in the workque
+		swift_deque_push(&thread->workque, &frame1, &status);
+		swift_deque_push(&thread->workque, &frame2, &status);
+
+		while ((n = SWIFT_ATOMIC_READ(data->sync_frames_remaining))) {
+			SWIFT_LOG(INFO, "[%d] %s rem=%d c=%d f=%c.%d (%d)\n", thread->id, "@sync", n,
+									  SWIFT_PROC(frame->info), SWIFT_FRAME_NAME(frame->info),
+									  frame->dbg, SWIFT_FRAME_ID(frame->info));
+			swift_scheduler_execute(thread);
+		}
+
+		*data->r = r1 + r2;
+	}
+
+	SWIFT_LOG(INFO, "[%d] __fibo(%d)=%d\n", thread->id, data->n, *data->r);
+
+	if (SWIFT_FRAME_IS_END_PARALLEL(frame)) {
+		SWIFT_LOG(INFO, "[%d] END_PARALLEL!!!\n", thread->id);
+		thread->stop = 1;
+	}
+
+	swift_signal_frame_done(thread, frame);
+	swift_frame_done(thread->context, thread, frame);
+}
+
+void* thread_start(void *arg) {
+	swift_thread_t *thread = arg;
+	int i = 0;
+
+	SWIFT_LOG(INFO, "_____started thread %d\n", thread->id);
+
+	//while (i++ <= N) {
+		//swift_scheduler_execute(thread, &status);
+	//}
+
+	while(!thread->stop) {
+		swift_scheduler_execute(thread);
+	}
+
+	// inform all other threads that they must stop
+	for (i=0; i<thread->context->thread_num; i++) {
+		thread->context->threads[i].stop = 1;
+	}
+
+
+	SWIFT_LOG(INFO, "_____finished thread %d: %d frames processed\n", thread->id, thread->stats);
+	printf("_____finished thread %d: %d frames processed\n", thread->id, thread->stats);
+
+	return arg;
+}
+
+int main(int argc, char **argv) {
+	swift_context_t context;
+	swift_frame_t *frame;
+	swift_status_t status;
+	fibo_data_t *data;
+	int i, r;
+	int nthreads, n;
+
+	if (argc != 3) {
+		fprintf(stderr, "usage: %s Nthreads N\n", argv[0]);
+		abort();
+	}
+
+	nthreads = strtol(argv[1], NULL, 10);
+	n = strtol(argv[2], NULL, 10);
+	N = n;
+
+	SWIFT_LOG(INFO, "Started nthreads=%d n=%d\n", nthreads, n);
+
+	/* initialize the context */
+	swift_context_init(&context, nthreads);
+
+	/* push the first frame */
+	frame = (swift_frame_t*) swift_malloc(&context.threads[0], sizeof(swift_frame_t) + sizeof(fibo_data_t));
+	SWIFT_FRAME_SET_END_PARALLEL(frame);
+	frame->closure = fibo;
+#ifdef LOGGING_ON
+	frame->dbg = n;
+	frame->creator_id = 0;
+#endif
+
+	data = (fibo_data_t*) ((char*)frame + sizeof(swift_frame_t));
+	data->n = n;
+	data->r = &r;
+	frame->private_data = data;
+
+	SWIFT_WRITE_FRAME_INFO(frame, 0, 'f', context.threads[0].frame_no++);
+	SWIFT_LOG_FRAME_INFO((&context.threads[0]), frame);
+
+	// no wait frame
+	frame->dependencies_no = 0;
+	frame->dependencies_frame = NULL;
+	frame->sync_frames_remaining = &data->sync_frames_remaining; // doesn't matter
+
+	swift_deque_push(&context.threads[0].workque, frame, &status);
+	SWIFT_LOG(INFO, "pushed first frame\n");
+
+
+	/* start the threads */
+	for (i=0; i<nthreads; i++) {
+		swift_thread_start(&context.threads[i], thread_start);
+	}
+
+	/* wait for the threads to finish */
+	for (i=0; i<nthreads; i++) {
+		SWIFT_LOG(INFO, "_____waiting %d\n", i);
+		swift_thread_wait(&context.threads[i]);
+		SWIFT_LOG(INFO, "_____waiting %d done\n", i);
+	}
+
+	/* check the result */
+	printf("computed result for fibo(%d)=%d\n", n, r);
+	swift_context_destroy(&context);
+
+	return 0;
+}
Index: /proiecte/swift/trunk/test/qsort_common.c
===================================================================
--- /proiecte/swift/trunk/test/qsort_common.c	(revision 176)
+++ /proiecte/swift/trunk/test/qsort_common.c	(revision 176)
@@ -0,0 +1,93 @@
+/*
+ * swift_context.c
+ *
+ * (c) 2009 Ionut Rosoiu <ionut.rosoiu@gmail.com>
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+
+#define SIZE 100
+#define MAX 100
+
+void read_array(char *filename, int **a, int *n)
+{
+	FILE *f = fopen(filename, "rb");
+	int *arr, fsize, N, i;
+
+	if (f == NULL) {
+		fprintf(stderr, "Cannot open file: %s", filename);
+		abort();
+	}
+
+	*a = NULL;
+	arr = NULL;
+
+	fseek(f, 0, SEEK_END);
+	fsize = (int) ftell(f);
+	N = fsize / sizeof(int);
+	fseek(f, 0, SEEK_SET);
+
+	arr = (int *) malloc(N * sizeof(int));
+
+	if (!arr) {
+		fprintf(stderr, "Out of memory");
+		abort();
+	}
+
+	*a = arr;
+	*n = N;
+
+	for (i=0; i<N; i++) {
+		if (!fread(&arr[i], sizeof(int), 1, f)) {
+			fprintf(stderr, "Error reading item %d\n", i);
+		}
+	}
+}
+
+void write_array(char *filename, int N)
+{
+	FILE *f = fopen(filename, "wb");
+	int i, val;
+
+	if (f == NULL) {
+		fprintf(stderr, "Cannot open file: %s", filename);
+		abort();
+	}
+
+	srand(time(NULL));
+
+	for (i=0; i<N; i++) {
+		val = rand() % MAX;
+		fwrite(&val, sizeof(int), 1, f);
+	}
+
+	fclose(f);
+}
+
+void free_array(int *a)
+{
+	free(a);
+}
+
+void print_array(int *a, int n)
+{
+	int i = 0;
+	for (i=0; i<n-1; i++) {
+		printf ("%d.%d\n", i, a[i]);
+	}
+	printf("\n");
+}
+
+void check_array(int *a, int n)
+{
+	int i = 0;
+	for (i=0; i<n-1; i++) {
+		if (a[i] > a[i+1]) {
+			fprintf(stderr, "Invalid array: at pos %d, elements %d %d", i, a[i], a[i+1]);
+			abort();
+		}
+	}
+}
Index: /proiecte/swift/trunk/test/qsort_gen.c
===================================================================
--- /proiecte/swift/trunk/test/qsort_gen.c	(revision 176)
+++ /proiecte/swift/trunk/test/qsort_gen.c	(revision 176)
@@ -0,0 +1,27 @@
+/*
+ * swift_context.c
+ *
+ * (c) 2009 Ionut Rosoiu <ionut.rosoiu@gmail.com>
+ *
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+
+extern void write_array(char *filename, int N);
+
+int main(int argc, char **argv) {
+	int n;
+
+	if (argc != 3) {
+		fprintf(stderr, "usage: %s <input_file> <N>\n", argv[0]);
+		abort();
+	}
+
+	n = strtol(argv[2], NULL, 10);
+	write_array(argv[1], n);
+
+	printf("wrote file %s with %d numbers\n", argv[1], n);
+
+	return 0;
+}
Index: /proiecte/swift/trunk/test/qsort_omp_par.c
===================================================================
--- /proiecte/swift/trunk/test/qsort_omp_par.c	(revision 176)
+++ /proiecte/swift/trunk/test/qsort_omp_par.c	(revision 176)
@@ -0,0 +1,75 @@
+/*
+ * swift_context.c
+ *
+ * (c) 2009 Ionut Rosoiu <ionut.rosoiu@gmail.com>
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <omp.h>
+#include "swift_compiler.h"
+
+extern void read_array(char *filename, int **arr, int *n);
+extern void free_array(int *arr);
+extern void check_array(int *arr, int n);
+
+int partition (int *data, int p, int r)
+{
+    int x = data[p];
+    int k = p;
+    int l = r+1;
+    int t;
+
+    while (1) {
+        do k++; while ((data[k] <= x) && (k < r));
+        do l--; while (data[l] > x);
+        while (k < l) {
+            t = data[k];  data[k] = data[l];  data[l] = t;
+            do k++; while (data[k] <= x);
+            do l--; while (data[l] > x);
+        }
+        t = data[p];  data[p] = data[l];  data[l] = t;
+        return l;
+    }
+}
+
+void quicksort_omp_par (int *data, int p, int r)
+{
+    if (p < r) {
+            int q = partition (data, p, r);
+            #pragma omp parallel sections firstprivate(data, p, q, r)
+            {
+                #pragma omp section
+            	quicksort_omp_par(data, p, q-1);
+                #pragma omp section
+            	quicksort_omp_par(data, q+1, r);
+            }
+    }
+}
+
+void quicksort(int *arr, int n)
+{
+	quicksort_omp_par(arr, 0, n);
+}
+
+int main(int argc, char **argv)
+{
+	int n, *a;
+
+	if (argc != 2) {
+		fprintf(stderr, "usage: %s <input_file>\n", argv[0]);
+		abort();
+	}
+
+	read_array(argv[1], &a, &n);
+
+	quicksort(a, n);
+
+	check_array(a, n);
+
+	free_array(a);
+
+	printf("done.\n");
+	return 0;
+}
Index: /proiecte/swift/trunk/test/qsort_omp_task.c
===================================================================
--- /proiecte/swift/trunk/test/qsort_omp_task.c	(revision 176)
+++ /proiecte/swift/trunk/test/qsort_omp_task.c	(revision 176)
@@ -0,0 +1,76 @@
+/*
+ * swift_context.c
+ *
+ * (c) 2009 Ionut Rosoiu <ionut.rosoiu@gmail.com>
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <omp.h>
+#include "swift_compiler.h"
+
+extern void read_array(char *filename, int **arr, int *n);
+extern void free_array(int *arr);
+extern void check_array(int *arr, int n);
+
+int partition (int *data, int p, int r)
+{
+    int x = data[p];
+    int k = p;
+    int l = r+1;
+    int t;
+
+    while (1) {
+        do k++; while ((data[k] <= x) && (k < r));
+        do l--; while (data[l] > x);
+        while (k < l) {
+            t = data[k];  data[k] = data[l];  data[l] = t;
+            do k++; while (data[k] <= x);
+            do l--; while (data[l] > x);
+        }
+        t = data[p];  data[p] = data[l];  data[l] = t;
+        return l;
+    }
+}
+
+void quicksort_omp_par (int *data, int p, int r)
+{
+    if (p < r) {
+            int q = partition (data, p, r);
+
+            #pragma omp task
+            quicksort_omp_par(data, p, q-1);
+
+            #pragma omp task
+            quicksort_omp_par(data, q+1, r);
+
+			#pragma omp taskwait
+    }
+}
+
+void quicksort(int *arr, int n)
+{
+	quicksort_omp_par(arr, 0, n);
+}
+
+int main(int argc, char **argv)
+{
+	int n, *a;
+
+	if (argc != 2) {
+		fprintf(stderr, "usage: %s <input_file>\n", argv[0]);
+		abort();
+	}
+
+	read_array(argv[1], &a, &n);
+
+	quicksort(a, n);
+
+	check_array(a, n);
+
+	free_array(a);
+
+	printf("done.\n");
+	return 0;
+}
Index: /proiecte/swift/trunk/test/qsort_serial.c
===================================================================
--- /proiecte/swift/trunk/test/qsort_serial.c	(revision 176)
+++ /proiecte/swift/trunk/test/qsort_serial.c	(revision 176)
@@ -0,0 +1,87 @@
+/*
+ * swift_context.c
+ *
+ * (c) 2009 Ionut Rosoiu <ionut.rosoiu@gmail.com>
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "swift_compiler.h"
+
+extern void read_array(char *filename, int **arr, int *n);
+extern void free_array(int *arr);
+extern void print_array(int *arr, int n);
+extern void check_array(int *arr, int n);
+
+void swap(int *a, int *b)
+{
+	int tmp = *a;
+	*a = *b;
+	*b = tmp;
+}
+
+int partition(int *a, int l, int r)
+{
+	int pivot = a[l];
+	int i = l;
+	int j = r + 1;
+
+	while (1) {
+		do {
+			++i;
+		} while (a[i] <= pivot && i <= r);
+
+		do {
+			--j;
+		} while (a[j] > pivot);
+
+		if (i >= j) {
+			break;
+		}
+
+		swap(&a[i], &a[j]);
+	}
+
+	swap(&a[l], &a[j]);
+	return j;
+}
+
+void qs(int *a, int l, int r)
+{
+	int pivot;
+
+	if (l < r) {
+		pivot = partition(a, l, r);
+		qs(a, l, pivot-1);
+		qs(a, pivot+1, r);
+	}
+}
+
+int quicksort(int *a, int size)
+{
+	qs(a, 0, size - 1);
+	return 0;
+}
+
+int main(int argc, char **argv)
+{
+	int n, r, *a;
+
+	if (argc != 2) {
+		fprintf(stderr, "usage: %s <input_file>\n", argv[0]);
+		abort();
+	}
+
+	read_array(argv[1], &a, &n);
+	print_array(a, n);
+
+	r = quicksort(a, n);
+
+	check_array(a, n);
+
+	free_array(a);
+
+	printf("done.\n");
+	return 0;
+}
Index: /proiecte/swift/trunk/test/qsort_ws.c
===================================================================
--- /proiecte/swift/trunk/test/qsort_ws.c	(revision 176)
+++ /proiecte/swift/trunk/test/qsort_ws.c	(revision 176)
@@ -0,0 +1,269 @@
+/*
+ * swift_context.c
+ *
+ * (c) 2009 Ionut Rosoiu <ionut.rosoiu@gmail.com>
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <omp.h>
+#include "swift.h"
+
+int limit;
+
+extern void read_array(char *filename, int **arr, int *n);
+extern void free_array(int *arr);
+extern void check_array(int *arr, int n);
+
+typedef struct qs_data {
+	int *a;
+	int l;
+	int r;
+
+	char _pad1[SWIFT_CACHE_LINE_SIZE - sizeof(swift_size_t)];
+
+	swift_size_t sync_frames_remaining;
+
+	char _pad2[SWIFT_CACHE_LINE_SIZE - sizeof(swift_size_t)];
+} qs_data_t;
+
+/* forward declaration for the fibo() */
+void qs(swift_thread_t *thread, swift_frame_t *frame);
+
+
+inline
+void swap(int *a, int *b)
+{
+	int tmp = *a;
+	*a = *b;
+	*b = tmp;
+}
+
+inline
+int partition(int *a, int l, int r)
+{
+	int pivot = a[l];
+	int i = l;
+	int j = r + 1;
+
+	while (1) {
+		do {
+			++i;
+		} while (a[i] <= pivot && i <= r);
+
+		do {
+			--j;
+		} while (a[j] > pivot);
+
+		if (i >= j) {
+			break;
+		}
+
+		swap(&a[i], &a[j]);
+	}
+
+	swap(&a[l], &a[j]);
+	return j;
+}
+
+void qs_ws(swift_thread_t *thread, swift_frame_t *frame)
+{
+	qs_data_t *data = frame->private_data;
+	swift_status_t status;
+	int pivot, n;
+
+	SWIFT_LOG(INFO, "\n[%d] qs() c=%d f=%c.%d-%d (%d)\n", thread->id,
+								SWIFT_PROC(frame->info), SWIFT_FRAME_NAME(frame->info),
+								((frame->dbg >> 16) & 0xFF), (frame->dbg & 0xFF),
+								SWIFT_FRAME_ID(frame->info));
+
+	if (data->l < data->r) {
+		swift_frame_t frame1;
+		qs_data_t data1;
+
+		swift_frame_t frame2;
+		qs_data_t data2;
+
+#ifdef LOGGING_ON
+		int i;
+#endif
+
+		pivot = partition(data->a, data->l, data->r);
+
+#ifdef LOGGING_ON
+		for (i=data->l; i<=data->r; i++) {
+			if (i == pivot) {
+				fprintf(stderr, "%d<%d> ", i, data->a[i]);
+			} else {
+				fprintf(stderr, "%d(%d) ", i, data->a[i]);
+			}
+		}
+		fprintf(stderr, "\n");
+#endif
+
+		// ---------- left ---------
+		frame1.closure = qs_ws;
+		frame1.flags = 0;
+#ifdef LOGGING_ON
+		frame1.creator_id = thread->id;
+		frame1.dbg = ((data->l & 0xFF) << 16) | ((pivot - 1) & 0xFF);
+#endif
+		data1.a = data->a;
+		data1.l = data->l;
+		data1.r = pivot - 1;
+
+		frame1.private_data = &data1;
+
+		SWIFT_WRITE_FRAME_INFO((&frame1), thread->id, 'q', thread->frame_no++);
+
+		frame1.dependencies_frame = NULL;
+		frame1.sync_frames_remaining = &data->sync_frames_remaining;
+
+		// ---------- right ---------
+		frame2.closure = qs_ws;
+		frame2.flags = 0;
+#ifdef LOGGING_ON
+		frame2.creator_id = thread->id;
+		frame2.dbg = (((pivot + 1) & 0xFF) << 16) | (data->r & 0xFF);
+#endif
+		data2.a = data->a;
+		data2.l = pivot + 1;
+		data2.r = data->r;
+
+		frame2.private_data = &data2;
+
+		SWIFT_WRITE_FRAME_INFO((&frame2), thread->id, 'q', thread->frame_no++);
+
+		frame2.dependencies_frame = NULL;
+		frame2.sync_frames_remaining = &data->sync_frames_remaining;
+
+		// ------------------------
+		// wait for 1&2 to finish
+		data->sync_frames_remaining = 2;
+
+		// put it into the workqueue
+		swift_deque_push(&thread->workque, &frame1, &status);
+		swift_deque_push(&thread->workque, &frame2, &status);
+
+		// sync
+		while ((n = SWIFT_ATOMIC_READ(data->sync_frames_remaining))) {
+			SWIFT_LOG(INFO, "[%d] %s rem=%d c=%d f=%c.%d-%d (%d)\n", thread->id, "@sync", n,
+							SWIFT_PROC(frame->info), SWIFT_FRAME_NAME(frame->info),
+							((frame->dbg >> 16) & 0xFF), (frame->dbg & 0xFF),
+							SWIFT_FRAME_ID(frame->info));
+			swift_scheduler_execute(thread);
+		}
+
+		SWIFT_LOG(INFO, "[%d] __qs(%d, %d)\n", thread->id, data->l, data->r);
+
+		if (SWIFT_FRAME_IS_END_PARALLEL(frame)) {
+			SWIFT_LOG(INFO, "[%d] END_PARALLEL!!!\n", thread->id);
+			thread->stop = 1;
+		}
+	}
+
+	swift_signal_frame_done(thread, frame);
+	swift_frame_done(thread->context, thread, frame);
+}
+
+void* thread_start(void *arg) {
+	swift_thread_t *thread = arg;
+	int i = 0;
+
+	SWIFT_LOG(INFO, "_____started thread %d\n", thread->id);
+
+	while(!thread->stop) {
+		swift_scheduler_execute(thread);
+	}
+
+	// inform all other threads that they must stop
+	for (i=0; i<thread->context->thread_num; i++) {
+		thread->context->threads[i].stop = 1;
+	}
+
+
+	SWIFT_LOG(INFO, "_____finished thread %d: %d frames processed\n", thread->id, thread->stats);
+	printf("_____finished thread %d: %d frames processed\n", thread->id, thread->stats);
+
+	return arg;
+}
+
+int quicksort(int *a, int size, int nthreads)
+{
+	swift_context_t context;
+	swift_frame_t frame;
+	qs_data_t data;
+	swift_status_t status;
+	int i;
+
+	SWIFT_LOG(INFO, "Started nthreads=%d\n", nthreads);
+
+	/* initialize the context */
+	swift_context_init(&context, nthreads);
+
+	/* push the first frame */
+	SWIFT_FRAME_SET_END_PARALLEL(&frame);
+	frame.closure = qs_ws;
+#ifdef LOGGING_ON
+	frame.dbg = size & 0xFF;
+	frame.creator_id = 0;
+#endif
+
+	data.a = a;
+	data.l = 0;
+	data.r = size - 1;
+	frame.private_data = &data;
+
+	SWIFT_WRITE_FRAME_INFO((&frame), 0, 'q', context.threads[0].frame_no++);
+	SWIFT_LOG_FRAME_INFO((&context.threads[0]), (&frame));
+
+	frame.dependencies_no = 0;
+	frame.dependencies_frame = NULL;
+	frame.sync_frames_remaining = &data.sync_frames_remaining;
+
+	swift_deque_push(&context.threads[0].workque, &frame, &status);
+	SWIFT_LOG(INFO, "pushed first frame\n");
+
+
+	/* start the threads */
+	for (i=0; i<nthreads; i++) {
+		swift_thread_start(&context.threads[i], thread_start);
+	}
+
+	/* wait for the threads to finish */
+	for (i=0; i<nthreads; i++) {
+		SWIFT_LOG(INFO, "_____waiting %d\n", i);
+		swift_thread_wait(&context.threads[i]);
+		SWIFT_LOG(INFO, "_____waiting %d done\n", i);
+	}
+
+	/* check the result */
+	printf("done with the first frame.\n");
+	swift_context_destroy(&context);
+	return 0;
+}
+
+int main(int argc, char **argv)
+{
+	int n, *a, nthreads;
+
+	if (argc != 4) {
+		fprintf(stderr, "usage: %s <input_file> <nthreads> <serial_limit>\n", argv[0]);
+		abort();
+	}
+
+	read_array(argv[1], &a, &n);
+
+	nthreads = strtol(argv[2], NULL, 10);
+	limit = strtol(argv[3], NULL, 10);
+
+	quicksort(a, n, nthreads);
+
+	check_array(a, n);
+
+	free_array(a);
+
+	printf("done.\n");
+	return 0;
+}
Index: /proiecte/swift/trunk/test/test_deque.c
===================================================================
--- /proiecte/swift/trunk/test/test_deque.c	(revision 176)
+++ /proiecte/swift/trunk/test/test_deque.c	(revision 176)
@@ -0,0 +1,119 @@
+/*
+ * swift_context.c
+ *
+ * (c) 2009 Ionut Rosoiu <ionut.rosoiu@gmail.com>
+ *
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <unistd.h>
+#include "swift.h"
+
+#define NUM_THREADS 	2
+#define MAX_VAL			100
+
+swift_deque_t deque;
+int vals[MAX_VAL];
+swift_frame_t frames[MAX_VAL];
+
+void* pusher(void *arg) {
+	swift_status_t status;
+	int i, j = 0;
+
+	printf("pusher started.\n");
+	for (i=0; i<MAX_VAL; i++) {
+		do {
+			swift_deque_push(&deque, &frames[j++], &status);
+		} while (status == SWIFT_DEQUE_FULL);
+	}
+	printf("pusher finished.\n");
+
+	return arg;
+}
+
+void* popper(void *arg) {
+	swift_status_t status;
+	swift_frame_t *frame;
+	int i;
+
+	printf("popper started.\n");
+	for (i=0; i<MAX_VAL; i++) {
+		frame = swift_deque_pop(&deque, &status);
+		if (frame) {
+			vals[frame->dependencies_no] = 1;
+		}
+	}
+	printf("popper finished.\n");
+
+	return arg;
+}
+
+void* stealer(void *arg) {
+	swift_status_t status;
+	swift_thread_t *thread = arg;
+	swift_frame_t *frame;
+	int i;
+
+	printf("stealer %d started\n", thread->id);
+	for (i=0; i<MAX_VAL + 1; i++) {
+		do {
+			frame = swift_deque_steal(&deque, &status);
+		} while (status == SWIFT_DEQUE_ABORT);
+
+		if (frame) {
+			printf("[S]    pop %d (%p)\n", frame->dependencies_no, (void*)frame);
+			vals[frame->dependencies_no] = 1;
+		}
+	}
+	printf("stealer %d finished.\n", thread->id);
+
+	return arg;
+}
+
+swift_entrypoint_t funcs[4] = {
+		pusher, // must be first
+		popper,
+		stealer,
+		stealer
+};
+
+int main() {
+	swift_thread_t threads[NUM_THREADS];
+	int i;
+
+	//swift_assert(NUM_THREADS == 4);
+
+	/* initialize the deque */
+	swift_deque_init(&threads[0], &deque, MAX_VAL);
+
+	/* initialize the value vector */
+	for (i=0; i<MAX_VAL; i++) {
+		frames[i].dependencies_no = i;
+		vals[i] = 0;
+	}
+
+	/* start the threads */
+	for (i=0; i<NUM_THREADS; i++) {
+		threads[i].id = i;
+
+		swift_thread_start(&threads[i], funcs[i]);
+	}
+
+	printf("cleaning-up...\n");
+
+	/* clean-up */
+	for (i=0; i<NUM_THREADS; i++) {
+		swift_thread_wait(&threads[i]);
+		printf("thread %d done.\n", i);
+	}
+
+	for (i=0; i<MAX_VAL; i++) {
+		printf("%d ", i);
+		swift_assert(vals[i]);
+	}
+
+	swift_deque_destroy(&threads[0], &deque);
+
+	return 0;
+}
