ACE_TAO
ACE_TAO copied to clipboard
Any TypeCode::equivalent() is slow on sequences because of c++ exceptions are used
Version
TAO 2.0a or 2.2a
Host machine and operating system
RHEL 6
Target machine and operating system (if different from host)
Compiler name and version (including patch level)
gcc 4.4.7
The $ACE_ROOT/ace/config.h file
If you use a link to a platform-specific file, simply state which one
The $ACE_ROOT/include/makeinclude/platform_macros.GNU file
if you use a link to a platform-specific file, simply state which one (unless this isn't used in this case, e.g., with Microsoft Visual C++)
Contents of $ACE_ROOT/bin/MakeProjectCreator/config/default.features
Used by MPC when you generate your own makefiles
AREA/CLASS/EXAMPLE AFFECTED:
TAO\tao\AnyTypeCode\TypeCode.cpp
The problem effects:
Affect only performance
Synopsis
Durying Any extraction from tc_sequnce (globaldefs::NVSList_T) the c++ exceptions are used which is slow.
Description
CORBA::Any value;
globaldefs::NamingAttributes_T *objectName;
value >>= objectName;
Calls:
CORBA::TypeCode::equivalent (TypeCode_ptr tc) const
{
try {
char const * const this_id = unaliased_this->id ();
char const * const tc_id = unaliased_tc->id ();
}
catch (const ::CORBA::TypeCode::BadKind&)
id()/id_i()
is not overriden for some reason for tc_sequence
(globaldefs::NVSList_T) type so the exception ::CORBA::TypeCode::BadKind
is used:
CORBA::TypeCode::id_i (void) const
{ throw ::CORBA::TypeCode::BadKind (); }
Can we check what function was not overriden without exceptions?
Repeat by
TODO
Sample fix/ workaround
Fix: file TypeCode.cpp: method CORBA::TypeCode::equivalent (TypeCode_ptr tc) const May call operation "id()" only for types: for tk_objref, tk_struct, tk_union, tk_enum, tk_alias, tk_value, tk_value_box, tk_native, tk_abstract_interface tk_local_interface, tk_except tk_component, tk_home and tk_event for which "id()" operation is overriden (does not throw exception; see CORBA 3.3 Chapter 8.11.1 "The TypeCode Interface")
switch (this_kind)
{
case tk_objref:
case tk_struct:
case tk_union:
case tk_enum:
case tk_alias:
case tk_value:
case tk_value_box:
case tk_native:
case tk_abstract_interface:
case tk_local_interface:
case tk_except:
case tk_component:
case tk_home:
case tk_event:
{
try
{
char const * const this_id = unaliased_this->id ();
char const * const tc_id = unaliased_tc->id ();
if (ACE_OS::strlen (this_id) != 0
&& ACE_OS::strlen (tc_id) != 0)
{
return ACE_OS::strcmp (this_id, tc_id) == 0;
}
}
catch (const ::CORBA::TypeCode::BadKind&)
{
// Some TypeCodes do not support the id() operation. Ignore the
// failure, and continue equivalence verification using TypeCode
// subclass-specific techniques.
}
break;
}
default:
;
}