diff options
author | coryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1998-08-08 03:11:08 +0000 |
---|---|---|
committer | coryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1998-08-08 03:11:08 +0000 |
commit | 5bb71ce4bfd4ec788b34a1e465b5fb10ec7e90b3 (patch) | |
tree | 35985dabecb288b528a95873d3fa3679bd07dd9a | |
parent | c11ce37933a18f6f233b0c12b0674910832544f4 (diff) | |
download | ATCD-5bb71ce4bfd4ec788b34a1e465b5fb10ec7e90b3.tar.gz |
ChangeLogTag:Fri Aug 7 21:39:26 1998 Carlos O'Ryan <coryan@cs.wustl.edu>
-rw-r--r-- | ChangeLog-98b | 19 | ||||
-rw-r--r-- | TAO/ChangeLog-98c | 46 | ||||
-rw-r--r-- | TAO/docs/releasenotes/TODO.html | 122 | ||||
-rw-r--r-- | TAO/docs/releasenotes/index.html | 4 | ||||
-rwxr-xr-x | TAO/orbsvcs/tests/EC_Throughput/run_test.pl | 7 | ||||
-rw-r--r-- | TAO/tao/CDR.cpp | 109 | ||||
-rw-r--r-- | TAO/tao/CDR.h | 14 | ||||
-rw-r--r-- | TAO/tao/CDR.i | 21 | ||||
-rw-r--r-- | TAO/tao/Connect.cpp | 10 | ||||
-rw-r--r-- | TAO/tao/IIOP_Object.cpp | 22 | ||||
-rw-r--r-- | TAO/tao/Invocation.cpp | 29 | ||||
-rw-r--r-- | TAO/tao/Invocation.h | 17 | ||||
-rw-r--r-- | TAO/tao/Invocation.i | 15 | ||||
-rw-r--r-- | TAO/tao/ORB_Core.cpp | 8 | ||||
-rw-r--r-- | TAO/tao/ORB_Core.h | 19 | ||||
-rw-r--r-- | TAO/tao/ORB_Core.i | 13 | ||||
-rw-r--r-- | TAO/tests/Cubit/TAO/IDL_Cubit/Makefile | 2 | ||||
-rw-r--r-- | TAO/tests/Cubit/TAO/IDL_Cubit/client_i.cpp | 21 | ||||
-rw-r--r-- | TAO/tests/Cubit/TAO/IDL_Cubit/cubit_i.cpp | 4 | ||||
-rw-r--r-- | ace/INET_Addr.cpp | 5 | ||||
-rw-r--r-- | ace/Message_Block.cpp | 144 | ||||
-rw-r--r-- | ace/Message_Block.h | 27 | ||||
-rw-r--r-- | ace/Message_Block.i | 13 | ||||
-rw-r--r-- | apps/gperf/Makefile | 5 | ||||
-rwxr-xr-x | bin/auto_compile | 7 |
25 files changed, 574 insertions, 129 deletions
diff --git a/ChangeLog-98b b/ChangeLog-98b index 0312e75d323..54007e4d403 100644 --- a/ChangeLog-98b +++ b/ChangeLog-98b @@ -1,3 +1,22 @@ +Fri Aug 7 21:39:26 1998 Carlos O'Ryan <coryan@cs.wustl.edu> + + * ace/INET_Addr.cpp: + Compare the fields of in_addr instead of calling memcmp. + + * ace/Message_Block.cpp: + * ace/Message_Block.h: + * ace/Message_Block.i: + The Message_Block can receive an allocator for the data block, + so instead of creating them on the heap they can be allocated + from a TSS allocator or other memory pool. By default we use + ACE_New_Allocator. + + * apps/gperf/Makefile: + The Id was wrong. + + * bin/auto_compile: + Added gperf to the default list of directories. + Fri Aug 7 13:58:58 1998 Gonzalo Diethelm <gonzo@tango.cs.wustl.edu> * bin/envinfo.cpp: diff --git a/TAO/ChangeLog-98c b/TAO/ChangeLog-98c index 8ee6b96ae7e..cf22bc0a7b8 100644 --- a/TAO/ChangeLog-98c +++ b/TAO/ChangeLog-98c @@ -1,3 +1,49 @@ +Fri Aug 7 21:39:26 1998 Carlos O'Ryan <coryan@cs.wustl.edu> + + * docs/releasenotes/TODO.html: + Update the notes. + + * docs/releasenotes/index.html: + Added a pointer to the TODO list. + + * orbsvcs/tests/EC_Throughput/run_test.pl: + We need to wait for the NamingService and the EventService after + killing them. We also need a pause after starting up the + consumer. + + * tao/CDR.cpp: + * tao/CDR.h: + * tao/CDR.i: + The OutputCDR class receives allocators for the buffers and the + data blocks. + + * tao/Connect.cpp: + Minimize the number of calls to TAO_ORB_Core_instance() in the + upcall. + + * tao/IIOP_Object.cpp: + Use the ORB_Core allocators for the outgoing CDR stream. + + * tao/Invocation.cpp: + * tao/Invocation.h: + * tao/Invocation.i: + Receive the ORB_Core as an argument to minimize calls to + TAO_ORB_Core_instance. + Use allocators for the outgoing stream. + + * tao/ORB_Core.cpp: + * tao/ORB_Core.h: + * tao/ORB_Core.i: + Added TSS allocators for the outgoing stream. + + * tests/Cubit/TAO/IDL_Cubit/client_i.cpp: + * tests/Cubit/TAO/IDL_Cubit/cubit_i.cpp: + Fixed problems with Timeprobe registrations. + Also made the <-x> option functional when -v or -o is used. + + * tests/Cubit/TAO/IDL_Cubit/Makefile: + Enabled GPERF support in the IDL compiler again. + Fri Aug 7 18:00:22 1998 Jeff Parsons <jp4@cs.wustl.edu> * Param_Test/bd_short_seq.{h,cpp}: diff --git a/TAO/docs/releasenotes/TODO.html b/TAO/docs/releasenotes/TODO.html index dec8899f19b..aaa340e042f 100644 --- a/TAO/docs/releasenotes/TODO.html +++ b/TAO/docs/releasenotes/TODO.html @@ -29,10 +29,6 @@ </CENTER> <UL> - <LI>Optimize the outgoing CDR streams by using TSS memory pools - for both the data blocks and the buffers. - </LI> - <LI>The do_static_call() and do_dynamic_call() methods should use an array of void* (in the first case static and generated by the IDL compiler); @@ -43,13 +39,21 @@ <LI>Optimize twoways by delaying memory allocation for the incoming data buffer. </LI> - + <LI>Optimize connection lookup in the client side, using "hints" from the previous lookup, or keeping smaller sets on each IIOP profile or a combination of both. [STATUS] Irfan is working on this. </LI> + <LI>Further optimize memory allocation by using a memory pool + for the incoming CDR stream. + </LI> + + <LI>Further optimize the outgoing memory allocation by adding + support for message blocks allocated from a pool. + </LI> + <LI>Add compiled marshalling [STATUS] Andy is working on this. </LI> @@ -71,8 +75,15 @@ <LI>The operation tables do not need to be statics. </LI> + + <LI>Add suspend and resume operations to the PushConsumerProxy + and PushSupplierProxy interfaces, following the Notification + Service spec. + </LI> - <LI>IDL compiler front-end should be case-insensitive. + <LI>IDL compiler front-end should be case insensitive (actually + it should flag identifiers that only differ by case as a + conflict). </LI> <LI>Support nested upcalls in different concurrency models, like @@ -213,7 +224,95 @@ <LI>Remove the uneeded methods from CORBA::Object </LI> - <LI>Optimize operation demuxing [active demuxing for operations]. + <LI>Implement operation demuxing for clients. + </LI> + + <LI>The current implementation of octet sequences based on + message blocks has a few problems, it cannot marshall + sequences of message blocks properly. + </LI> + + <LI><P>The CORBAlite RFP is very interesting IMHO we just need to + remove features from TAO to make it a CORBAlite + implementation. The problem is how to keep the full blown + CORBA implementation also, this is an idea: + Write the TAOlite version of a class (example TypeCode):</P> + + <CODE> + class TAO_CORBAlite_TypeCode { + // Just the CORBAlite methods are implemented. + }; + </CODE> + + <P>Derive the full blown implementation:</P> + + <CODE> + class TAO_CORBA_TypeCode : public TAO_CORBAlite_TypeCode { + }; + </CODE> + + <P>create two namespaces:</P> + + <CODE> + // in tao/CORBAlite.h + class CORBA { + tyedef TAO_CORBAlite_TypeCode TypeCode; + }; + + // in tao/CORBAfull.h + class CORBA { + typedef TAO_CORBAfull_TypeCode TypeCode; + }; + </CODE> + + <P>then (at compile time) the users chooses between the CORBAlite + or CORBAfull implementations:</P> + + <CODE> + #if USERS_WANTS_FAT_FREE_CORBA + #include "tao/CORBAlite.h" + #else + #include "tao/CORBAfull.h" + #endif + </CODE> + + <P>We need to consider how to support even smaller profiles that + the CORBAlite RFP, like removing <any> or <fixed> support. + We also need to come out with a scheme to support + interpretive marshalling in the CORBAlite framework (where + TypeCodes don't have enough methods as to traverse them). + </P> + </LI> + + <LI>Consider decompositions of the ORB that would allow + dynamically linked plug-ins, examples of things that would be + easy to implement as plugins: + <UL> + <LI>SSL support + </LI> + <LI>UNIX socket support + </LI> + </UL> + Things that would be really hard: + <UL> + <LI>Dynamically load the support for costly features, as the + ImplRepo or Location Forwarding. + </LI> + <LI>Dynamically configure POA with or without support for + holding state. + </LI> + </UL> + </LI> + + <LI>Currently the IDL compiler creates an operation table that + includes all the base classes operations; this permits the + generation of efficient code that does not rely in + dynamic_cast or the _downcast() method for Servanst (which + compare strings, hence it is slow). + It could be interesting to implement the alternative approach + were the class only looks its own operations and then tries + the parent. This will reduce code size, but will probably + decrease performance. </LI> <LI>Cleanup memory managment in some of the servers, for @@ -231,7 +330,7 @@ </LI> <LI>Cleanup the IDL structures for subscriptions, publications, - etc. + etc. (in the EC). </LI> <LI>Resolve the Typecode::equal dilemma: is it structural or @@ -280,6 +379,13 @@ </CENTER> <UL> + <LI>Optimize the outgoing CDR streams by using TSS memory pools + for both the data blocks and the buffers. + [DONE] But we may consider strategizing the kind of allocator + we use (like using a free list instead of a generic + ACE_Malloc). + </LI> + <LI>Optimize Octet Sequences. [DONE] </LI> diff --git a/TAO/docs/releasenotes/index.html b/TAO/docs/releasenotes/index.html index 5962a49fa15..e103be67a88 100644 --- a/TAO/docs/releasenotes/index.html +++ b/TAO/docs/releasenotes/index.html @@ -65,7 +65,11 @@ release</A> of <A HREF="http://www.cs.wustl.edu/~schmidt/TAO.html">TAO</A>: <LI> <A HREF="#locate">Locate requests</A></LI> +<LI> + +<A HREF="TODO.html">Our TODO list</A></LI> </UL> + A complete list of all modifications to TAO is available in the <A HREF="http://www.cs.wustl.edu/~schmidt/ACE_wrappers/TAO/ChangeLog">ChangeLog</A>. <P> diff --git a/TAO/orbsvcs/tests/EC_Throughput/run_test.pl b/TAO/orbsvcs/tests/EC_Throughput/run_test.pl index 2660782467c..7e120083dc8 100755 --- a/TAO/orbsvcs/tests/EC_Throughput/run_test.pl +++ b/TAO/orbsvcs/tests/EC_Throughput/run_test.pl @@ -19,13 +19,16 @@ $ES = Process::Create ("../../Event_Service/Event_Service".$Process::EXE_EXT); sleep $sleeptime; $C = Process::Create ("ECT_Consumer".$Process::EXE_EXT); + +sleep $sleeptime; + $S = Process::Create ("ECT_Supplier".$Process::EXE_EXT); $C->Wait (); $S->Wait (); -$NS->Kill (); -$ES->Kill (); +$NS->Kill (); $NS->Wait (); +$ES->Kill (); $ES->Wait (); unlink $NS_ior; diff --git a/TAO/tao/CDR.cpp b/TAO/tao/CDR.cpp index 6f2df3ffcb5..e7fbb870cf0 100644 --- a/TAO/tao/CDR.cpp +++ b/TAO/tao/CDR.cpp @@ -32,6 +32,7 @@ // by external critical sections. #include "tao/corba.h" +#include "ace/Timeprobe.h" #if !defined (__ACE_INLINE__) # include "tao/CDR.i" @@ -39,6 +40,35 @@ ACE_RCSID(tao, CDR, "$Id$") +#if defined (ACE_ENABLE_TIMEPROBES) + +static const char *TAO_CDR_Timeprobe_Description[] = +{ + "OutputCDR::ctor[1] - enter", + "OutputCDR::ctor[1] - leave", + "OutputCDR::ctor[2] - enter", + "OutputCDR::ctor[2] - leave", + "OutputCDR::ctor[3] - enter", + "OutputCDR::ctor[3] - leave" +}; + +enum +{ + TAO_OUTPUT_CDR_CTOR1_ENTER = 2000, + TAO_OUTPUT_CDR_CTOR1_LEAVE, + TAO_OUTPUT_CDR_CTOR2_ENTER, + TAO_OUTPUT_CDR_CTOR2_LEAVE, + TAO_OUTPUT_CDR_CTOR3_ENTER, + TAO_OUTPUT_CDR_CTOR3_LEAVE +}; + + +// Setup Timeprobes +ACE_TIMEPROBE_EVENT_DESCRIPTIONS (TAO_CDR_Timeprobe_Description, + TAO_OUTPUT_CDR_CTOR1_ENTER); + +#endif /* ACE_ENABLE_TIMEPROBES */ + int CDR::grow (ACE_Message_Block *mb, size_t minsize) { @@ -73,8 +103,20 @@ CDR::grow (ACE_Message_Block *mb, size_t minsize) } } +#if 0 + TAO_ORB_Core* orb_core = TAO_ORB_Core_instance (); + ACE_Message_Block tmp (newsize, + ACE_Message_Block::MB_DATA, + 0, 0, + orb_core->cdr_buffer_allocator (), + 0, + 0, + ACE_Time_Value::zero, + ACE_Time_Value::max_time, + orb_core->data_block_allocator ()); +#else ACE_Message_Block tmp (newsize); - +#endif CDR::mb_align (&tmp); tmp.copy (mb->rd_ptr (), mb->length()); @@ -91,24 +133,47 @@ CDR::grow (ACE_Message_Block *mb, size_t minsize) TAO_OutputCDR::TAO_OutputCDR (size_t size, int byte_order, - TAO_Marshal_Factory *factory) - : start_ (size?size:CDR::DEFAULT_BUFSIZE + CDR::MAX_ALIGNMENT), + TAO_Marshal_Factory *factory, + ACE_Allocator *buffer_allocator, + ACE_Allocator *data_block_allocator) + : start_ (size?size:CDR::DEFAULT_BUFSIZE + CDR::MAX_ALIGNMENT, + ACE_Message_Block::MB_DATA, + 0, 0, + buffer_allocator, + 0, + 0, + ACE_Time_Value::zero, + ACE_Time_Value::max_time, + data_block_allocator), factory_ (factory), do_byte_swap_ (byte_order != TAO_ENCAP_BYTE_ORDER), good_bit_ (1) { + ACE_FUNCTION_TIMEPROBE (TAO_OUTPUT_CDR_CTOR1_ENTER); CDR::mb_align (&this->start_); this->current_ = &this->start_; } TAO_OutputCDR::TAO_OutputCDR (char *data, size_t size, int byte_order, - TAO_Marshal_Factory *factory) - : start_ (data, size), + TAO_Marshal_Factory *factory, + ACE_Allocator *buffer_allocator, + ACE_Allocator *data_block_allocator) + : start_ (size, + ACE_Message_Block::MB_DATA, + 0, + data, + buffer_allocator, + 0, + 0, + ACE_Time_Value::zero, + ACE_Time_Value::max_time, + data_block_allocator), factory_ (factory), do_byte_swap_ (byte_order != TAO_ENCAP_BYTE_ORDER), good_bit_ (1) { + ACE_FUNCTION_TIMEPROBE (TAO_OUTPUT_CDR_CTOR2_ENTER); // We cannot trust the buffer to be properly aligned CDR::mb_align (&this->start_); this->current_ = &this->start_; @@ -122,6 +187,7 @@ TAO_OutputCDR::TAO_OutputCDR (ACE_Message_Block *data, do_byte_swap_ (byte_order != TAO_ENCAP_BYTE_ORDER), good_bit_ (1) { + ACE_FUNCTION_TIMEPROBE (TAO_OUTPUT_CDR_CTOR3_ENTER); // We cannot trust the buffer to be properly aligned CDR::mb_align (&this->start_); this->current_ = &this->start_; @@ -156,19 +222,9 @@ TAO_OutputCDR::total_length (void) const return l; } - -ACE_INLINE int -TAO_OutputCDR::adjust (size_t size, size_t align, char*& buf) +int +TAO_OutputCDR::grow_and_adjust (size_t size, size_t align, char*& buf) { - buf = ptr_align_binary (this->current_->wr_ptr(), align); - char *end = buf + size; - - if (end <= this->current_->end ()) - { - this->current_->wr_ptr (end); - return 0; - } - if (this->current_->cont () == 0 || this->current_->cont ()->size () < size + CDR::MAX_ALIGNMENT) { @@ -183,7 +239,18 @@ TAO_OutputCDR::adjust (size_t size, size_t align, char*& buf) } this->good_bit_ = 0; ACE_Message_Block* tmp; - ACE_NEW_RETURN (tmp, ACE_Message_Block (block_size), -1); + TAO_ORB_Core* orb_core = TAO_ORB_Core_instance (); + ACE_NEW_RETURN (tmp, + ACE_Message_Block (block_size, + ACE_Message_Block::MB_DATA, + 0, 0, + orb_core->cdr_buffer_allocator (), + 0, + 0, + ACE_Time_Value::zero, + ACE_Time_Value::max_time, + orb_core->data_block_allocator ()), + -1); this->good_bit_ = 1; // The new block must start with the same alignment as the @@ -211,12 +278,6 @@ TAO_OutputCDR::adjust (size_t size, size_t align, char*& buf) return 0; } -ACE_INLINE int -TAO_OutputCDR::adjust (size_t size, char*& buf) -{ - return this->adjust (size, size, buf); -} - CORBA_Boolean TAO_OutputCDR::write_1 (const CORBA::Octet* x) { diff --git a/TAO/tao/CDR.h b/TAO/tao/CDR.h index 5b496cf543b..cc8ef49015c 100644 --- a/TAO/tao/CDR.h +++ b/TAO/tao/CDR.h @@ -142,14 +142,18 @@ public: TAO_OutputCDR (size_t size = 0, int byte_order = TAO_ENCAP_BYTE_ORDER, TAO_Marshal_Factory *f = - TAO_Marshal::DEFAULT_MARSHAL_FACTORY); + TAO_Marshal::DEFAULT_MARSHAL_FACTORY, + ACE_Allocator* buffer_allocator = 0, + ACE_Allocator* data_block_allocator = 0); // Default constructor, allocates <size> bytes in the internal // buffer, if <size> == 0 it allocates the default size. TAO_OutputCDR (char *data, size_t size, int byte_order = TAO_ENCAP_BYTE_ORDER, TAO_Marshal_Factory *f = - TAO_Marshal::DEFAULT_MARSHAL_FACTORY); + TAO_Marshal::DEFAULT_MARSHAL_FACTORY, + ACE_Allocator* buffer_allocator = 0, + ACE_Allocator* data_block_allocator = 0); // Build a CDR stream with an initial buffer, it will *not* remove // <data>, since it did not allocated it. @@ -294,6 +298,12 @@ private: // As above, but now the size and alignment requirements may be // different. + int grow_and_adjust (size_t size, size_t align, char*& buf); + // Grow the CDR stream. When it returns <buf> contains a pointer to + // memory in the CDR stream, with at least <size> bytes ahead of it + // and aligned to an <align> boundary. It moved the wr_ptr() + // to <buf + size>. + CORBA_Boolean write_1 (const CORBA::Octet* x); CORBA_Boolean write_2 (const CORBA::UShort* x); CORBA_Boolean write_4 (const CORBA::ULong* x); diff --git a/TAO/tao/CDR.i b/TAO/tao/CDR.i index 966af3f7054..40376bf3612 100644 --- a/TAO/tao/CDR.i +++ b/TAO/tao/CDR.i @@ -318,6 +318,27 @@ TAO_OutputCDR::length (void) const return this->start_.length (); } +ACE_INLINE int +TAO_OutputCDR::adjust (size_t size, size_t align, char*& buf) +{ + buf = ptr_align_binary (this->current_->wr_ptr(), align); + char *end = buf + size; + + if (end <= this->current_->end ()) + { + this->current_->wr_ptr (end); + return 0; + } + + return this->grow_and_adjust (size, align, buf); +} + +ACE_INLINE int +TAO_OutputCDR::adjust (size_t size, char*& buf) +{ + return this->adjust (size, size, buf); +} + ACE_INLINE CORBA::TypeCode::traverse_status TAO_OutputCDR::encode (CORBA::TypeCode_ptr tc, const void *data, diff --git a/TAO/tao/Connect.cpp b/TAO/tao/Connect.cpp index 2e248d829eb..775c6872812 100644 --- a/TAO/tao/Connect.cpp +++ b/TAO/tao/Connect.cpp @@ -194,13 +194,14 @@ TAO_Server_Connection_Handler::handle_message (TAO_InputCDR &input, CORBA::ULong &request_id, CORBA::Environment &env) { - TAO_POA *the_poa = TAO_ORB_Core_instance ()->root_poa (); + TAO_ORB_Core* orb_core = TAO_ORB_Core_instance (); + TAO_POA *the_poa = orb_core->root_poa (); // This will extract the request header, set <response_required> as // appropriate. IIOP_ServerRequest request (input, output, - TAO_ORB_Core_instance ()->orb (), + orb_core->orb (), the_poa, env); @@ -262,7 +263,8 @@ TAO_Server_Connection_Handler::handle_locate (TAO_InputCDR &input, request_id = locateRequestHeader.request_id; response_required = CORBA::B_TRUE; - TAO_POA *the_poa = TAO_ORB_Core_instance ()->root_poa (); + TAO_ORB_Core *orb_core = TAO_ORB_Core_instance (); + TAO_POA *the_poa = orb_core->root_poa (); char repbuf[CDR::DEFAULT_BUFSIZE]; @@ -275,7 +277,7 @@ TAO_Server_Connection_Handler::handle_locate (TAO_InputCDR &input, locateRequestHeader.object_key, "_non_existent", dummy_output, - TAO_ORB_Core_instance ()->orb (), + orb_core->orb (), the_poa, env); diff --git a/TAO/tao/IIOP_Object.cpp b/TAO/tao/IIOP_Object.cpp index f62f38e745a..f09af6ee1be 100644 --- a/TAO/tao/IIOP_Object.cpp +++ b/TAO/tao/IIOP_Object.cpp @@ -26,6 +26,8 @@ static const char *TAO_IIOP_Object_Timeprobe_Description[] = { "IIOP_Object::do_static_call - start", "IIOP_Object::do_static_call - end", + "IIOP_Object::do_static_call - set_cancel", + "IIOP_Object::do_static_call - grab_orb_core", "IIOP_Object::do_static_call - invocation_ctor", "IIOP_Object::do_static_call - invocation_start", "IIOP_Object::do_static_call - put_params" @@ -36,6 +38,8 @@ enum // Timeprobe description table start key TAO_IIOP_OBJECT_DO_STATIC_CALL_START = 500, TAO_IIOP_OBJECT_DO_STATIC_CALL_END, + TAO_IIOP_OBJECT_DO_STATIC_CALL_SET_CANCEL, + TAO_IIOP_OBJECT_DO_STATIC_CALL_GRAB_ORB_CORE, TAO_IIOP_OBJECT_DO_STATIC_CALL_INVOCATION_CTOR, TAO_IIOP_OBJECT_DO_STATIC_CALL_INVOCATION_START, TAO_IIOP_OBJECT_DO_STATIC_CALL_PUT_PARAMS @@ -434,10 +438,16 @@ IIOP_Object::do_static_call (CORBA::Environment &env, // exception reporting TAO_Synchronous_Cancellation_Required NOT_USED; + ACE_TIMEPROBE (TAO_IIOP_OBJECT_DO_STATIC_CALL_SET_CANCEL); + + TAO_ORB_Core* orb_core = TAO_ORB_Core_instance (); + + ACE_TIMEPROBE (TAO_IIOP_OBJECT_DO_STATIC_CALL_GRAB_ORB_CORE); + // Do a locate_request if necessary/wanted. if (this->use_locate_request_ && this->first_locate_request_) { - TAO_GIOP_Locate_Request_Invocation call (this); + TAO_GIOP_Locate_Request_Invocation call (this, orb_core); call.start (env); @@ -449,10 +459,9 @@ IIOP_Object::do_static_call (CORBA::Environment &env, // exception reporting return; } - if (info->is_roundtrip) { - TAO_GIOP_Twoway_Invocation call (this, info->opname); + TAO_GIOP_Twoway_Invocation call (this, info->opname, orb_core); ACE_TIMEPROBE (TAO_IIOP_OBJECT_DO_STATIC_CALL_INVOCATION_CTOR); // We may need to loop through here more than once if we're @@ -582,7 +591,7 @@ IIOP_Object::do_static_call (CORBA::Environment &env, // exception reporting } else { - TAO_GIOP_Oneway_Invocation call (this, info->opname); + TAO_GIOP_Oneway_Invocation call (this, info->opname, orb_core); ACE_TIMEPROBE (TAO_IIOP_OBJECT_DO_STATIC_CALL_INVOCATION_CTOR); // Start the call by constructing the request message header. @@ -676,9 +685,10 @@ IIOP_Object::do_dynamic_call (const char *opname, { TAO_Synchronous_Cancellation_Required NOT_USED; + TAO_ORB_Core *orb_core = TAO_ORB_Core_instance (); if (is_roundtrip) { - TAO_GIOP_Twoway_Invocation call (this, opname); + TAO_GIOP_Twoway_Invocation call (this, opname, orb_core); // Loop as needed for forwarding; see above. @@ -856,7 +866,7 @@ IIOP_Object::do_dynamic_call (const char *opname, } else { - TAO_GIOP_Oneway_Invocation call (this, opname); + TAO_GIOP_Oneway_Invocation call (this, opname, orb_core); call.start (env); if (env.exception () != 0) return; diff --git a/TAO/tao/Invocation.cpp b/TAO/tao/Invocation.cpp index bffda12e2b5..e0be7f2ba17 100644 --- a/TAO/tao/Invocation.cpp +++ b/TAO/tao/Invocation.cpp @@ -1,6 +1,7 @@ // $Id$ #include "tao/corba.h" + #include "tao/Timeprobe.h" #if !defined (__ACE_INLINE__) @@ -17,12 +18,12 @@ ACE_RCSID(tao, Invocation, "$Id$") "GIOP_Invocation::start - leave", "GIOP_Invocation::start - connect", "GIOP_Invocation::start - start_msg", - "GIOP_Invocation::start - request_hdr", + "GIOP_Invocation::start - request_hdr" }; enum { - TAO_GIOP_INVOCATION_START_ENTER, + TAO_GIOP_INVOCATION_START_ENTER = 1000, TAO_GIOP_INVOCATION_START_LEAVE, TAO_GIOP_INVOCATION_START_CONNECT, TAO_GIOP_INVOCATION_START_START_MSG, @@ -53,11 +54,17 @@ ACE_TIMEPROBE_EVENT_DESCRIPTIONS (TAO_Invocation_Timeprobe_Description, // restructuring an ORB core in terms of asynchrony. TAO_GIOP_Invocation::TAO_GIOP_Invocation (IIOP_Object *data, - const char *operation) + const char *operation, + TAO_ORB_Core* orb_core) : data_ (data), opname_ (operation), my_request_id_ (0), - out_stream_ (buffer, sizeof buffer) /* CDR::DEFAULT_BUFSIZE */ + out_stream_ (buffer, sizeof buffer, /* CDR::DEFAULT_BUFSIZE */ + TAO_ENCAP_BYTE_ORDER, + TAO_Marshal::DEFAULT_MARSHAL_FACTORY, + orb_core->cdr_buffer_allocator (), + orb_core->data_block_allocator ()), + orb_core_ (orb_core) { // @@ TODO The comments here are scary, can someone please give me a // warm fuzzy feeling about this (coryan). @@ -91,7 +98,7 @@ TAO_GIOP_Invocation::~TAO_GIOP_Invocation (void) void TAO_GIOP_Invocation::start (CORBA::Boolean is_roundtrip, TAO_GIOP::Message_Type message_type, - CORBA::Environment &env) + CORBA::Environment &env) { ACE_FUNCTION_TIMEPROBE (TAO_GIOP_INVOCATION_START_ENTER); @@ -123,7 +130,7 @@ TAO_GIOP_Invocation::start (CORBA::Boolean is_roundtrip, // Get a pointer to the connector, which might be in thread-specific // storage, depending on the concurrency model. - TAO_CONNECTOR *con = TAO_ORB_Core_instance ()->connector (); + TAO_CONNECTOR *con = this->orb_core_->connector (); // Determine the object key and the address to which we'll need a // connection. @@ -154,9 +161,9 @@ TAO_GIOP_Invocation::start (CORBA::Boolean is_roundtrip, // Establish the connection and get back a // <Client_Connection_Handler>. #if defined (TAO_ARL_USES_SAME_CONNECTOR_PORT) - if (TAO_ORB_Core_instance ()->arl_same_port_connect ()) + if (this->orb_core_->arl_same_port_connect ()) { - ACE_INET_Addr local_addr (TAO_ORB_Core_instance ()->orb_params ()->addr ()); + ACE_INET_Addr local_addr (this->orb_core_->orb_params ()->addr ()); local_addr.set_port_number (server_addr_p->get_port_number ()); // Set the local port number to use. @@ -472,7 +479,7 @@ TAO_GIOP_Twoway_Invocation::invoke (CORBA::ExceptionList &exceptions, TAO_GIOP::Message_Type m = TAO_GIOP::recv_request (handler, this->inp_stream_); - TAO_ORB_Core_instance ()->reactor ()->resume_handler (this->data_->handler ()); + this->orb_core_->reactor ()->resume_handler (this->data_->handler ()); // suspend was called in TAO_Client_Connection_Handler::handle_input switch (m) @@ -738,7 +745,7 @@ TAO_GIOP_Twoway_Invocation::invoke (TAO_Exception_Data *excepts, TAO_GIOP::Message_Type m = TAO_GIOP::recv_request (handler, this->inp_stream_); - TAO_ORB_Core_instance ()->reactor ()->resume_handler (this->data_->handler ()); + this->orb_core_->reactor ()->resume_handler (this->data_->handler ()); // suspend was called in TAO_Client_Connection_Handler::handle_input switch (m) @@ -1008,7 +1015,7 @@ TAO_GIOP_Locate_Request_Invocation::invoke (CORBA::Environment &env) TAO_GIOP::Message_Type m = TAO_GIOP::recv_request (handler, this->inp_stream_); - TAO_ORB_Core_instance ()->reactor ()->resume_handler (this->data_->handler ()); + this->orb_core_->reactor ()->resume_handler (this->data_->handler ()); // suspend was called in TAO_Client_Connection_Handler::handle_input switch (m) diff --git a/TAO/tao/Invocation.h b/TAO/tao/Invocation.h index fded0202721..74eefd8ab4e 100644 --- a/TAO/tao/Invocation.h +++ b/TAO/tao/Invocation.h @@ -44,7 +44,8 @@ class TAO_Export TAO_GIOP_Invocation public: // = Initialization and termination methods. TAO_GIOP_Invocation (IIOP_Object *data, - const char *operation); + const char *operation, + TAO_ORB_Core* orb_core); ~TAO_GIOP_Invocation (void); void put_param (CORBA::TypeCode_ptr tc, @@ -59,7 +60,7 @@ public: protected: void start (CORBA::Boolean is_roundtrip, TAO_GIOP::Message_Type message_type, - CORBA::Environment &env); + CORBA::Environment &env); // Locates the right Client_Connection_Handler and initializes the // CDR stream. // The message_type tells how to initialize the output CDR stream @@ -92,6 +93,9 @@ protected: TAO_OutputCDR out_stream_; // Stream into which the response is placed. + + TAO_ORB_Core* orb_core_; + // The orb_core context where we make this invocation. }; class TAO_Export TAO_GIOP_Twoway_Invocation : public TAO_GIOP_Invocation @@ -108,7 +112,8 @@ class TAO_Export TAO_GIOP_Twoway_Invocation : public TAO_GIOP_Invocation public: // = Initialization and termination methods. TAO_GIOP_Twoway_Invocation (IIOP_Object *data, - const char *operation); + const char *operation, + TAO_ORB_Core* orb_core); void start (CORBA::Environment &env); // Calls TAO_GIOP_Invocation::start. @@ -147,7 +152,8 @@ class TAO_Export TAO_GIOP_Oneway_Invocation : public TAO_GIOP_Invocation public: // = Initialization and termination methods. TAO_GIOP_Oneway_Invocation (IIOP_Object *data, - const char *operation); + const char *operation, + TAO_ORB_Core* orb_core); void start (CORBA::Environment &env); // Call TAO_GIOP_Invocation::start() @@ -164,7 +170,8 @@ class TAO_Export TAO_GIOP_Locate_Request_Invocation : public TAO_GIOP_Invocation // public: // = Initialization and termination methods. - TAO_GIOP_Locate_Request_Invocation (IIOP_Object *data); + TAO_GIOP_Locate_Request_Invocation (IIOP_Object *data, + TAO_ORB_Core* orb_core); void start (CORBA::Environment &env); // Calls TAO_GIOP_Invocation::start. diff --git a/TAO/tao/Invocation.i b/TAO/tao/Invocation.i index 882d3233f0d..3bb8220b2cb 100644 --- a/TAO/tao/Invocation.i +++ b/TAO/tao/Invocation.i @@ -22,8 +22,9 @@ TAO_GIOP_Invocation::out_stream (void) ACE_INLINE TAO_GIOP_Twoway_Invocation:: TAO_GIOP_Twoway_Invocation (IIOP_Object *data, - const char *operation) - : TAO_GIOP_Invocation (data, operation), + const char *operation, + TAO_ORB_Core *orb_core) + : TAO_GIOP_Invocation (data, operation, orb_core), inp_stream_ (CDR::DEFAULT_BUFSIZE) { } @@ -53,8 +54,9 @@ TAO_GIOP_Twoway_Invocation::inp_stream (void) ACE_INLINE TAO_GIOP_Oneway_Invocation:: TAO_GIOP_Oneway_Invocation (IIOP_Object *data, - const char *operation) - : TAO_GIOP_Invocation (data, operation) + const char *operation, + TAO_ORB_Core *orb_core) + : TAO_GIOP_Invocation (data, operation, orb_core) { } @@ -74,8 +76,9 @@ TAO_GIOP_Oneway_Invocation::invoke (CORBA::Environment &env) ACE_INLINE TAO_GIOP_Locate_Request_Invocation:: -TAO_GIOP_Locate_Request_Invocation (IIOP_Object *data) - : TAO_GIOP_Invocation (data, 0), +TAO_GIOP_Locate_Request_Invocation (IIOP_Object *data, + TAO_ORB_Core *orb_core) + : TAO_GIOP_Invocation (data, 0, orb_core), inp_stream_ (CDR::DEFAULT_BUFSIZE) { } diff --git a/TAO/tao/ORB_Core.cpp b/TAO/tao/ORB_Core.cpp index fe375325944..04411d5cbed 100644 --- a/TAO/tao/ORB_Core.cpp +++ b/TAO/tao/ORB_Core.cpp @@ -1344,6 +1344,9 @@ TAO_ORB_Core_instance (void) template void ACE_Convert (const char *, u_int &); # endif /* __GNUG__ */ +template class ACE_Malloc<ACE_LOCAL_MEMORY_POOL,ACE_Null_Mutex>; +template class ACE_Allocator_Adapter<ACE_Malloc<ACE_LOCAL_MEMORY_POOL,ACE_Null_Mutex> >; + template class ACE_Env_Value<int>; template class ACE_Env_Value<u_int>; template class ACE_Strategy_Acceptor<TAO_Server_Connection_Handler, TAO_SOCK_ACCEPTOR>; @@ -1387,7 +1390,12 @@ template class ACE_Singleton<TAO_GLOBAL_Collocation_Table, ACE_SYNCH_MUTEX>; template class ACE_Node<ACE_SYNCH_CONDITION*>; template class ACE_Unbounded_Set<ACE_SYNCH_CONDITION*>; template class ACE_Unbounded_Set_Iterator<ACE_SYNCH_CONDITION*>; + #elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) + +#pragma instantiate ACE_Malloc<ACE_LOCAL_MEMORY_POOL,ACE_Null_Mutex> +#pragma instantiate ACE_Allocator_Adapter<ACE_Malloc<ACE_LOCAL_MEMORY_POOL,ACE_Null_Mutex> > + #pragma instantiate ACE_Env_Value<int> #pragma instantiate ACE_Env_Value<u_int> #pragma instantiate ACE_Strategy_Acceptor<TAO_Server_Connection_Handler, TAO_SOCK_ACCEPTOR> diff --git a/TAO/tao/ORB_Core.h b/TAO/tao/ORB_Core.h index 2148f93da10..353c341f88b 100644 --- a/TAO/tao/ORB_Core.h +++ b/TAO/tao/ORB_Core.h @@ -214,6 +214,15 @@ public: ACE_SYNCH_CONDITION *get_next_follower (void); // returns randomly a follower from the leader-follower set // returns follower on success, else 0 + + ACE_Allocator *data_block_allocator (void); + // This allocator is always TSS and has no locks. It is intended for + // allocating the ACE_Data_Blocks used in *outgoing* CDR streams. + + ACE_Allocator *cdr_buffer_allocator (void); + // This allocator is always TSS and has no locks. It is intended for + // allocating the buffers used in *outgoing* CDR streams. + private: int init (int& argc, char ** argv); // Initialize the guts of the ORB Core. It is intended that this be @@ -309,6 +318,14 @@ private: // A string of comma-separated <{host}>:<{port}> pairs used to // pre-establish connections using <preconnect>. + typedef ACE_Malloc<ACE_LOCAL_MEMORY_POOL,ACE_Null_Mutex> TSS_MALLOC; + typedef ACE_Allocator_Adapter<TSS_MALLOC> TSS_ALLOCATOR; + + TSS_ALLOCATOR data_block_allocator_; + // The Allocator for the ACE_Data_Blocks. + + TSS_ALLOCATOR cdr_buffer_allocator_; + // The Allocator for the CDR buffers. }; class TAO_Default_Reactor : public ACE_Reactor @@ -422,6 +439,8 @@ public: // global collocation table if we are using one, otherwise, return // 0. + // = Modifiers + void set_allocator (ACE_Allocator *alloc); // Set the allocator pointer which will be returned by // <get_allocator()>. diff --git a/TAO/tao/ORB_Core.i b/TAO/tao/ORB_Core.i index 573092dfd71..88ce0bcf8b2 100644 --- a/TAO/tao/ORB_Core.i +++ b/TAO/tao/ORB_Core.i @@ -145,3 +145,16 @@ ACE_Hash_Addr<ACE_INET_Addr>::hash_i (const ACE_INET_Addr &addr) const } # endif /* __ACE_INLINE__ */ #endif /* ACE_HAS_TEMPLATE_SPECIALIZATION */ + +ACE_INLINE ACE_Allocator* +TAO_ORB_Core::data_block_allocator (void) +{ + return &this->data_block_allocator_; +} + +ACE_INLINE ACE_Allocator* +TAO_ORB_Core::cdr_buffer_allocator (void) +{ + return &this->cdr_buffer_allocator_; +} + diff --git a/TAO/tests/Cubit/TAO/IDL_Cubit/Makefile b/TAO/tests/Cubit/TAO/IDL_Cubit/Makefile index ccf61b8f274..b86f67f8ad9 100644 --- a/TAO/tests/Cubit/TAO/IDL_Cubit/Makefile +++ b/TAO/tests/Cubit/TAO/IDL_Cubit/Makefile @@ -13,7 +13,7 @@ ifndef TAO_ROOT endif # ! TAO_ROOT # To use perfect hashing op lookup strategy, use -P. -# TAO_IDLFLAGS += -P +TAO_IDLFLAGS += -P LDLIBS = -lorbsvcs -lTAO diff --git a/TAO/tests/Cubit/TAO/IDL_Cubit/client_i.cpp b/TAO/tests/Cubit/TAO/IDL_Cubit/client_i.cpp index 80b6c155fde..12bcc57f907 100644 --- a/TAO/tests/Cubit/TAO/IDL_Cubit/client_i.cpp +++ b/TAO/tests/Cubit/TAO/IDL_Cubit/client_i.cpp @@ -74,7 +74,7 @@ enum // Setup Timeprobes ACE_TIMEPROBE_EVENT_DESCRIPTIONS (Cubit_Client_Timeprobe_Description, - CUBIT_CLIENT_CUBE_OCTET_START); + CUBIT_CLIENT_CUBE_ONEWAY_START); #endif /* ACE_ENABLE_TIMEPROBES */ @@ -168,6 +168,7 @@ Cubit_Client::parse_args (void) ACE_OS::strdup (get_opts.optarg); break; case 'x': + ACE_DEBUG ((LM_DEBUG, "We will shutdown the server\n")); this->shutdown_ = 1; break; case 's': // Don't use the TAO Naming Service. @@ -819,6 +820,7 @@ Cubit_Client::run (int testing_collocation) this->cubit_->shutdown (TAO_TRY_ENV); TAO_CHECK_ENV; + ACE_DEBUG ((LM_DEBUG, "shutdown on shutdown object\n")); dexc (this->env_, "server, please ACE_OS::exit"); } @@ -832,6 +834,7 @@ Cubit_Client::run (int testing_collocation) } else if (this->shutdown_) { + ACE_DEBUG ((LM_DEBUG, "shutdown on cubit object\n")); this->cubit_->shutdown (this->env_); dexc (this->env_, "server, please ACE_OS::exit"); } @@ -860,6 +863,13 @@ Cubit_Client::run_oneway (void) timer.elapsed_time (elapsed_time); this->print_stats ("cube_oneway", elapsed_time); + if (this->shutdown_) + { + ACE_DEBUG ((LM_DEBUG, "shutdown on cubit object\n")); + this->cubit_->shutdown (this->env_); + dexc (this->env_, "server, please ACE_OS::exit"); + } + return this->error_count_ == 0 ? 0 : 1; } @@ -882,6 +892,13 @@ Cubit_Client::run_void (void) timer.elapsed_time (elapsed_time); this->print_stats ("cube_void", elapsed_time); + if (this->shutdown_) + { + ACE_DEBUG ((LM_DEBUG, "shutdown on cubit object\n")); + this->cubit_->shutdown (this->env_); + dexc (this->env_, "server, please ACE_OS::exit"); + } + return this->error_count_ == 0 ? 0 : 1; } @@ -1006,7 +1023,7 @@ Cubit_Client::init (int argc, char **argv) this->factory_->make_cubit (TAO_TRY_ENV); TAO_CHECK_ENV; - if (CORBA::is_nil (this->cubit_)) + if (CORBA::is_nil (this->cubit_.in ())) ACE_ERROR_RETURN ((LM_ERROR, "null cubit objref returned by factory\n"), -1); diff --git a/TAO/tests/Cubit/TAO/IDL_Cubit/cubit_i.cpp b/TAO/tests/Cubit/TAO/IDL_Cubit/cubit_i.cpp index b19c1c67eb0..e920ed1be9a 100644 --- a/TAO/tests/Cubit/TAO/IDL_Cubit/cubit_i.cpp +++ b/TAO/tests/Cubit/TAO/IDL_Cubit/cubit_i.cpp @@ -56,7 +56,7 @@ static const char *Cubit_i_Timeprobe_Description[] = enum { // Timeprobe description table start key - CUBIT_I_CUBE_ONEWAY_START, + CUBIT_I_CUBE_ONEWAY_START = 10100, CUBIT_I_CUBE_ONEWAY_END, CUBIT_I_CUBE_VOID_START, @@ -86,7 +86,7 @@ enum // Setup Timeprobes ACE_TIMEPROBE_EVENT_DESCRIPTIONS (Cubit_i_Timeprobe_Description, - CUBIT_I_CUBE_OCTET_START); + CUBIT_I_CUBE_ONEWAY_START); #endif /* ACE_ENABLE_TIMEPROBES */ diff --git a/ace/INET_Addr.cpp b/ace/INET_Addr.cpp index 222ecc33c07..d18f5526181 100644 --- a/ace/INET_Addr.cpp +++ b/ace/INET_Addr.cpp @@ -58,9 +58,8 @@ ACE_INET_Addr::operator == (const ACE_INET_Addr &sap) const ACE_TRACE ("ACE_INET_Addr::operator =="); return this->inet_addr_.sin_port == sap.inet_addr_.sin_port - && ACE_OS::memcmp ((void *) &this->inet_addr_.sin_addr, - (void *) &sap.inet_addr_.sin_addr, - sizeof (this->inet_addr_.sin_addr)) == 0; + && (this->inet_addr_.sin_addr.S_un.S_addr + == sap.inet_addr_.sin_addr.S_un.S_addr); } ACE_INET_Addr::ACE_INET_Addr (void) diff --git a/ace/Message_Block.cpp b/ace/Message_Block.cpp index 52f1917c1d2..6b82657604d 100644 --- a/ace/Message_Block.cpp +++ b/ace/Message_Block.cpp @@ -4,6 +4,9 @@ #include "ace/Message_Block.h" #include "ace/Synch_T.h" +// #define ACE_ENABLE_TIMEPROBES +#include "ace/Timeprobe.h" + #if !defined (__ACE_INLINE__) #include "ace/Message_Block.i" #endif /* __ACE_INLINE__ */ @@ -12,6 +15,39 @@ ACE_RCSID(ace, Message_Block, "$Id$") ACE_ALLOC_HOOK_DEFINE(ACE_Message_Block) +#if defined (ACE_ENABLE_TIMEPROBES) + +static const char *ACE_MB_Timeprobe_Description[] = +{ + "Message_Block::init_i - enter", + "Message_Block::init_i - leave", + "Message_Block::init_i - db alloc", + "Message_Block::init_i - db ctor", + "Data_Block::ctor[1] - enter", + "Data_Block::ctor[1] - leave", + "Data_Block::ctor[2] - enter", + "Data_Block::ctor[2] - leave" +}; + +enum +{ + ACE_MESSAGE_BLOCK_INIT_I_ENTER = 3000, + ACE_MESSAGE_BLOCK_INIT_I_LEAVE, + ACE_MESSAGE_BLOCK_INIT_I_DB_ALLOC, + ACE_MESSAGE_BLOCK_INIT_I_DB_CTOR, + ACE_DATA_BLOCK_CTOR1_ENTER, + ACE_DATA_BLOCK_CTOR1_LEAVE, + ACE_DATA_BLOCK_CTOR2_ENTER, + ACE_DATA_BLOCK_CTOR2_LEAVE +}; + + +// Setup Timeprobes +ACE_TIMEPROBE_EVENT_DESCRIPTIONS (ACE_MB_Timeprobe_Description, + ACE_MESSAGE_BLOCK_INIT_I_ENTER); + +#endif /* ACE_ENABLE_TIMEPROBES */ + void ACE_Message_Block::data_block (ACE_Data_Block *db) { @@ -174,9 +210,11 @@ ACE_Data_Block::ACE_Data_Block (void) base_ (0), allocator_strategy_ (0), locking_strategy_ (0), - reference_count_ (1) + reference_count_ (1), + data_block_allocator_ (0) { ACE_TRACE ("ACE_Data_Block::ACE_Data_Block"); + ACE_FUNCTION_TIMEPROBE (ACE_DATA_BLOCK_CTOR1_ENTER); } ACE_Data_Block::ACE_Data_Block (size_t size, @@ -184,7 +222,8 @@ ACE_Data_Block::ACE_Data_Block (size_t size, const char *msg_data, ACE_Allocator *allocator_strategy, ACE_Lock *locking_strategy, - ACE_Message_Block::Message_Flags flags) + ACE_Message_Block::Message_Flags flags, + ACE_Allocator *data_block_allocator) : type_ (msg_type), cur_size_ (size), max_size_ (size), @@ -192,15 +231,20 @@ ACE_Data_Block::ACE_Data_Block (size_t size, base_ ((char *) msg_data), allocator_strategy_ (allocator_strategy), locking_strategy_ (locking_strategy), - reference_count_ (1) + reference_count_ (1), + data_block_allocator_ (data_block_allocator) { ACE_TRACE ("ACE_Data_Block::ACE_Data_Block"); + ACE_FUNCTION_TIMEPROBE (ACE_DATA_BLOCK_CTOR2_ENTER); // If the user didn't pass one in, let's use the // <ACE_Allocator::instance>. if (this->allocator_strategy_ == 0) ACE_ALLOCATOR (this->allocator_strategy_, ACE_Allocator::instance ()); + if (this->data_block_allocator_ == 0) + ACE_ALLOCATOR (this->data_block_allocator_, ACE_Allocator::instance ()); + if (msg_data == 0) ACE_ALLOCATOR (this->base_, (char *) this->allocator_strategy_->malloc (size)); @@ -223,7 +267,8 @@ ACE_Message_Block::ACE_Message_Block (const char *data, 0, // priority ACE_Time_Value::zero, // execution time ACE_Time_Value::max_time, // absolute time of deadline - 0) == -1) // data block + 0, // data block + 0) == -1) // data_block allocator ACE_ERROR ((LM_ERROR, ASYS_TEXT ("ACE_Message_Block"))); } @@ -241,7 +286,8 @@ ACE_Message_Block::ACE_Message_Block (void) 0, // priority ACE_Time_Value::zero, // execution time ACE_Time_Value::max_time, // absolute time of deadline - 0) == -1) // data block + 0, // data block + 0) == -1) // data_block allocator ACE_ERROR ((LM_ERROR, ASYS_TEXT ("ACE_Message_Block"))); } @@ -253,7 +299,8 @@ ACE_Message_Block::ACE_Message_Block (size_t size, ACE_Lock *locking_strategy, u_long priority, const ACE_Time_Value & execution_time, - const ACE_Time_Value & deadline_time) + const ACE_Time_Value & deadline_time, + ACE_Allocator *data_block_allocator) { ACE_TRACE ("ACE_Message_Block::ACE_Message_Block"); @@ -267,7 +314,8 @@ ACE_Message_Block::ACE_Message_Block (size_t size, priority, execution_time, deadline_time, - 0) == -1) // data block + 0, // data block + data_block_allocator) == -1) ACE_ERROR ((LM_ERROR, ASYS_TEXT ("ACE_Message_Block"))); } @@ -280,7 +328,8 @@ ACE_Message_Block::init (size_t size, ACE_Lock *locking_strategy, u_long priority, const ACE_Time_Value & execution_time, - const ACE_Time_Value & deadline_time) + const ACE_Time_Value & deadline_time, + ACE_Allocator *data_block_allocator) { ACE_TRACE ("ACE_Message_Block::init"); @@ -294,7 +343,8 @@ ACE_Message_Block::init (size_t size, priority, execution_time, deadline_time, - 0); // data block + 0, // data block + data_block_allocator); } int @@ -314,7 +364,8 @@ ACE_Message_Block::init (const char *data, 0, // priority ACE_Time_Value::zero, // execution time ACE_Time_Value::max_time, // absolute time of deadline - 0); // data block + 0, // data block + 0); } ACE_Message_Block::ACE_Message_Block (size_t size, @@ -327,7 +378,8 @@ ACE_Message_Block::ACE_Message_Block (size_t size, u_long priority, const ACE_Time_Value & execution_time, const ACE_Time_Value & deadline_time, - ACE_Data_Block *db) + ACE_Data_Block *db, + ACE_Allocator *data_block_allocator) { ACE_TRACE ("ACE_Message_Block::ACE_Message_Block"); @@ -341,7 +393,8 @@ ACE_Message_Block::ACE_Message_Block (size_t size, priority, execution_time, deadline_time, - db) == -1) + db, + data_block_allocator) == -1) ACE_ERROR ((LM_ERROR, ASYS_TEXT ("ACE_Message_Block"))); } @@ -359,7 +412,8 @@ ACE_Message_Block::ACE_Message_Block (ACE_Data_Block *data_block) 0, // priority ACE_Time_Value::zero, // execution time ACE_Time_Value::max_time, // absolute time of deadline - data_block) == -1) // data block + data_block, + data_block->data_block_allocator ()) == -1) // data block ACE_ERROR ((LM_ERROR, ASYS_TEXT ("ACE_Message_Block"))); } @@ -374,9 +428,11 @@ ACE_Message_Block::init_i (size_t size, u_long priority, const ACE_Time_Value & execution_time, const ACE_Time_Value & deadline_time, - ACE_Data_Block *db) + ACE_Data_Block *db, + ACE_Allocator *data_block_allocator) { ACE_TRACE ("ACE_Message_Block::init_i"); + ACE_FUNCTION_TIMEPROBE (ACE_MESSAGE_BLOCK_INIT_I_ENTER); this->priority_ = priority; this->execution_time_ = execution_time; @@ -387,16 +443,28 @@ ACE_Message_Block::init_i (size_t size, this->data_block_ = 0; if (db == 0) - // Allocate the <ACE_Data_Block> portion, which is reference - // counted. - ACE_NEW_RETURN (db, - ACE_Data_Block (size, - msg_type, - msg_data, - allocator_strategy, - locking_strategy, - flags), - -1); + { + if (data_block_allocator == 0) + ACE_ALLOCATOR_RETURN (data_block_allocator, + ACE_Allocator::instance (), -1); + + ACE_TIMEPROBE (ACE_MESSAGE_BLOCK_INIT_I_DB_ALLOC); + + // Allocate the <ACE_Data_Block> portion, which is reference + // counted. + ACE_NEW_MALLOC_RETURN (db, + ACE_static_cast(ACE_Data_Block*, + data_block_allocator->malloc (sizeof (ACE_Data_Block))), + ACE_Data_Block (size, + msg_type, + msg_data, + allocator_strategy, + locking_strategy, + flags, + data_block_allocator), + -1); + ACE_TIMEPROBE (ACE_MESSAGE_BLOCK_INIT_I_DB_CTOR); + } // Reset the data_block_ pointer. this->data_block (db); @@ -446,6 +514,7 @@ ACE_Data_Block::release (ACE_Lock *lock) ACE_Data_Block *result = 0; ACE_Lock *lock_to_be_used = 0; + ACE_Allocator *allocator = this->data_block_allocator_; // Check if we were passed in a lock if (lock != 0) @@ -480,7 +549,7 @@ ACE_Data_Block::release (ACE_Lock *lock) // since otherwise we'd be trying to "release" through a deleted // pointer! if (result == 0) - delete this; + ACE_DES_FREE (this, allocator->free, ACE_Data_Block); return result; } @@ -622,7 +691,8 @@ ACE_Message_Block::duplicate (void) const // "duplicated" <ACE_Data_Block> // (will simply increment the // reference count). - this->data_block ()->duplicate ()), // data block + this->data_block ()->duplicate (), + this->data_block ()->data_block_allocator ()), 0); // Set the read and write pointers in the new <Message_Block> to the @@ -671,14 +741,17 @@ ACE_Data_Block::clone (ACE_Message_Block::Message_Flags mask) const ACE_Data_Block *nb; - ACE_NEW_RETURN (nb, - ACE_Data_Block (this->max_size_, // size - this->type_, // type - 0, // data - this->allocator_strategy_, // allocator - this->locking_strategy_, // locking strategy - this->flags_), // flags - 0); + ACE_NEW_MALLOC_RETURN (nb, + ACE_static_cast(ACE_Data_Block*, + this->data_block_allocator_->malloc (sizeof (ACE_Data_Block))), + ACE_Data_Block (this->max_size_, // size + this->type_, // type + 0, // data + this->allocator_strategy_, // allocator + this->locking_strategy_, // locking strategy + this->flags_, // flags + this->data_block_allocator_), + 0); // Copy all of the payload memory into the new object. ACE_OS::memcpy (nb->base_, this->base_, this->max_size_); @@ -712,7 +785,8 @@ ACE_Message_Block::clone (Message_Flags mask) const this->priority_, // priority this->execution_time_, // execution time this->deadline_time_, // absolute time to deadline - db); // data_block + db, // data_block + db->data_block_allocator ()); if (nb == 0) { db->release (); diff --git a/ace/Message_Block.h b/ace/Message_Block.h index de140cb3d49..728a6e34834 100644 --- a/ace/Message_Block.h +++ b/ace/Message_Block.h @@ -116,7 +116,8 @@ public: ACE_Lock *locking_strategy = 0, u_long priority = 0, const ACE_Time_Value & execution_time = ACE_Time_Value::zero, - const ACE_Time_Value & deadline_time = ACE_Time_Value::max_time); + const ACE_Time_Value & deadline_time = ACE_Time_Value::max_time, + ACE_Allocator *data_block_allocator = 0); // Create an initialized message of type <type> containing <size> // bytes. The <cont> argument initializes the continuation field in // the <Message_Block>. If <data> == 0 then we create and own the @@ -127,6 +128,9 @@ public: // counting) from race conditions. Note that the <size> of the // <Message_Block> will be <size>, but the <length> will be 0 until // <wr_ptr> is set. + // The <data_block_allocator> is use to allocate the data blocks + // while the <allocator_strategy> is used to allocate the buffers + // contained by those. int init (const char *data, size_t size = 0); @@ -143,7 +147,8 @@ public: ACE_Lock *locking_strategy = 0, u_long priority = 0, const ACE_Time_Value & execution_time = ACE_Time_Value::zero, - const ACE_Time_Value & deadline_time = ACE_Time_Value::max_time); + const ACE_Time_Value & deadline_time = ACE_Time_Value::max_time, + ACE_Allocator *data_block_allocator = 0); // Create an initialized message of type <type> containing <size> // bytes. The <cont> argument initializes the continuation field in // the <Message_Block>. If <data> == 0 then we create and own the @@ -154,6 +159,9 @@ public: // counting) from race conditions. Note that the <size> of the // <Message_Block> will be <size>, but the <length> will be 0 until // <wr_ptr> is set. + // The <data_block_allocator> is use to allocate the data blocks + // while the <allocator_strategy> is used to allocate the buffers + // contained by those. virtual ~ACE_Message_Block (void); // Delete all the resources held in the message. @@ -334,7 +342,8 @@ private: u_long priority, const ACE_Time_Value & execution_time, const ACE_Time_Value & deadline_time, - ACE_Data_Block *db); + ACE_Data_Block *db, + ACE_Allocator *data_block_allocator); // Perform the actual initialization. ACE_Message_Block *release_i (ACE_Lock *lock); @@ -350,7 +359,8 @@ private: u_long priority, const ACE_Time_Value & execution_time, const ACE_Time_Value & deadline_time, - ACE_Data_Block *db); + ACE_Data_Block *db, + ACE_Allocator *data_block_allocator); // Perform the actual initialization. char *rd_ptr_; @@ -409,7 +419,8 @@ public: const char *msg_data, ACE_Allocator *allocator_strategy, ACE_Lock *locking_strategy, - ACE_Message_Block::Message_Flags flags); + ACE_Message_Block::Message_Flags flags, + ACE_Allocator *data_block_allocator); // Initialize. virtual ~ACE_Data_Block (void); @@ -476,6 +487,9 @@ public: int reference_count (void) const; // Get the current reference count. + ACE_Allocator *data_block_allocator (void); + // Get the allocator used to create this object + private: ACE_Data_Block *release_i (void); // Internal release implementation @@ -513,6 +527,9 @@ private: // shared by all owners of the <Data_Block>'s data, i.e., all the // <ACE_Message_Block>s. + ACE_Allocator *data_block_allocator_; + // The allocator use to destroy ourselves. + // = Disallow these operations. ACE_Data_Block &operator= (const ACE_Data_Block &); ACE_Data_Block (const ACE_Data_Block &); diff --git a/ace/Message_Block.i b/ace/Message_Block.i index 4f58c137176..4b3eb0ae957 100644 --- a/ace/Message_Block.i +++ b/ace/Message_Block.i @@ -60,6 +60,12 @@ ACE_Data_Block::flags (void) const return this->flags_; } +ACE_INLINE ACE_Allocator* +ACE_Data_Block::data_block_allocator (void) +{ + return this->data_block_allocator_; +} + ACE_INLINE ACE_Message_Block::Message_Flags ACE_Message_Block::set_flags (ACE_Message_Block::Message_Flags more_flags) { @@ -519,10 +525,3 @@ ACE_Laxity_Message_Strategy::convert_priority (ACE_Time_Value & priority, priority -= mb.msg_deadline_time (); } // dynamic priority conversion function based on laxity - - - - - - - diff --git a/apps/gperf/Makefile b/apps/gperf/Makefile index 11d7fbf4847..e57acc530f8 100644 --- a/apps/gperf/Makefile +++ b/apps/gperf/Makefile @@ -1,7 +1,7 @@ #---------------------------------------------------------------------------- -# $Id: Makefile 1.1 10/18/96 # -# Makefile for the Orbix applications +# $Id$ +# #---------------------------------------------------------------------------- #---------------------------------------------------------------------------- @@ -22,4 +22,3 @@ include $(ACE_ROOT)/include/makeinclude/macros.GNU include $(ACE_ROOT)/include/makeinclude/rules.common.GNU include $(ACE_ROOT)/include/makeinclude/rules.nested.GNU include $(ACE_ROOT)/include/makeinclude/rules.nolocal.GNU - diff --git a/bin/auto_compile b/bin/auto_compile index de070bb0d2a..7ed8583984f 100755 --- a/bin/auto_compile +++ b/bin/auto_compile @@ -39,6 +39,7 @@ $MODULE='ACE_wrappers'; ('ace', 'netsvcs', 'tests', + 'apps/gperf', 'TAO'); # This are the pairs "sub-directory , script" we run; the separator @@ -77,12 +78,12 @@ $ADMIN = $ARGV[3]; # to ADMIN. sub mydie { - local $msg = shift; + local @msg = @_; open(MAIL, "|mail $ADMIN") || die "cannot open email pipe on error: $msg\n"; print MAIL 'The following error is brought to you by: ', "\n"; print MAIL $CMD, ' [', $REVISION, "] for $BUILD on $CHECKOUT\n"; - print MAIL "\n", $msg, "\n"; + print MAIL "\n", @msg, "\n"; print MAIL "\nPlease check log files for more info\n"; close(MAIL) || die "cannot close email pipe on error: $msg\n"; @@ -223,7 +224,7 @@ foreach $i (@RUN_LIST) { } if ($#failures >= 0) { - mydie join ("\n", @failures); + mydie @failures; } close(LOG) |