summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcoryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1998-10-14 04:24:34 +0000
committercoryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1998-10-14 04:24:34 +0000
commita75c149af7ad0324ef2a41750b54f8665da558a5 (patch)
tree81cee7daa0dd54ebc952efa37d3c24227debc979
parentbd1719144c32060fb372c01dddd85f591b0829bc (diff)
downloadATCD-a75c149af7ad0324ef2a41750b54f8665da558a5.tar.gz
ChangeLogTag:Tue Oct 13 23:03:24 1998 Carlos O'Ryan <coryan@cs.wustl.edu>
-rw-r--r--TAO/ChangeLog-98c19
-rw-r--r--TAO/orbsvcs/Event_Service/svc.conf2
-rw-r--r--TAO/tao/CDR.cpp39
-rw-r--r--TAO/tao/CDR.h17
-rw-r--r--TAO/tao/Connect.cpp6
-rw-r--r--TAO/tao/Invocation.i8
-rw-r--r--TAO/tao/ORB_Core.cpp64
-rw-r--r--TAO/tao/ORB_Core.h9
-rw-r--r--TAO/tao/ORB_Core.i6
9 files changed, 128 insertions, 42 deletions
diff --git a/TAO/ChangeLog-98c b/TAO/ChangeLog-98c
index 50b7c4e2408..4a96a28b2a8 100644
--- a/TAO/ChangeLog-98c
+++ b/TAO/ChangeLog-98c
@@ -1,3 +1,22 @@
+Tue Oct 13 23:03:24 1998 Carlos O'Ryan <coryan@cs.wustl.edu>
+
+ * tao/ORB_Core.h:
+ * tao/ORB_Core.i:
+ * tao/ORB_Core.cpp:
+ * tao/Invocation.i:
+ * tao/Connect.cpp:
+ * tao/CDR.h:
+ * tao/CDR.cpp:
+ The input CDR can be created using a user provided data block,
+ this is used to select the right kind of locking for the
+ Data_Block reference count.
+ The ORB_Core acts as a Factory of Data_Blocks, selecting the
+ right type according to the -ORBinputcdrallocator option.
+
+ * orbsvcs/Event_Service/svc.conf:
+ Use the appropiate allocator for the EC, because it shares the
+ CDR buffers between several threads (to minimize data copying).
+
Tue Oct 13 22:15:53 1998 Irfan Pyarali <irfan@cs.wustl.edu>
* orbsvcs/tests/EC_Throughput/ECT_Supplier.cpp (svc): Must set the
diff --git a/TAO/orbsvcs/Event_Service/svc.conf b/TAO/orbsvcs/Event_Service/svc.conf
index 272f088b3dd..f3362851751 100644
--- a/TAO/orbsvcs/Event_Service/svc.conf
+++ b/TAO/orbsvcs/Event_Service/svc.conf
@@ -2,6 +2,6 @@
#
# The options are described in $TAO_ROOT/docs/Options.html
#
-dynamic Resource_Factory Service_Object * TAO:_make_TAO_Resource_Factory() "-ORBresources global -ORBpoa global -ORBcoltable global"
+dynamic Resource_Factory Service_Object * TAO:_make_TAO_Resource_Factory() "-ORBresources global -ORBpoa global -ORBcoltable global -ORBinputcdrallocator global"
dynamic Client_Strategy_Factory Service_Object * TAO:_make_TAO_Default_Client_Strategy_Factory()
dynamic Server_Strategy_Factory Service_Object * TAO:_make_TAO_Default_Server_Strategy_Factory() "-ORBconcurrency reactive -ORBdemuxstrategy dynamic -ORBtablesize 128 -ORBpoalock thread -ORBcoltbllock thread -ORBpoamgrlock thread"
diff --git a/TAO/tao/CDR.cpp b/TAO/tao/CDR.cpp
index 8cfc0d127ef..656dc0d111b 100644
--- a/TAO/tao/CDR.cpp
+++ b/TAO/tao/CDR.cpp
@@ -580,18 +580,8 @@ TAO_OutputCDR::write_boolean_array (const CORBA::Boolean* x,
TAO_InputCDR::TAO_InputCDR (const char *buf, size_t bufsiz,
int byte_order,
- TAO_Marshal_Factory *factory,
- ACE_Allocator* buffer_allocator,
- ACE_Allocator* data_block_allocator)
- : start_ (bufsiz,
- ACE_Message_Block::MB_DATA,
- 0,
- buf,
- buffer_allocator,
- 0, 0,
- ACE_Time_Value::zero,
- ACE_Time_Value::max_time,
- data_block_allocator),
+ TAO_Marshal_Factory *factory)
+ : start_ (buf, bufsiz),
factory_ (factory),
do_byte_swap_ (byte_order != TAO_ENCAP_BYTE_ORDER),
good_bit_ (1)
@@ -601,19 +591,8 @@ TAO_InputCDR::TAO_InputCDR (const char *buf, size_t bufsiz,
TAO_InputCDR::TAO_InputCDR (size_t bufsiz,
int byte_order,
- TAO_Marshal_Factory *factory,
- ACE_Allocator* buffer_allocator,
- ACE_Allocator* data_block_allocator)
- : start_ (bufsiz,
- ACE_Message_Block::MB_DATA,
- 0,
- 0,
- buffer_allocator,
- 0,
- 0,
- ACE_Time_Value::zero,
- ACE_Time_Value::max_time,
- data_block_allocator),
+ TAO_Marshal_Factory *factory)
+ : start_ (bufsiz),
factory_ (factory),
do_byte_swap_ (byte_order != TAO_ENCAP_BYTE_ORDER),
good_bit_ (1)
@@ -632,6 +611,16 @@ TAO_InputCDR::TAO_InputCDR (ACE_Message_Block *data,
this->start_.wr_ptr (data->wr_ptr ());
}
+TAO_InputCDR::TAO_InputCDR (ACE_Data_Block *data,
+ int byte_order,
+ TAO_Marshal_Factory *factory)
+ : start_ (data),
+ factory_ (factory),
+ do_byte_swap_ (byte_order != TAO_ENCAP_BYTE_ORDER),
+ good_bit_ (1)
+{
+}
+
TAO_InputCDR::TAO_InputCDR (const TAO_InputCDR& rhs,
size_t size,
CORBA::Long offset)
diff --git a/TAO/tao/CDR.h b/TAO/tao/CDR.h
index 7d6a8f61cd4..2b9bad27554 100644
--- a/TAO/tao/CDR.h
+++ b/TAO/tao/CDR.h
@@ -386,9 +386,7 @@ public:
TAO_InputCDR (const char* buf, size_t bufsiz,
int byte_order = TAO_ENCAP_BYTE_ORDER,
TAO_Marshal_Factory *f =
- TAO_Marshal::DEFAULT_MARSHAL_FACTORY,
- ACE_Allocator* buffer_allocator = 0,
- ACE_Allocator* data_block_allocator = 0);
+ TAO_Marshal::DEFAULT_MARSHAL_FACTORY);
// Create an input stream from an arbitrary buffer, care must be
// exercised wrt alignment, because this contructor will *not* work
// if the buffer is unproperly aligned.
@@ -396,11 +394,9 @@ public:
TAO_InputCDR (size_t bufsiz,
int byte_order = TAO_ENCAP_BYTE_ORDER,
TAO_Marshal_Factory *f =
- TAO_Marshal::DEFAULT_MARSHAL_FACTORY,
- ACE_Allocator* buffer_allocator = 0,
- ACE_Allocator* data_block_allocator = 0);
+ TAO_Marshal::DEFAULT_MARSHAL_FACTORY);
// Create an empty input stream. The caller is responsible for
- // putting the right data in here.
+ // putting the right data and providing the right alignment.
TAO_InputCDR (ACE_Message_Block *data,
int byte_order =
@@ -409,6 +405,13 @@ public:
TAO_Marshal::DEFAULT_MARSHAL_FACTORY);
// Create an input stream from an ACE_Message_Block
+ TAO_InputCDR (ACE_Data_Block *data,
+ int byte_order =
+ TAO_ENCAP_BYTE_ORDER,
+ TAO_Marshal_Factory *f =
+ TAO_Marshal::DEFAULT_MARSHAL_FACTORY);
+ // Create an input stream from an ACE_Data_Block
+
TAO_InputCDR (const TAO_InputCDR& rhs);
TAO_InputCDR& operator= (const TAO_InputCDR& rhs);
// Make a copy of the current stream state, but does not copy the
diff --git a/TAO/tao/Connect.cpp b/TAO/tao/Connect.cpp
index 592ca4da861..14b9a0a7e83 100644
--- a/TAO/tao/Connect.cpp
+++ b/TAO/tao/Connect.cpp
@@ -507,11 +507,9 @@ TAO_Server_Connection_Handler::handle_input (ACE_HANDLE)
// @@ TODO This should take its memory from a specialized
// allocator. It is better to use a message block than a on stack
// buffer because we cannot minimize memory copies in that case.
- TAO_InputCDR input (CDR::DEFAULT_BUFSIZE,
+ TAO_InputCDR input (this->orb_core_->create_input_cdr_data_block (CDR::DEFAULT_BUFSIZE),
TAO_ENCAP_BYTE_ORDER,
- TAO_Marshal::DEFAULT_MARSHAL_FACTORY,
- this->orb_core_->input_cdr_buffer_allocator (),
- this->orb_core_->input_cdr_dblock_allocator ());
+ TAO_Marshal::DEFAULT_MARSHAL_FACTORY);
char repbuf[CDR::DEFAULT_BUFSIZE];
#if defined(ACE_HAS_PURIFY)
diff --git a/TAO/tao/Invocation.i b/TAO/tao/Invocation.i
index e7fd39edc7c..6195b9db53a 100644
--- a/TAO/tao/Invocation.i
+++ b/TAO/tao/Invocation.i
@@ -25,11 +25,9 @@ TAO_GIOP_Twoway_Invocation (IIOP_Object *data,
const char *operation,
TAO_ORB_Core *orb_core)
: TAO_GIOP_Invocation (data, operation, orb_core),
- inp_stream_ (CDR::DEFAULT_BUFSIZE,
+ inp_stream_ (orb_core->create_input_cdr_data_block (CDR::DEFAULT_BUFSIZE),
TAO_ENCAP_BYTE_ORDER,
- TAO_Marshal::DEFAULT_MARSHAL_FACTORY,
- orb_core->input_cdr_buffer_allocator (),
- orb_core->input_cdr_dblock_allocator ())
+ TAO_Marshal::DEFAULT_MARSHAL_FACTORY)
{
}
@@ -83,7 +81,7 @@ TAO_GIOP_Locate_Request_Invocation::
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)
+ inp_stream_ (orb_core->create_input_cdr_data_block (CDR::DEFAULT_BUFSIZE))
{
}
diff --git a/TAO/tao/ORB_Core.cpp b/TAO/tao/ORB_Core.cpp
index 9e90410d7b3..6412289288d 100644
--- a/TAO/tao/ORB_Core.cpp
+++ b/TAO/tao/ORB_Core.cpp
@@ -1457,6 +1457,66 @@ TAO_Resource_Factory::input_cdr_buffer_allocator (void)
}
+ACE_Data_Block*
+TAO_Resource_Factory::create_input_cdr_data_block (size_t size)
+{
+ switch (this->cdr_allocator_source_)
+ {
+ case TAO_GLOBAL:
+ {
+ ACE_Allocator* buffer_alloc =
+ this->input_cdr_buffer_allocator ();
+ ACE_Allocator* dblock_alloc =
+ this->input_cdr_dblock_allocator ();
+
+ typedef
+ ACE_Locked_Data_Block<ACE_Lock_Adapter<ACE_SYNCH_MUTEX> >
+ Global_Data_Block;
+ Global_Data_Block *nb;
+
+ ACE_NEW_MALLOC_RETURN (
+ nb,
+ ACE_static_cast(Global_Data_Block*,
+ dblock_alloc->malloc (sizeof (Global_Data_Block))),
+ Global_Data_Block (size,
+ ACE_Message_Block::MB_DATA,
+ 0,
+ buffer_alloc,
+ 0,
+ dblock_alloc),
+ 0);
+ return nb;
+ }
+ break;
+
+ case TAO_TSS:
+ {
+ ACE_Allocator* buffer_alloc =
+ this->input_cdr_buffer_allocator ();
+ ACE_Allocator* dblock_alloc =
+ this->input_cdr_dblock_allocator ();
+
+ ACE_Data_Block *nb;
+
+ ACE_NEW_MALLOC_RETURN (
+ nb,
+ ACE_static_cast(ACE_Data_Block*,
+ dblock_alloc->malloc (sizeof (ACE_Data_Block))),
+ ACE_Data_Block (size,
+ ACE_Message_Block::MB_DATA,
+ 0,
+ buffer_alloc,
+ 0,
+ 0,
+ dblock_alloc),
+ 0);
+ return nb;
+ }
+ break;
+ }
+ return 0;
+}
+
TAO_GLOBAL_Collocation_Table *
TAO_Resource_Factory::get_global_collocation_table (void)
{
@@ -1527,6 +1587,8 @@ TAO_ORB_Core_instance (void)
template class ACE_Malloc<ACE_LOCAL_MEMORY_POOL,ACE_SYNCH_MUTEX>;
template class ACE_Allocator_Adapter<ACE_Malloc<ACE_LOCAL_MEMORY_POOL,ACE_SYNCH_MUTEX> >;
+template class ACE_Locked_Data_Block<ACE_Allocator_Adapter<ACE_SYNCH_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>;
@@ -1579,6 +1641,8 @@ template class ACE_Select_Reactor_T< ACE_Select_Reactor_Token_T<ACE_Noop_Token>
#pragma instantiate ACE_Malloc<ACE_LOCAL_MEMORY_POOL,ACE_SYNCH_MUTEX>
#pragma instantiate ACE_Allocator_Adapter<ACE_Malloc<ACE_LOCAL_MEMORY_POOL,ACE_SYNCH_MUTEX> >
+#pragma instantiate ACE_Locked_Data_Block<ACE_Allocator_Adapter<ACE_SYNCH_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 00efa3c8270..ad32d380f9c 100644
--- a/TAO/tao/ORB_Core.h
+++ b/TAO/tao/ORB_Core.h
@@ -250,6 +250,10 @@ public:
// This allocator is always TSS and has no locks. It is intended for
// allocating the buffers used in *outgoing* CDR streams.
+ ACE_Data_Block *create_input_cdr_data_block (size_t size);
+ // The Message Blocks used for input CDRs must have appropiate
+ // locking strategies.
+
CORBA_Environment *default_environment (void) const;
void default_environment (CORBA_Environment*);
// The thread has a default environment to simplify porting between
@@ -531,6 +535,10 @@ public:
virtual ACE_Allocator* input_cdr_buffer_allocator (void);
// Access the input CDR allocators.
+ ACE_Data_Block *create_input_cdr_data_block (size_t size);
+ // The Message Blocks used for input CDRs must have appropiate
+ // locking strategies.
+
// @@ I suspect that putting these structs inside of this class is
// going to break some compilers (e.g., HP/YUX) when you try to use
// this stuff with the ACE_Singletons below. I suggest you move
@@ -613,6 +621,7 @@ public:
ACE_Allocator *input_cdr_dblock_allocator_;
ACE_Allocator *input_cdr_buffer_allocator_;
// The allocators for the input CDR streams.
+
};
protected:
diff --git a/TAO/tao/ORB_Core.i b/TAO/tao/ORB_Core.i
index 383a0347b4c..66e4cfd8be2 100644
--- a/TAO/tao/ORB_Core.i
+++ b/TAO/tao/ORB_Core.i
@@ -157,6 +157,12 @@ TAO_ORB_Core::default_environment (CORBA_Environment* env)
this->default_environment_ = env;
}
+ACE_INLINE ACE_Data_Block*
+TAO_ORB_Core::create_input_cdr_data_block (size_t size)
+{
+ return this->resource_factory ()->create_input_cdr_data_block (size);
+}
+
// ****************************************************************
ACE_INLINE void