Merge lp:~zorba-coders/zorba/markos-scratch into lp:zorba

Proposed by Markos Zaharioudakis
Status: Merged
Approved by: Markos Zaharioudakis
Approved revision: 11047
Merged at revision: 11348
Proposed branch: lp:~zorba-coders/zorba/markos-scratch
Merge into: lp:zorba
Diff against target: 515 lines (+150/-126)
12 files modified
ChangeLog (+5/-8)
src/compiler/expression/path_expr.h (+1/-0)
src/compiler/parsetree/parsenode_print_xqdoc_visitor.cpp (+42/-42)
src/diagnostics/diagnostic.h (+1/-20)
src/diagnostics/qname.h (+47/-0)
src/diagnostics/xquery_stack_trace.cpp (+1/-0)
src/store/api/item.h (+14/-1)
src/store/naive/atomic_items.cpp (+20/-24)
src/store/naive/atomic_items.h (+15/-13)
src/store/naive/item.cpp (+1/-18)
src/zorbaserialization/serialize_basic_types.cpp (+2/-0)
src/zorbaserialization/serialize_template_types.h (+1/-0)
To merge this branch: bzr merge lp:~zorba-coders/zorba/markos-scratch
Reviewer Review Type Date Requested Status
Markos Zaharioudakis Approve
Review via email: mp+157572@code.launchpad.net

Commit message

Inlined Item::getTypeCode method for better performance

Description of the change

Inlined Item::getTypeCode method for better performance

To post a comment you must log in.
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 :

The attempt to merge lp:~zorba-coders/zorba/markos-scratch into lp:zorba failed. Below is the output from the failed tests.

CMake Error at /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake:275 (message):
  Validation queue job markos-scratch-2013-04-08T01-08-52.383Z is finished.
  The final status was:

  1 tests did not succeed - changes not commited.

Error in read script: /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake

11047. By Markos Zaharioudakis

