Merge lp:~zorba-coders/zorba/no-batching into lp:zorba

Proposed by Markos Zaharioudakis
Status: Merged
Approved by: Markos Zaharioudakis
Approved revision: 11243
Merged at revision: 11480
Proposed branch: lp:~zorba-coders/zorba/no-batching
Merge into: lp:zorba
Diff against target: 1023 lines (+153/-314)
21 files modified
include/zorba/config.h.cmake (+0/-2)
src/runtime/api/plan_iterator_wrapper.cpp (+14/-14)
src/runtime/api/plan_iterator_wrapper.h (+13/-12)
src/runtime/base/binarybase.h (+4/-4)
src/runtime/base/narybase.h (+29/-33)
src/runtime/base/noarybase.h (+4/-4)
src/runtime/base/plan_iterator.cpp (+0/-5)
src/runtime/base/plan_iterator.h (+54/-204)
src/runtime/base/unarybase.h (+4/-4)
src/runtime/core/flwor_iterator.cpp (+2/-2)
src/runtime/core/flwor_iterator.h (+2/-2)
src/runtime/core/gflwor/groupby_iterator.cpp (+2/-2)
src/runtime/core/gflwor/groupby_iterator.h (+2/-2)
src/runtime/core/gflwor/orderby_iterator.cpp (+2/-2)
src/runtime/core/gflwor/orderby_iterator.h (+2/-2)
src/runtime/core/gflwor/window_iterator.cpp (+2/-2)
src/runtime/core/gflwor/window_iterator.h (+3/-2)
src/runtime/core/item_iterator.cpp (+3/-3)
src/runtime/core/item_iterator.h (+4/-4)
src/runtime/update/update.cpp (+4/-6)
src/runtime/update/update.h (+3/-3)
To merge this branch: bzr merge lp:~zorba-coders/zorba/no-batching
Reviewer Review Type Date Requested Status
Markos Zaharioudakis Approve
Review via email: mp+166118@code.launchpad.net

Commit message

Removed the Batcher class from the runtime (saves 10% off the size of the zorba library)

Description of the change

Removed the Batcher class from the runtime (saves 10% off the size of the zorba library)

To post a comment you must log in.
lp:~zorba-coders/zorba/no-batching updated
11243. By Markos Zaharioudakis

merge from trunk

Revision history for this message
Markos Zaharioudakis (markos-za) :
review: Approve
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue job no-batching-2013-05-29T02-22-14.256Z is finished. The final status was:

