Changes to attempt to silence bcc64x
[ACE_TAO.git] / ACE / ace / PI_Malloc.cpp
blob10373d36131c2eb467c213bae8ee320a830e59dd
1 #ifndef ACE_PI_MALLOC_CPP
2 #define ACE_PI_MALLOC_CPP
4 #include "ace/PI_Malloc.h"
6 #if (ACE_HAS_POSITION_INDEPENDENT_POINTERS == 1)
8 #if !defined (__ACE_INLINE__)
9 #include "ace/PI_Malloc.inl"
10 #endif /* __ACE_INLINE__ */
12 #include "ace/Object_Manager.h"
13 #include "ace/Process_Mutex.h"
14 #include "ace/OS_NS_string.h"
16 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
18 void
19 ACE_PI_Control_Block::ACE_Malloc_Header::dump () const
21 #if defined (ACE_HAS_DUMP)
22 ACE_TRACE ("ACE_PI_Control_Block::ACE_Malloc_Header::dump");
24 ACELIB_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
25 ACELIB_DEBUG ((LM_DEBUG, ACE_TEXT ("\nnext_block = %x"), (ACE_Malloc_Header *) this->next_block_));
26 ACELIB_DEBUG ((LM_DEBUG, ACE_TEXT ("\nsize = %d\n"), this->size_));
27 ACELIB_DEBUG ((LM_DEBUG, ACE_END_DUMP));
28 #endif /* ACE_HAS_DUMP */
31 void
32 ACE_PI_Control_Block::print_alignment_info ()
34 #if defined (ACE_HAS_DUMP)
35 ACE_TRACE ("ACE_PI_Control_Block::ACE_Control_Block::print_alignment_info");
36 ACELIB_DEBUG ((LM_DEBUG, ACE_TEXT ("Start ---> ACE_PI_Control_Block::print_alignment_info:\n")));
37 ACELIB_DEBUG ((LM_DEBUG,
38 ACE_TEXT ("Sizeof ptr: %d\n")
39 ACE_TEXT ("Sizeof size_t: %d\n")
40 ACE_TEXT ("Sizeof long: %d\n")
41 ACE_TEXT ("Sizeof double: %d\n")
42 ACE_TEXT ("Sizeof ACE_MALLOC_ALIGN: %d\n")
43 ACE_TEXT ("sizeof ACE_MALLOC_PADDING: %d\n")
44 ACE_TEXT ("Sizeof ACE_MALLOC_HEADER_SIZE: %d\n")
45 ACE_TEXT ("Sizeof ACE_PI_MALLOC_PADDING_SIZE: %d\n")
46 ACE_TEXT ("Sizeof ACE_PI_CONTROL_BLOCK_SIZE: %d\n")
47 ACE_TEXT ("Sizeof ACE_PI_CONTROL_BLOCK_ALIGN_BYTES: %d\n")
48 ACE_TEXT ("Sizeof (MALLOC_HEADER): %d\n")
49 ACE_TEXT ("Sizeof (CONTROL_BLOCK): %d\n"),
50 sizeof (char *),
51 sizeof (size_t),
52 sizeof (long),
53 sizeof (double),
54 ACE_MALLOC_ALIGN,
55 ACE_MALLOC_PADDING,
56 ACE_MALLOC_HEADER_SIZE,
57 ACE_PI_MALLOC_PADDING_SIZE,
58 ACE_PI_CONTROL_BLOCK_SIZE,
59 ACE_PI_CONTROL_BLOCK_ALIGN_BYTES,
60 sizeof (ACE_Malloc_Header),
61 sizeof (ACE_PI_Control_Block)
62 ));
63 ACELIB_DEBUG ((LM_DEBUG, ACE_TEXT ("End <--- ACE_PI_Control_Block::print_alignment_info:\n")));
64 #endif /* ACE_HAS_DUMP */
67 void
68 ACE_PI_Control_Block::dump () const
70 #if defined (ACE_HAS_DUMP)
71 ACE_TRACE ("ACE_PI_Control_Block::dump");
73 ACELIB_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
74 ACELIB_DEBUG ((LM_DEBUG, ACE_TEXT ("Name Node:\n")));
75 for (ACE_Name_Node *nextn = this->name_head_;
76 nextn != 0;
77 nextn = nextn->next_)
78 nextn->dump ();
80 ACELIB_DEBUG ((LM_DEBUG, ACE_TEXT ("freep_ = %x"), (ACE_Malloc_Header *) this->freep_));
81 this->base_.dump ();
83 ACELIB_DEBUG ((LM_DEBUG, ACE_TEXT ("\nMalloc Header:\n")));
84 for (ACE_Malloc_Header *nexth = ((ACE_Malloc_Header *)this->freep_)->next_block_;
85 nexth != 0 && nexth != &this->base_;
86 nexth = nexth->next_block_)
87 nexth->dump ();
89 ACELIB_DEBUG ((LM_DEBUG, ACE_TEXT ("\n")));
90 ACELIB_DEBUG ((LM_DEBUG, ACE_END_DUMP));
91 #endif /* ACE_HAS_DUMP */
94 ACE_PI_Control_Block::ACE_Name_Node::ACE_Name_Node ()
96 ACE_TRACE ("ACE_PI_Control_Block::ACE_Name_Node::ACE_Name_Node");
99 ACE_PI_Control_Block::ACE_Name_Node::ACE_Name_Node (const char *name,
100 char *name_ptr,
101 char *pointer,
102 ACE_Name_Node *next)
103 : name_ (name_ptr),
104 pointer_ (pointer),
105 next_ (next),
106 prev_ (0)
108 ACE_TRACE ("ACE_PI_Control_Block::ACE_Name_Node::ACE_Name_Node");
109 char *n = this->name_;
110 ACE_OS::strcpy (n, name);
111 if (next != 0)
112 next->prev_ = this;
115 ACE_PI_Control_Block::ACE_Name_Node::ACE_Name_Node (const ACE_Name_Node &)
117 ACE_TRACE ("ACE_PI_Control_Block::ACE_Name_Node::ACE_Name_Node");
118 ACE_ASSERT (0); // not implemented!
121 const char *
122 ACE_PI_Control_Block::ACE_Name_Node::name () const
124 return this->name_;
127 void
128 ACE_PI_Control_Block::ACE_Name_Node::name (const char *)
130 ACE_ASSERT (0); // not implemented yet.
133 ACE_PI_Control_Block::ACE_Malloc_Header::ACE_Malloc_Header ()
134 : next_block_ (0),
135 size_ (0)
139 void
140 ACE_PI_Control_Block::ACE_Name_Node::dump () const
142 #if defined (ACE_HAS_DUMP)
143 ACE_TRACE ("ACE_PI_Control_Block::ACE_Name_Node::dump");
145 ACELIB_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
146 ACELIB_DEBUG ((LM_DEBUG, ACE_TEXT("pointer = %x"), (const char *) this->pointer_));
147 ACELIB_DEBUG ((LM_DEBUG, ACE_TEXT("\nnext_ = %x"), (ACE_Name_Node *) this->next_));
148 ACELIB_DEBUG ((LM_DEBUG,
149 ACE_TEXT("\nname_ = (%x, %s)"),
150 (const char *) this->name_,
151 (const char *) this->name_));
152 ACELIB_DEBUG ((LM_DEBUG, ACE_TEXT("\n")));
153 ACELIB_DEBUG ((LM_DEBUG, ACE_END_DUMP));
154 #endif /* ACE_HAS_DUMP */
157 ACE_END_VERSIONED_NAMESPACE_DECL
159 #endif /* ACE_HAS_POSITION_INDEPENDENT_POINTERS == 1*/
161 #endif /* ACE_PI_MALLOC_CPP */