summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOssama Othman <ossama-othman@users.noreply.github.com>2005-07-28 08:28:33 +0000
committerOssama Othman <ossama-othman@users.noreply.github.com>2005-07-28 08:28:33 +0000
commita7a3f30094c389870b4e1f817d7cca6c0b663e19 (patch)
tree287c236baa7aef12a87a7bee2623ab698da6a411
parent207a63b15f4f6d7d3b66eb3a906ad00438e277e3 (diff)
downloadATCD-a7a3f30094c389870b4e1f817d7cca6c0b663e19.tar.gz
ChangeLogTag:Thu Jul 28 00:43:34 2005 Ossama Othman <ossama@dre.vanderbilt.edu>
-rw-r--r--TAO/ChangeLog76
-rw-r--r--TAO/tao/CORBA_String.h25
-rw-r--r--TAO/tao/CORBA_String.inl8
-rw-r--r--TAO/tao/ORB.cpp41
-rw-r--r--TAO/tao/ORB_Table.cpp14
-rw-r--r--TAO/tao/ORB_Table.h7
-rw-r--r--TAO/tao/ORB_Table.inl14
-rw-r--r--TAO/tao/Object_Ref_Table.cpp9
-rw-r--r--TAO/tao/Object_Ref_Table.h4
-rw-r--r--TAO/tao/PortableServer/Servant_Base.cpp32
-rw-r--r--TAO/tao/PortableServer/Servant_Base.h2
-rw-r--r--TAO/tao/PortableServer/Servant_Base.i34
12 files changed, 155 insertions, 111 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog
index ee8492851c1..cc2e43d935f 100644
--- a/TAO/ChangeLog
+++ b/TAO/ChangeLog
@@ -1,3 +1,79 @@
+Thu Jul 28 00:43:34 2005 Ossama Othman <ossama@dre.vanderbilt.edu>
+
+ * tao/CORBA_String.h:
+ * tao/CORBA_String.inl:
+
+ Removed operator==({W}String_var,{W}String_var) from the CORBA
+ namespace. It was TAO-specific, only existed so that
+ {W}String_var could be used as map key, and polluted the CORBA
+ namespace. Replaced with TAO::String_Var_Equal_To equality
+ functor.
+
+ * tao/ORB.cpp (_downcast):
+
+ Removed redundant/unnecessary repository ID string comparison
+ from ORB::InvalidName::_downcast() method. A simple
+ dynamic_cast<>-based check is sufficient.
+
+ (ORB_init):
+
+ Removed ORB shutdown check. The goal of the check was to cause
+ the CORBA::BAD_INV_ORDER system exception to be thrown if the
+ ORB was shutdown. However, that only applies to ORB methods,
+ not CORBA::ORB_init(). Just return the ORB. ORB methods
+ already check for ORB shutdown.
+
+ * tao/ORB_Table.cpp (bind):
+
+ Moved pair creation before the lock acquisition. Pair creation
+ in this case need not be synchronized across threads.
+
+ (unbind):
+
+ Pass the iterator returned from the underlaying map's find()
+ call to erase(). Saves us a duplicate element search found in
+ the erase() overload that accepts a key_type instead of an
+ iterator.
+
+ Removed work around described here in ChangeLog entry "Fri Jul
+ 22 10:07:12 UTC 2005 Johnny Willemsen
+ <jwillemsen@remedy.nl>". It is no longer necessary due to
+ changes in the ACE_Array_Map implementation. Also addresses
+ missing key object destruction in the workaround.
+
+ * tao/ORB_Table.h:
+ * tao/ORB_Table.inl:
+
+ Removed the ORB_Core_Ref_Counter equality operator. It is a
+ vestige of a transitional ORB_Table and ORB_Core_Ref_Counter
+ implementation, and is no longer needed.
+
+ Set the ACE_Array_Map equality functor template parameter to
+ TAO::String_Var_Equal_To. See changes to CORBA_String.h above
+ for details.
+
+ * tao/Object_Ref_Table.h:
+
+ Set the ACE_Array_Map equality functor template parameter to
+ TAO::String_Var_Equal_To. See changes to CORBA_String.h above
+ for details.
+
+ * tao/Object_Ref_Table.cpp (bind):
+
+ Moved pair creation before the lock acquisition. Pair creation
+ in this case need not be synchronized across threads.
+
+ * tao/PortableServer/Servant_Base.cpp:
+ * tao/PortableServer/Servant_Base.h:
+ * tao/PortableServer/Servant_Base.i:
+
+ Inlined one-liners. Reduces footprint.
+
+ Use the ACE_Atomic_Op<long> specialization as the underlying
+ synchronized reference counting mechanism instead of
+ ACE_Atomic_Op<CORBA::ULong>. Improves performance and reduces
+ footprint.
+
Wed Jul 27 21:35:20 2005 J.T. Conklin <jtc@acorntoolworks.com>
* orbsvcs/performance-tests/LoadBalancing/LBPerf/RPS/Makefile.am:
diff --git a/TAO/tao/CORBA_String.h b/TAO/tao/CORBA_String.h
index 3e193c437b4..dec64106c43 100644
--- a/TAO/tao/CORBA_String.h
+++ b/TAO/tao/CORBA_String.h
@@ -290,20 +290,25 @@ namespace CORBA
void operator= (const CORBA::WString_var &);
};
+} // End CORBA namespace.
+
+namespace TAO
+{
/**
- * @name TAO-specific Equality Operators
+ * @struct TAO-specific @c {W}String_var Equality Functor
*
- * These equality operators exist to simplify usage of @c
- * {W}String_var in containers.
+ * This functor exist to simplify usage of @c {W}String_var in
+ * containers.
*/
- //@{
- bool operator== (CORBA::String_var const & lhs,
- CORBA::String_var const & rhs);
- bool operator== (CORBA::WString_var const & lhs,
- CORBA::WString_var const & rhs);
- //@}
+ struct String_Var_Equal_To
+ {
+ bool operator() (CORBA::String_var const & lhs,
+ CORBA::String_var const & rhs) const;
-} // End CORBA namespace.
+ bool operator() (CORBA::WString_var const & lhs,
+ CORBA::WString_var const & rhs) const;
+ };
+}
# if !defined (ACE_LACKS_IOSTREAM_TOTALLY)
diff --git a/TAO/tao/CORBA_String.inl b/TAO/tao/CORBA_String.inl
index 083d600ccc2..992044b1bb4 100644
--- a/TAO/tao/CORBA_String.inl
+++ b/TAO/tao/CORBA_String.inl
@@ -277,15 +277,15 @@ CORBA::WString_out::ptr (void)
// ----------------------------------------------------------------------
ACE_INLINE bool
-CORBA::operator== (CORBA::String_var const & lhs,
- CORBA::String_var const & rhs)
+TAO::String_Var_Equal_To::operator() (CORBA::String_var const & lhs,
+ CORBA::String_var const & rhs) const
{
return (ACE_OS::strcmp (lhs.in (), rhs.in ()) == 0);
}
ACE_INLINE bool
-CORBA::operator== (CORBA::WString_var const & lhs,
- CORBA::WString_var const & rhs)
+TAO::String_Var_Equal_To::operator() (CORBA::WString_var const & lhs,
+ CORBA::WString_var const & rhs) const
{
return (ACE_OS::strcmp (lhs.in (), rhs.in ()) == 0);
}
diff --git a/TAO/tao/ORB.cpp b/TAO/tao/ORB.cpp
index 7f2b781b825..4e0a2833fe1 100644
--- a/TAO/tao/ORB.cpp
+++ b/TAO/tao/ORB.cpp
@@ -98,15 +98,7 @@ CORBA::ORB::InvalidName::operator= (const ::CORBA::ORB::InvalidName &_tao_excp)
CORBA::ORB::InvalidName *
CORBA::ORB::InvalidName::_downcast (CORBA::Exception *exc)
{
- if (!ACE_OS::strcmp ("IDL:omg.org/CORBA/ORB/InvalidName:1.0",
- exc->_rep_id ()))
- {
- return dynamic_cast<InvalidName *> (exc);
- }
- else
- {
- return 0;
- }
+ return dynamic_cast<InvalidName *> (exc);
}
CORBA::Exception *CORBA::ORB::InvalidName::_alloc (void)
@@ -381,7 +373,7 @@ CORBA::ORB::create_environment (CORBA::Environment_ptr &environment
void
CORBA::ORB::create_named_value (CORBA::NamedValue_ptr &nv
- ACE_ENV_ARG_DECL)
+ ACE_ENV_ARG_DECL)
{
ACE_NEW_THROW_EX (nv,
CORBA::NamedValue,
@@ -1111,7 +1103,7 @@ CORBA::ORB::resolve_initial_references (const char *name,
this->check_shutdown (ACE_ENV_SINGLE_ARG_PARAMETER);
ACE_CHECK_RETURN (CORBA::Object::_nil ());
- CORBA::Object_var result = CORBA::Object::_nil ();
+ CORBA::Object_var result;
if (ACE_OS::strcmp (name, TAO_OBJID_ROOTPOA) == 0)
{
@@ -1546,26 +1538,6 @@ CORBA::ORB_init (int &argc,
// The ORB was already initialized. Just return that one.
if (oc.get () != 0)
{
- ACE_MT (ACE_GUARD_RETURN (TAO_SYNCH_RECURSIVE_MUTEX,
- guard,
- *ACE_Static_Object_Lock::instance (),
- CORBA::ORB::_nil ()));
-
- if (oc->has_shutdown ())
- {
- // As defined by the CORBA 2.3 specification, throw a
- // CORBA::BAD_INV_ORDER exception with minor code 4 if the
- // ORB has shutdown by the time an ORB function is
- // called.
-
- // @@ Does the BAD_INV_ORDER exception apply here?
- // -Ossama
-
- ACE_THROW_RETURN (CORBA::BAD_INV_ORDER (CORBA::OMGVMCID | 4,
- CORBA::COMPLETED_NO),
- CORBA::ORB::_nil ());
- }
-
return CORBA::ORB::_duplicate (oc->orb ());
}
else
@@ -1583,8 +1555,8 @@ CORBA::ORB_init (int &argc,
// The ORB table increases the reference count on the ORB Core
// so do not release it here. Allow the TAO_ORB_Core_Auto_Ptr
- // to decrease the reference on the ORB Core when it goes out of
- // scope.
+ // to decrease the reference count on the ORB Core when it goes
+ // out of scope.
oc.reset (tmp);
}
@@ -1609,8 +1581,7 @@ CORBA::ORB_init (int &argc,
CORBA::ORB::_nil ());
}
-
- TAO::ORBInitializer_Registry_Adapter *orbinitializer_registry =
+ TAO::ORBInitializer_Registry_Adapter * orbinitializer_registry =
oc.get ()->orbinitializer_registry ();
PortableInterceptor::SlotId slotid = 0;
diff --git a/TAO/tao/ORB_Table.cpp b/TAO/tao/ORB_Table.cpp
index ce1706cf729..80ce3562e0f 100644
--- a/TAO/tao/ORB_Table.cpp
+++ b/TAO/tao/ORB_Table.cpp
@@ -39,14 +39,14 @@ TAO::ORB_Table::bind (char const * orb_id,
return -1;
};
+ value_type const value =
+ std::make_pair (key_type (orb_id), data_type (orb_core));
+
ACE_GUARD_RETURN (TAO_SYNCH_MUTEX,
guard,
this->lock_,
-1);
- value_type const value =
- std::make_pair (key_type (orb_id), data_type (orb_core));
-
std::pair<iterator, bool> result = this->table_.insert (value);
if (result.second)
@@ -108,8 +108,7 @@ TAO::ORB_Table::unbind (const char *orb_id)
{
TAO::ORB_Core_Ref_Counter oc ((*result).second);
- if (this->table_.erase (key_type (orb_id)) == 0)
- return -1;
+ this->table_.erase (result);
if (oc.core () == this->first_orb_)
{
@@ -122,11 +121,6 @@ TAO::ORB_Table::unbind (const char *orb_id)
this->first_orb_ = 0;
}
}
-
- // Assign a default constructed ref counter, this will make sure
- // we drop the refcount on the ORB_Core now, instead at the
- // moment we destruct the table.
- (*result).second = TAO::ORB_Core_Ref_Counter ();
}
return 0;
diff --git a/TAO/tao/ORB_Table.h b/TAO/tao/ORB_Table.h
index dc75324c61a..d527c79377a 100644
--- a/TAO/tao/ORB_Table.h
+++ b/TAO/tao/ORB_Table.h
@@ -69,7 +69,9 @@ namespace TAO
*/
ORB_Table (void);
- typedef ACE_Array_Map<CORBA::String_var, ORB_Core_Ref_Counter> Table;
+ typedef ACE_Array_Map<CORBA::String_var,
+ ORB_Core_Ref_Counter,
+ TAO::String_Var_Equal_To> Table;
typedef Table::key_type key_type;
typedef Table::data_type data_type;
typedef Table::value_type value_type;
@@ -183,9 +185,6 @@ namespace TAO
/// Assignment operator.
void operator= (ORB_Core_Ref_Counter const & rhs);
- /// Equality operator.
- bool operator== (ORB_Core_Ref_Counter const & rhs);
-
/// ORB_Core pointer accessor.
TAO_ORB_Core * core (void) const { return this->core_; }
diff --git a/TAO/tao/ORB_Table.inl b/TAO/tao/ORB_Table.inl
index ad72ba1421f..cef161c5c7f 100644
--- a/TAO/tao/ORB_Table.inl
+++ b/TAO/tao/ORB_Table.inl
@@ -75,8 +75,7 @@ TAO::ORB_Core_Ref_Counter::ORB_Core_Ref_Counter (
(void) this->core_->_incr_refcnt ();
}
-ACE_INLINE
-void
+ACE_INLINE void
TAO::ORB_Core_Ref_Counter::operator= (TAO::ORB_Core_Ref_Counter const & rhs)
{
// Strongly exception safe. May not be strictly necessary, but
@@ -84,14 +83,3 @@ TAO::ORB_Core_Ref_Counter::operator= (TAO::ORB_Core_Ref_Counter const & rhs)
TAO::ORB_Core_Ref_Counter tmp (rhs);
std::swap (this->core_, tmp.core_);
}
-
-ACE_INLINE
-bool
-TAO::ORB_Core_Ref_Counter::operator== (TAO::ORB_Core_Ref_Counter const & rhs)
-{
- return (this->core_ == rhs.core_
- || (this->core_ != 0
- && rhs.core_ != 0
- && ACE_OS::strcmp (this->core_->orbid (),
- rhs.core_->orbid ()) == 0));
-}
diff --git a/TAO/tao/Object_Ref_Table.cpp b/TAO/tao/Object_Ref_Table.cpp
index 98c1299b566..2e68e4f4eed 100644
--- a/TAO/tao/Object_Ref_Table.cpp
+++ b/TAO/tao/Object_Ref_Table.cpp
@@ -36,15 +36,16 @@ TAO_Object_Ref_Table::bind (const char *id,
return -1;
};
+ Table::value_type const value =
+ std::make_pair (CORBA::String_var (id),
+ CORBA::Object_var (CORBA::Object::_duplicate (obj)));
+
ACE_GUARD_RETURN (TAO_SYNCH_MUTEX,
guard,
this->lock_,
-1);
- std::pair<iterator, bool> const result =
- this->table_.insert (
- std::make_pair (CORBA::String_var (id),
- CORBA::Object_var (CORBA::Object::_duplicate (obj))));
+ std::pair<iterator, bool> const result = this->table_.insert (value);
if (!result.second)
{
diff --git a/TAO/tao/Object_Ref_Table.h b/TAO/tao/Object_Ref_Table.h
index 705ef575161..014463862e1 100644
--- a/TAO/tao/Object_Ref_Table.h
+++ b/TAO/tao/Object_Ref_Table.h
@@ -55,7 +55,9 @@ class TAO_Export TAO_Object_Ref_Table
{
public:
- typedef ACE_Array_Map<CORBA::String_var, CORBA::Object_var> Table;
+ typedef ACE_Array_Map<CORBA::String_var,
+ CORBA::Object_var,
+ TAO::String_Var_Equal_To> Table;
typedef Table::iterator iterator;
diff --git a/TAO/tao/PortableServer/Servant_Base.cpp b/TAO/tao/PortableServer/Servant_Base.cpp
index 21b6fa6a8df..9c635d8f45b 100644
--- a/TAO/tao/PortableServer/Servant_Base.cpp
+++ b/TAO/tao/PortableServer/Servant_Base.cpp
@@ -336,7 +336,7 @@ TAO_ServantBase::_add_ref (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
void
TAO_ServantBase::_remove_ref (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
{
- const CORBA::ULong new_count = --this->ref_count_;
+ long const new_count = --this->ref_count_;
if (new_count == 0)
delete this;
@@ -345,18 +345,10 @@ TAO_ServantBase::_remove_ref (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
CORBA::ULong
TAO_ServantBase::_refcount_value (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) const
{
- return this->ref_count_.value ();
+ return static_cast<CORBA::ULong> (this->ref_count_.value ());
}
-TAO_ServantBase_var::TAO_ServantBase_var (void)
- : ptr_ (0)
-{
-}
-
-TAO_ServantBase_var::TAO_ServantBase_var (TAO_ServantBase *p)
- : ptr_ (p)
-{
-}
+// -------------------------------------------------------------------
TAO_ServantBase_var::TAO_ServantBase_var (const TAO_ServantBase_var &b)
: ptr_ (b.ptr_)
@@ -447,24 +439,6 @@ TAO_ServantBase_var::operator= (const TAO_ServantBase_var &b)
return *this;
}
-TAO_ServantBase *
-TAO_ServantBase_var::operator->() const
-{
- return this->ptr_;
-}
-
-TAO_ServantBase *
-TAO_ServantBase_var::in (void) const
-{
- return this->ptr_;
-}
-
-TAO_ServantBase *&
-TAO_ServantBase_var::inout (void)
-{
- return this->ptr_;
-}
-
TAO_ServantBase *&
TAO_ServantBase_var::out (void)
{
diff --git a/TAO/tao/PortableServer/Servant_Base.h b/TAO/tao/PortableServer/Servant_Base.h
index 4a3551cee74..e0ded5cd97d 100644
--- a/TAO/tao/PortableServer/Servant_Base.h
+++ b/TAO/tao/PortableServer/Servant_Base.h
@@ -163,7 +163,7 @@ protected:
protected:
/// Reference counter.
- ACE_Atomic_Op<TAO_SYNCH_MUTEX, CORBA::ULong> ref_count_;
+ ACE_Atomic_Op<TAO_SYNCH_MUTEX, long> ref_count_;
/// The operation table for this servant. It is initialized by the
/// most derived class.
diff --git a/TAO/tao/PortableServer/Servant_Base.i b/TAO/tao/PortableServer/Servant_Base.i
index b48403a8e3c..a0f38b795a9 100644
--- a/TAO/tao/PortableServer/Servant_Base.i
+++ b/TAO/tao/PortableServer/Servant_Base.i
@@ -2,8 +2,42 @@
//
// $Id$
+
+ACE_INLINE
+TAO_ServantBase_var::TAO_ServantBase_var (void)
+ : ptr_ (0)
+{
+}
+
+ACE_INLINE
+TAO_ServantBase_var::TAO_ServantBase_var (TAO_ServantBase *p)
+ : ptr_ (p)
+{
+}
+
+ACE_INLINE TAO_ServantBase *
+TAO_ServantBase_var::operator->() const
+{
+ return this->ptr_;
+}
+
+ACE_INLINE TAO_ServantBase *
+TAO_ServantBase_var::in (void) const
+{
+ return this->ptr_;
+}
+
+ACE_INLINE TAO_ServantBase *&
+TAO_ServantBase_var::inout (void)
+{
+ return this->ptr_;
+}
+
+// -------------------------------------------------------------------
+
ACE_INLINE u_long
TAO_Servant_Hash::operator () (PortableServer::Servant servant) const
{
return static_cast<u_long> (reinterpret_cast<ptrdiff_t> (servant));
}
+