Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

PI_Malloc.cpp

Go to the documentation of this file.
00001 #include "ace_pch.h"
00002 #ifndef ACE_PI_MALLOC_CPP
00003 #define ACE_PI_MALLOC_CPP
00004 
00005 #include "ace/PI_Malloc.h"
00006 
00007 ACE_RCSID (ace,
00008            PI_Malloc,
00009            "$Id: PI_Malloc.cpp,v 1.1.1.2.2.1 2003/03/13 19:44:22 chad Exp $")
00010 
00011 #if (ACE_HAS_POSITION_INDEPENDENT_POINTERS == 1)
00012 
00013 #include "ace/Object_Manager.h"
00014 #include "ace/Process_Mutex.h"
00015 
00016 #if !defined (__ACE_INLINE__)
00017 #include "ace/PI_Malloc.i"
00018 #endif /* __ACE_INLINE__ */
00019 
00020 #include "ace/Synch_T.h"
00021 
00022 void
00023 ACE_PI_Control_Block::ACE_Malloc_Header::dump (void) const
00024 {
00025   ACE_TRACE ("ACE_PI_Control_Block::ACE_Malloc_Header::dump");
00026 
00027   ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
00028   ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\nnext_block = %x"), (ACE_Malloc_Header *) this->next_block_));
00029   ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\nsize = %d\n"), this->size_));
00030   ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
00031 }
00032 
00033 void
00034 ACE_PI_Control_Block::print_alignment_info (void)
00035 {
00036   ACE_TRACE ("ACE_PI_Control_Block::ACE_Control_Block::print_alignment_info");
00037   ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("Start ---> ACE_PI_Control_Block::print_alignment_info:\n")));
00038   ACE_DEBUG ((LM_DEBUG,
00039               ACE_LIB_TEXT ("Sizeof ptr: %d\n")
00040               ACE_LIB_TEXT ("Sizeof size_t: %d\n")
00041               ACE_LIB_TEXT ("Sizeof long: %d\n")
00042               ACE_LIB_TEXT ("Sizeof double: %d\n")
00043               ACE_LIB_TEXT ("Sizeof ACE_MALLOC_ALIGN: %d\n")
00044               ACE_LIB_TEXT ("sizeof ACE_MALLOC_PADDING: %d\n")
00045               ACE_LIB_TEXT ("Sizeof ACE_MALLOC_HEADER_SIZE: %d\n")
00046               ACE_LIB_TEXT ("Sizeof ACE_PI_MALLOC_PADDING_SIZE: %d\n")
00047               ACE_LIB_TEXT ("Sizeof ACE_PI_CONTROL_BLOCK_SIZE: %d\n")
00048               ACE_LIB_TEXT ("Sizeof ACE_PI_CONTROL_BLOCK_ALIGN_LONGS: %d\n")
00049               ACE_LIB_TEXT ("Sizeof (MALLOC_HEADER): %d\n")
00050               ACE_LIB_TEXT ("Sizeof (CONTROL_BLOCK): %d\n"),
00051               sizeof (char *),
00052               sizeof (size_t),
00053               sizeof (long),
00054               sizeof (double),
00055               ACE_MALLOC_ALIGN,
00056               ACE_MALLOC_PADDING,
00057               ACE_MALLOC_HEADER_SIZE,
00058               ACE_PI_MALLOC_PADDING_SIZE,
00059               ACE_PI_CONTROL_BLOCK_SIZE,
00060               ACE_PI_CONTROL_BLOCK_ALIGN_LONGS,
00061               sizeof (ACE_Malloc_Header),
00062               sizeof (ACE_PI_Control_Block)
00063               ));
00064   ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("End <--- ACE_PI_Control_Block::print_alignment_info:\n")));
00065 }
00066 
00067 void
00068 ACE_PI_Control_Block::dump (void) const
00069 {
00070   ACE_TRACE ("ACE_PI_Control_Block::dump");
00071 
00072   ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
00073   ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("Name Node:\n")));
00074   for (ACE_Name_Node *nextn = this->name_head_;
00075        nextn != 0;
00076        nextn = nextn->next_)
00077     nextn->dump ();
00078 
00079   ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("freep_ = %x"), (ACE_Malloc_Header *) this->freep_));
00080   this->base_.dump ();
00081 
00082   ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\nMalloc Header:\n")));
00083   for (ACE_Malloc_Header *nexth = ((ACE_Malloc_Header *)this->freep_)->next_block_;
00084        nexth != 0 && nexth != &this->base_;
00085        nexth = nexth->next_block_)
00086     nexth->dump ();
00087 
00088   ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\n")));
00089   ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
00090 }
00091 
00092 ACE_PI_Control_Block::ACE_Name_Node::ACE_Name_Node (void)
00093 {
00094   ACE_TRACE ("ACE_PI_Control_Block::ACE_Name_Node::ACE_Name_Node");
00095 }
00096 
00097 ACE_PI_Control_Block::ACE_Name_Node::ACE_Name_Node (const char *name,
00098                                                     char *name_ptr,
00099                                                     char *pointer,
00100                                                     ACE_Name_Node *next)
00101   : name_ (name_ptr),
00102     pointer_ (pointer),
00103     next_ (next),
00104     prev_ (0)
00105 {
00106   ACE_TRACE ("ACE_PI_Control_Block::ACE_Name_Node::ACE_Name_Node");
00107   char *n = this->name_;
00108   ACE_OS::strcpy (n, name);
00109   if (next != 0)
00110     next->prev_ = this;
00111 }
00112 
00113 ACE_PI_Control_Block::ACE_Name_Node::ACE_Name_Node (const ACE_Name_Node &)
00114 {
00115   ACE_TRACE ("ACE_PI_Control_Block::ACE_Name_Node::ACE_Name_Node");
00116   ACE_ASSERT (0); // not implemented!
00117 }
00118 
00119 const char *
00120 ACE_PI_Control_Block::ACE_Name_Node::name (void) const
00121 {
00122   const char *c = this->name_;
00123   return c;
00124 }
00125 
00126 void
00127 ACE_PI_Control_Block::ACE_Name_Node::name (const char *)
00128 {
00129   ACE_ASSERT (0); // not implemented yet.
00130 }
00131 
00132 ACE_PI_Control_Block::ACE_Malloc_Header::ACE_Malloc_Header (void)
00133   : next_block_ (0),
00134     size_ (0)
00135 {
00136 }
00137 
00138 void
00139 ACE_PI_Control_Block::ACE_Name_Node::dump (void) const
00140 {
00141   ACE_TRACE ("ACE_PI_Control_Block::ACE_Name_Node::dump");
00142 
00143   ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
00144   ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT("pointer = %x"), (const char *) this->pointer_));
00145   ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT("\nnext_ = %x"), (ACE_Name_Node *) this->next_));
00146   ACE_DEBUG ((LM_DEBUG,
00147               ACE_LIB_TEXT("\nname_ = (%x, %s)"),
00148               (const char *) this->name_,
00149               (const char *) this->name_));
00150   ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT("\n")));
00151   ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
00152 }
00153 
00154 
00155 #if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
00156 template class ACE_Based_Pointer_Basic<ACE_PI_Control_Block::ACE_Malloc_Header>;
00157 template class ACE_Based_Pointer_Basic<ACE_PI_Control_Block::ACE_Name_Node>;
00158 template class ACE_Based_Pointer_Basic<char>;
00159 template class ACE_Based_Pointer<ACE_PI_Control_Block::ACE_Malloc_Header>;
00160 template class ACE_Based_Pointer<ACE_PI_Control_Block::ACE_Name_Node>;
00161 #elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
00162 #pragma instantiate ACE_Based_Pointer_Basic<ACE_PI_Control_Block::ACE_Malloc_Header>
00163 #pragma instantiate ACE_Based_Pointer_Basic<ACE_PI_Control_Block::ACE_Name_Node>
00164 #pragma instantiate ACE_Based_Pointer_Basic<char>
00165 #pragma instantiate ACE_Based_Pointer<ACE_PI_Control_Block::ACE_Malloc_Header>
00166 #pragma instantiate ACE_Based_Pointer<ACE_PI_Control_Block::ACE_Name_Node>
00167 #endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */
00168 
00169 #endif /* ACE_HAS_POSITION_INDEPENDENT_POINTERS == 1*/
00170 
00171 #endif /* ACE_PI_MALLOC_CPP */

Generated on Mon Jun 16 11:20:48 2003 for ACE by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002