fixed bug in IntegerItemImpl::equals()

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 markos-scratch-2013-04-08T09-17-53.794Z 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 'ChangeLog'
2--- ChangeLog 2013-04-03 10:23:36 +0000
3+++ ChangeLog 2013-04-08 08:47:22 +0000
4@@ -36,7 +36,8 @@
5 * Extented index join rule to general flwor expressions.
6
7 Bug Fixes/Other Changes:
8- * Fixed bug #1123836 (overflows in date/time casts now return FODT0001 and in durations return FODT0002)
9+ * Fixed bug #1123836 (overflows in date/time casts now return FODT0001 and
10+ in durations return FODT0002)
11 * Fixed bug #1114228 (unrecognized options in the XQuery namespace now raise an error)
12 * Fixed bug #1124273 (xqdoc crash because of annotation literals)
13 * Fixed bug #867027 (XQST0059 error messages inconsistent)
14@@ -46,6 +47,8 @@
15 * Fixed bug in index join rule (copy var ids after cloning index domain expr).
16 * Fixed bug #1123162 (FOTS: formatting dates and times failures)
17 * Added missing wrapper expressions around some variable references.
18+ * Fixed optimizer bug: elimination of positional variable sometimes caused
19+ elimination of whole FOR clause.
20 * Fixed bug in the throwing of error XQTY0086 during node construction.
21 * Fixed bug #1148335 (where-clause expression was not always reset when it should be)
22 * Fixed bug #1122396 (Associate origin/destination URI to I/O stream)
23@@ -60,21 +63,15 @@
24 * Fixed bug #866874 (regex "range subtraction" not supported for ICU)
25 * Fixed bug in computing the static type of an allowing-empty FOR variable.
26 * Fixed bug #1099648 and #1088886 (XML parsing failures on Red Hat)
27-<<<<<<< TREE
28 * Fixed bug #1099535 (xml:parse endless loop)
29 * Fixed bug in optimizing fn:count over general-index probes
30 * Fixed bug #866958 (Parsing error not explicit enough)
31 * Fixed bug #867068: (Incorrect usage of XQDY0027)
32-=======
33- * Fixed bug #1099535 (xml:parse endless loop)
34 * Fixed bug: jsoniq constructor should not be const-folded
35- * Fixed bug #866958 (Parsing error not explicit enough)
36 * Fixed bug #1152834 (bug in computing the scripting kind of array and object
37 constructor exprs)
38 * Fixed bug #1125444 (input group-by exprs were not treated by index-flwor_vars()
39- functoin, leading to erroneous loop hoisting).
40- * Fixed bug #867068 (Incorrect usage of XQDY0027)
41->>>>>>> MERGE-SOURCE
42+ function, leading to erroneous loop hoisting).
43 * Fixed bug #1023362 (xsi:type attribute ignored during validation)
44
45
46
47=== modified file 'src/compiler/expression/path_expr.h'
48--- src/compiler/expression/path_expr.h 2013-02-07 17:24:36 +0000
49+++ src/compiler/expression/path_expr.h 2013-04-08 08:47:22 +0000
50@@ -22,6 +22,7 @@
51
52 #include "zorbatypes/zstring.h"
53
54+#include <zorba/store_consts.h>
55
56 namespace zorba
57 {
58
59=== modified file 'src/compiler/parsetree/parsenode_print_xqdoc_visitor.cpp'
60--- src/compiler/parsetree/parsenode_print_xqdoc_visitor.cpp 2013-03-22 00:38:18 +0000
61+++ src/compiler/parsetree/parsenode_print_xqdoc_visitor.cpp 2013-04-08 08:47:22 +0000
62@@ -48,6 +48,48 @@
63
64 class ParseNodePrintXQDocVisitor : public parsenode_visitor
65 {
66+protected:
67+ store::Item_t& theResult;
68+
69+ store::Item_t theModule;
70+ store::Item_t theImports;
71+ store::Item_t theVariables;
72+ store::Item_t theFunctions;
73+ store::Item_t theCollections;
74+ store::Item_t theIndexes;
75+
76+ // set of functions being invoked in the function
77+ // whoes declaration is currently being processed
78+ map<string, store::Item_t> theInvokedFunc;
79+
80+ // prefix -> uri
81+ map<zstring, zstring> theNamespaceMap;
82+
83+ // prefix -> uri for the schema imports
84+ map<zstring, zstring> theNamespaceSchemaMap;
85+
86+ const char* theXQDocNS;
87+ const char* theXQDocPrefix;
88+
89+ zstring theFileName;
90+ zstring theBaseURI;
91+ zstring theVersion;
92+ store::NsBindings theNSBindings;
93+
94+ store::ItemFactory * theFactory;
95+
96+ string theQuery;
97+ zstring theEncoding;
98+ zstring theXQueryVersion;
99+
100+ uint32_t theOptions;
101+
102+ // helper vars to compute index sources
103+ bool theIsIndexDecl;
104+ bool theWaitForIndexSourceLiteral;
105+ std::vector<pair<zstring,zstring> > theIndexSources;
106+
107+
108 private:
109
110 string getFileName(const string& aFileName)
111@@ -458,48 +500,6 @@
112 }
113
114
115-protected:
116- store::Item_t& theResult;
117-
118- store::Item_t theModule;
119- store::Item_t theImports;
120- store::Item_t theVariables;
121- store::Item_t theFunctions;
122- store::Item_t theCollections;
123- store::Item_t theIndexes;
124-
125- // set of functions being invoked in the function
126- // whoes declaration is currently being processed
127- map<string, store::Item_t> theInvokedFunc;
128-
129- // prefix -> uri
130- map<zstring, zstring> theNamespaceMap;
131-
132- // prefix -> uri for the schema imports
133- map<zstring, zstring> theNamespaceSchemaMap;
134-
135- const char* theXQDocNS;
136- const char* theXQDocPrefix;
137-
138- zstring theFileName;
139- zstring theBaseURI;
140- zstring theVersion;
141- store::NsBindings theNSBindings;
142-
143- store::ItemFactory * theFactory;
144-
145- string theQuery;
146- zstring theEncoding;
147- zstring theXQueryVersion;
148-
149- uint32_t theOptions;
150-
151- // helper vars to compute index sources
152- bool theIsIndexDecl;
153- bool theWaitForIndexSourceLiteral;
154- std::vector<pair<zstring,zstring> >
155- theIndexSources;
156-
157 public:
158
159 ParseNodePrintXQDocVisitor(store::Item_t& aResult,
160
161=== modified file 'src/diagnostics/diagnostic.h'
162--- src/diagnostics/diagnostic.h 2013-02-07 17:24:36 +0000
163+++ src/diagnostics/diagnostic.h 2013-04-08 08:47:22 +0000
164@@ -22,7 +22,7 @@
165 #include <zorba/xquery_exception.h>
166
167 #include "compiler/parser/query_loc.h"
168-#include "store/api/item.h"
169+#include "store/api/shared_types.h"
170
171 namespace zorba {
172 namespace diagnostic {
173@@ -30,25 +30,6 @@
174 ///////////////////////////////////////////////////////////////////////////////
175
176 /**
177- * Given a store::Item_t that represents a QName, creates an instance of
178- * QNameType having the same QName.
179- *
180- * @tparam QNameType The type of QName to create.
181- * @param qname The QName item.
182- * @return Returns said QNameType.
183- */
184-template<class QNameType> inline
185-QNameType to_QName( store::Item_t const &qname ) {
186- return QNameType(
187- qname->getNamespace().c_str(),
188- qname->getPrefix().c_str(),
189- qname->getLocalName().c_str()
190- );
191-}
192-
193-///////////////////////////////////////////////////////////////////////////////
194-
195-/**
196 * Makes an empty location.
197 *
198 * @return Returns said location.
199
200=== added file 'src/diagnostics/qname.h'
201--- src/diagnostics/qname.h 1970-01-01 00:00:00 +0000
202+++ src/diagnostics/qname.h 2013-04-08 08:47:22 +0000
203@@ -0,0 +1,47 @@
204+/*
205+ * Copyright 2006-2008 The FLWOR Foundation.
206+ *
207+ * Licensed under the Apache License, Version 2.0 (the "License");
208+ * you may not use this file except in compliance with the License.
209+ * You may obtain a copy of the License at
210+ *
211+ * http://www.apache.org/licenses/LICENSE-2.0
212+ *
213+ * Unless required by applicable law or agreed to in writing, software
214+ * distributed under the License is distributed on an "AS IS" BASIS,
215+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
216+ * See the License for the specific language governing permissions and
217+ * limitations under the License.
218+ */
219+
220+#ifndef ZORBA_DIAGNOSTIC_QNAME_H
221+#define ZORBA_DIAGNOSTIC_QNAME_H
222+
223+#include <zorba/config.h>
224+
225+#include "store/api/item.h"
226+
227+namespace zorba {
228+namespace diagnostic {
229+
230+
231+template<class QNameType>
232+QNameType to_QName( store::Item_t const &qname ) {
233+ return QNameType(
234+ qname->getNamespace().c_str(),
235+ qname->getPrefix().c_str(),
236+ qname->getLocalName().c_str()
237+ );
238+}
239+
240+
241+} // namespace diagnostic
242+} // namespace zorba
243+
244+#endif /* ZORBA_DIAGNOSTIC_QNAME_H */
245+/*
246+ * Local variables:
247+ * mode: c++
248+ * End:
249+ */
250+/* vim:set et sw=2 ts=2: */
251
252=== modified file 'src/diagnostics/xquery_stack_trace.cpp'
253--- src/diagnostics/xquery_stack_trace.cpp 2013-02-07 17:24:36 +0000
254+++ src/diagnostics/xquery_stack_trace.cpp 2013-04-08 08:47:22 +0000
255@@ -25,6 +25,7 @@
256 #include <zorba/xquery_exception.h>
257
258 #include "diagnostic.h"
259+#include "qname.h"
260
261 namespace zorba {
262
263
264=== modified file 'src/store/api/item.h'
265--- src/store/api/item.h 2013-03-24 20:40:03 +0000
266+++ src/store/api/item.h 2013-04-08 08:47:22 +0000
267@@ -29,6 +29,8 @@
268 #include <zorba/store_consts.h>
269 #include "store/api/shared_types.h"
270
271+#include "diagnostics/xquery_diagnostics.h"
272+
273 #ifndef ZORBA_NO_FULL_TEXT
274 #include <zorba/locale.h>
275 #include <zorba/tokenizer.h>
276@@ -120,6 +122,7 @@
277 void removeReference();
278
279 virtual size_t alloc_size() const;
280+
281 virtual size_t dynamic_size() const;
282
283 /* ------------------- General Methods for Items ------------------------- */
284@@ -331,7 +334,17 @@
285 /**
286 * @return The numeric code coresponding to the data type of this item.
287 */
288- SchemaTypeCode getTypeCode() const;
289+ SchemaTypeCode getTypeCode() const
290+ {
291+ if (isAtomic())
292+ {
293+ return static_cast<SchemaTypeCode>(theUnion.itemKind >> 4);
294+ }
295+
296+ throw ZORBA_EXCEPTION(
297+ zerr::ZSTR0050_FUNCTION_NOT_IMPLEMENTED_FOR_ITEMTYPE,
298+ ERROR_PARAMS(__FUNCTION__, typeid(*this).name()));
299+ }
300
301 /**
302 * @return If this is an atomic item with a user-defined data type UT, return
303
304=== modified file 'src/store/naive/atomic_items.cpp'
305--- src/store/naive/atomic_items.cpp 2013-03-21 18:22:40 +0000
306+++ src/store/naive/atomic_items.cpp 2013-04-08 08:47:22 +0000
307@@ -2745,31 +2745,19 @@
308 }
309
310
311-long IntegerItemImpl::compare( Item const *other, long,
312- const XQPCollator* ) const {
313- try
314- {
315- return theValue.compare( other->getIntegerValue() );
316- }
317- catch ( ZorbaException const& )
318- {
319- return getDecimalValue().compare( other->getDecimalValue() );
320- }
321-}
322-
323-bool IntegerItemImpl::equals( const store::Item* other, long,
324- const XQPCollator*) const
325+long IntegerItemImpl::compare(Item const* other, long, const XQPCollator*) const
326 {
327 try
328 {
329- return theValue == other->getIntegerValue();
330+ return theValue.compare(other->getIntegerValue());
331 }
332- catch (ZorbaException const&)
333+ catch (ZorbaException const& )
334 {
335- return getDecimalValue() == other->getDecimalValue();
336+ return getDecimalValue().compare(other->getDecimalValue());
337 }
338 }
339
340+
341 xs_decimal IntegerItemImpl::getDecimalValue() const
342 {
343 return xs_decimal(theValue);
344@@ -2870,20 +2858,24 @@
345 return sizeof( *this );
346 }
347
348-long NonPositiveIntegerItem::compare( Item const *other, long,
349- const XQPCollator* ) const {
350+
351+long NonPositiveIntegerItem::compare(Item const* other, long, const XQPCollator*) const
352+{
353 try
354 {
355- return theValue.compare( other->getIntegerValue() );
356+ return theValue.compare(other->getIntegerValue());
357 }
358- catch ( ZorbaException const& )
359+ catch (ZorbaException const&)
360 {
361- return getDecimalValue().compare( other->getDecimalValue() );
362+ return getDecimalValue().compare(other->getDecimalValue());
363 }
364 }
365
366-bool NonPositiveIntegerItem::equals( const store::Item* other, long,
367- const XQPCollator* ) const
368+
369+bool NonPositiveIntegerItem::equals(
370+ const store::Item* other,
371+ long,
372+ const XQPCollator* ) const
373 {
374 try
375 {
376@@ -2895,21 +2887,25 @@
377 }
378 }
379
380+
381 store::Item* NonPositiveIntegerItem::getType() const
382 {
383 return GET_STORE().theSchemaTypeNames[store::XS_NON_POSITIVE_INTEGER];
384 }
385
386+
387 xs_decimal NonPositiveIntegerItem::getDecimalValue() const
388 {
389 return xs_decimal(theValue);
390 }
391
392+
393 xs_integer NonPositiveIntegerItem::getIntegerValue() const
394 {
395 return xs_integer(theValue);
396 }
397
398+
399 xs_long NonPositiveIntegerItem::getLongValue() const
400 {
401 try
402
403=== modified file 'src/store/naive/atomic_items.h'
404--- src/store/naive/atomic_items.h 2013-03-21 18:22:40 +0000
405+++ src/store/naive/atomic_items.h 2013-04-08 08:47:22 +0000
406@@ -114,8 +114,6 @@
407 theTypeName.transfer(typeName);
408 }
409
410- //UserTypedAtomicItem() {}
411-
412 public:
413 size_t alloc_size() const;
414 size_t dynamic_size() const;
415@@ -1566,17 +1564,21 @@
416
417 store::Item* getType() const;
418
419- uint32_t hash(long = 0, const XQPCollator* aCollation = 0) const;
420-
421- long compare(
422- const Item* other,
423- long timezone = 0,
424- const XQPCollator* aCollation = 0) const;
425-
426- bool equals(
427- const store::Item* other,
428- long timezone = 0,
429- const XQPCollator* aCollation = 0) const;
430+ uint32_t hash(long = 0, const XQPCollator* c = 0) const;
431+
432+ long compare(const Item* other, long tz = 0, const XQPCollator* c = 0) const;
433+
434+ bool equals(const Item* other, long tz = 0, const XQPCollator* c = 0) const
435+ {
436+ try
437+ {
438+ return theValue == other->getIntegerValue();
439+ }
440+ catch (ZorbaException const&)
441+ {
442+ return getDecimalValue() == other->getDecimalValue();
443+ }
444+ }
445
446 bool getEBV() const;
447
448
449=== modified file 'src/store/naive/item.cpp'
450--- src/store/naive/item.cpp 2013-03-26 23:32:03 +0000
451+++ src/store/naive/item.cpp 2013-04-08 08:47:22 +0000
452@@ -220,7 +220,6 @@
453 ZORBA_ASSERT(false);
454 }
455 }
456-
457 #endif
458 }
459
460@@ -289,19 +288,6 @@
461 }
462
463
464-store::SchemaTypeCode Item::getTypeCode() const
465-{
466- if (isAtomic())
467- {
468- return static_cast<SchemaTypeCode>(theUnion.itemKind >> 4);
469- }
470-
471- throw ZORBA_EXCEPTION(
472- zerr::ZSTR0050_FUNCTION_NOT_IMPLEMENTED_FOR_ITEMTYPE,
473- ERROR_PARAMS(__FUNCTION__, typeid(*this).name()));
474-}
475-
476-
477 Item* Item::getType() const
478 {
479 throw ZORBA_EXCEPTION(
480@@ -318,10 +304,7 @@
481 };
482
483
484-bool Item::equals(
485- const store::Item* other,
486- long timezone,
487- const XQPCollator* aCollation) const
488+bool Item::equals(const store::Item* other, long tz, const XQPCollator* c) const
489 {
490 throw ZORBA_EXCEPTION(zerr::ZSTR0040_TYPE_ERROR,
491 ERROR_PARAMS(ZED(NoCompareTypes_23),
492
493=== modified file 'src/zorbaserialization/serialize_basic_types.cpp'
494--- src/zorbaserialization/serialize_basic_types.cpp 2013-02-07 17:24:36 +0000
495+++ src/zorbaserialization/serialize_basic_types.cpp 2013-04-08 08:47:22 +0000
496@@ -22,6 +22,8 @@
497 #include "zorbaserialization/archiver.h"
498 #include "zorbaserialization/base64impl.h"
499
500+#include "zorbatypes/floatimpl.h"
501+
502 #include "diagnostics/xquery_diagnostics.h"
503 #include "diagnostics/util_macros.h"
504 #include "diagnostics/assert.h"
505
506=== modified file 'src/zorbaserialization/serialize_template_types.h'
507--- src/zorbaserialization/serialize_template_types.h 2013-03-04 21:00:58 +0000
508+++ src/zorbaserialization/serialize_template_types.h 2013-04-08 08:47:22 +0000
509@@ -32,6 +32,7 @@
510 #include "diagnostics/assert.h"
511
512 #include "zorbatypes/zstring.h"
513+#include "zorbatypes/floatimpl.h"
514
515 #include "zorbautils/checked_vector.h"
516

Subscribers

People subscribed via source and target branches