diff options
author | coryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1999-10-07 18:16:40 +0000 |
---|---|---|
committer | coryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1999-10-07 18:16:40 +0000 |
commit | b086b7488ec4cdc4e534ebd9ae2605fb5e55961c (patch) | |
tree | 813aa266563911c2233aaedd7aa38ae32ab064c5 | |
parent | 8e686f0ddd974e5da488843b5a6d071468892eed (diff) | |
download | ATCD-b086b7488ec4cdc4e534ebd9ae2605fb5e55961c.tar.gz |
ChangeLogTag:Thu Oct 7 13:14:43 1999 Carlos O'Ryan <coryan@cs.wustl.edu>
-rw-r--r-- | TAO/ChangeLog-99c | 48 | ||||
-rw-r--r-- | TAO/tao/Any.cpp | 73 | ||||
-rw-r--r-- | TAO/tao/Any.h | 14 | ||||
-rw-r--r-- | TAO/tao/GIOP_Server_Request.cpp | 9 | ||||
-rw-r--r-- | TAO/tao/GIOP_Server_Request.h | 6 | ||||
-rw-r--r-- | TAO/tao/GIOP_Server_Request.i | 6 | ||||
-rw-r--r-- | TAO/tao/NVList.cpp | 124 | ||||
-rw-r--r-- | TAO/tao/NVList.h | 17 | ||||
-rw-r--r-- | TAO/tao/NVList.i | 2 | ||||
-rw-r--r-- | TAO/tao/Request.cpp | 26 | ||||
-rw-r--r-- | TAO/tao/Request.h | 6 | ||||
-rw-r--r-- | TAO/tao/Request.i | 8 | ||||
-rw-r--r-- | TAO/tao/Server_Request.h | 3 | ||||
-rw-r--r-- | TAO/tao/Stub.cpp | 64 | ||||
-rw-r--r-- | TAO/tao/Stub.h | 1 | ||||
-rwxr-xr-x | TAO/tests/DSI_Gateway/run_test.pl | 2 | ||||
-rw-r--r-- | TAO/tests/DSI_Gateway/test_dsi.cpp | 3 | ||||
-rw-r--r-- | TAO/tests/Param_Test/param_test_i.cpp | 6 | ||||
-rwxr-xr-x | TAO/tests/Param_Test/run_test.pl | 4 |
19 files changed, 269 insertions, 153 deletions
diff --git a/TAO/ChangeLog-99c b/TAO/ChangeLog-99c index af73d470e97..d66e8518b2a 100644 --- a/TAO/ChangeLog-99c +++ b/TAO/ChangeLog-99c @@ -1,3 +1,51 @@ +Thu Oct 7 13:14:43 1999 Carlos O'Ryan <coryan@cs.wustl.edu> + + * tao/Any.h: + * tao/Any.cpp: + * tao/GIOP_Server_Request.h: + * tao/GIOP_Server_Request.i: + * tao/GIOP_Server_Request.cpp: + * tao/NVList.h: + * tao/NVList.i: + * tao/NVList.cpp: + * tao/Request.h: + * tao/Request.i: + * tao/Request.cpp: + * tao/Server_Request.h: + * tao/Stub.h: + * tao/Stub.cpp: + The implementation of efficient DSI/DII gateways is trickier + than i first thought. The problem is that the spec supports the + following use case: + + Initialize an Any with some user provided variable. + + Put the Any into an NVList + + Use the NVList in a Server_Request. + + The argument should be in the user variable after that. + Obviously lazy evaluation does not work in that case, because + the user does not invoke any operation after the invocation. + I have changed the code to use lazy evaluation *only* if a flag + is set, this flag is controlled by the application developer + using a TAO extension. Later we could figure out an automatic + way to set the flag. + Finally i simplified the marshaling and demarshaling of + arguments into Anys, by moving the code into the Any class, and + out of Stub, NVList, Request and other places it was spread + over. + I also fixed a couple of latent bugs with the implementations of + Any demarshaling. + + * tests/DSI_Gateway/test_dsi.cpp: + Use the new TAO extensions to enable lazy evaluation. + + * tests/DSI_Gateway/run_test.pl: + Fixed typo + + * tests/Param_Test/param_test_i.cpp: + Added debugging messages in the <test_short> method. + + * tests/Param_Test/run_test.pl: + Minor cosmetic fixes. + Thu Oct 7 11:46:31 1999 Carlos O'Ryan <coryan@cs.wustl.edu> * orbsvcs/orbsvcs/Event/EC_Gateway_UDP.h: diff --git a/TAO/tao/Any.cpp b/TAO/tao/Any.cpp index 234799124bf..00fd66a1f8b 100644 --- a/TAO/tao/Any.cpp +++ b/TAO/tao/Any.cpp @@ -389,6 +389,79 @@ CORBA_Any::free_value (CORBA::Environment &ACE_TRY_ENV) this->value_ = 0; } +void +CORBA_Any::_tao_encode (TAO_OutputCDR &cdr, + TAO_ORB_Core *orb_core, + CORBA::Environment &ACE_TRY_ENV) +{ + // If the Any owns the data, then we have allocated space. + if (this->value_ != 0) + { + (void) cdr.encode (this->type_, + this->value_, + 0, + ACE_TRY_ENV); + return; + } + + TAO_InputCDR in (this->cdr_, + TAO_ENCAP_BYTE_ORDER, + orb_core); + cdr.append (this->type_, + &in, + ACE_TRY_ENV); +} + +void +CORBA_Any::_tao_decode (TAO_InputCDR &cdr, + CORBA::Environment &ACE_TRY_ENV) +{ + if (this->value_ != 0) + { + // @@ Should we free that value first? + cdr.decode (this->type_, + this->value_, + 0, + ACE_TRY_ENV); + return; + } + + // @@ (JP) The following code depends on the fact that + // TAO_InputCDR does not contain chained message blocks, + // otherwise <begin> and <end> could be part of + // different buffers! + + // This will be the start of a new message block. + char *begin = cdr.rd_ptr (); + + // Skip over the next aregument. + CORBA::TypeCode::traverse_status status = + cdr.skip (this->type_, ACE_TRY_ENV); + ACE_CHECK; + + if (status != CORBA::TypeCode::TRAVERSE_CONTINUE) + { + ACE_THROW (CORBA::MARSHAL ()); + } + + // This will be the end of the new message block. + char *end = cdr.rd_ptr (); + + size_t size = end - begin; + ACE_Message_Block mb (size + ACE_CDR::MAX_ALIGNMENT); + ACE_CDR::mb_align (&mb); + ptr_arith_t offset = ptr_arith_t (begin) % ACE_CDR::MAX_ALIGNMENT; + mb.rd_ptr (offset); + mb.wr_ptr (offset + size); + ACE_OS::memcpy (mb.rd_ptr (), begin, size); + + // Stick it into the Any. It gets duplicated there. + this->_tao_replace (this->type_, + &mb, + ACE_TRY_ENV); + ACE_CHECK; +} + // insertion operators void diff --git a/TAO/tao/Any.h b/TAO/tao/Any.h index da565b972da..1b42aeafc69 100644 --- a/TAO/tao/Any.h +++ b/TAO/tao/Any.h @@ -336,6 +336,17 @@ public: TAO_default_environment ()); // Replace the value of the Any, used in the >>= operators. + void _tao_encode (TAO_OutputCDR &cdr, + TAO_ORB_Core *orb_core, + CORBA::Environment &ACE_TRY_ENV = + TAO_default_environment ()); + // Encode the contents of the Any into <cdr> + + void _tao_decode (TAO_InputCDR &cdr, + CORBA::Environment &ACE_TRY_ENV = + TAO_default_environment ()); + // Decode the <cdr> using the typecode in the Any object. + #if !defined(__GNUC__) || __GNUC__ > 2 || __GNUC_MINOR__ >= 8 typedef CORBA_Any_ptr _ptr_type; typedef CORBA_Any_var _var_type; @@ -363,9 +374,8 @@ private: void operator<<= (unsigned char); CORBA::Boolean operator>>= (unsigned char&) const; - friend class TAO_Stub; - friend class TAO_Marshal_Any; friend class CORBA_NVList; + friend class TAO_Marshal_Any; }; class TAO_Export CORBA_Any_var diff --git a/TAO/tao/GIOP_Server_Request.cpp b/TAO/tao/GIOP_Server_Request.cpp index 200509e778e..acea336087b 100644 --- a/TAO/tao/GIOP_Server_Request.cpp +++ b/TAO/tao/GIOP_Server_Request.cpp @@ -50,6 +50,7 @@ TAO_GIOP_ServerRequest:: : incoming_ (&input), outgoing_ (&output), response_expected_ (0), + lazy_evaluation_ (0), #if !defined (TAO_HAS_MINIMUM_CORBA) @@ -224,6 +225,7 @@ TAO_GIOP_ServerRequest:: incoming_ (0), outgoing_ (&output), response_expected_ (response_expected), + lazy_evaluation_ (0), #if !defined (TAO_HAS_MINIMUM_CORBA) @@ -277,13 +279,15 @@ TAO_GIOP_ServerRequest::oa (void) void TAO_GIOP_ServerRequest::arguments (CORBA::NVList_ptr &list, - CORBA::Environment &) + CORBA::Environment &ACE_TRY_ENV) { // Save params for later use when marshaling the reply. this->params_ = list; this->params_->_tao_incoming_cdr (*this->incoming_, - CORBA::ARG_IN | CORBA::ARG_INOUT); + CORBA::ARG_IN | CORBA::ARG_INOUT, + this->lazy_evaluation_, + ACE_TRY_ENV); } // Store the result value. There's either an exception, or a result, @@ -404,6 +408,7 @@ TAO_GIOP_ServerRequest::dsi_marshal (CORBA::Environment &ACE_TRY_ENV) { this->params_->_tao_encode (*this->outgoing_, this->orb_core_, + CORBA::ARG_INOUT | CORBA::ARG_OUT, ACE_TRY_ENV); ACE_CHECK; } diff --git a/TAO/tao/GIOP_Server_Request.h b/TAO/tao/GIOP_Server_Request.h index 8b2dc6834af..09248f7182a 100644 --- a/TAO/tao/GIOP_Server_Request.h +++ b/TAO/tao/GIOP_Server_Request.h @@ -126,6 +126,9 @@ public: virtual CORBA::Boolean response_expected (void) const; // is the response expected + virtual void _tao_lazy_evaluation (int lazy_evaluation); + // Set the lazy evaluation flag + virtual CORBA::Principal_ptr principal (void) const; virtual const TAO_ObjectKey &object_key (void) const; @@ -175,6 +178,9 @@ private: CORBA::Boolean response_expected_; // is it oneway or twoway + int lazy_evaluation_; + // If zero then the NVList is evaluated ASAP. + #if !defined (TAO_HAS_MINIMUM_CORBA) CORBA::NVList_ptr params_; diff --git a/TAO/tao/GIOP_Server_Request.i b/TAO/tao/GIOP_Server_Request.i index 57edfac9630..f6f3260d153 100644 --- a/TAO/tao/GIOP_Server_Request.i +++ b/TAO/tao/GIOP_Server_Request.i @@ -53,6 +53,12 @@ TAO_GIOP_ServerRequest::response_expected (void) const return this->response_expected_; } +ACE_INLINE void +TAO_GIOP_ServerRequest::_tao_lazy_evaluation (int lazy_evaluation) +{ + this->lazy_evaluation_ = lazy_evaluation; +} + ACE_INLINE CORBA::Principal_ptr TAO_GIOP_ServerRequest::principal (void) const { diff --git a/TAO/tao/NVList.cpp b/TAO/tao/NVList.cpp index cca0ebabfc7..233d06c67e6 100644 --- a/TAO/tao/NVList.cpp +++ b/TAO/tao/NVList.cpp @@ -10,6 +10,7 @@ #include "tao/Environment.h" #include "tao/ORB.h" #include "tao/debug.h" +#include "ace/Auto_Ptr.h" #if !defined (__ACE_INLINE__) # include "tao/NVList.i" @@ -231,7 +232,7 @@ CORBA::NamedValue_ptr CORBA_NVList::add_element (CORBA::Flags flags, CORBA::Environment &ACE_TRY_ENV) { - this->compute_list (ACE_TRY_ENV); + this->evaluate (ACE_TRY_ENV); ACE_CHECK_RETURN (CORBA::NamedValue::_nil ()); if (ACE_BIT_DISABLED (flags, @@ -259,7 +260,7 @@ CORBA_NVList::add_element (CORBA::Flags flags, CORBA::NamedValue_ptr CORBA_NVList::item (CORBA::ULong n, CORBA::Environment &ACE_TRY_ENV) { - this->compute_list (ACE_TRY_ENV); + this->evaluate (ACE_TRY_ENV); ACE_CHECK_RETURN (CORBA::NamedValue::_nil ()); if (n >= this->max_) // 0 based indexing @@ -272,9 +273,18 @@ CORBA_NVList::item (CORBA::ULong n, CORBA::Environment &ACE_TRY_ENV) } void -CORBA_NVList::_tao_incoming_cdr (const TAO_InputCDR &cdr, - int flag) +CORBA_NVList::_tao_incoming_cdr (TAO_InputCDR &cdr, + int flag, + int lazy_evaluation, + CORBA::Environment &ACE_TRY_ENV) { + if (!lazy_evaluation) + { + this->_tao_decode (cdr, + flag, + ACE_TRY_ENV); + return; + } ACE_GUARD (ACE_SYNCH_MUTEX, ace_mon, this->refcount_lock_); if (this->incoming_ != 0) { @@ -289,6 +299,7 @@ CORBA_NVList::_tao_incoming_cdr (const TAO_InputCDR &cdr, void CORBA_NVList::_tao_encode (TAO_OutputCDR &cdr, TAO_ORB_Core *orb_core, + int flag, CORBA::Environment &ACE_TRY_ENV) { ACE_GUARD (ACE_SYNCH_MUTEX, ace_mon, this->refcount_lock_); @@ -304,7 +315,7 @@ CORBA_NVList::_tao_encode (TAO_OutputCDR &cdr, CORBA::NamedValue_ptr nv = *item; - if (ACE_BIT_DISABLED (nv->flags (), this->incoming_flag_)) + if (ACE_BIT_DISABLED (nv->flags (), flag)) continue; if (TAO_debug_level > 3) @@ -317,7 +328,8 @@ CORBA_NVList::_tao_encode (TAO_OutputCDR &cdr, "NVList::_tao_encode - parameter <%s>\n", arg)); } - cdr.append (nv->value ()->type_, + CORBA::TypeCode_var tc = nv->value ()->type (); + cdr.append (tc.in (), this->incoming_, ACE_TRY_ENV); ACE_CHECK; @@ -341,37 +353,23 @@ CORBA_NVList::_tao_encode (TAO_OutputCDR &cdr, CORBA::NamedValue_ptr nv = *item; - if (ACE_BIT_DISABLED (nv->flags (), this->incoming_flag_)) + if (ACE_BIT_DISABLED (nv->flags (), flag)) continue; - // If the Any owns the data, then we have allocated space. - if (nv->value ()->any_owns_data_) - { - (void) cdr.encode (nv->value ()->type_, - nv->value ()->value_, 0, - ACE_TRY_ENV); - ACE_CHECK; - } - else - { - TAO_InputCDR in (nv->value ()->cdr_, - TAO_ENCAP_BYTE_ORDER, - orb_core); - cdr.append (nv->value ()->type_, &in, ACE_TRY_ENV); - ACE_CHECK; - } + nv->value ()->_tao_encode (cdr, + orb_core, + ACE_TRY_ENV); + ACE_CHECK; } } void -CORBA_NVList::compute_list (CORBA::Environment &ACE_TRY_ENV) +CORBA_NVList::_tao_decode (TAO_InputCDR &incoming, + int flag, + CORBA::Environment &ACE_TRY_ENV) { - ACE_GUARD (ACE_SYNCH_MUTEX, ace_mon, this->refcount_lock_); - if (this->incoming_ == 0) - return; - if (TAO_debug_level > 3) - ACE_DEBUG ((LM_DEBUG, "TAO (%P|%t) : NVList::compute_list\n")); + ACE_DEBUG ((LM_DEBUG, "TAO (%P|%t) : NVList::_tao_decode\n")); // Then unmarshal each "in" and "inout" parameter. ACE_Unbounded_Queue_Iterator<CORBA::NamedValue_ptr> i (this->values_); @@ -387,74 +385,48 @@ CORBA_NVList::compute_list (CORBA::Environment &ACE_TRY_ENV) // @@ this is where we assume that the NVList is coming from // a Server-side request, we could probably handle both // cases with a flag, but there is no clear need for that. - if (ACE_BIT_DISABLED (nv->flags (), this->incoming_flag_)) + if (ACE_BIT_DISABLED (nv->flags (), flag)) continue; if (TAO_debug_level > 3) ACE_DEBUG ((LM_DEBUG, - "TAO (%P|%t) : NVList::compute_list - %s\n", + "TAO (%P|%t) : NVList::_tao_decode - %s\n", nv->name ()?nv->name ():"(no name given)" )); CORBA::Any_ptr any = nv->value (); - CORBA::TypeCode_var tc = any->type (); - - // @@ (JP) The following code depends on the fact that - // TO_InputCDR does not contain chained message blocks, - // otherwise <begin> and <end> could be part of - // different buffers! - - // This will be the start of a new message block. - char *begin = this->incoming_->rd_ptr (); - - // Skip over the next aregument. - CORBA::TypeCode::traverse_status status = - this->incoming_->skip (tc.in (), ACE_TRY_ENV); - ACE_CHECK; - - if (status != CORBA::TypeCode::TRAVERSE_CONTINUE) - { - if (TAO_debug_level > 0) - { - const char* param_name = nv->name (); - if (param_name == 0) - param_name = "(no name given)"; - - ACE_ERROR ((LM_ERROR, - "CORBA_NVList::compute_list - problem while" - " decoding parameter <%s>\n", param_name)); - } - return; - } - - // This will be the end of the new message block. - char *end = this->incoming_->rd_ptr (); - - // Allocate the new message block and set its endpoints. - ACE_Message_Block cdr (end - begin); - - cdr.rd_ptr (begin); - - cdr.wr_ptr (end); - - // Stick it into the Any. It gets duplicated there. - any->_tao_replace (tc.in (), - &cdr, - ACE_TRY_ENV); + any->_tao_decode (incoming, + ACE_TRY_ENV); ACE_CHECK; } +} - delete this->incoming_; +void +CORBA_NVList::evaluate (CORBA::Environment &ACE_TRY_ENV) +{ + ACE_GUARD (ACE_SYNCH_MUTEX, ace_mon, this->refcount_lock_); + if (this->incoming_ == 0) + return; + + auto_ptr<TAO_InputCDR> incoming (this->incoming_); this->incoming_ = 0; + + this->_tao_decode (*(incoming.get ()), + this->incoming_flag_, + ACE_TRY_ENV); } #if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) template class ACE_Node<CORBA::NamedValue_ptr>; template class ACE_Unbounded_Queue<CORBA::NamedValue_ptr>; template class ACE_Unbounded_Queue_Iterator<CORBA::NamedValue_ptr>; +template class ACE_Auto_Basic_Ptr<TAO_InputCDR>; +template class auto_ptr<TAO_InputCDR>; #elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) #pragma instantiate ACE_Node<CORBA::NamedValue_ptr> #pragma instantiate ACE_Unbounded_Queue<CORBA::NamedValue_ptr> #pragma instantiate ACE_Unbounded_Queue_Iterator<CORBA::NamedValue_ptr> +#pragma instantiate ACE_Auto_Basic_Ptr<TAO_InputCDR> +#pragma instantiate auto_ptr<TAO_InputCDR> #endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ #endif /* TAO_HAS_MINIMUM_CORBA */ diff --git a/TAO/tao/NVList.h b/TAO/tao/NVList.h index 8af2dcd1f41..57b8dc0429f 100644 --- a/TAO/tao/NVList.h +++ b/TAO/tao/NVList.h @@ -240,8 +240,10 @@ public: // = TAO Extensions: - void _tao_incoming_cdr (const TAO_InputCDR &cdr, - int flag); + void _tao_incoming_cdr (TAO_InputCDR &cdr, + int flag, + int lazy_evaluation, + CORBA::Environment &ACE_TRY_ENV); // Set the incoming CDR stream, this is used by TAO to perform lazy // evaluation of the NVList in an incoming ServerRequest. // The <flag> is used to check which parameters (IN, OUT and/or @@ -249,9 +251,16 @@ public: void _tao_encode (TAO_OutputCDR &cdr, TAO_ORB_Core *orb_core, + int flag, CORBA::Environment &ACE_TRY_ENV = TAO_default_environment ()); - // Encode the NVList into the + // Encode the NVList into the CDR stream. <flag> masks the type of + // arguments (IN, OUT or INOUT) that are to be marshaled. + + void _tao_decode (TAO_InputCDR &cdr, + int flag, + CORBA::Environment &ACE_TRY_ENV); + // Decode the NVList arguments from the <cdr> stream. // Useful for template programming. #if !defined(__GNUC__) || __GNUC__ > 2 || __GNUC_MINOR__ >= 8 @@ -270,7 +279,7 @@ private: // helper to increase the list size. This is used by all the add_ // methods of the NVList class - void compute_list (CORBA::Environment &ACE_TRY_ENV); + void evaluate (CORBA::Environment &ACE_TRY_ENV); // Lazy evaluation routine to fill up the Anys in the NVList from // the CDR stream. diff --git a/TAO/tao/NVList.i b/TAO/tao/NVList.i index 56349e0089d..02b967a4094 100644 --- a/TAO/tao/NVList.i +++ b/TAO/tao/NVList.i @@ -249,7 +249,7 @@ CORBA_NVList::CORBA_NVList (void) ACE_INLINE CORBA::ULong CORBA_NVList::count (CORBA_Environment &ACE_TRY_ENV) const { - (ACE_const_cast(CORBA_NVList*,this))->compute_list (ACE_TRY_ENV); + (ACE_const_cast(CORBA_NVList*,this))->evaluate (ACE_TRY_ENV); ACE_CHECK_RETURN (0); return this->max_; diff --git a/TAO/tao/Request.cpp b/TAO/tao/Request.cpp index 119113496eb..5bc099e8a16 100644 --- a/TAO/tao/Request.cpp +++ b/TAO/tao/Request.cpp @@ -56,7 +56,8 @@ CORBA_Request::CORBA_Request (CORBA::Object_ptr obj, env_ (ACE_TRY_ENV), contexts_ (0), ctx_ (0), - refcount_ (1) + refcount_ (1), + lazy_evaluation_ (0) { target_ = CORBA::Object::_duplicate (obj); opname_ = CORBA::string_dup (op); @@ -69,7 +70,8 @@ CORBA_Request::CORBA_Request (CORBA::Object_ptr obj, env_ (ACE_TRY_ENV), contexts_ (0), ctx_ (0), - refcount_ (1) + refcount_ (1), + lazy_evaluation_ (0) { target_ = CORBA::Object::_duplicate (obj); opname_ = CORBA::string_dup (op); @@ -101,12 +103,13 @@ CORBA_Request::invoke (CORBA::Environment &ACE_TRY_ENV) { TAO_Stub *stub = this->target_->_stubobj (); - stub->do_dynamic_call ((char *) opname_, + stub->do_dynamic_call ((char *) this->opname_, 1, - args_, - result_, - flags_, - exceptions_, + this->args_, + this->result_, + this->flags_, + this->exceptions_, + this->lazy_evaluation_, ACE_TRY_ENV); } @@ -117,10 +120,11 @@ CORBA_Request::send_oneway (CORBA::Environment &ACE_TRY_ENV) stub->do_dynamic_call ((char *) opname_, 0, - args_, - result_, - flags_, - exceptions_, + this->args_, + this->result_, + this->flags_, + this->exceptions_, + this->lazy_evaluation_, ACE_TRY_ENV); } diff --git a/TAO/tao/Request.h b/TAO/tao/Request.h index ddf66b63447..d0d944b1a2a 100644 --- a/TAO/tao/Request.h +++ b/TAO/tao/Request.h @@ -123,6 +123,9 @@ public: CORBA::ULong _incr_refcnt (void); CORBA::ULong _decr_refcnt (void); + void _tao_lazy_evaluation (int lazy_evaluation); + // Set the lazy evaluation flag + #if !defined(__GNUC__) || __GNUC__ > 2 || __GNUC_MINOR__ >= 8 typedef CORBA_Request_ptr _ptr_type; typedef CORBA_Request_var _var_type; @@ -181,6 +184,9 @@ private: ACE_SYNCH_MUTEX refcount_lock_; // protect the reference count + + int lazy_evaluation_; + // If not zero then the NVList is not evaluated by default }; typedef CORBA_Request* CORBA_Request_ptr; diff --git a/TAO/tao/Request.i b/TAO/tao/Request.i index 2e9c42c7a70..5d818ec5b01 100644 --- a/TAO/tao/Request.i +++ b/TAO/tao/Request.i @@ -139,7 +139,13 @@ CORBA_Request::ctx (void) const ACE_INLINE void CORBA_Request::ctx (CORBA::Context_ptr ctx) { - ACE_UNUSED_ARG (ctx); + this->ctx_ = ctx; +} + +ACE_INLINE void +CORBA_Request::_tao_lazy_evaluation (int lazy_evaluation) +{ + this->lazy_evaluation_ = lazy_evaluation; } // ************************************************************* diff --git a/TAO/tao/Server_Request.h b/TAO/tao/Server_Request.h index 9ff3467ba29..74be359edcb 100644 --- a/TAO/tao/Server_Request.h +++ b/TAO/tao/Server_Request.h @@ -208,6 +208,9 @@ public: virtual CORBA::Boolean response_expected (void) const = 0; // is the response expected + virtual void _tao_lazy_evaluation (int lazy_evaluation) = 0; + // Set the lazy evaluation flag + #if !defined(__GNUC__) || __GNUC__ > 2 || __GNUC_MINOR__ >= 8 typedef CORBA::ServerRequest_ptr _ptr_type; #endif /* __GNUC__ */ diff --git a/TAO/tao/Stub.cpp b/TAO/tao/Stub.cpp index 81906a080d4..14ebb6012a3 100644 --- a/TAO/tao/Stub.cpp +++ b/TAO/tao/Stub.cpp @@ -532,6 +532,7 @@ TAO_Stub::do_dynamic_call (const char *opname, CORBA::NamedValue_ptr result, CORBA::Flags, CORBA::ExceptionList &exceptions, + int lazy_evaluation, CORBA::Environment &ACE_TRY_ENV) { TAO_Synchronous_Cancellation_Required NOT_USED; @@ -602,58 +603,15 @@ TAO_Stub::do_dynamic_call (const char *opname, if (result != 0) { - if (!result->value ()->value_) - { - // storage was not allocated. In this case, we - // simply grab the portion of the CDR stream - // that contained this parameter, The - // application should use the appropriate >>= - // operator to retrieve the value - - TAO_InputCDR temp (call.inp_stream ()); - CORBA::Any *any = result->value (); - - // @@ Again, this code does not work if the input CDR - // stream is not a single message block. - char *begin = call.inp_stream ().rd_ptr (); - // skip the parameter to get the ending position - CORBA::TypeCode::traverse_status retval = - temp.skip (any->type_, ACE_TRY_ENV); - ACE_CHECK; - - if (retval == CORBA::TypeCode::TRAVERSE_CONTINUE) - { - char *end = temp.rd_ptr (); - ACE_NEW (any->cdr_, - ACE_Message_Block (end - begin)); - any->cdr_->wr_ptr (end - begin); - TAO_OutputCDR out (any->cdr_); - retval = out.append (any->type_, - &call.inp_stream (), - ACE_TRY_ENV); - ACE_CHECK; - - if (retval == CORBA::TypeCode::TRAVERSE_CONTINUE) - { - any->value_ = 0; - any->any_owns_data_ = 0; - } - } - } - else - { - // the application had allocated the top level - // storage. We simply retrieve the data - (void) call.inp_stream ().decode (result->value ()->type_, - result->value ()->value_, - 0, - ACE_TRY_ENV); - ACE_CHECK; - } + result->value ()->_tao_decode (call.inp_stream (), + ACE_TRY_ENV); + ACE_CHECK; } args->_tao_incoming_cdr (call.inp_stream (), - CORBA::ARG_OUT | CORBA::ARG_INOUT); + CORBA::ARG_OUT | CORBA::ARG_INOUT, + lazy_evaluation, + ACE_TRY_ENV); } else { @@ -693,10 +651,10 @@ TAO_Stub::put_params (TAO_GIOP_Invocation &call, CORBA::NVList_ptr args, CORBA::Environment &ACE_TRY_ENV) { - TAO_OutputCDR &cdr = call.out_stream (); - - // First try to use the optimized marshaling - args->_tao_encode (cdr, this->orb_core_, ACE_TRY_ENV); + args->_tao_encode (call.out_stream (), + this->orb_core_, + CORBA::ARG_IN | CORBA::ARG_INOUT, + ACE_TRY_ENV); } #endif /* TAO_HAS_MINIMUM_CORBA */ diff --git a/TAO/tao/Stub.h b/TAO/tao/Stub.h index e0943bf785f..472f3df3b48 100644 --- a/TAO/tao/Stub.h +++ b/TAO/tao/Stub.h @@ -247,6 +247,7 @@ public: CORBA::NamedValue_ptr result, CORBA::Flags flags, CORBA::ExceptionList &exceptions, + int lazy_evaluation, CORBA_Environment &ACE_TRY_ENV = TAO_default_environment ()); // Dynamic invocations use a more costly "varargs" calling diff --git a/TAO/tests/DSI_Gateway/run_test.pl b/TAO/tests/DSI_Gateway/run_test.pl index ccc040cf8bf..d2b21f51186 100755 --- a/TAO/tests/DSI_Gateway/run_test.pl +++ b/TAO/tests/DSI_Gateway/run_test.pl @@ -19,7 +19,7 @@ if (ACE::waitforfile_timed ($svfile, 5) == -1) { } $gwfile = "gateway.ior"; -$GW = Process::Create ($EXEPREFIX."gatewat$EXE_EXT ", +$GW = Process::Create ($EXEPREFIX."gateway$EXE_EXT ", " -k file://$svfile" . " -o $gwfile"); diff --git a/TAO/tests/DSI_Gateway/test_dsi.cpp b/TAO/tests/DSI_Gateway/test_dsi.cpp index 482e1846977..a55e64fd02d 100644 --- a/TAO/tests/DSI_Gateway/test_dsi.cpp +++ b/TAO/tests/DSI_Gateway/test_dsi.cpp @@ -101,6 +101,7 @@ DSI_Simple_Server::test_method_impl (CORBA::ServerRequest_ptr request, list->add_value ("the_out_structure", the_out_structure, CORBA::ARG_OUT ); list->add_value ("name" , name , CORBA::ARG_INOUT); + request->_tao_lazy_evaluation (1); request->arguments (list, ACE_TRY_ENV); ACE_CHECK; @@ -123,6 +124,8 @@ DSI_Simple_Server::test_method_impl (CORBA::ServerRequest_ptr request, ACE_TRY_ENV); ACE_CHECK; + target_request->_tao_lazy_evaluation (1); + target_request->invoke (ACE_TRY_ENV); ACE_CHECK; diff --git a/TAO/tests/Param_Test/param_test_i.cpp b/TAO/tests/Param_Test/param_test_i.cpp index 271f6e6624f..2e81c0a3dc4 100644 --- a/TAO/tests/Param_Test/param_test_i.cpp +++ b/TAO/tests/Param_Test/param_test_i.cpp @@ -79,6 +79,12 @@ Param_Test_i::test_short (CORBA::Short s1, { s2 = (CORBA::Short) (s1 * 2); s3 = (CORBA::Short) (s1 * 3); + if (TAO_debug_level > 0) + { + ACE_DEBUG ((LM_DEBUG, "\n*=*=*=*SERVER SIDE=*=*=*=*=*=*=\n")); + ACE_DEBUG ((LM_DEBUG, " in = %d, inout = %d, out = %d\n", + s1, s2, s3)); + } return (CORBA::Short) (s1 * 4); } diff --git a/TAO/tests/Param_Test/run_test.pl b/TAO/tests/Param_Test/run_test.pl index dd9e0527bce..489cef322c6 100755 --- a/TAO/tests/Param_Test/run_test.pl +++ b/TAO/tests/Param_Test/run_test.pl @@ -35,8 +35,8 @@ sub run_test } $CL = Process::Create ($EXEPREFIX."client".$EXE_EXT, - " $debug -f $iorfile -i $invocation -t ". - "$type -n $num -x"); + " $debug -f $iorfile -i $invocation " + . "-t $type -n $num -x"); $client = $CL->TimedWait (60); if ($client == -1) { |