All tests succeeded!

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'include/zorba/config.h.cmake'
2--- include/zorba/config.h.cmake 2013-02-07 17:24:36 +0000
3+++ include/zorba/config.h.cmake 2013-05-28 18:24:26 +0000
4@@ -194,8 +194,6 @@
5 #cmakedefine ZORBA_DEBUG_STRING
6
7 // Zorba runtime configuration parameters
8-#define ZORBA_BATCHING_TYPE ${ZORBA_BATCHING_TYPE}
9-#define ZORBA_BATCHING_BATCHSIZE ${ZORBA_BATCHING_BATCHSIZE}
10 #define ZORBA_FLOAT_POINT_PRECISION ${ZORBA_FLOAT_POINT_PRECISION}
11
12 // Zorba threading mechanism
13
14=== modified file 'src/runtime/api/plan_iterator_wrapper.cpp'
15--- src/runtime/api/plan_iterator_wrapper.cpp 2013-05-25 14:36:27 +0000
16+++ src/runtime/api/plan_iterator_wrapper.cpp 2013-05-28 18:24:26 +0000
17@@ -81,13 +81,25 @@
18 }
19
20
21-void PlanStateIteratorWrapper::open(PlanState& planState, uint32_t& offset)
22+void PlanStateIteratorWrapper::openImpl(PlanState& planState, uint32_t& offset)
23 {
24 theStoreIterator->open();
25 }
26
27
28-bool PlanStateIteratorWrapper::produceNext(
29+void PlanStateIteratorWrapper::reset() const
30+{
31+ theStoreIterator->reset();
32+}
33+
34+
35+void PlanStateIteratorWrapper::resetImpl(PlanState& planState) const
36+{
37+ theStoreIterator->reset();
38+}
39+
40+
41+bool PlanStateIteratorWrapper::nextImpl(
42 store::Item_t& result,
43 PlanState& planState) const
44 {
45@@ -101,18 +113,6 @@
46 }
47
48
49-void PlanStateIteratorWrapper::reset() const
50-{
51- theStoreIterator->reset();
52-}
53-
54-
55-void PlanStateIteratorWrapper::reset(PlanState& planState) const
56-{
57- theStoreIterator->reset();
58-}
59-
60-
61 void PlanStateIteratorWrapper::accept(PlanIterVisitor& v) const
62 {
63 }
64
65=== modified file 'src/runtime/api/plan_iterator_wrapper.h'
66--- src/runtime/api/plan_iterator_wrapper.h 2013-05-25 14:36:27 +0000
67+++ src/runtime/api/plan_iterator_wrapper.h 2013-05-28 18:24:26 +0000
68@@ -84,22 +84,23 @@
69
70 virtual void accept(PlanIterVisitor& v) const;
71
72- virtual void open(PlanState& planState, uint32_t& offset);
73-
74- virtual bool produceNext(store::Item_t& result, PlanState& planState) const;
75-
76+ virtual uint32_t getStateSize() const { return 0; }
77+
78+ virtual uint32_t getStateSizeOfSubtree() const { return 0; }
79+
80+ virtual void openImpl(PlanState& planState, uint32_t& offset);
81+
82+ virtual void closeImpl(PlanState& planState) {}
83+
84+ virtual void resetImpl(PlanState& planState) const;
85+
86+ virtual bool nextImpl(store::Item_t& result, PlanState& planState) const;
87+
88+public:
89 virtual bool next(store::Item_t&);
90
91 virtual void reset() const;
92
93- virtual void reset(PlanState& planState) const;
94-
95- virtual void close(PlanState& planState) {}
96-
97- virtual uint32_t getStateSize() const { return 0; }
98-
99- virtual uint32_t getStateSizeOfSubtree() const { return 0; }
100-
101 #ifndef NDEBUG
102 virtual std::string toString() const;
103 #endif
104
105=== modified file 'src/runtime/base/binarybase.h'
106--- src/runtime/base/binarybase.h 2013-02-07 17:24:36 +0000
107+++ src/runtime/base/binarybase.h 2013-05-28 18:24:26 +0000
108@@ -31,7 +31,7 @@
109 data members.
110 ********************************************************************************/
111 template <class IterType, class StateType>
112-class BinaryBaseIterator : public Batcher<IterType>
113+class BinaryBaseIterator : public PlanIterator
114 {
115 protected:
116 PlanIter_t theChild0;
117@@ -39,10 +39,10 @@
118
119 public:
120 SERIALIZABLE_ABSTRACT_CLASS(BinaryBaseIterator)
121- SERIALIZABLE_CLASS_CONSTRUCTOR2(BinaryBaseIterator, Batcher<IterType>)
122+ SERIALIZABLE_CLASS_CONSTRUCTOR2(BinaryBaseIterator, PlanIterator)
123 void serialize(::zorba::serialization::Archiver& ar)
124 {
125- serialize_baseclass(ar, (Batcher<IterType>*)this);
126+ serialize_baseclass(ar, (PlanIterator*)this);
127 ar & theChild0;
128 ar & theChild1;
129 }
130@@ -54,7 +54,7 @@
131 PlanIter_t& child0,
132 PlanIter_t& child1)
133 :
134- Batcher<IterType>(sctx, loc),
135+ PlanIterator(sctx, loc),
136 theChild0(child0),
137 theChild1(child1)
138 {
139
140=== modified file 'src/runtime/base/narybase.h'
141--- src/runtime/base/narybase.h 2013-02-07 17:24:36 +0000
142+++ src/runtime/base/narybase.h 2013-05-28 18:24:26 +0000
143@@ -34,17 +34,17 @@
144 data members.
145 ********************************************************************************/
146 template <class IterType, class StateType>
147-class NaryBaseIterator : public Batcher<IterType>
148+class NaryBaseIterator : public PlanIterator
149 {
150 protected:
151 std::vector<PlanIter_t> theChildren;
152
153 public:
154 SERIALIZABLE_ABSTRACT_CLASS(NaryBaseIterator)
155- SERIALIZABLE_CLASS_CONSTRUCTOR2(NaryBaseIterator, Batcher<IterType>)
156+ SERIALIZABLE_CLASS_CONSTRUCTOR2(NaryBaseIterator, PlanIterator)
157 void serialize(::zorba::serialization::Archiver& ar)
158 {
159- serialize_baseclass(ar, (Batcher<IterType>*)this);
160+ serialize_baseclass(ar, (PlanIterator*)this);
161 ar & theChildren;
162 }
163
164@@ -80,18 +80,17 @@
165 NaryBaseIterator<IterType, StateType>::NaryBaseIterator(
166 static_context* sctx,
167 const QueryLoc& loc,
168- std::vector<PlanIter_t>& aChildren)
169+ std::vector<PlanIter_t>& children)
170 :
171- Batcher<IterType>(sctx, loc),
172- theChildren(aChildren)
173+ PlanIterator(sctx, loc),
174+ theChildren(children)
175 {
176 #ifndef NDEBUG
177- std::vector<PlanIter_t>::const_iterator lEnd = aChildren.end();
178- for(std::vector<PlanIter_t>::const_iterator lIter = aChildren.begin();
179- lIter != lEnd;
180- ++lIter)
181+ std::vector<PlanIter_t>::const_iterator end = children.end();
182+ std::vector<PlanIter_t>::const_iterator ite = children.begin();
183+ for(; ite != end; ++ite)
184 {
185- assert(*lIter != 0);
186+ assert(*ite != 0);
187 }
188 #endif
189 }
190@@ -114,11 +113,11 @@
191 {
192 uint32_t size = 0;
193
194- std::vector<PlanIter_t>::const_iterator lIter = theChildren.begin();
195- std::vector<PlanIter_t>::const_iterator lEnd = theChildren.end();
196- for (; lIter != lEnd; ++lIter )
197+ std::vector<PlanIter_t>::const_iterator ite = theChildren.begin();
198+ std::vector<PlanIter_t>::const_iterator end = theChildren.end();
199+ for (; ite != end; ++ite)
200 {
201- size += (*lIter)->getStateSizeOfSubtree();
202+ size += (*ite)->getStateSizeOfSubtree();
203 }
204
205 return this->getStateSize() + size;
206@@ -126,47 +125,44 @@
207
208
209 template <class IterType, class StateType>
210-void
211-NaryBaseIterator<IterType, StateType>::openImpl(
212+void NaryBaseIterator<IterType, StateType>::openImpl(
213 PlanState& planState,
214 uint32_t& offset)
215 {
216 StateTraitsImpl<StateType>::createState(planState, this->theStateOffset, offset);
217 StateTraitsImpl<StateType>::initState(planState, this->theStateOffset);
218
219- std::vector<PlanIter_t>::iterator lIter = theChildren.begin();
220- std::vector<PlanIter_t>::iterator lEnd = theChildren.end();
221- for ( ; lIter != lEnd; ++lIter )
222+ std::vector<PlanIter_t>::iterator ite = theChildren.begin();
223+ std::vector<PlanIter_t>::iterator end = theChildren.end();
224+ for (; ite != end; ++ite)
225 {
226- (*lIter)->open(planState, offset);
227+ (*ite)->open(planState, offset);
228 }
229 }
230
231
232 template <class IterType, class StateType>
233-void
234-NaryBaseIterator<IterType, StateType>::resetImpl(PlanState& planState) const
235+void NaryBaseIterator<IterType, StateType>::resetImpl(PlanState& planState) const
236 {
237 StateTraitsImpl<StateType>::reset(planState, this->theStateOffset);
238
239- std::vector<PlanIter_t>::const_iterator lIter = theChildren.begin();
240- std::vector<PlanIter_t>::const_iterator lEnd = theChildren.end();
241- for ( ; lIter != lEnd; ++lIter )
242+ std::vector<PlanIter_t>::const_iterator ite = theChildren.begin();
243+ std::vector<PlanIter_t>::const_iterator end = theChildren.end();
244+ for (; ite != end; ++ite)
245 {
246- (*lIter)->reset(planState);
247+ (*ite)->reset(planState);
248 }
249 }
250
251
252 template <class IterType, class StateType>
253-void
254-NaryBaseIterator<IterType, StateType>::closeImpl(PlanState& planState)
255+void NaryBaseIterator<IterType, StateType>::closeImpl(PlanState& planState)
256 {
257- std::vector<PlanIter_t>::const_iterator lIter = theChildren.begin();
258- std::vector<PlanIter_t>::const_iterator lEnd = theChildren.end();
259- for ( ; lIter != lEnd; ++lIter )
260+ std::vector<PlanIter_t>::const_iterator ite = theChildren.begin();
261+ std::vector<PlanIter_t>::const_iterator end = theChildren.end();
262+ for (; ite != end; ++ite)
263 {
264- (*lIter)->close(planState);
265+ (*ite)->close(planState);
266 }
267
268 StateTraitsImpl<StateType>::destroyState(planState, this->theStateOffset);
269
270=== modified file 'src/runtime/base/noarybase.h'
271--- src/runtime/base/noarybase.h 2013-02-07 17:24:36 +0000
272+++ src/runtime/base/noarybase.h 2013-05-28 18:24:26 +0000
273@@ -31,22 +31,22 @@
274 data members.
275 ********************************************************************************/
276 template <class IterType, class StateType>
277-class NoaryBaseIterator : public Batcher<IterType>
278+class NoaryBaseIterator : public PlanIterator
279 {
280 public:
281 SERIALIZABLE_TEMPLATE_ABSTRACT_CLASS(NoaryBaseIterator);
282
283- SERIALIZABLE_CLASS_CONSTRUCTOR2(NoaryBaseIterator, Batcher<IterType>);
284+ SERIALIZABLE_CLASS_CONSTRUCTOR2(NoaryBaseIterator, PlanIterator);
285
286 void serialize(::zorba::serialization::Archiver& ar)
287 {
288- serialize_baseclass(ar, (Batcher<IterType>*)this);
289+ serialize_baseclass(ar, (PlanIterator*)this);
290 }
291
292 public:
293 NoaryBaseIterator(static_context* sctx, const QueryLoc& loc)
294 :
295- Batcher<IterType>(sctx, loc)
296+ PlanIterator(sctx, loc)
297 {
298 }
299
300
301=== modified file 'src/runtime/base/plan_iterator.cpp'
302--- src/runtime/base/plan_iterator.cpp 2013-05-24 22:52:47 +0000
303+++ src/runtime/base/plan_iterator.cpp 2013-05-28 18:24:26 +0000
304@@ -71,7 +71,6 @@
305 }
306
307
308-
309 void PlanState::checkDepth(const QueryLoc& loc)
310 {
311 if (theStackDepth > 256)
312@@ -181,10 +180,7 @@
313 }
314
315
316-#if ZORBA_BATCHING_TYPE == 0
317-
318 #ifndef NDEBUG
319-
320 bool PlanIterator::consumeNext(
321 store::Item_t& result,
322 const PlanIterator* iter,
323@@ -210,7 +206,6 @@
324 }
325 #endif
326
327-#endif
328
329 } // namespace zorba
330 /* vim:set et sw=2 ts=2: */
331
332=== modified file 'src/runtime/base/plan_iterator.h'
333--- src/runtime/base/plan_iterator.h 2013-05-24 22:52:47 +0000
334+++ src/runtime/base/plan_iterator.h 2013-05-28 18:24:26 +0000
335@@ -32,11 +32,6 @@
336 #include "zorbaserialization/serialize_zorba_types.h"
337
338
339-#if ZORBA_BATCHING_TYPE == 1
340-#include "store/api/item.h"
341-#endif
342-
343-
344 // Info: Forcing inlining a function in g++:
345 // store::Item_t next() __attribute__((always_inline)) {...}
346
347@@ -168,27 +163,15 @@
348 private:
349 uint32_t theDuffsLine;
350
351-public:
352-#if ZORBA_BATCHING_TYPE == 1
353-public:
354- bool theIsDone;
355- store::Item_t * theEndItem;
356- store::Item_t * theCurrItem;
357- store::Item_t theBatch[ZORBA_BATCHING_BATCHSIZE];
358-#endif
359 #ifndef NDEBUG
360- bool theIsOpened;
361+public:
362+ bool theIsOpened;
363 #endif
364
365 public:
366 PlanIteratorState()
367 :
368 theDuffsLine(DUFFS_ALLOCATE_RESOURCES)
369-#if ZORBA_BATCHING_TYPE == 1
370- , theIsDone(false)
371- , theEndItem(NULL)
372- , theCurrItem(NULL)
373-#endif
374 #ifndef NDEBUG
375 , theIsOpened(false)
376 #endif
377@@ -213,7 +196,10 @@
378 * Each subclass implementation of this method must call the init() method of
379 * their parent class explicitly in order to guarantee proper initialization.
380 */
381- void init(PlanState& s) { reset(s); }
382+ void init(PlanState&)
383+ {
384+ theDuffsLine = DUFFS_ALLOCATE_RESOURCES;
385+ }
386
387 /**
388 * Reset the current state object.
389@@ -230,11 +216,6 @@
390 void reset(PlanState&)
391 {
392 theDuffsLine = DUFFS_ALLOCATE_RESOURCES;
393-#if ZORBA_BATCHING_TYPE == 1
394- theIsDone = false;
395- theEndItem = NULL;
396- theCurrItem = NULL;
397-#endif
398 }
399 };
400
401@@ -297,9 +278,6 @@
402 QueryLoc loc;
403 static_context * theSctx;
404
405-
406-// Stable IDs for debugging purposes. An individual ID is assigned to each iterator
407-// and this can be used to identify it in the debug information.
408 #ifndef NDEBUG
409 int theId;
410
411@@ -359,7 +337,19 @@
412 * Begin the execution of the iterator. Initializes information required for
413 * the plan state and constructs the state object.
414 */
415- virtual void open(PlanState& planState, uint32_t& offset) = 0;
416+ void open(PlanState& planState, uint32_t& offset)
417+ {
418+ openImpl(planState, offset);
419+#ifndef NDEBUG
420+ // do this after openImpl because the state is created there
421+ PlanIteratorState* state =
422+ StateTraitsImpl<PlanIteratorState>::getState(planState, theStateOffset);
423+ ZORBA_ASSERT(!state->theIsOpened); // don't call open twice
424+ state->theIsOpened = true;
425+#endif
426+ }
427+
428+ virtual void openImpl(PlanState& planState, uint32_t& offset) = 0;
429
430 /**
431 * Restarts the iterator so that the next 'produceNext' call will start
432@@ -367,7 +357,17 @@
433 *
434 * @param planState
435 */
436- virtual void reset(PlanState& planState) const = 0;
437+ void reset(PlanState& planState) const
438+ {
439+#ifndef NDEBUG
440+ PlanIteratorState* state =
441+ StateTraitsImpl<PlanIteratorState>::getState(planState, theStateOffset);
442+ ZORBA_ASSERT(state->theIsOpened);
443+#endif
444+ resetImpl(planState);
445+ }
446+
447+ virtual void resetImpl(PlanState& planState) const = 0;
448
449 /**
450 * Finish the execution of the iterator. Releases all resources and destroys
451@@ -376,7 +376,19 @@
452 *
453 * @param planState
454 */
455- virtual void close(PlanState& planState) = 0;
456+ void close(PlanState& planState)
457+ {
458+#ifndef NDEBUG
459+ PlanIteratorState* state =
460+ StateTraitsImpl<PlanIteratorState>::getState(planState, theStateOffset);
461+ closeImpl(planState);
462+ state->theIsOpened = false;
463+#else
464+ closeImpl(planState);
465+#endif
466+ }
467+
468+ virtual void closeImpl(PlanState& planState) = 0;
469
470 /**
471 * Return the number of items in the sequence that is computed by this
472@@ -388,57 +400,6 @@
473 */
474 virtual bool count(store::Item_t& result, PlanState& planState) const;
475
476-
477-#if ZORBA_BATCHING_TYPE == 1
478-
479- /**
480- * Produce the next batch of items and place them in the batch buffer.
481- * Implicitly, the first call of producNext() initializes the iterator and
482- * allocates resources (main memory, file descriptors, etc.).
483- *
484- * @param stateBLock
485- */
486- virtual void produceNext(PlanState& planState) const = 0;
487-
488- /**
489- * Static Method: Retreives the next item from the batch buffer of the given
490- * iterator and returns it to the caller. If all the items from the iterator's
491- * batch buffer have been consumed already, then it makes the iterator produce
492- * its next batch of results and retrieves the 1st item from this new batch.
493- */
494- static bool consumeNext(
495- store::Item_t& result,
496- const PlanIterator* iter,
497- PlanState& planState)
498- {
499- PlanIteratorState* state =
500- StateTraitsImpl<PlanIteratorState>::getState(planState, iter->getStateOffset());
501-
502- if (state->theCurrItem == state->theEndItem)
503- {
504- // there are no more buffered items, so pruduce the next batch, if any
505-
506- if (state->theIsDone)
507- return false;
508-
509- iter->produceNext(planState);
510-
511- if (state->theCurrItem == state->theEndItem)
512- {
513- // nothing was produced.
514- assert(state->theIsDone);
515- return false;
516- }
517- }
518-
519- result.transfer(*state->theCurrItem);
520- ++state->theCurrItem;
521- return true;
522- }
523-
524-
525-#else // ZORBA_BATCHING_TYPE
526-
527 /**
528 * Produce the next item and return it to the caller. Implicitly, the first
529 * call of 'producNext' initializes the iterator and allocates resources
530@@ -446,7 +407,17 @@
531 *
532 * @param stateBLock
533 */
534- virtual bool produceNext(store::Item_t& handle, PlanState& planState) const = 0;
535+ bool produceNext(store::Item_t& result, PlanState& planState) const
536+ {
537+#ifndef NDEBUG
538+ PlanIteratorState* state =
539+ StateTraitsImpl<PlanIteratorState>::getState(planState, theStateOffset);
540+ ZORBA_ASSERT(state->theIsOpened);
541+#endif
542+ return nextImpl(result, planState);
543+ }
544+
545+ virtual bool nextImpl(store::Item_t& result, PlanState& planState) const = 0;
546
547 /**
548 * Static Method: Makes the given iterator produce its next result and returns
549@@ -472,127 +443,6 @@
550 return iter->produceNext(result, planState);
551 }
552 #endif
553-
554-#endif // ZORBA_BATCHING_TYPE
555-};
556-
557-
558-/*******************************************************************************
559- Class to implement batching
560-********************************************************************************/
561-template <class IterType>
562-class Batcher: public PlanIterator
563-{
564-public:
565- SERIALIZABLE_TEMPLATE_ABSTRACT_CLASS(Batcher)
566- SERIALIZABLE_CLASS_CONSTRUCTOR2(Batcher, PlanIterator)
567- void serialize(::zorba::serialization::Archiver& ar)
568- {
569- serialize_baseclass(ar, (PlanIterator*)this);
570- }
571-
572-public:
573- Batcher(const Batcher<IterType>& b) : PlanIterator(b) {}
574-
575- Batcher(static_context* sctx, const QueryLoc& loc) : PlanIterator(sctx, loc) {}
576-
577- ~Batcher() {}
578-
579-#if ZORBA_BATCHING_TYPE == 1
580-
581- void produceNext(PlanState& planState) const
582- {
583- PlanIteratorState* state =
584- StateTraitsImpl<PlanIteratorState>::getState(planState, theStateOffset);
585- assert(state->theIsOpened);
586- state->theEndItem = &state->theBatch[ZORBA_BATCHING_BATCHSIZE];
587- state->theCurrItem = &state->theBatch[0];
588- do
589- {
590- // In general, to compute this iterator's next result, nextImpl() will
591- // call consumeNext() on one or more of this iterator's child iterators.
592- if (!static_cast<const IterType*>(this)->nextImpl(*state->theCurrItem, planState))
593- {
594- state->theEndItem = state->theCurrItem;
595- state->theCurrItem = &state->theBatch[0];
596- state->theIsDone = true;
597- return;
598- }
599-
600- ++state->theCurrItem;
601- }
602- while (state->theCurrItem < state->theEndItem);
603-
604- state->theCurrItem = &state->theBatch[0];
605- }
606-
607-#else // ZORBA_BATCHING_TYPE
608-
609- bool produceNext(store::Item_t& result, PlanState& planState) const
610- {
611-#ifndef NDEBUG
612- PlanIteratorState* state =
613- StateTraitsImpl<PlanIteratorState>::getState(planState, theStateOffset);
614- ZORBA_ASSERT(state->theIsOpened);
615-#endif
616- return static_cast<const IterType*>(this)->nextImpl(result, planState);
617- }
618-
619-#endif // ZORBA_BATCHING_TYPE
620-
621-#ifndef NDEBUG
622- void open(PlanState& planState, uint32_t& offset)
623- {
624- static_cast<IterType*>(this)->openImpl(planState, offset);
625- // do this after openImpl because the state is created there
626- PlanIteratorState* state =
627- StateTraitsImpl<PlanIteratorState>::getState(planState, theStateOffset);
628- ZORBA_ASSERT(!state->theIsOpened); // don't call open twice
629- state->theIsOpened = true;
630- }
631-
632- void reset(PlanState& planState) const
633- {
634- PlanIteratorState* state =
635- StateTraitsImpl<PlanIteratorState>::getState(planState, theStateOffset);
636- ZORBA_ASSERT(state->theIsOpened);
637- static_cast<const IterType*>(this)->resetImpl(planState);
638- }
639-
640- void close(PlanState& planState)
641- {
642- PlanIteratorState* state =
643- StateTraitsImpl<PlanIteratorState>::getState(planState, theStateOffset);
644- static_cast<IterType*>(this)->closeImpl(planState);
645- state->theIsOpened = false;
646- }
647-
648-#else // NDEBUG
649-
650- void open(PlanState& planState, uint32_t& offset)
651- {
652- static_cast<IterType*>(this)->openImpl(planState, offset);
653- }
654-
655- void reset(PlanState& planState) const
656- {
657- static_cast<const IterType*>(this)->resetImpl(planState);
658- }
659-
660- void close(PlanState& planState)
661- {
662- static_cast<IterType*>(this)->closeImpl(planState);
663- }
664-
665-#endif // NDEBUG
666-
667- inline bool nextImpl(store::Item_t& result, PlanState& planState) const;
668-
669- inline void openImpl(PlanState& planState, uint32_t& offset) const;
670-
671- inline void resetImpl(PlanState& planState) const;
672-
673- inline void closeImpl(PlanState& planState);
674 };
675
676 #ifndef NDEBUG
677
678=== modified file 'src/runtime/base/unarybase.h'
679--- src/runtime/base/unarybase.h 2013-02-07 17:24:36 +0000
680+++ src/runtime/base/unarybase.h 2013-05-28 18:24:26 +0000
681@@ -31,17 +31,17 @@
682 data members.
683 ********************************************************************************/
684 template <class IterType, class StateType>
685-class UnaryBaseIterator : public Batcher<IterType>
686+class UnaryBaseIterator : public PlanIterator
687 {
688 protected:
689 PlanIter_t theChild;
690
691 public:
692 SERIALIZABLE_ABSTRACT_CLASS(UnaryBaseIterator)
693- SERIALIZABLE_CLASS_CONSTRUCTOR2(UnaryBaseIterator, Batcher<IterType>)
694+ SERIALIZABLE_CLASS_CONSTRUCTOR2(UnaryBaseIterator, PlanIterator)
695 void serialize(::zorba::serialization::Archiver& ar)
696 {
697- serialize_baseclass(ar, (Batcher<IterType>*)this);
698+ serialize_baseclass(ar, (PlanIterator*)this);
699 ar & theChild;
700 }
701
702@@ -51,7 +51,7 @@
703 const QueryLoc& loc,
704 const PlanIter_t& child)
705 :
706- Batcher<IterType>(sctx, loc),
707+ PlanIterator(sctx, loc),
708 theChild(child)
709 {
710 #ifndef NDEBUG
711
712=== modified file 'src/runtime/core/flwor_iterator.cpp'
713--- src/runtime/core/flwor_iterator.cpp 2013-03-15 08:22:41 +0000
714+++ src/runtime/core/flwor_iterator.cpp 2013-05-28 18:24:26 +0000
715@@ -881,7 +881,7 @@
716 MaterializeClause* materializeClause,
717 PlanIter_t& aReturnClause)
718 :
719- Batcher<FLWORIterator>(sctx, loc),
720+ PlanIterator(sctx, loc),
721 theForLetClauses(aForLetClauses),
722 theNumBindings(aForLetClauses.size()),
723 theWhereClause(aWhereClause),
724@@ -934,7 +934,7 @@
725 ********************************************************************************/
726 void FLWORIterator::serialize(::zorba::serialization::Archiver& ar)
727 {
728- serialize_baseclass(ar, (Batcher<FLWORIterator>*)this);
729+ serialize_baseclass(ar, (PlanIterator*)this);
730 ar & theForLetClauses;
731 theNumBindings = theForLetClauses.size();
732 ar & theWhereClause; //can be null
733
734=== modified file 'src/runtime/core/flwor_iterator.h'
735--- src/runtime/core/flwor_iterator.h 2013-03-04 21:00:58 +0000
736+++ src/runtime/core/flwor_iterator.h 2013-05-28 18:24:26 +0000
737@@ -437,7 +437,7 @@
738 - Data Members:
739
740 ********************************************************************************/
741-class FLWORIterator : public Batcher<FLWORIterator>
742+class FLWORIterator : public PlanIterator
743 {
744 private:
745 std::vector<ForLetClause> theForLetClauses;
746@@ -450,7 +450,7 @@
747
748 public:
749 SERIALIZABLE_CLASS(FLWORIterator);
750- SERIALIZABLE_CLASS_CONSTRUCTOR2(FLWORIterator, Batcher<FLWORIterator>);
751+ SERIALIZABLE_CLASS_CONSTRUCTOR2(FLWORIterator, PlanIterator);
752 void serialize(::zorba::serialization::Archiver& ar);
753
754 public:
755
756=== modified file 'src/runtime/core/gflwor/groupby_iterator.cpp'
757--- src/runtime/core/gflwor/groupby_iterator.cpp 2013-02-07 17:24:36 +0000
758+++ src/runtime/core/gflwor/groupby_iterator.cpp 2013-05-28 18:24:26 +0000
759@@ -128,7 +128,7 @@
760 std::vector<GroupingSpec> aGroupingSpecs,
761 std::vector<NonGroupingSpec> aNonGroupingSpecs)
762 :
763- Batcher<GroupByIterator>(sctx, aLoc),
764+ PlanIterator(sctx, aLoc),
765 theTupleIter(aTupleIterator),
766 theGroupingSpecs(aGroupingSpecs),
767 theNonGroupingSpecs(aNonGroupingSpecs)
768@@ -149,7 +149,7 @@
769 ********************************************************************************/
770 void GroupByIterator::serialize(::zorba::serialization::Archiver& ar)
771 {
772- serialize_baseclass(ar, (Batcher<GroupByIterator>*)this);
773+ serialize_baseclass(ar, (PlanIterator*)this);
774 ar & theTupleIter;
775 ar & theGroupingSpecs;
776 ar & theNonGroupingSpecs;
777
778=== modified file 'src/runtime/core/gflwor/groupby_iterator.h'
779--- src/runtime/core/gflwor/groupby_iterator.h 2013-02-07 17:24:36 +0000
780+++ src/runtime/core/gflwor/groupby_iterator.h 2013-05-28 18:24:26 +0000
781@@ -61,7 +61,7 @@
782 /***************************************************************************//**
783
784 ********************************************************************************/
785-class GroupByIterator : public Batcher<GroupByIterator>
786+class GroupByIterator : public PlanIterator
787 {
788 private:
789 PlanIter_t theTupleIter;
790@@ -70,7 +70,7 @@
791
792 public:
793 SERIALIZABLE_CLASS(GroupByIterator)
794- SERIALIZABLE_CLASS_CONSTRUCTOR2(GroupByIterator, Batcher<GroupByIterator>)
795+ SERIALIZABLE_CLASS_CONSTRUCTOR2(GroupByIterator, PlanIterator)
796 void serialize(::zorba::serialization::Archiver& ar);
797
798 public:
799
800=== modified file 'src/runtime/core/gflwor/orderby_iterator.cpp'
801--- src/runtime/core/gflwor/orderby_iterator.cpp 2013-02-26 04:12:43 +0000
802+++ src/runtime/core/gflwor/orderby_iterator.cpp 2013-05-28 18:24:26 +0000
803@@ -189,7 +189,7 @@
804 std::vector<std::vector<PlanIter_t> >& outputForVarsRefs,
805 std::vector<std::vector<PlanIter_t> >& outputLetVarsRefs)
806 :
807- Batcher<OrderByIterator>(sctx, aLoc),
808+ PlanIterator(sctx, aLoc),
809 theStable(stable),
810 theOrderSpecs(orderSpecs),
811 theTupleIter(tupleIterator),
812@@ -208,7 +208,7 @@
813
814 void OrderByIterator::serialize(::zorba::serialization::Archiver& ar)
815 {
816- serialize_baseclass(ar, (Batcher<OrderByIterator>*)this);
817+ serialize_baseclass(ar, (PlanIterator*)this);
818 ar & theStable;
819 ar & theOrderSpecs;
820 ar & theTupleIter;
821
822=== modified file 'src/runtime/core/gflwor/orderby_iterator.h'
823--- src/runtime/core/gflwor/orderby_iterator.h 2013-02-26 04:12:43 +0000
824+++ src/runtime/core/gflwor/orderby_iterator.h 2013-05-28 18:24:26 +0000
825@@ -179,7 +179,7 @@
826 /*******************************************************************************
827
828 ********************************************************************************/
829-class OrderByIterator : public Batcher<OrderByIterator>
830+class OrderByIterator : public PlanIterator
831 {
832 private:
833 bool theStable;
834@@ -194,7 +194,7 @@
835
836 public:
837 SERIALIZABLE_CLASS(OrderByIterator)
838- SERIALIZABLE_CLASS_CONSTRUCTOR2(OrderByIterator, Batcher<OrderByIterator>)
839+ SERIALIZABLE_CLASS_CONSTRUCTOR2(OrderByIterator, PlanIterator)
840 void serialize(::zorba::serialization::Archiver& ar);
841
842 public:
843
844=== modified file 'src/runtime/core/gflwor/window_iterator.cpp'
845--- src/runtime/core/gflwor/window_iterator.cpp 2013-04-24 18:01:51 +0000
846+++ src/runtime/core/gflwor/window_iterator.cpp 2013-05-28 18:24:26 +0000
847@@ -620,7 +620,7 @@
848 bool lazyEval,
849 ulong maxNeededHistory)
850 :
851- Batcher<WindowIterator>(sctx, loc),
852+ PlanIterator(sctx, loc),
853 theWindowType(windowType),
854 theTupleIter(tupleIter),
855 theInputIter(domainIter),
856@@ -651,7 +651,7 @@
857 ********************************************************************************/
858 void WindowIterator::serialize(::zorba::serialization::Archiver& ar)
859 {
860- serialize_baseclass(ar, (Batcher<WindowIterator>*)this);
861+ serialize_baseclass(ar, (PlanIterator*)this);
862 SERIALIZE_ENUM(WindowType, theWindowType);
863 ar & theTupleIter;
864 ar & theInputIter;
865
866=== modified file 'src/runtime/core/gflwor/window_iterator.h'
867--- src/runtime/core/gflwor/window_iterator.h 2013-04-24 18:01:51 +0000
868+++ src/runtime/core/gflwor/window_iterator.h 2013-05-28 18:24:26 +0000
869@@ -312,7 +312,7 @@
870 buffer the domain sequence.
871 theMaxNeededHistory : This is relevant only if a lazy temp sequence is used.
872 ********************************************************************************/
873-class WindowIterator : public Batcher<WindowIterator>
874+class WindowIterator : public PlanIterator
875 {
876 public:
877 static const ulong MAX_HISTORY;
878@@ -344,7 +344,8 @@
879
880 WindowIterator(::zorba::serialization::Archiver& ar)
881 :
882- Batcher<WindowIterator>(ar), theStartClause(ar)
883+ PlanIterator(ar),
884+ theStartClause(ar)
885 {
886 }
887
888
889=== modified file 'src/runtime/core/item_iterator.cpp'
890--- src/runtime/core/item_iterator.cpp 2013-03-05 00:45:43 +0000
891+++ src/runtime/core/item_iterator.cpp 2013-05-28 18:24:26 +0000
892@@ -85,7 +85,7 @@
893 PlanIter_t& aElseIter,
894 bool aIsBooleanIter)
895 :
896- Batcher<IfThenElseIterator>(sctx, loc),
897+ PlanIterator(sctx, loc),
898 theCondIter(aCondIter),
899 theThenIter(aThenIter),
900 theElseIter(aElseIter),
901@@ -96,7 +96,7 @@
902
903 void IfThenElseIterator::serialize(::zorba::serialization::Archiver& ar)
904 {
905- serialize_baseclass(ar, (Batcher<IfThenElseIterator>*)this);
906+ serialize_baseclass(ar, (PlanIterator*)this);
907 ar & theCondIter;
908 ar & theThenIter;
909 ar & theElseIter;
910@@ -165,7 +165,7 @@
911 }
912
913
914-void IfThenElseIterator::closeImpl(PlanState& planState) const
915+void IfThenElseIterator::closeImpl(PlanState& planState)
916 {
917 theCondIter->close(planState);
918 theThenIter->close(planState);
919
920=== modified file 'src/runtime/core/item_iterator.h'
921--- src/runtime/core/item_iterator.h 2013-03-05 00:45:43 +0000
922+++ src/runtime/core/item_iterator.h 2013-05-28 18:24:26 +0000
923@@ -82,17 +82,17 @@
924 };
925
926
927-class IfThenElseIterator : public Batcher<IfThenElseIterator>
928+class IfThenElseIterator : public PlanIterator
929 {
930 private:
931 PlanIter_t theCondIter;
932 PlanIter_t theThenIter;
933 PlanIter_t theElseIter;
934- bool theIsBooleanIter;
935+ bool theIsBooleanIter;
936
937 public:
938 SERIALIZABLE_CLASS(IfThenElseIterator)
939- SERIALIZABLE_CLASS_CONSTRUCTOR2(IfThenElseIterator, Batcher<IfThenElseIterator>)
940+ SERIALIZABLE_CLASS_CONSTRUCTOR2(IfThenElseIterator, PlanIterator)
941 void serialize(::zorba::serialization::Archiver& ar);
942
943 public:
944@@ -127,7 +127,7 @@
945
946 void resetImpl(PlanState& planState) const;
947
948- void closeImpl(PlanState& planState) const;
949+ void closeImpl(PlanState& planState);
950 };
951
952
953
954=== modified file 'src/runtime/update/update.cpp'
955--- src/runtime/update/update.cpp 2013-02-07 17:24:36 +0000
956+++ src/runtime/update/update.cpp 2013-05-28 18:24:26 +0000
957@@ -751,7 +751,7 @@
958 PlanIter_t aApplyIter,
959 PlanIter_t aReturnIter)
960 :
961- Batcher<TransformIterator>(sctx, aLoc),
962+ PlanIterator(sctx, aLoc),
963 theCopyClauses(aCopyClauses),
964 theModifyIter(aModifyIter),
965 thePulHolderIter(aPulHolderIter),
966@@ -768,7 +768,7 @@
967
968 void TransformIterator::serialize(::zorba::serialization::Archiver& ar)
969 {
970- serialize_baseclass(ar, (Batcher<TransformIterator>*)this);
971+ serialize_baseclass(ar, (PlanIterator*)this);
972 ar & theCopyClauses;
973 ar & theModifyIter;
974 ar & thePulHolderIter;
975@@ -926,8 +926,7 @@
976 }
977
978
979-void
980-TransformIterator::resetImpl(PlanState& planState) const
981+void TransformIterator::resetImpl(PlanState& planState) const
982 {
983 StateTraitsImpl<PlanIteratorState>::reset(planState, theStateOffset);
984
985@@ -945,8 +944,7 @@
986 }
987
988
989-void
990-TransformIterator::closeImpl(PlanState& planState) const
991+void TransformIterator::closeImpl(PlanState& planState)
992 {
993 CopyClause::const_iter_t lIter = theCopyClauses.begin();
994 CopyClause::const_iter_t lEnd = theCopyClauses.end();
995
996=== modified file 'src/runtime/update/update.h'
997--- src/runtime/update/update.h 2013-02-07 17:24:36 +0000
998+++ src/runtime/update/update.h 2013-05-28 18:24:26 +0000
999@@ -175,7 +175,7 @@
1000 };
1001
1002
1003-class TransformIterator : public Batcher<TransformIterator>
1004+class TransformIterator : public PlanIterator
1005 {
1006 private:
1007 std::vector<CopyClause> theCopyClauses;
1008@@ -186,7 +186,7 @@
1009
1010 public:
1011 SERIALIZABLE_CLASS(TransformIterator)
1012- SERIALIZABLE_CLASS_CONSTRUCTOR2(TransformIterator, Batcher<TransformIterator>)
1013+ SERIALIZABLE_CLASS_CONSTRUCTOR2(TransformIterator, PlanIterator)
1014 void serialize(::zorba::serialization::Archiver& ar);
1015
1016 public:
1017@@ -213,7 +213,7 @@
1018
1019 void resetImpl(PlanState& planState) const;
1020
1021- void closeImpl(PlanState& planState) const;
1022+ void closeImpl(PlanState& planState);
1023 };
1024
1025

Subscribers

People subscribed via source and target branches