summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornanbor <nanbor@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2002-03-05 21:53:47 +0000
committernanbor <nanbor@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2002-03-05 21:53:47 +0000
commit624894daf0ff8e43fc6db627e58684088170627a (patch)
treeaa3228d650476fbeb939904ccd65d7d8c6342e8e
parent683d04c17af14e77529bec6b8d433e2665855a42 (diff)
downloadATCD-624894daf0ff8e43fc6db627e58684088170627a.tar.gz
ChangeLogTag:Tue Mar 05 15:46:15 2002 Nanbor Wang <nanbor@cs.wustl.edu>
-rw-r--r--ChangeLog13
-rw-r--r--ChangeLogs/ChangeLog-02a13
-rw-r--r--ChangeLogs/ChangeLog-03a13
-rw-r--r--THANKS1
-rw-r--r--ace/Malloc_T.cpp4
-rw-r--r--ace/Memory_Pool.cpp2
-rw-r--r--ace/Memory_Pool.h19
-rw-r--r--ace/Memory_Pool.i53
8 files changed, 102 insertions, 16 deletions
diff --git a/ChangeLog b/ChangeLog
index 25b7d504ba3..20e7986d906 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+Tue Mar 05 15:46:15 2002 Nanbor Wang <nanbor@cs.wustl.edu>
+
+ * ace/Memory_Pool.h:
+ * ace/Memory_Pool.i: Added a base_addr () method for all memroy
+ pool classes. For memory pools that don't have a base_addr and
+ will never remap the pool to a different area, this method
+ always return 0.
+
+ * ace/Malloc_T.cpp: Reset this->cb_ptr_ after acquiring new memory
+ to memory_pool's base_addr (if base_addr != 0). This makes sure
+ the cb_ptr_ points to the right memory after a remap. Thanks to
+ Ariel Peltz <Arielp@bigbandnet.com> for pointing this out.
+
Tue Mar 5 12:20:26 2002 Ossama Othman <ossama@uci.edu>
* ace/INET_Addr.cpp (get_host_name_i, set):
diff --git a/ChangeLogs/ChangeLog-02a b/ChangeLogs/ChangeLog-02a
index 25b7d504ba3..20e7986d906 100644
--- a/ChangeLogs/ChangeLog-02a
+++ b/ChangeLogs/ChangeLog-02a
@@ -1,3 +1,16 @@
+Tue Mar 05 15:46:15 2002 Nanbor Wang <nanbor@cs.wustl.edu>
+
+ * ace/Memory_Pool.h:
+ * ace/Memory_Pool.i: Added a base_addr () method for all memroy
+ pool classes. For memory pools that don't have a base_addr and
+ will never remap the pool to a different area, this method
+ always return 0.
+
+ * ace/Malloc_T.cpp: Reset this->cb_ptr_ after acquiring new memory
+ to memory_pool's base_addr (if base_addr != 0). This makes sure
+ the cb_ptr_ points to the right memory after a remap. Thanks to
+ Ariel Peltz <Arielp@bigbandnet.com> for pointing this out.
+
Tue Mar 5 12:20:26 2002 Ossama Othman <ossama@uci.edu>
* ace/INET_Addr.cpp (get_host_name_i, set):
diff --git a/ChangeLogs/ChangeLog-03a b/ChangeLogs/ChangeLog-03a
index 25b7d504ba3..20e7986d906 100644
--- a/ChangeLogs/ChangeLog-03a
+++ b/ChangeLogs/ChangeLog-03a
@@ -1,3 +1,16 @@
+Tue Mar 05 15:46:15 2002 Nanbor Wang <nanbor@cs.wustl.edu>
+
+ * ace/Memory_Pool.h:
+ * ace/Memory_Pool.i: Added a base_addr () method for all memroy
+ pool classes. For memory pools that don't have a base_addr and
+ will never remap the pool to a different area, this method
+ always return 0.
+
+ * ace/Malloc_T.cpp: Reset this->cb_ptr_ after acquiring new memory
+ to memory_pool's base_addr (if base_addr != 0). This makes sure
+ the cb_ptr_ points to the right memory after a remap. Thanks to
+ Ariel Peltz <Arielp@bigbandnet.com> for pointing this out.
+
Tue Mar 5 12:20:26 2002 Ossama Othman <ossama@uci.edu>
* ace/INET_Addr.cpp (get_host_name_i, set):
diff --git a/THANKS b/THANKS
index 580f0a09af4..2a8984b8023 100644
--- a/THANKS
+++ b/THANKS
@@ -1468,6 +1468,7 @@ Yan Dai <dai_y@ociweb.com>
Sean I. Luzader <sean.i.luzader@lmco.com>
Renjie Tang <rtang@informatica.com>
Max V. Zinal <Zlat0@mail.ru>
+Ariel Peltz <Arielp@bigbandnet.com>
I would particularly like to thank Paul Stephenson, who worked with me
at Ericsson in the early 1990's. Paul devised the recursive Makefile
diff --git a/ace/Malloc_T.cpp b/ace/Malloc_T.cpp
index 3eccefe3a5c..74b97b3d4b1 100644
--- a/ace/Malloc_T.cpp
+++ b/ace/Malloc_T.cpp
@@ -394,6 +394,10 @@ ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::shared_malloc (size_t nbytes)
currp = (MALLOC_HEADER *)
this->memory_pool_.acquire (nunits * sizeof (MALLOC_HEADER),
chunk_bytes);
+ void *remap_addr = this->memory_pool_.base_addr ();
+ if (remap_addr != 0)
+ this->cb_ptr_ = (ACE_CB *) remap_addr;
+
if (currp != 0)
{
ACE_MALLOC_STATS (++this->cb_ptr_->malloc_stats_.nblocks_);
diff --git a/ace/Memory_Pool.cpp b/ace/Memory_Pool.cpp
index 1cc7cee6b3a..9ec2fe66821 100644
--- a/ace/Memory_Pool.cpp
+++ b/ace/Memory_Pool.cpp
@@ -459,7 +459,7 @@ ACE_MMAP_Memory_Pool_Options::ACE_MMAP_Memory_Pool_Options (const void *base_add
// for backwards compatability
if (base_addr_ == 0 && use_fixed_addr_ == ALWAYS_FIXED)
use_fixed_addr_ = FIRSTCALL_FIXED;
-
+
// HP-UX 11, 64-bit bug workaround.
#if defined (__hpux) && defined (__LP64__)
long temp = ACE_DEFAULT_BASE_ADDRL;
diff --git a/ace/Memory_Pool.h b/ace/Memory_Pool.h
index 3a824cf6f12..de4cc2759a9 100644
--- a/ace/Memory_Pool.h
+++ b/ace/Memory_Pool.h
@@ -97,6 +97,10 @@ public:
/// Dump the state of an object.
virtual void dump (void) const;
+ /// Return the base address of this memory pool, 0 if base_addr
+ /// never changes.
+ virtual void *base_addr (void) const;
+
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
@@ -202,6 +206,10 @@ public:
/// starting at <addr> up to <len> bytes.
virtual int protect (void *addr, size_t len, int prot = PROT_RDWR);
+ /// Return the base address of this memory pool, 0 if base_addr
+ /// never changes.
+ virtual void *base_addr (void) const;
+
/// Dump the state of an object.
virtual void dump (void) const;
@@ -356,6 +364,10 @@ public:
*/
virtual int remap (void *addr);
+ /// Return the base address of this memory pool, 0 if base_addr
+ /// never changes.
+ virtual void *base_addr (void) const;
+
/// Dump the state of an object.
virtual void dump (void) const;
@@ -383,7 +395,7 @@ protected:
class ACE_Export ACE_MMAP_Memory_Pool_Options
{
public:
- enum
+ enum
{
FIRSTCALL_FIXED = 0,
ALWAYS_FIXED = 1,
@@ -693,6 +705,11 @@ public:
int sync (void *, size_t, int = MS_SYNC);
int protect (ssize_t = -1, int = PROT_RDWR);
int protect (void *, size_t, int = PROT_RDWR);
+
+ /// Return the base address of this memory pool, 0 if base_addr
+ /// never changes.
+ virtual void *base_addr (void) const;
+
void dump (void) const {}
protected:
diff --git a/ace/Memory_Pool.i b/ace/Memory_Pool.i
index ccb540242ce..8a642391b71 100644
--- a/ace/Memory_Pool.i
+++ b/ace/Memory_Pool.i
@@ -36,6 +36,12 @@ ACE_Local_Memory_Pool::protect (void *, size_t, int)
return 0;
}
+ACE_INLINE void *
+ACE_Local_Memory_Pool::base_addr (void) const
+{
+ return 0;
+}
+
ACE_INLINE
ACE_MMAP_Memory_Pool::~ACE_MMAP_Memory_Pool (void)
{
@@ -131,6 +137,13 @@ ACE_Shared_Memory_Pool::protect (void *, size_t, int)
ACE_TRACE ("ACE_Shared_Memory_Pool::protect");
return 0;
}
+
+ACE_INLINE void *
+ACE_Shared_Memory_Pool::base_addr (void) const
+{
+ ACE_TRACE ("ACE_Shared_Memory_Pool::base_addr");
+ return this->base_addr_;
+}
#endif /* !ACE_LACKS_SYSV_SHMEM */
#if !defined (ACE_LACKS_SBRK)
@@ -140,6 +153,12 @@ ACE_Sbrk_Memory_Pool::~ACE_Sbrk_Memory_Pool (void)
{
}
+ACE_INLINE void *
+ACE_Sbrk_Memory_Pool::base_addr (void) const
+{
+ return 0;
+}
+
// Ask system for initial chunk of local memory.
ACE_INLINE void *
@@ -219,26 +238,32 @@ ACE_Pagefile_Memory_Pool::round_to_page_size (size_t nbytes)
}
ACE_INLINE int
-ACE_Pagefile_Memory_Pool::sync (ssize_t, int)
-{
- return 0;
+ACE_Pagefile_Memory_Pool::sync (ssize_t, int)
+{
+ return 0;
}
-ACE_INLINE int
+ACE_INLINE int
ACE_Pagefile_Memory_Pool::sync (void *, size_t, int)
-{
- return 0;
+{
+ return 0;
}
-ACE_INLINE int
-ACE_Pagefile_Memory_Pool::protect (ssize_t, int)
-{
- return 0;
+ACE_INLINE int
+ACE_Pagefile_Memory_Pool::protect (ssize_t, int)
+{
+ return 0;
}
-ACE_INLINE int
-ACE_Pagefile_Memory_Pool::protect (void *, size_t, int)
-{
- return 0;
+ACE_INLINE int
+ACE_Pagefile_Memory_Pool::protect (void *, size_t, int)
+{
+ return 0;
+}
+
+ACE_INLINE void *
+ACE_Pagefile_Memory_Pool::base_addr (void) const
+{
+ return 0;
}
#endif /* ACE_WIN32 */