← Back to team overview

zorba-coders team mailing list archive

[Merge] lp:~zorba-coders/zorba/collection-insert-without-copy into lp:zorba

 

Matthias Brantner has proposed merging lp:~zorba-coders/zorba/collection-insert-without-copy into lp:zorba.

Requested reviews:
  Matthias Brantner (matthias-brantner)

For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/collection-insert-without-copy/+merge/105126

no node copying during insertion into collection if the nodes are freshly constructed nodes
-- 
https://code.launchpad.net/~zorba-coders/zorba/collection-insert-without-copy/+merge/105126
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'src/runtime/base/plan_iterator.h'
--- src/runtime/base/plan_iterator.h	2012-05-03 12:31:51 +0000
+++ src/runtime/base/plan_iterator.h	2012-05-08 20:53:18 +0000
@@ -346,6 +346,8 @@
 
   TypeManager* getTypeManager() const;
 
+  virtual bool isConstructor() const { return false; }
+
   /**
    * Accept method for the PlanIterator-Tree-Visitor
    *

=== modified file 'src/runtime/collections/collections_base.h'
--- src/runtime/collections/collections_base.h	2012-05-03 12:31:51 +0000
+++ src/runtime/collections/collections_base.h	2012-05-08 20:53:18 +0000
@@ -128,6 +128,9 @@
 
     getCopyMode(lCopyMode, this->theSctx);
 
+    lCopyMode.theDoCopy = ! 
+    this->theChildren[this->theChildren.size()-1]->isConstructor();
+
     while (this->consumeNext(node, this->theChildren[this->theChildren.size()-1].getp(), planState))
     {
       checkNodeType(this->theSctx, node, collectionDecl, this->loc, theDynamicCollection);

=== modified file 'src/runtime/core/constructors.h'
--- src/runtime/core/constructors.h	2012-05-03 12:31:51 +0000
+++ src/runtime/core/constructors.h	2012-05-08 20:53:18 +0000
@@ -67,6 +67,8 @@
 
   bool copyInputNodes() const { return theCopyInputNodes; }
 
+  bool isConstructor() const { return true; }
+
   void accept(PlanIterVisitor& v) const;
 
   void openImpl(PlanState& planState, uint32_t& offset);
@@ -141,6 +143,8 @@
 
   bool copyInputNodes() const { return theCopyInputNodes; }
 
+  bool isConstructor() const { return true; }
+
   uint32_t getStateSizeOfSubtree() const;
   
   void accept(PlanIterVisitor&) const;
@@ -193,6 +197,8 @@
 
   store::Item* getQName() const { return theQName.getp(); }
 
+  bool isConstructor() const { return true; }
+
   void accept(PlanIterVisitor& v) const;
 
   bool nextImpl(store::Item_t& result, PlanState& planState) const;
@@ -234,6 +240,8 @@
         PlanIter_t& aChild,
         bool isRoot);
 
+  bool isConstructor() const { return true; }
+
   void accept(PlanIterVisitor& v) const;
 
   bool nextImpl(store::Item_t& result, PlanState& planState) const;
@@ -275,6 +283,8 @@
         PlanIter_t& aComment,
         bool isRoot);
 
+  bool isConstructor() const { return true; }
+
   void accept(PlanIterVisitor& v) const;
 
   bool nextImpl(store::Item_t& result, PlanState& planState) const;
@@ -314,6 +324,8 @@
         PlanIter_t& aContent,
         bool isRoot);
 
+  bool isConstructor() const { return true; }
+
   void accept(PlanIterVisitor& v) const;
 
   bool nextImpl(store::Item_t& result, PlanState& planState) const;