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
=== modified file 'ChangeLog'
--- ChangeLog 2013-04-03 10:23:36 +0000
+++ ChangeLog 2013-04-08 08:47:22 +0000
@@ -36,7 +36,8 @@
36 * Extented index join rule to general flwor expressions. 36 * Extented index join rule to general flwor expressions.
3737
38Bug Fixes/Other Changes:38Bug Fixes/Other Changes:
39 * Fixed bug #1123836 (overflows in date/time casts now return FODT0001 and in durations return FODT0002)39 * Fixed bug #1123836 (overflows in date/time casts now return FODT0001 and
40 in durations return FODT0002)
40 * Fixed bug #1114228 (unrecognized options in the XQuery namespace now raise an error)41 * Fixed bug #1114228 (unrecognized options in the XQuery namespace now raise an error)
41 * Fixed bug #1124273 (xqdoc crash because of annotation literals)42 * Fixed bug #1124273 (xqdoc crash because of annotation literals)
42 * Fixed bug #867027 (XQST0059 error messages inconsistent)43 * Fixed bug #867027 (XQST0059 error messages inconsistent)
@@ -46,6 +47,8 @@
46 * Fixed bug in index join rule (copy var ids after cloning index domain expr).47 * Fixed bug in index join rule (copy var ids after cloning index domain expr).
47 * Fixed bug #1123162 (FOTS: formatting dates and times failures)48 * Fixed bug #1123162 (FOTS: formatting dates and times failures)
48 * Added missing wrapper expressions around some variable references.49 * Added missing wrapper expressions around some variable references.
50 * Fixed optimizer bug: elimination of positional variable sometimes caused
51 elimination of whole FOR clause.
49 * Fixed bug in the throwing of error XQTY0086 during node construction.52 * Fixed bug in the throwing of error XQTY0086 during node construction.
50 * Fixed bug #1148335 (where-clause expression was not always reset when it should be)53 * Fixed bug #1148335 (where-clause expression was not always reset when it should be)
51 * Fixed bug #1122396 (Associate origin/destination URI to I/O stream)54 * Fixed bug #1122396 (Associate origin/destination URI to I/O stream)
@@ -60,21 +63,15 @@
60 * Fixed bug #866874 (regex "range subtraction" not supported for ICU)63 * Fixed bug #866874 (regex "range subtraction" not supported for ICU)
61 * Fixed bug in computing the static type of an allowing-empty FOR variable.64 * Fixed bug in computing the static type of an allowing-empty FOR variable.
62 * Fixed bug #1099648 and #1088886 (XML parsing failures on Red Hat)65 * Fixed bug #1099648 and #1088886 (XML parsing failures on Red Hat)
63<<<<<<< TREE
64 * Fixed bug #1099535 (xml:parse endless loop)66 * Fixed bug #1099535 (xml:parse endless loop)
65 * Fixed bug in optimizing fn:count over general-index probes67 * Fixed bug in optimizing fn:count over general-index probes
66 * Fixed bug #866958 (Parsing error not explicit enough)68 * Fixed bug #866958 (Parsing error not explicit enough)
67 * Fixed bug #867068: (Incorrect usage of XQDY0027)69 * Fixed bug #867068: (Incorrect usage of XQDY0027)
68=======
69 * Fixed bug #1099535 (xml:parse endless loop)
70 * Fixed bug: jsoniq constructor should not be const-folded70 * Fixed bug: jsoniq constructor should not be const-folded
71 * Fixed bug #866958 (Parsing error not explicit enough)
72 * Fixed bug #1152834 (bug in computing the scripting kind of array and object71 * Fixed bug #1152834 (bug in computing the scripting kind of array and object
73 constructor exprs)72 constructor exprs)
74 * Fixed bug #1125444 (input group-by exprs were not treated by index-flwor_vars()73 * Fixed bug #1125444 (input group-by exprs were not treated by index-flwor_vars()
75 functoin, leading to erroneous loop hoisting).74 function, leading to erroneous loop hoisting).
76 * Fixed bug #867068 (Incorrect usage of XQDY0027)
77>>>>>>> MERGE-SOURCE
78 * Fixed bug #1023362 (xsi:type attribute ignored during validation)75 * Fixed bug #1023362 (xsi:type attribute ignored during validation)
7976
8077
8178
=== modified file 'src/compiler/expression/path_expr.h'
--- src/compiler/expression/path_expr.h 2013-02-07 17:24:36 +0000
+++ src/compiler/expression/path_expr.h 2013-04-08 08:47:22 +0000
@@ -22,6 +22,7 @@
2222
23#include "zorbatypes/zstring.h"23#include "zorbatypes/zstring.h"
2424
25#include <zorba/store_consts.h>
2526
26namespace zorba27namespace zorba
27{28{
2829
=== modified file 'src/compiler/parsetree/parsenode_print_xqdoc_visitor.cpp'
--- src/compiler/parsetree/parsenode_print_xqdoc_visitor.cpp 2013-03-22 00:38:18 +0000
+++ src/compiler/parsetree/parsenode_print_xqdoc_visitor.cpp 2013-04-08 08:47:22 +0000
@@ -48,6 +48,48 @@
4848
49class ParseNodePrintXQDocVisitor : public parsenode_visitor49class ParseNodePrintXQDocVisitor : public parsenode_visitor
50{50{
51protected:
52 store::Item_t& theResult;
53
54 store::Item_t theModule;
55 store::Item_t theImports;
56 store::Item_t theVariables;
57 store::Item_t theFunctions;
58 store::Item_t theCollections;
59 store::Item_t theIndexes;
60
61 // set of functions being invoked in the function
62 // whoes declaration is currently being processed
63 map<string, store::Item_t> theInvokedFunc;
64
65 // prefix -> uri
66 map<zstring, zstring> theNamespaceMap;
67
68 // prefix -> uri for the schema imports
69 map<zstring, zstring> theNamespaceSchemaMap;
70
71 const char* theXQDocNS;
72 const char* theXQDocPrefix;
73
74 zstring theFileName;
75 zstring theBaseURI;
76 zstring theVersion;
77 store::NsBindings theNSBindings;
78
79 store::ItemFactory * theFactory;
80
81 string theQuery;
82 zstring theEncoding;
83 zstring theXQueryVersion;
84
85 uint32_t theOptions;
86
87 // helper vars to compute index sources
88 bool theIsIndexDecl;
89 bool theWaitForIndexSourceLiteral;
90 std::vector<pair<zstring,zstring> > theIndexSources;
91
92
51private:93private:
5294
53string getFileName(const string& aFileName)95string getFileName(const string& aFileName)
@@ -458,48 +500,6 @@
458}500}
459501
460502
461protected:
462 store::Item_t& theResult;
463
464 store::Item_t theModule;
465 store::Item_t theImports;
466 store::Item_t theVariables;
467 store::Item_t theFunctions;
468 store::Item_t theCollections;
469 store::Item_t theIndexes;
470
471 // set of functions being invoked in the function
472 // whoes declaration is currently being processed
473 map<string, store::Item_t> theInvokedFunc;
474
475 // prefix -> uri
476 map<zstring, zstring> theNamespaceMap;
477
478 // prefix -> uri for the schema imports
479 map<zstring, zstring> theNamespaceSchemaMap;
480
481 const char* theXQDocNS;
482 const char* theXQDocPrefix;
483
484 zstring theFileName;
485 zstring theBaseURI;
486 zstring theVersion;
487 store::NsBindings theNSBindings;
488
489 store::ItemFactory * theFactory;
490
491 string theQuery;
492 zstring theEncoding;
493 zstring theXQueryVersion;
494
495 uint32_t theOptions;
496
497 // helper vars to compute index sources
498 bool theIsIndexDecl;
499 bool theWaitForIndexSourceLiteral;
500 std::vector<pair<zstring,zstring> >
501 theIndexSources;
502
503public:503public:
504504
505ParseNodePrintXQDocVisitor(store::Item_t& aResult,505ParseNodePrintXQDocVisitor(store::Item_t& aResult,
506506
=== modified file 'src/diagnostics/diagnostic.h'
--- src/diagnostics/diagnostic.h 2013-02-07 17:24:36 +0000
+++ src/diagnostics/diagnostic.h 2013-04-08 08:47:22 +0000
@@ -22,7 +22,7 @@
22#include <zorba/xquery_exception.h>22#include <zorba/xquery_exception.h>
2323
24#include "compiler/parser/query_loc.h"24#include "compiler/parser/query_loc.h"
25#include "store/api/item.h"25#include "store/api/shared_types.h"
2626
27namespace zorba {27namespace zorba {
28namespace diagnostic {28namespace diagnostic {
@@ -30,25 +30,6 @@
30///////////////////////////////////////////////////////////////////////////////30///////////////////////////////////////////////////////////////////////////////
3131
32/**32/**
33 * Given a store::Item_t that represents a QName, creates an instance of
34 * QNameType having the same QName.
35 *
36 * @tparam QNameType The type of QName to create.
37 * @param qname The QName item.
38 * @return Returns said QNameType.
39 */
40template<class QNameType> inline
41QNameType to_QName( store::Item_t const &qname ) {
42 return QNameType(
43 qname->getNamespace().c_str(),
44 qname->getPrefix().c_str(),
45 qname->getLocalName().c_str()
46 );
47}
48
49///////////////////////////////////////////////////////////////////////////////
50
51/**
52 * Makes an empty location.33 * Makes an empty location.
53 *34 *
54 * @return Returns said location.35 * @return Returns said location.
5536
=== added file 'src/diagnostics/qname.h'
--- src/diagnostics/qname.h 1970-01-01 00:00:00 +0000
+++ src/diagnostics/qname.h 2013-04-08 08:47:22 +0000
@@ -0,0 +1,47 @@
1/*
2 * Copyright 2006-2008 The FLWOR Foundation.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef ZORBA_DIAGNOSTIC_QNAME_H
18#define ZORBA_DIAGNOSTIC_QNAME_H
19
20#include <zorba/config.h>
21
22#include "store/api/item.h"
23
24namespace zorba {
25namespace diagnostic {
26
27
28template<class QNameType>
29QNameType to_QName( store::Item_t const &qname ) {
30 return QNameType(
31 qname->getNamespace().c_str(),
32 qname->getPrefix().c_str(),
33 qname->getLocalName().c_str()
34 );
35}
36
37
38} // namespace diagnostic
39} // namespace zorba
40
41#endif /* ZORBA_DIAGNOSTIC_QNAME_H */
42/*
43 * Local variables:
44 * mode: c++
45 * End:
46 */
47/* vim:set et sw=2 ts=2: */
048
=== modified file 'src/diagnostics/xquery_stack_trace.cpp'
--- src/diagnostics/xquery_stack_trace.cpp 2013-02-07 17:24:36 +0000
+++ src/diagnostics/xquery_stack_trace.cpp 2013-04-08 08:47:22 +0000
@@ -25,6 +25,7 @@
25#include <zorba/xquery_exception.h>25#include <zorba/xquery_exception.h>
2626
27#include "diagnostic.h"27#include "diagnostic.h"
28#include "qname.h"
2829
29namespace zorba {30namespace zorba {
3031
3132
=== modified file 'src/store/api/item.h'
--- src/store/api/item.h 2013-03-24 20:40:03 +0000
+++ src/store/api/item.h 2013-04-08 08:47:22 +0000
@@ -29,6 +29,8 @@
29#include <zorba/store_consts.h>29#include <zorba/store_consts.h>
30#include "store/api/shared_types.h"30#include "store/api/shared_types.h"
3131
32#include "diagnostics/xquery_diagnostics.h"
33
32#ifndef ZORBA_NO_FULL_TEXT34#ifndef ZORBA_NO_FULL_TEXT
33#include <zorba/locale.h>35#include <zorba/locale.h>
34#include <zorba/tokenizer.h>36#include <zorba/tokenizer.h>
@@ -120,6 +122,7 @@
120 void removeReference();122 void removeReference();
121123
122 virtual size_t alloc_size() const;124 virtual size_t alloc_size() const;
125
123 virtual size_t dynamic_size() const;126 virtual size_t dynamic_size() const;
124127
125 /* ------------------- General Methods for Items ------------------------- */128 /* ------------------- General Methods for Items ------------------------- */
@@ -331,7 +334,17 @@
331 /**334 /**
332 * @return The numeric code coresponding to the data type of this item.335 * @return The numeric code coresponding to the data type of this item.
333 */336 */
334 SchemaTypeCode getTypeCode() const;337 SchemaTypeCode getTypeCode() const
338 {
339 if (isAtomic())
340 {
341 return static_cast<SchemaTypeCode>(theUnion.itemKind >> 4);
342 }
343
344 throw ZORBA_EXCEPTION(
345 zerr::ZSTR0050_FUNCTION_NOT_IMPLEMENTED_FOR_ITEMTYPE,
346 ERROR_PARAMS(__FUNCTION__, typeid(*this).name()));
347 }
335348
336 /**349 /**
337 * @return If this is an atomic item with a user-defined data type UT, return350 * @return If this is an atomic item with a user-defined data type UT, return
338351
=== modified file 'src/store/naive/atomic_items.cpp'
--- src/store/naive/atomic_items.cpp 2013-03-21 18:22:40 +0000
+++ src/store/naive/atomic_items.cpp 2013-04-08 08:47:22 +0000
@@ -2745,31 +2745,19 @@
2745}2745}
27462746
27472747
2748long IntegerItemImpl::compare( Item const *other, long,2748long IntegerItemImpl::compare(Item const* other, long, const XQPCollator*) const
2749 const XQPCollator* ) const {
2750 try
2751 {
2752 return theValue.compare( other->getIntegerValue() );
2753 }
2754 catch ( ZorbaException const& )
2755 {
2756 return getDecimalValue().compare( other->getDecimalValue() );
2757 }
2758}
2759
2760bool IntegerItemImpl::equals( const store::Item* other, long,
2761 const XQPCollator*) const
2762{2749{
2763 try2750 try
2764 {2751 {
2765 return theValue == other->getIntegerValue();2752 return theValue.compare(other->getIntegerValue());
2766 }2753 }
2767 catch (ZorbaException const&)2754 catch (ZorbaException const& )
2768 {2755 {
2769 return getDecimalValue() == other->getDecimalValue();2756 return getDecimalValue().compare(other->getDecimalValue());
2770 }2757 }
2771}2758}
27722759
2760
2773xs_decimal IntegerItemImpl::getDecimalValue() const2761xs_decimal IntegerItemImpl::getDecimalValue() const
2774{2762{
2775 return xs_decimal(theValue);2763 return xs_decimal(theValue);
@@ -2870,20 +2858,24 @@
2870 return sizeof( *this );2858 return sizeof( *this );
2871}2859}
28722860
2873long NonPositiveIntegerItem::compare( Item const *other, long,2861
2874 const XQPCollator* ) const {2862long NonPositiveIntegerItem::compare(Item const* other, long, const XQPCollator*) const
2863{
2875 try2864 try
2876 {2865 {
2877 return theValue.compare( other->getIntegerValue() );2866 return theValue.compare(other->getIntegerValue());
2878 }2867 }
2879 catch ( ZorbaException const& )2868 catch (ZorbaException const&)
2880 {2869 {
2881 return getDecimalValue().compare( other->getDecimalValue() );2870 return getDecimalValue().compare(other->getDecimalValue());
2882 }2871 }
2883}2872}
28842873
2885bool NonPositiveIntegerItem::equals( const store::Item* other, long,2874
2886 const XQPCollator* ) const2875bool NonPositiveIntegerItem::equals(
2876 const store::Item* other,
2877 long,
2878 const XQPCollator* ) const
2887{2879{
2888 try2880 try
2889 {2881 {
@@ -2895,21 +2887,25 @@
2895 }2887 }
2896}2888}
28972889
2890
2898store::Item* NonPositiveIntegerItem::getType() const2891store::Item* NonPositiveIntegerItem::getType() const
2899{2892{
2900 return GET_STORE().theSchemaTypeNames[store::XS_NON_POSITIVE_INTEGER];2893 return GET_STORE().theSchemaTypeNames[store::XS_NON_POSITIVE_INTEGER];
2901}2894}
29022895
2896
2903xs_decimal NonPositiveIntegerItem::getDecimalValue() const2897xs_decimal NonPositiveIntegerItem::getDecimalValue() const
2904{2898{
2905 return xs_decimal(theValue);2899 return xs_decimal(theValue);
2906}2900}
29072901
2902
2908xs_integer NonPositiveIntegerItem::getIntegerValue() const2903xs_integer NonPositiveIntegerItem::getIntegerValue() const
2909{2904{
2910 return xs_integer(theValue);2905 return xs_integer(theValue);
2911}2906}
29122907
2908
2913xs_long NonPositiveIntegerItem::getLongValue() const2909xs_long NonPositiveIntegerItem::getLongValue() const
2914{2910{
2915 try2911 try
29162912
=== modified file 'src/store/naive/atomic_items.h'
--- src/store/naive/atomic_items.h 2013-03-21 18:22:40 +0000
+++ src/store/naive/atomic_items.h 2013-04-08 08:47:22 +0000
@@ -114,8 +114,6 @@
114 theTypeName.transfer(typeName);114 theTypeName.transfer(typeName);
115 }115 }
116116
117 //UserTypedAtomicItem() {}
118
119public:117public:
120 size_t alloc_size() const;118 size_t alloc_size() const;
121 size_t dynamic_size() const;119 size_t dynamic_size() const;
@@ -1566,17 +1564,21 @@
15661564
1567 store::Item* getType() const;1565 store::Item* getType() const;
15681566
1569 uint32_t hash(long = 0, const XQPCollator* aCollation = 0) const;1567 uint32_t hash(long = 0, const XQPCollator* c = 0) const;
15701568
1571 long compare(1569 long compare(const Item* other, long tz = 0, const XQPCollator* c = 0) const;
1572 const Item* other,1570
1573 long timezone = 0,1571 bool equals(const Item* other, long tz = 0, const XQPCollator* c = 0) const
1574 const XQPCollator* aCollation = 0) const;1572 {
15751573 try
1576 bool equals(1574 {
1577 const store::Item* other,1575 return theValue == other->getIntegerValue();
1578 long timezone = 0,1576 }
1579 const XQPCollator* aCollation = 0) const;1577 catch (ZorbaException const&)
1578 {
1579 return getDecimalValue() == other->getDecimalValue();
1580 }
1581 }
15801582
1581 bool getEBV() const;1583 bool getEBV() const;
15821584
15831585
=== modified file 'src/store/naive/item.cpp'
--- src/store/naive/item.cpp 2013-03-26 23:32:03 +0000
+++ src/store/naive/item.cpp 2013-04-08 08:47:22 +0000
@@ -220,7 +220,6 @@
220 ZORBA_ASSERT(false);220 ZORBA_ASSERT(false);
221 }221 }
222 }222 }
223
224#endif223#endif
225}224}
226225
@@ -289,19 +288,6 @@
289}288}
290289
291290
292store::SchemaTypeCode Item::getTypeCode() const
293{
294 if (isAtomic())
295 {
296 return static_cast<SchemaTypeCode>(theUnion.itemKind >> 4);
297 }
298
299 throw ZORBA_EXCEPTION(
300 zerr::ZSTR0050_FUNCTION_NOT_IMPLEMENTED_FOR_ITEMTYPE,
301 ERROR_PARAMS(__FUNCTION__, typeid(*this).name()));
302}
303
304
305Item* Item::getType() const291Item* Item::getType() const
306{292{
307 throw ZORBA_EXCEPTION(293 throw ZORBA_EXCEPTION(
@@ -318,10 +304,7 @@
318};304};
319305
320306
321bool Item::equals(307bool Item::equals(const store::Item* other, long tz, const XQPCollator* c) const
322 const store::Item* other,
323 long timezone,
324 const XQPCollator* aCollation) const
325{308{
326 throw ZORBA_EXCEPTION(zerr::ZSTR0040_TYPE_ERROR,309 throw ZORBA_EXCEPTION(zerr::ZSTR0040_TYPE_ERROR,
327 ERROR_PARAMS(ZED(NoCompareTypes_23),310 ERROR_PARAMS(ZED(NoCompareTypes_23),
328311
=== modified file 'src/zorbaserialization/serialize_basic_types.cpp'
--- src/zorbaserialization/serialize_basic_types.cpp 2013-02-07 17:24:36 +0000
+++ src/zorbaserialization/serialize_basic_types.cpp 2013-04-08 08:47:22 +0000
@@ -22,6 +22,8 @@
22#include "zorbaserialization/archiver.h"22#include "zorbaserialization/archiver.h"
23#include "zorbaserialization/base64impl.h"23#include "zorbaserialization/base64impl.h"
2424
25#include "zorbatypes/floatimpl.h"
26
25#include "diagnostics/xquery_diagnostics.h"27#include "diagnostics/xquery_diagnostics.h"
26#include "diagnostics/util_macros.h"28#include "diagnostics/util_macros.h"
27#include "diagnostics/assert.h"29#include "diagnostics/assert.h"
2830
=== modified file 'src/zorbaserialization/serialize_template_types.h'
--- src/zorbaserialization/serialize_template_types.h 2013-03-04 21:00:58 +0000
+++ src/zorbaserialization/serialize_template_types.h 2013-04-08 08:47:22 +0000
@@ -32,6 +32,7 @@
32#include "diagnostics/assert.h"32#include "diagnostics/assert.h"
3333
34#include "zorbatypes/zstring.h"34#include "zorbatypes/zstring.h"
35#include "zorbatypes/floatimpl.h"
3536
36#include "zorbautils/checked_vector.h"37#include "zorbautils/checked_vector.h"
3738

Subscribers

People subscribed via source and target branches