diff options
author | parsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2003-07-22 18:08:33 +0000 |
---|---|---|
committer | parsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2003-07-22 18:08:33 +0000 |
commit | 25e99dd1241827087d36a4547a50c3004df40af2 (patch) | |
tree | ed0b13360de71e961b5b1a8564a59f61a50be669 | |
parent | d4f1ed3cda6ec8e6e0e675de24ce37877ab7eb49 (diff) | |
download | ATCD-25e99dd1241827087d36a4547a50c3004df40af2.tar.gz |
ChangeLogTag: Tue Jul 22 13:02:16 2003 Jeff Parsons <j.parsons@vanderbilt.edu>
11 files changed, 276 insertions, 530 deletions
diff --git a/TAO/ChangeLog_ref b/TAO/ChangeLog_ref index 5d0257fb88f..677f9f67ad0 100644 --- a/TAO/ChangeLog_ref +++ b/TAO/ChangeLog_ref @@ -1,3 +1,23 @@ +Tue Jul 22 13:02:16 2003 Jeff Parsons <j.parsons@vanderbilt.edu> + + * TAO_IDL/be/be_visitor_interface/interface_ss.cpp: + * TAO_IDL/be/be_visitor_interface/strategized_proxy_broker_ss.cpp: + * TAO_IDL/be/be_visitor_interface/thru_poa_proxy_impl_ss.cpp: + * TAO_IDL/be/be_visitor_operation/operation.cpp: + * TAO_IDL/be/be_visitor_operation/thru_poa_proxy_impl_ss.cpp: + * TAO_IDL/be_include/be_visitor_interface/strategized_proxy_broker_ss.h: + * TAO_IDL/be_include/be_visitor_operation/operation.h: + + Modified skeleton-side generated source files to match + Bala's latest hand-crafted changes to support collocation. + + * tao/Collocation_Proxy_Broker.h (dispatch): + + Changed the type of the 'op_len' parameter (which holds the + length of the operation string name) from int to size_t, since + the latter type is returned from strlen(). Also changed + instances of Object * to Object_ptr. + Mon Jul 21 21:36:44 2003 Jeff Parsons <j.parsons@vanderbilt.edu> * TAO_IDL/be/be_visitor_interface/strategized_proxy_broker_sh.cpp: diff --git a/TAO/TAO_IDL/be/be_visitor_interface/interface_ss.cpp b/TAO/TAO_IDL/be/be_visitor_interface/interface_ss.cpp index 19c0747a6db..211c593fba4 100644 --- a/TAO/TAO_IDL/be/be_visitor_interface/interface_ss.cpp +++ b/TAO/TAO_IDL/be/be_visitor_interface/interface_ss.cpp @@ -563,53 +563,40 @@ int be_visitor_interface_ss::generate_proxy_classes (be_interface *node) { TAO_OutStream *os = this->ctx_->stream (); + be_visitor_context ctx; // Strategized Proxy Broker Implementation. - be_visitor_context ctx = *this->ctx_; - - ctx.state (TAO_CodeGen::TAO_INTERFACE_INTERCEPTORS_SS); - be_visitor_interface_interceptors_ss ii_visitor (&ctx); - - if (node->accept (&ii_visitor) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_interface_cs::" - "generate_proxy_classes - " - "codegen for interceptors classes failed\n"), - -1); - } - if (be_global->gen_thru_poa_collocation () || be_global->gen_direct_collocation ()) { - ctx = (*this->ctx_); + ctx = *this->ctx_; be_visitor_interface_strategized_proxy_broker_ss ispb_visitor (&ctx); if (node->accept (&ispb_visitor) == -1) { ACE_ERROR_RETURN ((LM_ERROR, - "be_visitor_interface_cs::" + "be_visitor_interface_ss::" "generate_proxy_classes - " "codegen for Base Proxy Broker class failed\n"), -1); } *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl - << "// " << __FILE__ << ":" << __LINE__ << be_nl; + << "// " << __FILE__ << ":" << __LINE__; - // Proxy Broker Factory Function. - *os << be_nl - << node->full_base_proxy_broker_name () << " *" << be_nl + // Proxy Broker Factory Function. + *os << be_nl << be_nl + << "TAO::Collocation_Proxy_Broker *" << be_nl << node->flat_client_enclosing_scope () << node->base_proxy_broker_name () - << "_Factory_function (CORBA::Object_ptr obj)" << be_nl + << "_Factory_function (CORBA::Object_ptr)" << be_nl << "{" << be_idt_nl - << "ACE_UNUSED_ARG (obj);" << be_nl - << "return ::" + << "return" << be_idt_nl + << "::" << node->full_strategized_proxy_broker_name () << "::" <<"the" << node->strategized_proxy_broker_name () - << "();" << be_uidt_nl + << "();" << be_uidt << be_uidt_nl << "}" << be_nl << be_nl; // Proxy Broker Function Pointer Initializer. @@ -630,17 +617,20 @@ be_visitor_interface_ss::generate_proxy_classes (be_interface *node) << "return 0;" << be_uidt_nl << "}" << be_nl << be_nl; - - *os << "static int " << node->flat_client_enclosing_scope () + *os << "static int" << be_nl + << node->flat_client_enclosing_scope () << node->base_proxy_broker_name () - << "_Stub_Factory_Initializer_Scarecrow = " << be_idt_nl + << "_Stub_Factory_Initializer_Scarecrow =" << be_idt_nl << node->flat_client_enclosing_scope () << node->base_proxy_broker_name () - << "_Factory_Initializer (ACE_reinterpret_cast (size_t, " + << "_Factory_Initializer (" << be_idt << be_idt_nl + << "ACE_reinterpret_cast (" << be_idt << be_idt_nl + << "size_t," << be_nl << node->flat_client_enclosing_scope () << node->base_proxy_broker_name () - << "_Factory_Initializer));" - << be_uidt_nl << be_nl; + << "_Factory_Initializer" << be_uidt_nl + << ")" << be_uidt << be_uidt_nl + << ");" << be_uidt << be_uidt_nl << be_nl; } diff --git a/TAO/TAO_IDL/be/be_visitor_interface/strategized_proxy_broker_sh.cpp b/TAO/TAO_IDL/be/be_visitor_interface/strategized_proxy_broker_sh.cpp index 575a5d8da2c..7de556e7c1c 100644 --- a/TAO/TAO_IDL/be/be_visitor_interface/strategized_proxy_broker_sh.cpp +++ b/TAO/TAO_IDL/be/be_visitor_interface/strategized_proxy_broker_sh.cpp @@ -37,8 +37,9 @@ be_visitor_interface_strategized_proxy_broker_sh::visit_interface ( << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl; *os << "class " << be_global->skel_export_macro () << " " - << node->strategized_proxy_broker_name () << " : public virtual " - << "::" << node->full_base_proxy_broker_name () << be_nl << "{" + << node->strategized_proxy_broker_name () << be_idt_nl + << ": public virtual " + << "TAO::Collocation_Proxy_Broker" << be_uidt_nl << "{" << be_nl << "public: " << be_idt; @@ -66,7 +67,7 @@ be_visitor_interface_strategized_proxy_broker_sh::visit_interface ( << "TAO::Argument ** args," << be_nl << "int num_args," << be_nl << "const char * op," << be_nl - << "int op_len," << be_nl + << "size_t op_len," << be_nl << "TAO::Collocation_Strategy strategy" << be_nl << "ACE_ENV_ARG_DECL" << be_uidt_nl << ")" << be_nl diff --git a/TAO/TAO_IDL/be/be_visitor_interface/strategized_proxy_broker_ss.cpp b/TAO/TAO_IDL/be/be_visitor_interface/strategized_proxy_broker_ss.cpp index 2d553173a64..e740be20c01 100644 --- a/TAO/TAO_IDL/be/be_visitor_interface/strategized_proxy_broker_ss.cpp +++ b/TAO/TAO_IDL/be/be_visitor_interface/strategized_proxy_broker_ss.cpp @@ -41,7 +41,8 @@ be_visitor_interface_strategized_proxy_broker_ss::visit_interface ( *os << "// Factory function Implementation." << be_nl << node->full_strategized_proxy_broker_name () - << " *" << node->full_strategized_proxy_broker_name () << "::the" + << " *" << be_nl + << node->full_strategized_proxy_broker_name () << "::the" << node->strategized_proxy_broker_name () << " (void)" << be_nl << "{" << be_idt_nl @@ -53,141 +54,94 @@ be_visitor_interface_strategized_proxy_broker_ss::visit_interface ( // Constructor Implementation. *os << node->full_strategized_proxy_broker_name () << "::" << node->strategized_proxy_broker_name () << " (void)" << be_nl - << "{" << be_idt_nl - << "for (int i = 0; i < TAO_Collocation_Strategies::CS_LAST; ++i)" - << be_idt_nl - << "{" << be_idt_nl - << "this->proxy_cache_[i] = 0;" << be_uidt_nl - << "}" - << be_uidt << be_uidt_nl + << "{" << be_nl << "}" << be_nl << be_nl; // Destructor Implementation. *os << node->full_strategized_proxy_broker_name () << "::~" << node->strategized_proxy_broker_name () << " (void)" << be_nl - << "{" << be_idt_nl - << "for (int i = 0; i < TAO_Collocation_Strategies::CS_LAST; ++i)" - << be_idt_nl - << "{" << be_idt_nl - << "delete this->proxy_cache_[i];" - << be_nl << be_nl - << "// Hack to prevent bug mentioned in 1204. Refer to 1204" - << be_nl - << "// for details.." - << be_nl - << "this->proxy_cache_[i] = 0;" - << be_uidt_nl - << "}" - << be_uidt << be_uidt_nl + << "{" << be_nl << "}" << be_nl << be_nl; - // select_proxy impementation - *os << node->full_base_proxy_impl_name () << "&" << be_nl + // get_strategy() impementation. + *os << "TAO::Collocation_Strategy" << be_nl <<node->full_strategized_proxy_broker_name () << "::" - << "select_proxy (" - << be_idt << be_idt_nl - << "::" << node->full_name () << " *object" << be_nl - << "ACE_ENV_ARG_DECL" - << be_uidt_nl - << ")" - << be_uidt_nl - << "{" - << be_idt_nl - << "int strategy =" - << be_idt_nl - << "TAO_ORB_Core::collocation_strategy (object ACE_ENV_ARG_PARAMETER);" - << be_uidt_nl - << "ACE_CHECK_RETURN (*this->proxy_cache_[strategy]);" - << be_nl << be_nl - << "if (this->proxy_cache_[strategy] != 0)" - << be_idt_nl + << "get_strategy (" << be_idt << be_idt_nl + << "CORBA::Object_ptr obj" << be_nl + << "ACE_ENV_ARG_DECL" << be_uidt_nl + << ")" << be_nl + << "ACE_THROW_SPEC ((CORBA::SystemException))" << be_uidt_nl << "{" << be_idt_nl - << "return *this->proxy_cache_[strategy];" << be_uidt_nl - << "}" - << be_uidt_nl << be_nl - << "this->create_proxy (strategy ACE_ENV_ARG_PARAMETER);" - << be_nl - << "ACE_CHECK_RETURN (*this->proxy_cache_[strategy]);" - << be_nl << be_nl - << "return *this->proxy_cache_[strategy];" + << "TAO::Collocation_Strategy strategy =" << be_idt_nl + << "TAO_ORB_Core::collocation_strategy_new (obj ACE_ENV_ARG_PARAMETER);" << be_uidt_nl + << "ACE_CHECK_RETURN (TAO::TAO_CS_REMOTE_STRATEGY);" << be_nl << be_nl + << "return strategy;" << be_uidt_nl << "}" << be_nl << be_nl; // create_proxy implementation - *os << "void " << be_nl - <<node->full_strategized_proxy_broker_name () << "::" - << "create_proxy (" - << be_idt << be_idt_nl - << "int strategy" - << be_nl - << "ACE_ENV_ARG_DECL" - << be_uidt_nl - << ")" - << be_uidt_nl - << "{" - << be_idt_nl - << "ACE_GUARD (TAO_SYNCH_MUTEX, guard, this->mutex_);" - << be_nl << be_nl - << "if (this->proxy_cache_[strategy] == 0)" - << be_idt_nl - << "{" - << be_idt_nl - << "switch (strategy)" - << be_idt_nl - << "{" << be_nl; + *os << "void" << be_nl + << node->full_strategized_proxy_broker_name () << "::" + << "dispatch (" << be_idt << be_idt_nl + << "CORBA::Object_ptr obj," << be_nl + << "CORBA::Object_out forward_obj," << be_nl + << "TAO::Argument ** args," << be_nl + << "int num_args," << be_nl + << "const char * op," << be_nl + << "size_t op_len," << be_nl + << "TAO::Collocation_Strategy strategy" << be_nl + << "ACE_ENV_ARG_DECL" << be_uidt_nl + << ")" << be_nl + << "ACE_THROW_SPEC ((CORBA::SystemException))" << be_uidt_nl + << "{" << be_idt_nl + << "ACE_TRY" << be_idt_nl + << "{" << be_idt_nl + << "switch (strategy)" << be_idt_nl + << "{" << be_idt_nl; if (be_global->gen_thru_poa_collocation ()) { - *os << "case TAO_Collocation_Strategies::CS_THRU_POA_STRATEGY:" - << be_idt_nl - << "ACE_NEW_THROW_EX (" - << be_idt << be_idt_nl - << "this->proxy_cache_[strategy]," << be_nl - << node->full_thru_poa_proxy_impl_name () << "," << be_nl - << "CORBA::NO_MEMORY ()" - << be_uidt << be_uidt_nl - << ");" << be_nl - << "ACE_CHECK;" << be_nl - << "break;" - << be_nl << be_uidt_nl; - } + *os << "case TAO::TAO_CS_THRU_POA_STRATEGY:" << be_idt_nl + << "// Here is where we need table lookups." << be_nl; + + this->gen_thru_poa_operations (node, os); + + *os << "break;" << be_uidt_nl; + } if (be_global->gen_direct_collocation ()) { - *os << "case TAO_Collocation_Strategies::CS_DIRECT_STRATEGY:" - << be_idt_nl - << "ACE_NEW_THROW_EX (" - << be_idt << be_idt_nl - << "this->proxy_cache_[strategy]," << be_nl - << node->full_direct_proxy_impl_name () << "," << be_nl - << "CORBA::NO_MEMORY ()" - << be_uidt << be_uidt_nl - << ");" << be_nl - << "ACE_CHECK;" << be_nl - << "break;" - << be_nl << be_uidt_nl; - } + *os << "case TAO::TAO_CS_DIRECT_STRATEGY:" << be_idt_nl; + + this->gen_direct_operations (node, os); - *os << "case TAO_Collocation_Strategies::CS_REMOTE_STRATEGY:" << be_nl - << "default:" + *os << "break;" << be_uidt_nl; + } + + *os << "default:" << be_idt_nl + << "ACE_THROW (CORBA::INTERNAL ());" << be_uidt << be_uidt_nl + << "}" << be_uidt << be_uidt_nl + << "}" << be_uidt + << "\n#if (TAO_HAS_MINIMUM_CORBA == 0)" << be_nl + << "ACE_CATCH (PortableServer::ForwardRequest, forward_request)" << be_idt_nl - << "ACE_NEW_THROW_EX (" - << be_idt << be_idt_nl - << "this->proxy_cache_[strategy]," << be_nl - << "::" << node->full_remote_proxy_impl_name () << "," << be_nl - << "CORBA::NO_MEMORY ()" - << be_uidt << be_uidt_nl - << ");" << be_nl - << "ACE_CHECK;" << be_nl - << "break;" + << "{" << be_idt_nl + << "forward_obj =" << be_idt_nl + << "CORBA::Object::_duplicate (forward_request.forward_reference.in ());" << be_uidt_nl - << "}" - << be_uidt << be_uidt_nl - << "}" - << be_uidt << be_uidt_nl - << "}" << be_nl; - - *os << be_nl + << "return;" << be_uidt_nl + << "}" << be_uidt + << "\n#else" << be_nl + << "ACE_CATCHANY" << be_idt_nl + << "{" << be_idt_nl + << "ACE_UNUSED_ARG (forward_obj);" << be_nl + << "ACE_RE_THROW;" << be_uidt_nl + << "}" << be_uidt + << "\n#endif /* TAO_HAS_MINIMUM_CORBA */" << be_nl + << "ACE_ENDTRY;" << be_uidt_nl + << "}"; + + *os << be_nl << be_nl << "//" << be_nl << "// End Strategized Proxy Broker Implementation" << be_nl << "///////////////////////////////////////////////////////////////////////"; @@ -195,10 +149,62 @@ be_visitor_interface_strategized_proxy_broker_ss::visit_interface ( return 0; } -int be_visitor_interface_strategized_proxy_broker_ss::visit_component ( +int +be_visitor_interface_strategized_proxy_broker_ss::visit_component ( be_component *node ) { return this->visit_interface (node); } +void +be_visitor_interface_strategized_proxy_broker_ss::gen_thru_poa_operations ( + be_interface *node, + TAO_OutStream *os + ) +{ + int index = 0; + AST_Decl *d = 0; + + for (UTL_ScopeActiveIterator si (node, UTL_Scope::IK_decls); + !si.is_done (); + si.next ()) + { + d = si.item (); + + if (d->node_type () != AST_Decl::NT_op) + { + continue; + } + + if (index != 0) + { + *os << "else "; + } + + ++index; + + *os << "if (ACE_OS::strcmp (op, \"" << d->local_name () << "\") == 0)" + << be_idt_nl + << "{" << be_idt_nl + << node->full_thru_poa_proxy_impl_name () << "::" + << d->local_name () << " (" << be_idt << be_idt_nl + << "obj," << be_nl + << "forward_obj," << be_nl + << "args," << be_nl + << "num_args" << be_nl + << "ACE_ENV_ARG_DECL" << be_uidt_nl + << ");" << be_uidt_nl + << "ACE_TRY_CHECK;" << be_uidt_nl + << "}" << be_uidt_nl; + } +} + +void +be_visitor_interface_strategized_proxy_broker_ss::gen_direct_operations ( + be_interface *node, + TAO_OutStream *os + ) +{ +} + diff --git a/TAO/TAO_IDL/be/be_visitor_interface/thru_poa_proxy_impl_ss.cpp b/TAO/TAO_IDL/be/be_visitor_interface/thru_poa_proxy_impl_ss.cpp index a9ab00f56be..baf41b38392 100644 --- a/TAO/TAO_IDL/be/be_visitor_interface/thru_poa_proxy_impl_ss.cpp +++ b/TAO/TAO_IDL/be/be_visitor_interface/thru_poa_proxy_impl_ss.cpp @@ -50,11 +50,12 @@ be_visitor_interface_thru_poa_proxy_impl_ss::visit_interface ( ACE_ERROR_RETURN ((LM_ERROR, "be_visitor_interface_ss::" "visit_interface - " - "codegen for Base Proxy Broker class failed\n"), + "codegen for ThruPOA Proxy Impl failed\n"), -1); } - *os << "//\n" + *os << be_nl << be_nl + << "//\n" << "// End ThruPOA Proxy Implementation\n" << "///////////////////////////////////////////////////////////////////////"; diff --git a/TAO/TAO_IDL/be/be_visitor_operation/operation.cpp b/TAO/TAO_IDL/be/be_visitor_operation/operation.cpp index a63791945aa..5b2e32b3596 100644 --- a/TAO/TAO_IDL/be/be_visitor_operation/operation.cpp +++ b/TAO/TAO_IDL/be/be_visitor_operation/operation.cpp @@ -451,7 +451,8 @@ be_visitor_operation::gen_stub_operation_body ( *os << "TAO::Arg_Traits<"; - this->gen_arg_template_param_name (return_type, os); + this->gen_arg_template_param_name (return_type, + os); *os << ">::stub_ret_val _tao_retval;"; @@ -468,7 +469,8 @@ be_visitor_operation::gen_stub_operation_body ( *os << be_nl << "TAO::Arg_Traits<"; - this->gen_arg_template_param_name (arg->field_type (), os); + this->gen_arg_template_param_name (arg->field_type (), + os); *os << ">::"; diff --git a/TAO/TAO_IDL/be/be_visitor_operation/operation_ss.cpp b/TAO/TAO_IDL/be/be_visitor_operation/operation_ss.cpp index a03d77e4b03..fa231cac6c2 100644 --- a/TAO/TAO_IDL/be/be_visitor_operation/operation_ss.cpp +++ b/TAO/TAO_IDL/be/be_visitor_operation/operation_ss.cpp @@ -197,103 +197,6 @@ be_visitor_operation_ss::visit_operation (be_operation *node) -1); } - // Fish out the interceptors. - *os << "\n\n#if (TAO_HAS_INTERCEPTORS == 1)" << be_nl; - - // Cast the Servant_Upcall pointer. - *os << "TAO_Object_Adapter::Servant_Upcall *_tao_upcall =" << be_idt_nl - << "ACE_static_cast (TAO_Object_Adapter::Servant_Upcall *, " - << "_tao_servant_upcall);" - << be_uidt_nl << be_nl; - - *os << "TAO_ServerRequestInterceptor_Adapter _tao_vfr (" - << be_idt << be_idt_nl - << "_tao_server_request.orb_core ()->server_request_interceptors ()," - << be_nl - << "_tao_server_request.interceptor_count ()" << be_uidt_nl - << ");" << be_uidt_nl << be_nl; - - *os << "TAO_ServerRequestInfo_" << node->flat_name (); - - // We need the interface node in which this operation was defined. However, - // if this operation node was an attribute node in disguise, we get this - // information from the context and add a "_get"/"_set" to the flat - // name to get around the problem of overloaded methods which are - // generated for attributes. - if (this->ctx_->attribute ()) - { - bt = be_type::narrow_from_decl (node->return_type ()); - if (!bt) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_interceptors_ch::" - "visit_operation - " - "Bad return type\n"), - -1); - } - - // Grab the right visitor to generate the return type if its not - // void it means it is not the accessor. - if (!this->void_return_type (bt)) - { - *os << "_get"; - } - else - { - *os << "_set"; - } - } - - *os << " _tao_ri (" << be_idt << be_idt_nl - << "_tao_server_request," << be_nl - << "_tao_upcall," << be_nl - << "_tao_impl"; - - // Generate the formal argument fields which are passed to the - // RequestInfo object. - ctx = *this->ctx_; - ctx.state (TAO_CodeGen::TAO_OPERATION_INTERCEPTORS_INFO_ARGLIST_SS); - be_visitor_operation_interceptors_arglist oiia_visitor (&ctx); - - if (node->accept (&oiia_visitor) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_operation_cs::" - "visit_operation - " - "codegen for arglist failed\n"), - -1); - } - - *os << be_uidt_nl << ");" << be_uidt_nl << be_nl; - - *os << "ACE_TRY" << be_idt_nl - << "{" << be_idt_nl; - - // Create a new scope. The receive_request() interception point and - // the upcall will occur within this scope. - *os << "{" << be_idt_nl; - - // Copy the thread scope current (TSC) to the request scope current - // (RSC) upon leaving this scope, i.e. just after the upcall - // completes. A "guard" is used to make the copy also occur if an - // exception is thrown. - *os << "TAO_PICurrent_Guard _tao_pi_guard (_tao_ri.server_request ()," - << be_nl - << " 1 /* Copy TSC to RSC */);" - << be_nl << be_nl; - - // Invoke the receive_request() interception point. - *os << "_tao_vfr.receive_request (&_tao_ri ACE_ENV_ARG_PARAMETER);" << be_nl - << "ACE_TRY_CHECK;" << be_nl; - - // Check if a PortableInterceptor::ForwardRequest was raised by - // ServerRequestInterceptor::receive_request(). - *os << be_nl - << "if (!_tao_vfr.location_forwarded ())" << be_idt_nl - << "{" << be_idt_nl; - - *os << "\n#endif /* TAO_HAS_INTERCEPTORS */\n"; - // Make the upcall and assign to the return val. ctx = *this->ctx_; be_visitor_operation_rettype_assign_ss ora_visitor (&ctx); @@ -343,156 +246,6 @@ be_visitor_operation_ss::visit_operation (be_operation *node) -1); } - // Invoke the send_reply() or send_other() interception point, and - // check for exception. - *os << "\n\n#if (TAO_HAS_INTERCEPTORS == 1)" << be_nl; - - // Close scope for "if (!_tao_vfr.location_forwarded ()" - *os << be_uidt_nl - << "}" << be_uidt; - - // Close the TAO_PICurrent_Guard scope - *os << be_uidt_nl - << "}" << be_nl << be_nl; - - // Set reply status only if no PortableInterceptor::ForwardRequest - // was raised by ServerRequestInterceptor::receive_request(). We - // have to make this check a second time because the scope of the - // first check overlaps with the scope of TAO_PICurrent_Guard. - *os << "if (!_tao_vfr.location_forwarded ())" << be_idt_nl - << "{" << be_idt_nl; - - // Grab the right visitor to generate the return type accessor if - // it's not void since we can't have a private member to be of void - // type. - if (!this->void_return_type (bt)) - { - // Here's what we are going to do to have a uniform way of - // getting the return value updated for the Request Info: - // declare a operation_retval type object and assign the - // _tao_retval._retn() to it. We pass this to the result - // updation method (note: it hasn't been destroyed). We then - // put it back into the original _tao_retval object. And - // finally the _retn() is returned from the operation without - // causing any problems. - // Generate the return type mapping (same as in the header file) - ctx = *this->ctx_; - be_visitor_operation_rettype oro_visitor (&ctx); - - if (bt->accept (&oro_visitor) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_operation_cs::" - "visit_operation - " - "codegen for return type failed\n"), - -1); - } - - if (bt->size_type () == AST_Type::VARIABLE - || bt->node_type () == AST_Decl::NT_array) - { - *os << " _tao_retval_info = _tao_retval._retn ();" << be_nl - << "_tao_ri.result (_tao_retval_info);" << be_nl - << "_tao_retval = _tao_retval_info;" << be_nl; - } - else - { - *os << " _tao_retval_info = _tao_retval;" << be_nl - << "_tao_ri.result (_tao_retval_info);" << be_nl; - } - } - - *os << "_tao_ri.reply_status (PortableInterceptor::SUCCESSFUL);" << be_nl - << "_tao_vfr.send_reply (&_tao_ri ACE_ENV_ARG_PARAMETER);"<< be_nl - << "ACE_TRY_CHECK;" << be_uidt_nl; - - // Close scope of the "if (!_tao_vfr.location_forwarded()" - // conditional block. - *os << be_uidt << "}" << be_uidt_nl; - - *os << "}" << be_uidt_nl - << "ACE_CATCHANY" << be_idt_nl - << "{" << be_idt_nl; - // Update the ServerRequestInfo exception attribute. - *os << "_tao_ri.exception (&ACE_ANY_EXCEPTION);"<< be_nl - << "_tao_vfr.send_exception (" << be_idt << be_idt_nl - << "&_tao_ri" << be_nl - << "ACE_ENV_ARG_PARAMETER" << be_uidt_nl - << ");" << be_uidt_nl - << "ACE_TRY_CHECK;" << be_nl; - - // The send_exception() interception point may have transformed the - // caught exception. In that event, we must not re-throw the caught - // exception. - *os << be_nl - << "PortableInterceptor::ReplyStatus _tao_status =" << be_idt_nl - << "_tao_ri.reply_status (ACE_ENV_SINGLE_ARG_PARAMETER);" << be_uidt_nl - << "ACE_TRY_CHECK;" << be_nl; - - *os << be_nl - << "if (_tao_status == PortableInterceptor::SYSTEM_EXCEPTION" << be_nl - << " || _tao_status == PortableInterceptor::USER_EXCEPTION)" - << be_idt_nl - << "{" << be_idt_nl; - - if (be_global->use_raw_throw ()) - { - *os << "throw;"; - } - else - { - *os << "ACE_RE_THROW;"; - } - - *os << be_uidt_nl - << "}" << be_uidt << be_uidt_nl - << "}" << be_uidt_nl; - - // Convert non-CORBA C++ exceptions to CORBA::UNKNOWN. - *os << "\n# if defined (ACE_HAS_EXCEPTIONS) \\\n" - << " && defined (ACE_HAS_BROKEN_UNEXPECTED_EXCEPTIONS)" << be_nl - << "ACE_CATCHALL" << be_idt_nl - << "{" << be_idt_nl - << "CORBA::UNKNOWN ex;" << be_nl - << be_nl - << "_tao_ri.exception (&ex);"<< be_nl - << "_tao_vfr.send_exception (" << be_idt << be_idt_nl - << "&_tao_ri" << be_nl - << "ACE_ENV_ARG_PARAMETER" << be_uidt_nl - << ");" << be_uidt_nl - << "ACE_TRY_CHECK;" << be_nl; - - // The receive_exception() interception point may have thrown a - // PortableInterceptor::ForwardRequest exception. In that event, - // the connection retry loop must be restarted so do not throw the - // CORBA::UNKNOWN exception to convert the unhandled C++ exception. - *os << be_nl - << "PortableInterceptor::ReplyStatus _tao_status =" << be_idt_nl - << "_tao_ri.reply_status (ACE_ENV_SINGLE_ARG_PARAMETER);" << be_uidt_nl - << "ACE_TRY_CHECK;" << be_nl; - - *os << be_nl - << "if (_tao_status == PortableInterceptor::SYSTEM_EXCEPTION)" - << be_idt_nl; - - if (be_global->use_raw_throw ()) - { - *os << "throw "; - } - else - { - *os << "ACE_TRY_THROW "; - } - - *os << "(ex);" << be_uidt << be_uidt_nl - << "}" << be_uidt - << "\n# endif /* ACE_HAS_EXCEPTIONS" - << " && ACE_HAS_BROKEN_UNEXPECTED_EXCEPTIONS */" << be_nl << be_nl; - - *os << "ACE_ENDTRY;" << be_nl; - *os << "ACE_CHECK;\n" - << "#endif /* TAO_HAS_INTERCEPTORS */" << be_nl << be_nl; - // Check if we are oneway in which case, we are done. if (node->flags () == AST_Operation::OP_oneway) { @@ -515,7 +268,8 @@ be_visitor_operation_ss::visit_operation (be_operation *node) -1); } - *os << be_nl << be_nl << "// In case _tao_servant_upcall is not used in this function" + *os << be_nl << be_nl + << "// In case _tao_servant_upcall is not used in this function" << be_nl << "ACE_UNUSED_ARG (_tao_servant_upcall);" << be_uidt_nl << "}";; diff --git a/TAO/TAO_IDL/be/be_visitor_operation/thru_poa_proxy_impl_ss.cpp b/TAO/TAO_IDL/be/be_visitor_operation/thru_poa_proxy_impl_ss.cpp index 8b30a1ce8c8..e57e9e8128d 100644 --- a/TAO/TAO_IDL/be/be_visitor_operation/thru_poa_proxy_impl_ss.cpp +++ b/TAO/TAO_IDL/be/be_visitor_operation/thru_poa_proxy_impl_ss.cpp @@ -48,94 +48,29 @@ be_visitor_operation_thru_poa_proxy_impl_ss::visit_operation ( ); } - // retrieve the operation return type - be_type *bt = be_type::narrow_from_decl (node->return_type ()); - - if (!bt) - { - ACE_ERROR_RETURN (( - LM_ERROR, - "(%N:%l) be_visitor_operation_thru_poa_collocated_ss::" - "visit_operation - " - "Bad return type\n" - ), - -1 - ); - } - *os << be_nl << be_nl << "// TAO_IDL - Generated from " << be_nl << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl; - // STEP 2: generate the return type mapping (same as in the header file) - be_visitor_context ctx (*this->ctx_); - be_visitor_operation_rettype oro_visitor (&ctx); - - if (bt->accept (&oro_visitor) == -1) - { - ACE_ERROR_RETURN (( - LM_ERROR, - "(%N:%l) be_visitor_operation_thru_poa_collocated_ss::" - "visit_operation - " - "codegen for return type failed\n" - ), - -1 - ); - } - - *os << " " << intf->full_thru_poa_proxy_impl_name () << "::"; - *os << node->local_name (); - - // STEP 4: generate the argument list with the appropriate mapping (same as - // in the header file) - ctx = *this->ctx_; - ctx.state (TAO_CodeGen::TAO_OPERATION_ARGLIST_PROXY_IMPL_XS); - be_visitor_operation_arglist oapi_visitor (&ctx); - - if (node->accept (&oapi_visitor) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_operation_ss::" - "visit_operation - " - "codegen for argument list failed\n"), - -1); - } - - *os << be_nl << "{" << be_idt << be_nl; - - if (!be_global->exception_support ()) - { - // Declare a return type - ctx = *this->ctx_; - be_visitor_operation_rettype_vardecl_ss ord_visitor (&ctx); - - if (bt->accept (&ord_visitor) == -1) - { - ACE_ERROR_RETURN (( - LM_ERROR, - "(%N:%l) be_visitor_operation_thru_poa_collocated_ss::" - "visit_operation - " - "codegen for return var decl failed\n" - ), - -1 - ); - } - - if (!this->void_return_type (bt)) - { - *os << be_nl << "ACE_UNUSED_ARG (_tao_retval);"; - } - } + *os << "void" << be_nl + << intf->full_thru_poa_proxy_impl_name () << "::" + << node->local_name () << " (" << be_idt << be_idt_nl + << "CORBA::Object_ptr obj," << be_nl + << "CORBA::Object_out forward," << be_nl + << "TAO::Argument ** args," << be_nl + << "int num_args" << be_nl + << "ACE_ENV_ARG_DECL" << be_uidt_nl + << ")" << be_uidt_nl + << "{" << be_idt_nl; *os << be_nl << "TAO_Object_Adapter::Servant_Upcall servant_upcall (" << be_idt << be_idt_nl - << "_collocated_tao_target_->_stubobj ()" + << "obj->_stubobj ()" << "->servant_orb_var ()->orb_core ()" << be_uidt_nl - << ");" << be_uidt_nl - << "CORBA::Object_var forward_to;" << be_nl + << ");" << be_uidt_nl << be_nl << "servant_upcall.prepare_for_upcall (" << be_idt << be_idt_nl - << "_collocated_tao_target_->_stubobj ()->object_key ()," << be_nl + << "obj->_stubobj ()->object_key ()," << be_nl << "\""; // Check if we are an attribute node in disguise. @@ -153,7 +88,7 @@ be_visitor_operation_thru_poa_proxy_impl_ss::visit_operation ( } *os << node->original_local_name () << "\"," << be_nl - << "forward_to.out ()"; + << "forward"; if (!be_global->exception_support ()) { @@ -169,20 +104,10 @@ be_visitor_operation_thru_poa_proxy_impl_ss::visit_operation ( // Check if there is an exception. if (!be_global->exception_support ()) { - if (this->gen_check_exception (bt) == -1) - { - ACE_ERROR_RETURN (( - LM_ERROR, - "(%N:%l) be_visitor_operation_thru_poa_collocated_ss::" - "visit_operation - " - "codegen for checking exception failed\n" - ), - -1 - ); - } + *os << "ACE_CHECK;"; } - *os << be_nl + *os << be_nl << be_nl << "servant_upcall.pre_invoke_collocated_request ("; if (!be_global->exception_support ()) @@ -196,25 +121,22 @@ be_visitor_operation_thru_poa_proxy_impl_ss::visit_operation ( *os << ");" << be_nl; } - // check if there is an exception + // Check if there is an exception. if (!be_global->exception_support ()) { - if (this->gen_check_exception (bt) == -1) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_operation_thru_" - " poa_collocated_ss::" - "visit_operation - " - "codegen for checking exception failed\n"), - -1); - } + *os << "ACE_CHECK;"; } - *os << be_nl; + *os << be_nl << be_nl; - if (!this->void_return_type (bt)) + if (!node->void_return_type ()) { - *os << "return "; + *os << "((TAO::Arg_Traits<"; + + this->gen_arg_template_param_name (node->return_type (), + os); + + *os << ">::stub_ret_val *) args[0])->arg () =" << be_idt_nl; } *os << "ACE_reinterpret_cast (" << be_idt << be_idt_nl @@ -224,12 +146,21 @@ be_visitor_operation_thru_poa_proxy_impl_ss::visit_operation ( << ")" << be_uidt << be_uidt_nl << ")" << be_uidt; + be_visitor_context ctx; + if (this->gen_invoke (ctx, node) == -1) { return -1; } - *os << "}"; + if (!node->void_return_type ()) + { + *os << be_uidt; + } + + *os << be_uidt << be_uidt_nl + << "ACE_CHECK;" << be_uidt_nl + << "}"; return 0; } @@ -244,29 +175,62 @@ be_visitor_operation_thru_poa_proxy_impl_ss::gen_invoke ( TAO_OutStream *os = this->ctx_->stream (); *os << "->" << node->local_name () << " (" - << be_idt << be_idt << be_idt_nl; + << be_idt << be_idt << be_idt; - ctx = *this->ctx_; - ctx.state (TAO_CodeGen::TAO_OPERATION_COLLOCATED_ARG_UPCALL_SS); - be_visitor_operation_argument visitor (&ctx); + UTL_ScopeActiveIterator si (node, + UTL_Scope::IK_decls); - if (node->accept (&visitor) == -1) + if (si.is_done ()) { - ACE_ERROR_RETURN (( - LM_ERROR, - "(%N:%l) be_visitor_operation_thru_poa_collocated_ss::" - "gen_invoke - " - "codegen for making upcall failed\n" - ), - -1 - ); + *os << be_nl + << "ACE_ENV_SINGLE_ARG_PARAMETER" + << be_uidt_nl + << ");"; + + return 0; + } + + AST_Argument *arg = 0; + int index = 1; + + for (; !si.is_done (); si.next (), ++index) + { + arg = AST_Argument::narrow_from_decl (si.item ()); + + if (index > 1) + { + *os << ","; + } + + *os << be_nl + << "((TAO::Arg_Traits<"; + + this->gen_arg_template_param_name (arg->field_type (), + os); + + *os << ">::"; + + switch (arg->direction ()) + { + case AST_Argument::dir_IN: + *os << "in"; + break; + case AST_Argument::dir_INOUT: + *os << "inout"; + break; + case AST_Argument::dir_OUT: + *os << "out"; + default: + break; + } + + *os << "_arg_val *) args[" << index << "])->arg ()"; } // End the upcall - *os << be_uidt_nl + *os << be_nl + << "ACE_ENV_ARG_PARAMETER" << be_uidt_nl << ");"; - *os << be_uidt << be_uidt << be_uidt_nl; - return 0; } diff --git a/TAO/TAO_IDL/be_include/be_visitor_interface/strategized_proxy_broker_ss.h b/TAO/TAO_IDL/be_include/be_visitor_interface/strategized_proxy_broker_ss.h index a426d570d17..a4c02776fd2 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_interface/strategized_proxy_broker_ss.h +++ b/TAO/TAO_IDL/be_include/be_visitor_interface/strategized_proxy_broker_ss.h @@ -21,7 +21,8 @@ #ifndef BE_STRATEGIZED_PROXY_BROKER_SS_H_ #define BE_STRATEGIZED_PROXY_BROKER_SS_H_ -class be_visitor_interface_strategized_proxy_broker_ss : public be_visitor_interface +class be_visitor_interface_strategized_proxy_broker_ss + : public be_visitor_interface { // = TITLE // Generates the implementation for the base proxy @@ -39,6 +40,13 @@ public: virtual int visit_component (be_component *node); // This will just call the above method - no need to create // another set of visitors for this stuff. + +private: + void gen_thru_poa_operations (be_interface *node, + TAO_OutStream *os); + + void gen_direct_operations (be_interface *node, + TAO_OutStream *os); }; #endif /* BE_STRATEGIZED_PROXY_BROKER_SS_H_ */ diff --git a/TAO/TAO_IDL/be_include/be_visitor_operation/operation.h b/TAO/TAO_IDL/be_include/be_visitor_operation/operation.h index 460a06ec0b9..aa17a9b2930 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_operation/operation.h +++ b/TAO/TAO_IDL/be_include/be_visitor_operation/operation.h @@ -109,7 +109,7 @@ public: // Notice that this operation_remote_proxy_impl // _does_ include the double quote. -private: +protected: void gen_arg_template_param_name (AST_Type *bt, TAO_OutStream *os); diff --git a/TAO/tao/Collocation_Proxy_Broker.h b/TAO/tao/Collocation_Proxy_Broker.h index c0601327a79..a8e93140c28 100644 --- a/TAO/tao/Collocation_Proxy_Broker.h +++ b/TAO/tao/Collocation_Proxy_Broker.h @@ -12,6 +12,7 @@ //============================================================================= #ifndef TAO_COLLOCATION_PROXY_BROKER_H #define TAO_COLLOCATION_PROXY_BROKER_H + #include "ace/pre.h" #include "tao/corbafwd.h" @@ -30,21 +31,20 @@ namespace TAO public: - virtual Collocation_Strategy get_strategy (CORBA::Object *obj + virtual Collocation_Strategy get_strategy (CORBA::Object_ptr obj ACE_ENV_ARG_DECL) = 0; - virtual void dispatch (CORBA::Object *obj, + virtual void dispatch (CORBA::Object_ptr obj, CORBA::Object_out forward_obj, - Argument **arg, + Argument ** args, int num_args, - const char *op, - int op_len, + const char * op, + size_t op_len, Collocation_Strategy strategy ACE_ENV_ARG_DECL) = 0; - private: }; } - #include "ace/post.h" + #endif /*TAO_COLLOCATION_PROXY_BROKER_H */ |