summaryrefslogtreecommitdiff
path: root/cpp/demo
diff options
context:
space:
mode:
authorBernard Normier <bernard@zeroc.com>2008-12-30 14:30:54 -0500
committerBernard Normier <bernard@zeroc.com>2008-12-30 14:30:54 -0500
commit0a534d9b2068e0531c5edf58f2dd2c706ba647d2 (patch)
tree75a404715afa75e1797af02eeaa3a894960d830a /cpp/demo
parentFixed bugs #3325, #3326 and #3327 (diff)
parentFix 3619 - Generated code for IceDelegateM not support gcc NRVO optimization (diff)
downloadice-0a534d9b2068e0531c5edf58f2dd2c706ba647d2.tar.bz2
ice-0a534d9b2068e0531c5edf58f2dd2c706ba647d2.tar.xz
ice-0a534d9b2068e0531c5edf58f2dd2c706ba647d2.zip
Merge branch 'R3_3_branch' of ssh://git/home/git/ice into R3_3_branch
Diffstat (limited to 'cpp/demo')
-rw-r--r--cpp/demo/Ice/Makefile3
-rw-r--r--cpp/demo/Ice/Makefile.mak3
-rw-r--r--cpp/demo/Ice/nrvo/Client.cpp10
-rw-r--r--cpp/demo/Ice/nrvo/Nrvo.ice4
-rw-r--r--cpp/demo/Ice/nrvo/README32
5 files changed, 42 insertions, 10 deletions
diff --git a/cpp/demo/Ice/Makefile b/cpp/demo/Ice/Makefile
index 7d605d2e45d..e393ac569ad 100644
--- a/cpp/demo/Ice/Makefile
+++ b/cpp/demo/Ice/Makefile
@@ -23,7 +23,8 @@ SUBDIRS = minimal \
session \
converter \
async \
- multicast
+ multicast \
+ nrvo
$(EVERYTHING)::
@for subdir in $(SUBDIRS); \
diff --git a/cpp/demo/Ice/Makefile.mak b/cpp/demo/Ice/Makefile.mak
index 55709c93147..5fb697825e7 100644
--- a/cpp/demo/Ice/Makefile.mak
+++ b/cpp/demo/Ice/Makefile.mak
@@ -23,7 +23,8 @@ SUBDIRS = minimal \
session \
converter \
async \
- multicast
+ multicast \
+ nrvo
!if "$(CPP_COMPILER)" != "BCC2007" && "$(CPP_COMPILER)" != "VC80_EXPRESS" && "$(CPP_COMPILER)" != "VC90_EXPRESS"
SUBDIRS = $(SUBDIRS) MFC
diff --git a/cpp/demo/Ice/nrvo/Client.cpp b/cpp/demo/Ice/nrvo/Client.cpp
index 2b98af66eed..7fec1f3ea71 100644
--- a/cpp/demo/Ice/nrvo/Client.cpp
+++ b/cpp/demo/Ice/nrvo/Client.cpp
@@ -80,14 +80,14 @@ NrvoClient::run(int argc, char* argv[])
case '2':
{
cout << "calling op2" << endl;
- StringSeq seq= nrvo->op2();
+ MyStringSeq seq = nrvo->op2();
break;
}
case '3':
{
cout << "calling op3" << endl;
- StringSeq seq= nrvo->op3(10);
+ MyStringSeq seq = nrvo->op3(10);
break;
}
@@ -132,9 +132,9 @@ NrvoClient::menu()
"usage:\n"
"\n"
"Operation to call:\n"
- "1: return a value object.\n"
- "2: return a value object that is a member attribute.\n"
- "3: return a value object from an operation with multiple return path.\n"
+ "1: return a string sequence.\n"
+ "2: return a string sequence that is a data member of the servant.\n"
+ "3: return a string sequence from an operation with multiple return path.\n"
"s: shutdown server.\n"
"x: exit.\n"
"?: show this menu.\n";
diff --git a/cpp/demo/Ice/nrvo/Nrvo.ice b/cpp/demo/Ice/nrvo/Nrvo.ice
index 0ca0c63965b..f403f0242ec 100644
--- a/cpp/demo/Ice/nrvo/Nrvo.ice
+++ b/cpp/demo/Ice/nrvo/Nrvo.ice
@@ -7,8 +7,8 @@
//
// **********************************************************************
-#ifndef NRV0_ICE
-#define NRV0_ICE
+#ifndef NRVO_ICE
+#define NRVO_ICE
module Demo
{
diff --git a/cpp/demo/Ice/nrvo/README b/cpp/demo/Ice/nrvo/README
index dc4d60c3866..105db4a5a32 100644
--- a/cpp/demo/Ice/nrvo/README
+++ b/cpp/demo/Ice/nrvo/README
@@ -1,6 +1,14 @@
A simple demo that show how Ice take advantage of NRVO (Named Return Value Optimization)
-include in Visual Studio c++ compiler.
+include in moderm c++ compilers.
+
+GCC and Visual Studio compilers suport this optimization
+
+ You could read more about Visual Studio NRVO at
+ http://msdn.microsoft.com/en-us/library/ms364057(VS.80).aspx
+
+ For GCC NRVO was first introduced in gcc-3.1 see the release changes for details
+ http://www.gnu.org/software/gcc/gcc-3.1/changes.html
To run the demo, first start the server:
@@ -9,3 +17,25 @@ $ server
In a separate window, start the client:
$ client
+
+When you start the client it show you a menu with different operations
+you can invoke each operation pressing the correspoding key.
+
+All this operations return a string sequence mapped to a custom class MyStringSeq,
+when a copy is made the message "MyStringSeq copy ctor" is wrote to the console, this
+permit you see what copies of the returned data are made by Ice run time.
+
+To make sure the optimzations are aply you should compile the demo with optimizations
+enabled.
+
+If you call an operation the client and server should print a message "calling <opname>"
+and bellow that message you will see as many "MyStringSeq copy ctor" messages as copies
+are made.
+
+In the server side we show 1 case when NRVO works, that is a function that
+has a single return path implemented in NrvoI::op1 . And 2 case where NRVO dont work, a
+function that return a data member of the servant implemented in NrvoI::op2 and a function
+with multiple returns path implemented in NrvoI::op3.
+
+So if you press option 1 you will see that NRVO is apply in both client and server sides,
+and if you call 2 or 3 the optimization only apply to client side.