summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorschmidt <douglascraigschmidt@users.noreply.github.com>1999-07-08 06:21:24 +0000
committerschmidt <douglascraigschmidt@users.noreply.github.com>1999-07-08 06:21:24 +0000
commit902949f767e3510138644fda8ba93d2b1ab6f7a8 (patch)
tree42eeffdbd4af0c3045f0e0f03e964fad27af62c8
parente986ec75fc0edc25ee124df915d50e7c1013f060 (diff)
downloadATCD-902949f767e3510138644fda8ba93d2b1ab6f7a8.tar.gz
ChangeLogTag:Thu Jul 8 00:23:02 1999 Douglas C. Schmidt <schmidt@tango.cs.wustl.edu>
-rw-r--r--ace/Based_Pointer_Repository.cpp48
-rw-r--r--ace/Based_Pointer_Repository.h28
-rw-r--r--ace/Based_Pointer_T.cpp53
-rw-r--r--ace/Based_Pointer_T.h48
-rw-r--r--ace/Based_Pointer_T.i86
-rw-r--r--ace/Malloc.cpp20
-rw-r--r--ace/Malloc.h85
-rw-r--r--ace/Malloc_T.cpp133
-rw-r--r--ace/Memory_Pool.cpp5
-rw-r--r--ace/SString.h3
-rw-r--r--ace/SString.i5
-rw-r--r--ace/config-aix-4.x.h1
-rw-r--r--ace/config-lynxos.h1
-rw-r--r--ace/config-psos-diab-mips.h1
-rw-r--r--ace/config-psos-diab-ppc.h1
-rw-r--r--ace/config-psos-diab.h1
-rw-r--r--ace/config-psos-tm.h1
-rw-r--r--ace/config-psosim-g++.h1
-rw-r--r--ace/config-sunos5.5.h3
-rw-r--r--ace/config-win32-borland.h17
-rw-r--r--ace/config-win32.h17
21 files changed, 386 insertions, 172 deletions
diff --git a/ace/Based_Pointer_Repository.cpp b/ace/Based_Pointer_Repository.cpp
index cf2f54d61f4..f6fdd1b099d 100644
--- a/ace/Based_Pointer_Repository.cpp
+++ b/ace/Based_Pointer_Repository.cpp
@@ -1,14 +1,41 @@
// $Id$
#define ACE_BUILD_DLL
-#include "ace/Based_Pointer_Repository.h"
+#include "ace/Map_Manager.h"
+#include "ace/Based_Pointer_Repository.h"
+
+// Useful typedefs.
+typedef ACE_Map_Manager <void *, size_t *, ACE_Null_Mutex> MAP_MANAGER;
+typedef ACE_Map_Iterator < void *, size_t *, ACE_Null_Mutex> MAP_ITERATOR;
+typedef ACE_Map_Entry <void *, size_t *> MAP_ENTRY;
+
+class ACE_Based_Pointer_Repository_Rep
+{
+ // = TITLE
+ // Implementation for the <ACE_Based_Pointer_Repository>.
+ //
+ // = DESCRIPTION
+ // Every memory pool in ACE binds it's mapping base address and
+ // the mapped size to this repository every time it maps/remaps a
+ // new chunk of memory successfully.
+public:
+ MAP_MANAGER addr_map_;
+ // Keeps track of the mapping between addresses and their associated
+ // values.
+
+ ACE_SYNCH_MUTEX lock_;
+ // Synchronize concurrent access to the map.
+};
ACE_Based_Pointer_Repository::ACE_Based_Pointer_Repository (void)
{
+ ACE_NEW (this->rep_,
+ ACE_Based_Pointer_Repository_Rep);
}
ACE_Based_Pointer_Repository::~ACE_Based_Pointer_Repository (void)
{
+ delete this->rep_;
}
// Search for appropriate base address in repository
@@ -17,8 +44,8 @@ int
ACE_Based_Pointer_Repository::find (void *addr,
void *&base_addr)
{
- ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, mon, this->lock_, -1);
- MAP_ITERATOR iter = addr_map_;
+ ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, mon, this->rep_->lock_, -1);
+ MAP_ITERATOR iter = this->rep_->addr_map_;
for (MAP_ENTRY *ce = 0;
iter.next (ce) != 0;
@@ -41,13 +68,14 @@ ACE_Based_Pointer_Repository::find (void *addr,
// existing entry.
int
-ACE_Based_Pointer_Repository::bind (void *addr, size_t size)
+ACE_Based_Pointer_Repository::bind (void *addr,
+ size_t size)
{
- ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, mon, this->lock_, -1);
+ ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, mon, this->rep_->lock_, -1);
size_t *sizep;
- if (addr_map_.find (addr, sizep) != -1)
+ if (this->rep_->addr_map_.find (addr, sizep) != -1)
{
// Store new size.
*sizep = size;
@@ -59,7 +87,7 @@ ACE_Based_Pointer_Repository::bind (void *addr, size_t size)
size_t,
-1);
*sizep = size;
- return addr_map_.bind (addr, sizep);
+ return this->rep_->addr_map_.bind (addr, sizep);
}
}
@@ -68,8 +96,8 @@ ACE_Based_Pointer_Repository::bind (void *addr, size_t size)
int
ACE_Based_Pointer_Repository::unbind (void *addr)
{
- ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, mon, this->lock_, -1);
- MAP_ITERATOR iter = addr_map_;
+ ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, mon, this->rep_->lock_, -1);
+ MAP_ITERATOR iter = this->rep_->addr_map_;
// Search for service handlers that requested notification.
@@ -83,7 +111,7 @@ ACE_Based_Pointer_Repository::unbind (void *addr)
delete ce->int_id_;
// Unbind base address.
- return addr_map_.unbind (ce->ext_id_);
+ return this->rep_->addr_map_.unbind (ce->ext_id_);
}
return 0;
diff --git a/ace/Based_Pointer_Repository.h b/ace/Based_Pointer_Repository.h
index b3180c008b9..f4f88c1f1d3 100644
--- a/ace/Based_Pointer_Repository.h
+++ b/ace/Based_Pointer_Repository.h
@@ -18,27 +18,16 @@
#ifndef ACE_BASED_POINTER_REPOSITORY_H
#define ACE_BASED_POINTER_REPOSITORY_H
-#include "ace/Singleton.h"
-#include "ace/Map_Manager.h"
+// Forward decl., using the "Cheshire Cat" technique.
+class ACE_Based_Pointer_Repository_Rep;
-class ACE_Export ACE_Based_Pointer_Repository
+class ACE_Export ACE_Based_Pointer_Repository
{
// = TITLE
// Maps pointers to the base address of the region to which each
// pointer belongs.
- //
- // = DESCRIPTION
- // Every memory pool in ACE binds it's mapping base address and
- // the mapped size to this repository every time it maps/remaps a
- // new chunk of memory successfully.
public:
// = Use <ACE_Null_Mutex> to allow locking while iterating.
- typedef ACE_Map_Manager <void *, size_t *, ACE_Null_Mutex>
- MAP_MANAGER;
- typedef ACE_Map_Iterator < void *, size_t *, ACE_Null_Mutex>
- MAP_ITERATOR;
- typedef ACE_Map_Entry <void *, size_t *>
- MAP_ENTRY;
// = Initialization and termination methods.
ACE_Based_Pointer_Repository (void);
@@ -61,14 +50,13 @@ public:
// contained within.
private:
- MAP_MANAGER addr_map_;
- // Keeps track of the mapping between addresses and their associated
- // values.
-
- ACE_SYNCH_MUTEX lock_;
- // Synchronize concurrent access to the map.
+ ACE_Based_Pointer_Repository_Rep *rep_;
+ // Use the "Cheshire-Cat" technique to hide the implementation in
+ // order to avoid circular #include dependencies.
};
+#include "ace/Singleton.h"
+
// Provide a Singleton access point to the based pointer repository.
typedef ACE_Singleton<ACE_Based_Pointer_Repository, ACE_SYNCH_RW_MUTEX>
ACE_BASED_POINTER_REPOSITORY;
diff --git a/ace/Based_Pointer_T.cpp b/ace/Based_Pointer_T.cpp
index 6a01f656f8c..5c993b8855f 100644
--- a/ace/Based_Pointer_T.cpp
+++ b/ace/Based_Pointer_T.cpp
@@ -3,8 +3,22 @@
#ifndef ACE_BASED_POINTER_T_CPP
#define ACE_BASED_POINTER_T_CPP
-#include "ace/Based_Pointer_Repository.h"
+#define ACE_BUILD_DLL
#include "ace/Based_Pointer_T.h"
+#include "ace/Based_Pointer_Repository.h"
+
+#if !defined (__ACE_INLINE__)
+#include "ace/Based_Pointer_T.i"
+#endif /* __ACE_INLINE__ */
+
+template <class CONCRETE> ACE_Based_Pointer<CONCRETE>
+operator+ (const ACE_Based_Pointer<CONCRETE> &lhs, long increment)
+{
+ // Perform pointer arithmetic.
+ CONCRETE *ptr = ((CONCRETE *) ACE_COMPUTE_BASED_POINTER (&lhs)) + increment;
+ ACE_Based_Pointer<CONCRETE> tmp (ptr);
+ return tmp;
+}
template <class CONCRETE>
ACE_Based_Pointer<CONCRETE>::ACE_Based_Pointer (void)
@@ -21,34 +35,19 @@ ACE_Based_Pointer<CONCRETE>::ACE_Based_Pointer (void)
this->base_offset_ = (char *) this - (char *) base_addr;
}
-template <class CONCRETE> CONCRETE *
-ACE_Based_Pointer<CONCRETE>::operator->(void)
-{
- char *base_addr = (char *) this - this->base_offset_;
-
- return (CONCRETE *)(base_addr + (long) this->target_);
-}
-
-template <class CONCRETE> CONCRETE *
-ACE_Based_Pointer<CONCRETE>::operator =(CONCRETE *from)
-{
- char *base_addr = (char *) this - this->base_offset_;
- this->target_ = (CONCRETE *)((char *) from - (char *) base_addr);
- return from;
-}
-
-template <class CONCRETE> CONCRETE
-ACE_Based_Pointer<CONCRETE>::operator *(void)
+template <class CONCRETE>
+ACE_Based_Pointer<CONCRETE>::ACE_Based_Pointer (CONCRETE *addr)
+ : target_ (0),
+ base_offset_ (0)
{
- char *base_addr = (char *) this - this->base_offset_;
- return *(CONCRETE *)(base_addr + (long) this->target_);
-}
+ void *base_addr = 0;
-template <class CONCRETE> CONCRETE
-ACE_Based_Pointer<CONCRETE>::operator [] (int index)
-{
- char *base_addr = (char *) this - this->base_offset_;
- return *((CONCRETE *)(base_addr + (long) this->target_) + index);
+ // Find the base address associated with the <addr> pointer. Note
+ // that it's ok for <find> to return 0, which simply indicates that
+ // the address is not in memory-mapped virtual address space.
+ ACE_BASED_POINTER_REPOSITORY::instance ()->find (addr,
+ base_addr);
+ this->base_offset_ = (char *) addr - (char *) base_addr;
}
#endif/* ACE_BASED_POINTER_T_CPP */
diff --git a/ace/Based_Pointer_T.h b/ace/Based_Pointer_T.h
index 31f4547776b..0003bce08e8 100644
--- a/ace/Based_Pointer_T.h
+++ b/ace/Based_Pointer_T.h
@@ -58,25 +58,67 @@ public:
// based-pointer uses its address as an offset to it's base
// address 0.
+ ACE_Based_Pointer (CONCRETE *initial);
+ // Initialize this object with the <initial> pointer.
+
+ ACE_Based_Pointer (const ACE_Based_Pointer<CONCRETE> &rhs);
+ // Copy constructor.
+
CONCRETE *operator->(void);
// The C++ "delegation operator".
CONCRETE *operator =(CONCRETE *from);
// Pseudo-assignment operator.
- CONCRETE operator *(void);
+ CONCRETE operator *(void) const;
// Dereference operator.
- CONCRETE operator [](int index);
+ int operator < (const ACE_Based_Pointer<CONCRETE> &) const;
+ // Less than operator.
+
+ int operator <= (const ACE_Based_Pointer<CONCRETE> &) const;
+ // Less than or equal operator.
+
+ int operator > (const ACE_Based_Pointer<CONCRETE> &) const;
+ // Greater than operator.
+
+ int operator >= (const ACE_Based_Pointer<CONCRETE> &) const;
+ // Greater than or equal operator.
+
+ int operator == (const ACE_Based_Pointer<CONCRETE> &) const;
+ // Equality operator.
+
+ int operator != (const ACE_Based_Pointer<CONCRETE> &) const;
+ // Inequality operator.
+
+ CONCRETE operator [](long index) const;
// Subscript operator.
-private:
+ void operator+= (long index);
+ // Increment operator.
+
+ operator void *() const;
+ // Returns the underlying memory address of the smart pointer.
+
+ // The following should be private, but that causes problems due to
+ // broken C++ compilers that don't like friends for methods
+ // in templates.
+// private:
CONCRETE *target_;
long base_offset_;
// Keep track of our offset from the base pointer.
};
+ACE_Export template <class CONCRETE>
+ACE_Based_Pointer<CONCRETE> operator+ (const ACE_Based_Pointer<CONCRETE> &lhs,
+ long increment);
+// Emulate "pointer arithmetic" by adding <increment> to <lhs>.
+
+#if defined (__ACE_INLINE__)
+#include "ace/Based_Pointer_T.i"
+#endif /* __ACE_INLINE__ */
+
#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
#include "ace/Based_Pointer_T.cpp"
#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
diff --git a/ace/Based_Pointer_T.i b/ace/Based_Pointer_T.i
new file mode 100644
index 00000000000..cb0a3ae5fea
--- /dev/null
+++ b/ace/Based_Pointer_T.i
@@ -0,0 +1,86 @@
+/* -*- C++ -*- */
+// $Id$
+
+#define ACE_COMPUTE_BASED_POINTER(P) (((char *) (P) - (P)->base_offset_) + (long) (P)->target_)
+
+template <class CONCRETE> ACE_INLINE
+ACE_Based_Pointer<CONCRETE>::ACE_Based_Pointer (const ACE_Based_Pointer<CONCRETE> &lhs)
+ : target_ (lhs.target_),
+ base_offset_ (lhs.base_offset_)
+{
+}
+
+template <class CONCRETE> ACE_INLINE CONCRETE *
+ACE_Based_Pointer<CONCRETE>::operator->(void)
+{
+ return (CONCRETE *)(ACE_COMPUTE_BASED_POINTER (this));
+}
+
+template <class CONCRETE> ACE_INLINE CONCRETE *
+ACE_Based_Pointer<CONCRETE>::operator =(CONCRETE *from)
+{
+ this->target_ = (CONCRETE *)((char *) from
+ - ((char *) this - this->base_offset_));
+ return from;
+}
+
+template <class CONCRETE> ACE_INLINE CONCRETE
+ACE_Based_Pointer<CONCRETE>::operator *(void) const
+{
+ return *(CONCRETE *)(ACE_COMPUTE_BASED_POINTER (this));
+}
+
+template <class CONCRETE> ACE_INLINE
+ACE_Based_Pointer<CONCRETE>::operator void *() const
+{
+ return ACE_reinterpret_cast (void *,
+ ACE_COMPUTE_BASED_POINTER (this));
+}
+
+template <class CONCRETE> ACE_INLINE CONCRETE
+ACE_Based_Pointer<CONCRETE>::operator [] (long index) const
+{
+ return *((CONCRETE *)(ACE_COMPUTE_BASED_POINTER (this)) + index);
+}
+
+template <class CONCRETE> ACE_INLINE void
+ACE_Based_Pointer<CONCRETE>::operator += (long index)
+{
+ this->base_offset_ += (index * sizeof (CONCRETE));
+}
+
+template <class CONCRETE> ACE_INLINE int
+ACE_Based_Pointer<CONCRETE>::operator == (const ACE_Based_Pointer<CONCRETE> &rhs) const
+{
+ return ACE_COMPUTE_BASED_POINTER (this) == ACE_COMPUTE_BASED_POINTER (&rhs);
+}
+
+template <class CONCRETE> ACE_INLINE int
+ACE_Based_Pointer<CONCRETE>::operator != (const ACE_Based_Pointer<CONCRETE> &rhs) const
+{
+ return !(*this == rhs);
+}
+
+template <class CONCRETE> ACE_INLINE int
+ACE_Based_Pointer<CONCRETE>::operator < (const ACE_Based_Pointer<CONCRETE> &rhs) const
+{
+ return ACE_COMPUTE_BASED_POINTER (this) < ACE_COMPUTE_BASED_POINTER (&rhs);
+}
+
+template <class CONCRETE> ACE_INLINE int
+ACE_Based_Pointer<CONCRETE>::operator <= (const ACE_Based_Pointer<CONCRETE> &rhs) const
+{
+ return ACE_COMPUTE_BASED_POINTER (this) <= ACE_COMPUTE_BASED_POINTER (&rhs);
+}
+
+template <class CONCRETE> ACE_INLINE int
+ACE_Based_Pointer<CONCRETE>::operator > (const ACE_Based_Pointer<CONCRETE> &rhs) const
+{
+ return ACE_COMPUTE_BASED_POINTER (this) > ACE_COMPUTE_BASED_POINTER (&rhs);
+}
+
+template <class CONCRETE> ACE_INLINE int
+ACE_Based_Pointer<CONCRETE>::operator >= (const ACE_Based_Pointer<CONCRETE> &rhs) const
+{
+ return ACE_COMPUTE_BASED_POINTER (this) >= ACE_COMPUTE_BASED_POINTER (&rhs);
+}
diff --git a/ace/Malloc.cpp b/ace/Malloc.cpp
index 21111301edc..beab22c6844 100644
--- a/ace/Malloc.cpp
+++ b/ace/Malloc.cpp
@@ -1,7 +1,7 @@
// $Id$
-#if !defined (ACE_MALLOC_C)
-#define ACE_MALLOC_C
+#if !defined (ACE_MALLOC_CPP)
+#define ACE_MALLOC_CPP
#define ACE_BUILD_DLL
#include "ace/Malloc.h"
@@ -30,7 +30,7 @@ ACE_Control_Block::dump (void) const
ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
this->name_head_->dump ();
- ACE_DEBUG ((LM_DEBUG, ASYS_TEXT("freep_ = %x"), this->freep_));
+ ACE_DEBUG ((LM_DEBUG, ASYS_TEXT("freep_ = %x"), (void *) this->freep_));
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
}
@@ -208,6 +208,16 @@ template class ACE_Atomic_Op<ACE_PROCESS_MUTEX, int>;
#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
#pragma instantiate ACE_Atomic_Op<ACE_PROCESS_MUTEX, int>
#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */
-
#endif /* ACE_HAS_MALLOC_STATS */
-#endif /* ACE_MALLOC_C */
+
+#if defined (ACE_HAS_POSITION_INDEPENDENT_MALLOC)
+#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
+template class ACE_Based_Pointer<ACE_Malloc_Header>;
+template ACE_Based_Pointer<ACE_Malloc_Header> operator+ (const ACE_Based_Pointer<ACE_Malloc_Header> &lhs, long increment);
+#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
+#pragma instantiate ACE_Based_Pointer<ACE_Malloc_Header>
+#pragma ACE_Based_Pointer<ACE_Malloc_Header> operator+ (const ACE_Based_Pointer<ACE_Malloc_Header> &lhs, long increment);
+#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */
+#endif /* ACE_HAS_POSITION_INDEPENDENT_MALLOC */
+
+#endif /* ACE_MALLOC_CPP */
diff --git a/ace/Malloc.h b/ace/Malloc.h
index bcbc452aecf..d7d6d135ce0 100644
--- a/ace/Malloc.h
+++ b/ace/Malloc.h
@@ -25,6 +25,10 @@
#include "ace/Malloc_Base.h"
+#if defined (ACE_HAS_POSITION_INDEPENDENT_MALLOC)
+#include "ace/Based_Pointer_T.h"
+#endif /* ACE_HAS_POSITION_INDEPENDENT_MALLOC */
+
#if defined (ACE_HAS_MALLOC_STATS)
#include "ace/Synch_T.h"
#if defined (ACE_HAS_THREADS)
@@ -34,10 +38,6 @@
#define ACE_PROCESS_MUTEX ACE_SV_Semaphore_Simple
#endif /* ACE_HAS_THREADS */
-#if defined (ACE_HAS_POSITION_INDEPENDENT_MALLOC)
-#include "ace/Based_Pointer_T.h"
-#endif /* ACE_HAS_POSITION_INDEPENDENT_MALLOC */
-
typedef ACE_Atomic_Op<ACE_PROCESS_MUTEX, int> ACE_INT;
struct ACE_Export ACE_Malloc_Stats
@@ -61,50 +61,58 @@ struct ACE_Export ACE_Malloc_Stats
#define AMS(X)
#endif /* ACE_HAS_MALLOC_STATS */
-#if !defined (ACE_MALLOC_ALIGN)
-// ACE_MALLOC_ALIGN allows you to insure that allocated regions are at
-// least <ACE_MALLOC_ALIGN> bytes long. It is especially useful when
-// you want areas to be at least a page long, or 32K long, or
+#if !defined (ACE_MALLOC_PADDING)
+// ACE_MALLOC_PADDING allows you to insure that allocated regions are
+// at least <ACE_MALLOC_PADDING> bytes long. It is especially useful
+// when you want areas to be at least a page long, or 32K long, or
// something like that. It doesn't guarantee alignment to an address
// multiple, like 8-byte data alignment, etc. The allocated area's
// padding to your selected size is done with an added array of long[]
// and your compiler will decide how to align things in memory.
//
-// The default ACE_MALLOC_ALIGN is 'long', which will probably add a
-// long of padding - it doesn't have any real affect. If you want to
-// use this feature, define ACE_MALLOC_ALIGN in your config.h file and
-// use a signed integer number of bytes you want. For example:
-// #define ACE_MALLOC_ALIGN ((int)4096)
+// If you want to use this feature, define ACE_MALLOC_PADDING in your
+// config.h file and use a signed integer number of bytes you want, e.g.:
+//
+// #define ACE_MALLOC_PADDING ((int) 4096)
-#define ACE_MALLOC_ALIGN ((int)(sizeof (long)))
+#define ACE_MALLOC_PADDING 1
+#endif /* ACE_MALLOC_PADDING */
+
+// The following is only for backwards compatibility.
+#if defined (ACE_MALLOC_ALIGN)
+#undef ACE_MALLOC_PADDING
+#define ACE_MALLOC_PADDING ACE_MALLOC_ALIGN
#endif /* ACE_MALLOC_ALIGN */
-union ACE_Export ACE_Malloc_Header
+class ACE_Export ACE_Malloc_Header
{
// = TITLE
- // We use a union to force alignment to the most restrictive type.
+ // This is the control block header. It's used by <ACE_Malloc>
+ // to keep track of each chunk of data when it's in the free
+ // list or in use.
+
+public:
+#if defined (ACE_HAS_POSITION_INDEPENDENT_MALLOC)
+ typedef ACE_Based_Pointer<ACE_Malloc_Header> HEADER_PTR;
+#else
+ typedef ACE_Malloc_Header *HEADER_PTR;
+#endif /* ACE_HAS_POSITION_INDEPENDENT_MALLOC */
class ACE_Malloc_Control_Block
{
- // = TITLE
- // This is the control block header. It's used by <ACE_Malloc>
- // to keep track of each chunk of data when it's in the free
- // list or in use.
public:
-#if defined (ACE_HAS_POSITION_INDEPENDENT_MALLOC)
- ACE_Based_Pointer<ACE_Malloc_Header> next_block_;
+ HEADER_PTR next_block_;
// Points to next block if on free list.
-#else
- ACE_Malloc_Header *next_block_;
- // Points to next block if on free list.
-#endif /* ACE_HAS_POSITION_INDEPENDENT_MALLOC */
size_t size_;
// Size of this block.
} s_;
- long align_[ACE_MALLOC_ALIGN/sizeof (long)];
- // Force alignment.
+#if (ACE_MALLOC_PADDING > 1)
+#define ACE_MALLOC_PADDING_SIZE ((ACE_MALLOC_PADDING - \
+ (sizeof (ACE_Malloc_Control_Block)) / sizeof (long)))
+ long padding_[ACE_MALLOC_PADDING_SIZE < 1 : ACE_MALLOC_PADDING_SIZE];
+#endif /* ACE_MALLOC_PADDING > 0 */
};
class ACE_Export ACE_Name_Node
@@ -137,13 +145,13 @@ class ACE_Export ACE_Control_Block
// This information is stored in memory allocated by the MEMORY_POOL.
//
// = DESCRIPTION
- // This class should be local to class ACE_Malloc, but cfront and
- // G++ don't like nested classes in templates...
+ // This class should be local to class ACE_Malloc, but some older
+ // C++ compilers don't like nested classes in templates...
public:
ACE_Name_Node *name_head_;
// Head of the linked list of Name Nodes.
- ACE_Malloc_Header *freep_;
+ ACE_Malloc_Header::HEADER_PTR freep_;
// Current head of the freelist.
char lock_name_[MAXNAMELEN];
@@ -157,18 +165,19 @@ public:
+ MAXNAMELEN \
+ sizeof (ACE_Malloc_Stats)))
#else
-#define ACE_CONTROL_BLOCK_SIZE ((int)(sizeof(ACE_Name_Node *) \
+#define ACE_CONTROL_BLOCK_SIZE ((int)(sizeof (ACE_Name_Node *) \
+ sizeof (ACE_Malloc_Header *) \
+ MAXNAMELEN))
#endif /* ACE_HAS_MALLOC_STATS */
// Notice the casting to int for sizeof() otherwise unsigned int
// arithmetic is used and some awful things may happen.
-#define ACE_CONTROL_BLOCK_ALIGN_LONGS ((ACE_CONTROL_BLOCK_SIZE % ACE_MALLOC_ALIGN != 0 \
- ? ACE_MALLOC_ALIGN - (ACE_CONTROL_BLOCK_SIZE) \
- : ACE_MALLOC_ALIGN) / int(sizeof(long)))
+#define ACE_CONTROL_BLOCK_ALIGN_LONGS ((ACE_CONTROL_BLOCK_SIZE % ACE_MALLOC_PADDING != 0 \
+ ? ACE_MALLOC_PADDING - (ACE_CONTROL_BLOCK_SIZE) \
+ : ACE_MALLOC_PADDING) / int (sizeof (long)))
long align_[ACE_CONTROL_BLOCK_ALIGN_LONGS < 1 ? 1 : ACE_CONTROL_BLOCK_ALIGN_LONGS];
+ // Force alignment.
ACE_Malloc_Header base_;
// Dummy node used to anchor the freelist.
@@ -188,9 +197,9 @@ class ACE_Export ACE_New_Allocator : public ACE_Allocator
// up memory. Please note that the only methods that are
// supported are malloc and free. All other methods are no-ops.
// If you require this functionality, please use:
- // ACE_Allocator_Adapter <ACE_Malloc <ACE_LOCAL_MEMORY_POOL, MUTEX>>
- // This will allow you to use the added functionality of
- // bind/find/etc. while using the new/delete operators.
+ // ACE_Allocator_Adapter <ACE_Malloc <ACE_LOCAL_MEMORY_POOL,
+ // MUTEX> > This will allow you to use the added functionality
+ // of bind/find/etc. while using the new/delete operators.
public:
virtual void *malloc (size_t nbytes);
virtual void *calloc (size_t nbytes, char initial_value = '\0');
diff --git a/ace/Malloc_T.cpp b/ace/Malloc_T.cpp
index 50818cf70a9..2d2fcc17ad8 100644
--- a/ace/Malloc_T.cpp
+++ b/ace/Malloc_T.cpp
@@ -22,19 +22,26 @@ ACE_Cached_Allocator<T, ACE_LOCK>::ACE_Cached_Allocator (size_t n_chunks)
: pool_ (0),
free_list_ (ACE_PURE_FREE_LIST)
{
- this->pool_ = (T*) new char[n_chunks * sizeof (T)];
- // ERRNO could be lost because this is within ctor
-
- for (size_t c = 0 ; c < n_chunks ; c++)
+ char *tmp = 0;
+
+ ACE_NEW (tmp,
+ char[n_chunks * sizeof (T)]);
+ this->pool_ = ACE_reinterpret_cast (T *,
+ tmp);
+
+ for (size_t c = 0;
+ c < n_chunks;
+ c++)
this->free_list_.add (new (&this->pool_ [c]) ACE_Cached_Mem_Pool_Node<T>);
// Put into free list using placement contructor, no real memory
- // allocation in the above new.
+ // allocation in the above <new>.
}
template <class T, class ACE_LOCK>
ACE_Cached_Allocator<T, ACE_LOCK>::~ACE_Cached_Allocator (void)
{
- char* tmp = (char *) this->pool_;
+ char *tmp = ACE_reinterpret_cast (char *,
+ this->pool_);
delete [] tmp;
}
@@ -79,7 +86,8 @@ ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK>::dump (void) const
ACE_DEBUG ((LM_DEBUG, ASYS_TEXT ("cb_ptr_ = %x"), this->cb_ptr_));
ACE_DEBUG ((LM_DEBUG, ASYS_TEXT ("\n")));
#if defined (ACE_HAS_MALLOC_STATS)
- this->cb_ptr_->malloc_stats_.dump ();
+ if (this->cb_ptr_ != 0)
+ this->cb_ptr_->malloc_stats_.dump ();
#endif /* ACE_HAS_MALLOC_STATS */
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
}
@@ -92,10 +100,13 @@ ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK>::print_stats (void) const
ACE_TRACE ("ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK>::print_stats");
ACE_GUARD (ACE_LOCK, ace_mon, this->lock_);
+ if (this->cb_ptr_ == 0)
+ return;
this->cb_ptr_->malloc_stats_.dump ();
- ACE_DEBUG ((LM_DEBUG, ASYS_TEXT (" (%P|%t) contents of freelist:\n")));
+ ACE_DEBUG ((LM_DEBUG,
+ ASYS_TEXT (" (%P|%t) contents of freelist:\n")));
- for (ACE_Malloc_Header *currp = this->cb_ptr_->freep_->s_.next_block_;
+ for (ACE_Malloc_Header::HEADER_PTR currp = this->cb_ptr_->freep_->s_.next_block_;
;
currp = currp->s_.next_block_)
{
@@ -109,15 +120,15 @@ ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK>::print_stats (void) const
}
#endif /* ACE_HAS_MALLOC_STATS */
-// Put block AP in the free list (locked version).
+// Put <ptr> in the free list (locked version).
template<ACE_MEM_POOL_1, class ACE_LOCK> void
-ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK>::free (void *ap)
+ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK>::free (void *ptr)
{
ACE_TRACE ("ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK>::free");
ACE_GUARD (ACE_LOCK, ace_mon, this->lock_);
- this->shared_free (ap);
+ this->shared_free (ptr);
}
// This function is called by the ACE_Malloc constructor to initialize
@@ -171,14 +182,14 @@ ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK>::open (void)
// If we've got any extra space at the end of the control
// block, then skip past the dummy ACE_Malloc_Header to
// point at the first free block.
- ACE_Malloc_Header *p = this->cb_ptr_->freep_ + 1;
+ ACE_Malloc_Header::HEADER_PTR p (this->cb_ptr_->freep_ + 1);
- // Why aC++ in 64-bit mode can't grok this, I have no idea... but
- // it ends up with an extra bit set which makes size_ really big
- // without this hack.
+ // Why aC++ in 64-bit mode can't grok this, I have no
+ // idea... but it ends up with an extra bit set which makes
+ // size_ really big without this hack.
#if defined (__hpux) && defined (__LP64__)
size_t hpux11_hack = (rounded_bytes - sizeof *this->cb_ptr_)
- / sizeof(ACE_Malloc_Header);
+ / sizeof (ACE_Malloc_Header);
p->s_.size_ = hpux11_hack;
#else
p->s_.size_ = (rounded_bytes - sizeof *this->cb_ptr_)
@@ -189,9 +200,12 @@ ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK>::open (void)
AMS (++this->cb_ptr_->malloc_stats_.nblocks_);
AMS (++this->cb_ptr_->malloc_stats_.ninuse_);
+ // Skip over the ACE_Malloc_Header when returning pointer.
+ ACE_Malloc_Header::HEADER_PTR tmp (p + 1);
// Insert the newly allocated chunk of memory into the free
- // list.
- this->shared_free ((void *) (p + 1));
+ // list. Note that this triggers operator void *() if we're
+ // using the ACE_POSITION_INDEPENDENT_MALLOC configuration.
+ this->shared_free ((void *) tmp);
}
}
return 0;
@@ -285,14 +299,15 @@ ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK>::shared_malloc (size_t nbytes)
(nbytes + sizeof (ACE_Malloc_Header) - 1) / sizeof (ACE_Malloc_Header)
+ 1; // Add one for the <ACE_Malloc_Header> itself.
- // Begin the search starting at the place in the freelist
- // where the last block was found.
- ACE_Malloc_Header *prevp = this->cb_ptr_->freep_;
- ACE_Malloc_Header *currp = prevp->s_.next_block_;
+ // Begin the search starting at the place in the freelist where the
+ // last block was found.
+ ACE_Malloc_Header::HEADER_PTR prevp = this->cb_ptr_->freep_;
+ ACE_Malloc_Header::HEADER_PTR currp = prevp->s_.next_block_;
// Search the freelist to locate a block of the appropriate size.
- for (int i = 0; ; i++, prevp = currp, currp = currp->s_.next_block_)
+ for (int i = 0;
+ ; i++, prevp = currp, currp = currp->s_.next_block_)
{
if (currp->s_.size_ >= nunits) // Big enough
{
@@ -310,8 +325,13 @@ ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK>::shared_malloc (size_t nbytes)
currp->s_.size_ = nunits;
}
this->cb_ptr_->freep_ = prevp;
+
// Skip over the ACE_Malloc_Header when returning pointer.
- return (void *) (currp + 1);
+ ACE_Malloc_Header::HEADER_PTR tmp (currp + 1);
+ // Insert the newly allocated chunk of memory into the free
+ // list. Note that this triggers operator void *() if we're
+ // using the ACE_POSITION_INDEPENDENT_MALLOC configuration.
+ return (void *) tmp;
}
else if (currp == this->cb_ptr_->freep_)
{
@@ -332,8 +352,12 @@ ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK>::shared_malloc (size_t nbytes)
// Compute the chunk size in ACE_Malloc_Header units.
currp->s_.size_ = chunk_bytes / sizeof (ACE_Malloc_Header);
- // Insert the new chunk into the freelist.
- this->shared_free ((void *) (currp + 1));
+ // Skip over the ACE_Malloc_Header when returning pointer.
+ ACE_Malloc_Header::HEADER_PTR tmp (currp + 1);
+ // Insert the newly allocated chunk of memory into the free
+ // list. Note that this triggers operator void *() if we're
+ // using the ACE_POSITION_INDEPENDENT_MALLOC configuration.
+ this->shared_free ((void *) tmp);
currp = this->cb_ptr_->freep_;
}
else
@@ -360,7 +384,7 @@ ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK>::malloc (size_t nbytes)
template <ACE_MEM_POOL_1, class ACE_LOCK> void *
ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK>::calloc (size_t nbytes,
- char initial_value)
+ char initial_value)
{
ACE_TRACE ("ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK>::calloc");
void *ptr = this->malloc (nbytes);
@@ -378,19 +402,17 @@ ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK>::shared_free (void *ap)
{
ACE_TRACE ("ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK>::shared_free");
- if (ap == 0)
+ if (ap == 0 || this->cb_ptr_ == 0)
return;
- ACE_Malloc_Header *blockp; // Points to the block ACE_Malloc_Header.
- ACE_Malloc_Header *currp;
-
// Adjust AP to point to the block ACE_Malloc_Header
- blockp = (ACE_Malloc_Header *) ap - 1;
+ ACE_Malloc_Header::HEADER_PTR blockp ((ACE_Malloc_Header *) ap - 1);
+ ACE_Malloc_Header::HEADER_PTR currp = this->cb_ptr_->freep_;
// Search until we find the location where the blocks belongs. Note
// that addresses are kept in sorted order.
- for (currp = this->cb_ptr_->freep_;
+ for (;
blockp <= currp || blockp >= currp->s_.next_block_;
currp = currp->s_.next_block_)
{
@@ -430,10 +452,14 @@ ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK>::shared_find (const char *name)
{
ACE_TRACE ("ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK>::shared_find");
+ if (this->cb_ptr_ == 0)
+ return 0;
+
for (ACE_Name_Node *node = this->cb_ptr_->name_head_;
node != 0;
node = node->next_)
- if (ACE_OS::strcmp (node->name_, name) == 0)
+ if (ACE_OS::strcmp (node->name_,
+ name) == 0)
return node;
return 0;
@@ -441,22 +467,26 @@ ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK>::shared_find (const char *name)
template <ACE_MEM_POOL_1, class ACE_LOCK> int
ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK>::shared_bind (const char *name,
- void *pointer)
+ void *pointer)
{
+ if (this->cb_ptr_ == 0)
+ return -1;
+
// Combine the two allocations into one to avoid overhead...
- ACE_Name_Node *new_node = (ACE_Name_Node *)
- this->shared_malloc (sizeof (ACE_Name_Node) + ACE_OS::strlen (name) + 1);
+ ACE_Name_Node *new_node;
- if (new_node == 0)
- return -1;
+ ACE_ALLOCATOR_RETURN (new_node,
+ (ACE_Name_Node *)
+ this->shared_malloc (sizeof (ACE_Name_Node) + ACE_OS::strlen (name) + 1),
+ -1);
- // This is a sleezy trick ;-)
+ // This is a clever trick ;-)
new_node->name_ = (char *) (new_node + 1);
// Insert new node at the head of the list. Note that (new_node) is
- // *not* a cast!
+ // *not* a cast, it's operator placement new.
ACE_NEW_RETURN (this->cb_ptr_->name_head_,
- (new_node) ACE_Name_Node (name, pointer,
+ (new_node) ACE_Name_Node (name, pointer,
this->cb_ptr_->name_head_),
-1);
return 0;
@@ -531,14 +561,16 @@ template <ACE_MEM_POOL_1, class ACE_LOCK> ssize_t
ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK>::avail_chunks (size_t size) const
{
ACE_TRACE ("ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK>::avail_chunks");
-
ACE_READ_GUARD_RETURN (ACE_LOCK, ace_mon, (ACE_LOCK &) this->lock_, -1);
+ if (this->cb_ptr_ == 0)
+ return -1;
+
size_t count = 0;
// Avoid dividing by 0...
size = size == 0 ? 1 : size;
- for (ACE_Malloc_Header *currp = this->cb_ptr_->freep_->s_.next_block_;
+ for (ACE_Malloc_Header::HEADER_PTR currp = this->cb_ptr_->freep_->s_.next_block_;
currp != this->cb_ptr_->freep_;
currp = currp->s_.next_block_)
// calculate how many will fit in this block.
@@ -552,8 +584,8 @@ template <ACE_MEM_POOL_1, class ACE_LOCK> int
ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK>::find (const char *name)
{
ACE_TRACE ("ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK>::find");
-
ACE_READ_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1);
+
return this->shared_find (name) == 0 ? -1 : 0;
}
@@ -561,8 +593,11 @@ template <ACE_MEM_POOL_1, class ACE_LOCK> int
ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK>::unbind (const char *name, void *&pointer)
{
ACE_TRACE ("ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK>::unbind");
-
ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1);
+
+ if (this->cb_ptr_ == 0)
+ return -1;
+
ACE_Name_Node *prev = 0;
for (ACE_Name_Node *curr = this->cb_ptr_->name_head_;
@@ -579,7 +614,7 @@ ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK>::unbind (const char *name, void *&pointer)
prev->next_ = curr->next_;
// This will free up both the node and the name due to our
- // sleezy trick in bind ()!
+ // clever trick in <bind>!
this->shared_free (curr);
return 0;
}
@@ -614,7 +649,7 @@ ACE_Malloc_Iterator<ACE_MEM_POOL_2, ACE_LOCK>::dump (void) const
template <ACE_MEM_POOL_1, class ACE_LOCK>
ACE_Malloc_Iterator<ACE_MEM_POOL_2, ACE_LOCK>::ACE_Malloc_Iterator (ACE_Malloc<ACE_MEM_POOL_2, ACE_LOCK> &malloc,
- const char *name)
+ const char *name)
: malloc_ (malloc),
curr_ (0),
guard_ (malloc_.lock_),
diff --git a/ace/Memory_Pool.cpp b/ace/Memory_Pool.cpp
index 1d07027de11..785c52b50d8 100644
--- a/ace/Memory_Pool.cpp
+++ b/ace/Memory_Pool.cpp
@@ -80,8 +80,7 @@ ACE_MMAP_Memory_Pool::release (void)
ACE_TRACE ("ACE_MMAP_Memory_Pool::release");
#if defined (ACE_HAS_POSITION_INDEPENDENT_MALLOC)
- ACE_POSITION_INDEPENDENT_REPOSITORY::instance ()->unbind (this->mmap_.addr (),
- this->mmap_.size ());
+ ACE_BASED_POINTER_REPOSITORY::instance ()->unbind (this->mmap_.addr ());
#endif /* ACE_HAS_POSITION_INDEPENDENT_MALLOC */
this->mmap_.remove ();
@@ -265,7 +264,7 @@ ACE_MMAP_Memory_Pool::map_file (off_t map_size)
else
{
#if defined (ACE_HAS_POSITION_INDEPENDENT_MALLOC)
- ACE_POSITION_INDEPENDENT_REPOSITORY::instance ()->bind (this->base_addr_,
+ ACE_BASED_POINTER_REPOSITORY::instance ()->bind (this->base_addr_,
map_size);
#endif /* ACE_HAS_POSITION_INDEPENDENT_MALLOC */
return 0;
diff --git a/ace/SString.h b/ace/SString.h
index dd8e7778ebc..63f8a949d3c 100644
--- a/ace/SString.h
+++ b/ace/SString.h
@@ -348,7 +348,8 @@ private:
// Pointer to data.
};
-ACE_Export ACE_INLINE ACE_WString operator + (const ACE_WString &, const ACE_WString &);
+ACE_Export ACE_INLINE ACE_WString operator+ (const ACE_WString &,
+ const ACE_WString &);
#if !defined (ACE_LACKS_IOSTREAM_TOTALLY)
ACE_Export ostream &operator << (ostream &, const ACE_WString &);
#endif /* ! ACE_LACKS_IOSTREAM_TOTALLY */
diff --git a/ace/SString.i b/ace/SString.i
index 44526a9fdc8..0b886f7d8a2 100644
--- a/ace/SString.i
+++ b/ace/SString.i
@@ -313,7 +313,8 @@ ACE_CString::hash (void) const
}
ACE_INLINE ACE_WString
-operator+ (const ACE_WString &s, const ACE_WString &t)
+operator+ (const ACE_WString &s,
+ const ACE_WString &t)
{
ACE_WString temp (s);
temp += t;
@@ -685,8 +686,6 @@ ACE_WString::hash (void) const
return ACE::hash_pjw (this->rep_);
}
-// ****************************************************************
-
ACE_INLINE
ACE_Auto_String_Free::ACE_Auto_String_Free (char* p)
: p_ (p)
diff --git a/ace/config-aix-4.x.h b/ace/config-aix-4.x.h
index c3b42d8a7eb..1c3bd127710 100644
--- a/ace/config-aix-4.x.h
+++ b/ace/config-aix-4.x.h
@@ -38,7 +38,6 @@
// Denotes that GNU has cstring.h as standard, to redefine memchr().
# define ACE_HAS_GNU_CSTRING_H
# define ACE_HAS_SSIZE_T
-# define ACE_MALLOC_ALIGN 8
# if !defined (ACE_MT_SAFE) || ACE_MT_SAFE != 0
// ACE_MT_SAFE is #defined below, for all compilers.
diff --git a/ace/config-lynxos.h b/ace/config-lynxos.h
index 6fd9462d8a3..5665994c5d5 100644
--- a/ace/config-lynxos.h
+++ b/ace/config-lynxos.h
@@ -84,7 +84,6 @@
#define ACE_LACKS_STRCASECMP
#define ACE_LACKS_TIMESPEC_T
#define ACE_LACKS_UCONTEXT_H
-#define ACE_MALLOC_ALIGN 8
// LynxOS, through 3.0.0, does not support MAP_PRIVATE, so map it to
// MAP_SHARED.
#define ACE_MAP_PRIVATE ACE_MAP_SHARED
diff --git a/ace/config-psos-diab-mips.h b/ace/config-psos-diab-mips.h
index 77aa346c9b7..f73da5be558 100644
--- a/ace/config-psos-diab-mips.h
+++ b/ace/config-psos-diab-mips.h
@@ -213,7 +213,6 @@
#define ACE_LACKS_UNIX_SIGNALS
-// #define ACE_MALLOC_ALIGN 8
// #define ACE_LACKS_SYSTIME_H
#define ACE_PAGE_SIZE 4096
diff --git a/ace/config-psos-diab-ppc.h b/ace/config-psos-diab-ppc.h
index 8bc6f9cf027..f37d033132f 100644
--- a/ace/config-psos-diab-ppc.h
+++ b/ace/config-psos-diab-ppc.h
@@ -211,7 +211,6 @@
#define ACE_LACKS_UNIX_SIGNALS
-// #define ACE_MALLOC_ALIGN 8
// #define ACE_LACKS_SYSTIME_H
#define ACE_PAGE_SIZE 4096
diff --git a/ace/config-psos-diab.h b/ace/config-psos-diab.h
index 5e9c62c163b..792ef8ad395 100644
--- a/ace/config-psos-diab.h
+++ b/ace/config-psos-diab.h
@@ -204,7 +204,6 @@
#define ACE_LACKS_UNIX_SIGNALS
-// #define ACE_MALLOC_ALIGN 8
// #define ACE_LACKS_SYSTIME_H
#define ACE_PAGE_SIZE 4096
diff --git a/ace/config-psos-tm.h b/ace/config-psos-tm.h
index c84025bfb64..ecf773da28f 100644
--- a/ace/config-psos-tm.h
+++ b/ace/config-psos-tm.h
@@ -174,7 +174,6 @@
#define ACE_LACKS_UNIX_SIGNALS
-// #define ACE_MALLOC_ALIGN 8
// #define ACE_LACKS_SYSTIME_H
#define ACE_PAGE_SIZE 4096
diff --git a/ace/config-psosim-g++.h b/ace/config-psosim-g++.h
index 3b8efeb0016..02e6b975e31 100644
--- a/ace/config-psosim-g++.h
+++ b/ace/config-psosim-g++.h
@@ -214,7 +214,6 @@
#define ACE_LACKS_UTSNAME_T
-// #define ACE_MALLOC_ALIGN 8
// #define ACE_LACKS_SYSTIME_H
#define ACE_PAGE_SIZE 4096
diff --git a/ace/config-sunos5.5.h b/ace/config-sunos5.5.h
index 1c5766e8a39..0487c26fd6c 100644
--- a/ace/config-sunos5.5.h
+++ b/ace/config-sunos5.5.h
@@ -79,7 +79,6 @@
// Denotes that GNU has cstring.h as standard, to redefine memchr().
# define ACE_HAS_GNU_CSTRING_H
# define ACE_HAS_XPG4_MULTIBYTE_CHAR
-# define ACE_MALLOC_ALIGN 8
# if !defined (ACE_MT_SAFE) || ACE_MT_SAFE != 0
// ACE_MT_SAFE is #defined below, for all compilers.
@@ -308,6 +307,8 @@
#define ACE_HAS_STL_QUEUE_CONFLICT
#define ACE_HAS_IDTYPE_T
+ // #define ACE_HAS_POSITION_INDEPENDENT_MALLOC
+
#define ACE_HAS_GPERF
#define ACE_HAS_DIRENT
#define ACE_HAS_MEMCHR
diff --git a/ace/config-win32-borland.h b/ace/config-win32-borland.h
index cfd8881314f..e4ab0c8daea 100644
--- a/ace/config-win32-borland.h
+++ b/ace/config-win32-borland.h
@@ -8,7 +8,12 @@
#ifndef ACE_WIN32_BORLAND_H
#define ACE_WIN32_BORLAND_H
-# if defined(__BORLANDC__)
+# if defined (__BORLANDC__)
+
+# define ACE_CC_NAME "Borland C++ Builder"
+# define ACE_CC_MAJOR_VERSION (__BORLANDC__ / 0x100)
+# define ACE_CC_MINOR_VERSION (__BORLANDC__ % 0x100)
+# define ACE_CC_BETA_VERSION (0)
# if defined (ACE_LACKS_MODE_MASKS)
# undef ACE_LACKS_MODE_MASKS
@@ -20,10 +25,12 @@
# endif /* defined (ACE_HAS_USER_MODE_MASKS) */
# define ACE_HAS_USER_MODE_MASKS 1
-# if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
-# undef ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION
-# endif /* defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) */
-# define ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION 1
+# if (__BORLANDC__ < 0x540)
+# if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
+# undef ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION
+# endif /* defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) */
+# define ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION 1
+# endif /* (__BORLANDC__ < 0x540) */
# if defined (ACE_EXPORT_NESTED_CLASSES)
# undef ACE_EXPORT_NESTED_CLASSES
diff --git a/ace/config-win32.h b/ace/config-win32.h
index 0de6d18f546..955d42a2061 100644
--- a/ace/config-win32.h
+++ b/ace/config-win32.h
@@ -50,6 +50,23 @@
// relies on the standard c++ library.
// Runtime restrictions: You must be using MSVC 4.2 or above and your
// application must link with the standard libraries.
+
+#if defined (_MSC_VER)
+
+# define ACE_CC_NAME "Visual C++"
+
+#if (_MSC_VER >= 1200)
+# define ACE_CC_MAJOR_VERSION 6
+#elif (_MSC_VER >= 1100)
+# define ACE_CC_MAJOR_VERSION 5
+#elif (_MSC_VER >= 1000)
+# define ACE_CC_MAJOR_VERSION 4
+#endif /* _MSC_VER >= 1200 */
+
+# define ACE_CC_MINOR_VERSION (_MSC_VER % 100)
+# define ACE_CC_BETA_VERSION (0)
+#endif /* _MSC_VER */
+
#if defined (_MSC_VER) && (_MSC_VER >= 1020)
#if !defined (ACE_HAS_STANDARD_CPP_LIBRARY)
#define ACE_HAS_STANDARD_CPP_LIBRARY 0