[Rcpp-commits] r4284 - in pkg/Rcpp: . inst inst/include/Rcpp src

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Mar 20 03:30:57 CET 2013


Author: edd
Date: 2013-03-20 03:30:56 +0100 (Wed, 20 Mar 2013)
New Revision: 4284

Modified:
   pkg/Rcpp/ChangeLog
   pkg/Rcpp/inst/NEWS.Rd
   pkg/Rcpp/inst/include/Rcpp/config.h
   pkg/Rcpp/src/api.cpp
Log:
second pass at api.cpp with now complete fallback to R's preserve/release


Modified: pkg/Rcpp/ChangeLog
===================================================================
--- pkg/Rcpp/ChangeLog	2013-03-20 01:39:52 UTC (rev 4283)
+++ pkg/Rcpp/ChangeLog	2013-03-20 02:30:56 UTC (rev 4284)
@@ -1,3 +1,12 @@
+2013-03-19  Dirk Eddelbuettel  <edd at debian.org>
+
+	* inst/include/Rcpp/config.h: Define RCPP_USE_NEW_PRESERVE_RELEASE
+	with default value of 0 to enable/disable new preserve/release code
+
+	* src/api.cpp: Bracket the new Rcpp object preserve / release code
+	with the new variable RCPP_USE_NEW_PRESERVE_RELEASE and fall back
+	to R behaviour if not set
+
 2013-03-12 Romain Francois <romain at r-enthusiasts.com>
 
         * include/Rcpp/Module.h: added virtual destructor to CppProperty
@@ -36,8 +45,8 @@
         * include/RcppCommon.h : move sexp_to_name here. Used in some debugging
         * include/Rcpp/vector/MatrixRow.h : fix const version of operator[]
         * include/Rcpp/vector/Vector.h : more debugging
-        * include/Rcpp/internal/wrap.h : more debugging. more dispatch.  
-        
+        * include/Rcpp/internal/wrap.h : more debugging. more dispatch. 
+
 2013-02-18 Romain Francois <romain at r-enthusiasts.com>
 
         * include/Rcpp/vector/string_proxy.h : only declare operator+=

Modified: pkg/Rcpp/inst/NEWS.Rd
===================================================================
--- pkg/Rcpp/inst/NEWS.Rd	2013-03-20 01:39:52 UTC (rev 4283)
+++ pkg/Rcpp/inst/NEWS.Rd	2013-03-20 02:30:56 UTC (rev 4284)
@@ -38,7 +38,10 @@
       R_ReleaseObject has been replaced by a new system based on the 
       functions Rcpp_PreserveObject, Rcpp_ReleaseObject and Rcpp_ReplaceObject
       which shows better performance and is implemented using a generic vector
-      treated as a stack instead of a pairlist in the R implementation
+      treated as a stack instead of a pairlist in the R
+      implementation.
+      \item As the preserve / release code is still a little rough at
+      the edges, a new #define is used (in config.h) to disable it for now.
       \item Platform-dependent code in Timer.cpp now recognises a few
       more BSD variants thanks to contributed defined() test suggestions
       \item Support for wide character strings has been added throughout the 

Modified: pkg/Rcpp/inst/include/Rcpp/config.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/config.h	2013-03-20 01:39:52 UTC (rev 4283)
+++ pkg/Rcpp/inst/include/Rcpp/config.h	2013-03-20 02:30:56 UTC (rev 4284)
@@ -29,7 +29,7 @@
 
 // Rcpp 0.10.3 has initial support for new preserve/release semantics
 // This switch enables a rollback to the standard R preserve/release semantics
-#define RCPP_USE_NEW_PRESERVE_RELEASE 1
+#define RCPP_USE_NEW_PRESERVE_RELEASE 0
                                                                                                                 
 #endif
 

Modified: pkg/Rcpp/src/api.cpp
===================================================================
--- pkg/Rcpp/src/api.cpp	2013-03-20 01:39:52 UTC (rev 4283)
+++ pkg/Rcpp/src/api.cpp	2013-03-20 02:30:56 UTC (rev 4284)
@@ -135,7 +135,18 @@
             #if RCPP_DEBUG_LEVEL > 1 
             Rcpp_Stack_Debug() ;
             #endif
-        
+#else        
+            // if we are setting to the same SEXP as we already have, do nothing 
+            if (x != y) {
+                
+                // the previous SEXP was not NULL, so release it 
+                Rcpp_ReleaseObject(x);
+                
+                // the new SEXP is not NULL, so preserve it 
+                Rcpp_PreserveObject(y);
+                        
+                //update();
+            }
 #endif
         }
         return y ;



More information about the Rcpp-commits mailing list