summaryrefslogtreecommitdiff
path: root/TAO/tao/PortableServer
diff options
context:
space:
mode:
authorelliott_c <elliott_c@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2006-07-17 14:42:07 +0000
committerelliott_c <elliott_c@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2006-07-17 14:42:07 +0000
commite16de8c8c2f4d0a6eb44160dc887fe875c83bb7f (patch)
tree8d4caf5c22cd4c69e8a455cb79683d909be7122c /TAO/tao/PortableServer
parentb6b6f7e828f346ac0c38b363fafe25f0a8e0532a (diff)
downloadATCD-e16de8c8c2f4d0a6eb44160dc887fe875c83bb7f.tar.gz
ChangeLogTag: Mon Jul 17 14:40:43 UTC 2006 Chad Elliott <elliott_c@ociweb.com>
Diffstat (limited to 'TAO/tao/PortableServer')
-rw-r--r--TAO/tao/PortableServer/POA_Current_Impl.cpp2
-rw-r--r--TAO/tao/PortableServer/POA_Current_Impl.h8
-rw-r--r--TAO/tao/PortableServer/POA_Current_Impl.inl19
-rw-r--r--TAO/tao/PortableServer/Root_POA.cpp5
-rw-r--r--TAO/tao/PortableServer/Servant_Upcall.cpp2
-rw-r--r--TAO/tao/PortableServer/Servant_Upcall.h1
6 files changed, 30 insertions, 7 deletions
diff --git a/TAO/tao/PortableServer/POA_Current_Impl.cpp b/TAO/tao/PortableServer/POA_Current_Impl.cpp
index 1c1e81b55c2..eab3e4d0e4f 100644
--- a/TAO/tao/PortableServer/POA_Current_Impl.cpp
+++ b/TAO/tao/PortableServer/POA_Current_Impl.cpp
@@ -23,7 +23,7 @@ namespace TAO
{
POA_Current_Impl::POA_Current_Impl (void)
: poa_ (0),
- object_id_ (),
+ object_id_ (TAO_POA_OBJECT_ID_BUF_SIZE, 0, object_id_buf_),
object_key_ (0),
servant_ (0),
priority_ (TAO_INVALID_PRIORITY),
diff --git a/TAO/tao/PortableServer/POA_Current_Impl.h b/TAO/tao/PortableServer/POA_Current_Impl.h
index 47f2a03994c..c14df79916d 100644
--- a/TAO/tao/PortableServer/POA_Current_Impl.h
+++ b/TAO/tao/PortableServer/POA_Current_Impl.h
@@ -25,6 +25,10 @@
TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+#ifndef TAO_POA_OBJECT_ID_BUF_SIZE
+#define TAO_POA_OBJECT_ID_BUF_SIZE 512
+#endif /* TAO_POA_OBJECT_ID_BUF_SIZE */
+
namespace TAO
{
namespace Portable_Server
@@ -146,6 +150,10 @@ namespace TAO
/// The POA implementation invoking an upcall
::TAO_Root_POA *poa_;
+ /// In order to avoid memory allocations, we will populate
+ /// the object id with this buffer.
+ CORBA::Octet object_id_buf_[TAO_POA_OBJECT_ID_BUF_SIZE];
+
/**
* The object ID of the current context. This is the user id and
* not the id the goes into the IOR. Note also that unlike the
diff --git a/TAO/tao/PortableServer/POA_Current_Impl.inl b/TAO/tao/PortableServer/POA_Current_Impl.inl
index db220558ae6..cf3fee49d65 100644
--- a/TAO/tao/PortableServer/POA_Current_Impl.inl
+++ b/TAO/tao/PortableServer/POA_Current_Impl.inl
@@ -25,7 +25,22 @@ namespace TAO
ACE_INLINE void
POA_Current_Impl::object_id (const PortableServer::ObjectId &id)
{
- this->object_id_ = id;
+ if (this->object_id_.release () ||
+ this->object_id_.get_buffer() == this->object_id_buf_)
+ {
+ // Resize the current object_id_. If it is less than the
+ // length of the current buffer, no allocation will take place.
+ size_t id_size = id.length ();
+ this->object_id_.length (id_size);
+
+ // Get the buffer and copy the new object id in it's place.
+ ACE_OS::memcpy (this->object_id_.get_buffer (),
+ id.get_buffer (), id_size);
+ }
+ else
+ {
+ this->object_id_ = id;
+ }
}
ACE_INLINE const PortableServer::ObjectId &
@@ -38,6 +53,8 @@ namespace TAO
POA_Current_Impl::replace_object_id (
const PortableServer::ObjectId &system_id)
{
+ // This has the effect of replacing the underlying buffer
+ // with that of another object id without copying.
object_id_.replace (system_id.maximum (),
system_id.length (),
const_cast <CORBA::Octet *> (system_id.get_buffer ()),
diff --git a/TAO/tao/PortableServer/Root_POA.cpp b/TAO/tao/PortableServer/Root_POA.cpp
index 945aafd7c2b..a1fa33136ac 100644
--- a/TAO/tao/PortableServer/Root_POA.cpp
+++ b/TAO/tao/PortableServer/Root_POA.cpp
@@ -1776,14 +1776,11 @@ TAO_Root_POA::parse_key (const TAO::ObjectKey &key,
CORBA::Boolean &is_system_id,
TAO::Portable_Server::Temporary_Creation_Time &poa_creation_time)
{
- // Start at zero.
- CORBA::ULong starting_at = 0;
-
// Get the object key octets.
const CORBA::Octet *key_data = key.get_buffer ();
// Skip the object key prefix since we have already checked for this.
- starting_at += TAO_OBJECTKEY_PREFIX_SIZE;
+ CORBA::ULong starting_at = TAO_OBJECTKEY_PREFIX_SIZE;
// Check the root indicator.
char root_key_type = key_data[starting_at];
diff --git a/TAO/tao/PortableServer/Servant_Upcall.cpp b/TAO/tao/PortableServer/Servant_Upcall.cpp
index 2842aec5bcb..9e5ef598e2b 100644
--- a/TAO/tao/PortableServer/Servant_Upcall.cpp
+++ b/TAO/tao/PortableServer/Servant_Upcall.cpp
@@ -34,7 +34,7 @@ namespace TAO
poa_ (0),
servant_ (0),
state_ (INITIAL_STAGE),
- system_id_ (),
+ system_id_ (TAO_POA_OBJECT_ID_BUF_SIZE, 0, system_id_buf_),
user_id_ (0),
current_context_ (),
#if (TAO_HAS_MINIMUM_POA == 0)
diff --git a/TAO/tao/PortableServer/Servant_Upcall.h b/TAO/tao/PortableServer/Servant_Upcall.h
index 18818009aab..427934e4faa 100644
--- a/TAO/tao/PortableServer/Servant_Upcall.h
+++ b/TAO/tao/PortableServer/Servant_Upcall.h
@@ -205,6 +205,7 @@ namespace TAO
State state_;
+ CORBA::Octet system_id_buf_[TAO_POA_OBJECT_ID_BUF_SIZE];
PortableServer::ObjectId system_id_;
const PortableServer::ObjectId *user_id_;