You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@vxquery.apache.org by pr...@apache.org on 2014/01/31 08:21:20 UTC

[04/13] Updated the PointablePool references. The static functions now take a pool variable as input so they do not create pointables for each instance.

http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/fc136fc2/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/util/FunctionHelper.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/util/FunctionHelper.java b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/util/FunctionHelper.java
index 9f1dba8..035a6ad 100644
--- a/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/util/FunctionHelper.java
+++ b/vxquery-core/src/main/java/org/apache/vxquery/runtime/functions/util/FunctionHelper.java
@@ -18,8 +18,8 @@ package org.apache.vxquery.runtime.functions.util;
 
 import java.io.DataInputStream;
 import java.io.DataOutput;
-import java.io.File;
 import java.io.FileInputStream;
+import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.io.InputStreamReader;
 import java.nio.ByteBuffer;
@@ -109,7 +109,8 @@ public class FunctionHelper {
     }
 
     public static void arithmeticOperation(AbstractArithmeticOperation aOp, DynamicContext dCtx,
-            TaggedValuePointable tvp1, TaggedValuePointable tvp2, IPointable result) throws SystemException {
+            TaggedValuePointable tvp1, TaggedValuePointable tvp2, PointablePool ppool, IPointable result)
+            throws SystemException {
         final ArrayBackedValueStorage abvs = new ArrayBackedValueStorage();
         final DataOutput dOut = abvs.getDataOutput();
         final ArrayBackedValueStorage abvsArgument1 = new ArrayBackedValueStorage();
@@ -141,7 +142,7 @@ public class FunctionHelper {
                 case ValueTag.XS_BYTE_TAG:
                 case ValueTag.XS_UNSIGNED_BYTE_TAG:
                     abvsArgument1.reset();
-                    getIntegerPointable(tvp1, dOutArgument1);
+                    getIntegerPointable(tvp1, ppool, dOutArgument1);
                     longp1.set(abvsArgument1.getByteArray(), abvsArgument1.getStartOffset() + 1,
                             LongPointable.TYPE_TRAITS.getFixedLength());
                     break;
@@ -174,7 +175,7 @@ public class FunctionHelper {
                 case ValueTag.XS_BYTE_TAG:
                 case ValueTag.XS_UNSIGNED_BYTE_TAG:
                     abvsArgument2.reset();
-                    getIntegerPointable(tvp2, dOutArgument2);
+                    getIntegerPointable(tvp2, ppool, dOutArgument2);
                     longp2.set(abvsArgument2.getByteArray(), abvsArgument2.getStartOffset() + 1,
                             LongPointable.TYPE_TRAITS.getFixedLength());
                     break;
@@ -513,12 +514,12 @@ public class FunctionHelper {
         throw new SystemException(ErrorCode.XPTY0004);
     }
 
-    public static void atomize(TaggedValuePointable tvp, IPointable result) throws IOException {
+    public static void atomize(TaggedValuePointable tvp, PointablePool pp, IPointable result) throws IOException {
         NodeTreePointable ntp = (NodeTreePointable) NodeTreePointable.FACTORY.createPointable();
         switch (tvp.getTag()) {
             case ValueTag.NODE_TREE_TAG:
                 tvp.getValue(ntp);
-                atomizeNode(ntp, result);
+                atomizeNode(ntp, pp, result);
                 break;
 
             default:
@@ -526,11 +527,10 @@ public class FunctionHelper {
         }
     }
 
-    public static void atomizeNode(NodeTreePointable ntp, IPointable result) throws IOException {
+    public static void atomizeNode(NodeTreePointable ntp, PointablePool pp, IPointable result) throws IOException {
         ArrayBackedValueStorage tempABVS = new ArrayBackedValueStorage();
         TaggedValuePointable tempTVP = (TaggedValuePointable) TaggedValuePointable.FACTORY.createPointable();
         VoidPointable vp = (VoidPointable) VoidPointable.FACTORY.createPointable();
-        PointablePool pp = PointablePoolFactory.INSTANCE.createPointablePool();
         ntp.getRootNode(tempTVP);
         switch (tempTVP.getTag()) {
             case ValueTag.ATTRIBUTE_NODE_TAG: {
@@ -566,7 +566,7 @@ public class FunctionHelper {
                 try {
                     tempTVP.getValue(dnp);
                     dnp.getContent(ntp, sp);
-                    buildStringConcatenation(sp, tempABVS, ntp);
+                    buildStringConcatenation(sp, pp, tempABVS, ntp);
                     result.set(tempABVS.getByteArray(), tempABVS.getStartOffset(), tempABVS.getLength());
                 } finally {
                     pp.giveBack(sp);
@@ -582,7 +582,7 @@ public class FunctionHelper {
                     tempTVP.getValue(enp);
                     if (enp.childrenChunkExists()) {
                         enp.getChildrenSequence(ntp, sp);
-                        buildStringConcatenation(sp, tempABVS, ntp);
+                        buildStringConcatenation(sp, pp, tempABVS, ntp);
                         result.set(tempABVS.getByteArray(), tempABVS.getStartOffset(), tempABVS.getLength());
                     }
                 } finally {
@@ -610,15 +610,15 @@ public class FunctionHelper {
         }
     }
 
-    public static void buildStringConcatenation(SequencePointable sp, ArrayBackedValueStorage tempABVS,
-            NodeTreePointable ntp) throws IOException {
+    public static void buildStringConcatenation(SequencePointable sp, PointablePool pp,
+            ArrayBackedValueStorage tempABVS, NodeTreePointable ntp) throws IOException {
         tempABVS.reset();
         DataOutput out = tempABVS.getDataOutput();
         out.write(ValueTag.XS_UNTYPED_ATOMIC_TAG);
         // Leave room for the utf-8 length
         out.write(0);
         out.write(0);
-        buildConcatenationRec(sp, out, ntp);
+        buildConcatenationRec(sp, pp, out, ntp);
         int utflen = tempABVS.getLength() - 3;
         byte[] bytes = tempABVS.getByteArray();
         // Patch utf-8 length at bytes 1 and 2
@@ -626,11 +626,10 @@ public class FunctionHelper {
         bytes[2] = (byte) ((utflen >>> 0) & 0xFF);
     }
 
-    public static void buildConcatenationRec(SequencePointable sp, DataOutput out, NodeTreePointable ntp)
-            throws IOException {
+    public static void buildConcatenationRec(SequencePointable sp, PointablePool pp, DataOutput out,
+            NodeTreePointable ntp) throws IOException {
         TaggedValuePointable tempTVP2 = (TaggedValuePointable) TaggedValuePointable.FACTORY.createPointable();
         VoidPointable vp = (VoidPointable) VoidPointable.FACTORY.createPointable();
-        PointablePool pp = PointablePoolFactory.INSTANCE.createPointablePool();
         int nItems = sp.getEntryCount();
         for (int i = 0; i < nItems; ++i) {
             sp.getEntry(i, tempTVP2);
@@ -653,7 +652,7 @@ public class FunctionHelper {
                         tempTVP2.getValue(enp);
                         if (enp.childrenChunkExists()) {
                             enp.getChildrenSequence(ntp, sp2);
-                            buildConcatenationRec(sp2, out, ntp);
+                            buildConcatenationRec(sp2, pp, out, ntp);
                         }
                     } finally {
                         pp.giveBack(sp2);
@@ -665,107 +664,180 @@ public class FunctionHelper {
     }
 
     public static boolean compareTaggedValues(AbstractValueComparisonOperation aOp, TaggedValuePointable tvp1,
-            TaggedValuePointable tvp2, DynamicContext dCtx) throws SystemException {
-        final TypedPointables tp1 = new TypedPointables();
-        final TypedPointables tp2 = new TypedPointables();
-
+            TaggedValuePointable tvp2, PointablePool pp, DynamicContext dCtx) throws SystemException {
         int tid1 = getBaseTypeForComparisons(tvp1.getTag());
         int tid2 = getBaseTypeForComparisons(tvp2.getTag());
-
+        boolean result;
         try {
             switch (tid1) {
                 case ValueTag.XS_DECIMAL_TAG:
-                    tvp1.getValue(tp1.decp);
+                    XSDecimalPointable decp1 = pp.takeOne(XSDecimalPointable.class);
+                    tvp1.getValue(decp1);
                     switch (tid2) {
                         case ValueTag.XS_DECIMAL_TAG:
-                            tvp2.getValue(tp2.decp);
-                            return aOp.operateDecimalDecimal(tp1.decp, tp2.decp);
+                            XSDecimalPointable decp2 = pp.takeOne(XSDecimalPointable.class);
+                            tvp2.getValue(decp2);
+                            result = aOp.operateDecimalDecimal(decp1, decp2);
+                            pp.giveBack(decp2);
+                            break;
 
                         case ValueTag.XS_INTEGER_TAG:
-                            tvp2.getValue(tp2.longp);
-                            return aOp.operateDecimalInteger(tp1.decp, tp2.longp);
+                            LongPointable longp2 = pp.takeOne(LongPointable.class);
+                            tvp2.getValue(longp2);
+                            result = aOp.operateDecimalInteger(decp1, longp2);
+                            pp.giveBack(longp2);
+                            break;
 
                         case ValueTag.XS_FLOAT_TAG:
-                            tvp2.getValue(tp2.floatp);
-                            return aOp.operateDecimalFloat(tp1.decp, tp2.floatp);
+                            FloatPointable floatp2 = pp.takeOne(FloatPointable.class);
+                            tvp2.getValue(floatp2);
+                            result = aOp.operateDecimalFloat(decp1, floatp2);
+                            pp.giveBack(floatp2);
+                            break;
 
                         case ValueTag.XS_DOUBLE_TAG:
-                            tvp2.getValue(tp2.doublep);
-                            return aOp.operateDecimalDouble(tp1.decp, tp2.doublep);
+                            DoublePointable doublep2 = pp.takeOne(DoublePointable.class);
+                            tvp2.getValue(doublep2);
+                            result = aOp.operateDecimalDouble(decp1, doublep2);
+                            pp.giveBack(doublep2);
+                            break;
+
+                        default:
+                            throw new SystemException(ErrorCode.XPTY0004);
                     }
-                    break;
+                    pp.giveBack(decp1);
+                    return result;
 
                 case ValueTag.XS_INTEGER_TAG:
-                    tvp1.getValue(tp1.longp);
+                    LongPointable longp1 = pp.takeOne(LongPointable.class);
+                    tvp1.getValue(longp1);
                     switch (tid2) {
                         case ValueTag.XS_DECIMAL_TAG:
-                            tvp2.getValue(tp2.decp);
-                            return aOp.operateIntegerDecimal(tp1.longp, tp2.decp);
+                            XSDecimalPointable decp2 = pp.takeOne(XSDecimalPointable.class);
+                            tvp2.getValue(decp2);
+                            result = aOp.operateIntegerDecimal(longp1, decp2);
+                            pp.giveBack(decp2);
+                            break;
 
                         case ValueTag.XS_INTEGER_TAG:
-                            tvp2.getValue(tp2.longp);
-                            return aOp.operateIntegerInteger(tp1.longp, tp2.longp);
+                            LongPointable longp2 = pp.takeOne(LongPointable.class);
+                            tvp2.getValue(longp2);
+                            result = aOp.operateIntegerInteger(longp1, longp2);
+                            pp.giveBack(longp2);
+                            break;
 
                         case ValueTag.XS_FLOAT_TAG:
-                            tvp2.getValue(tp2.floatp);
-                            return aOp.operateIntegerFloat(tp1.longp, tp2.floatp);
+                            FloatPointable floatp2 = pp.takeOne(FloatPointable.class);
+                            tvp2.getValue(floatp2);
+                            result = aOp.operateIntegerFloat(longp1, floatp2);
+                            pp.giveBack(floatp2);
+                            break;
 
                         case ValueTag.XS_DOUBLE_TAG:
-                            tvp2.getValue(tp2.doublep);
-                            return aOp.operateIntegerDouble(tp1.longp, tp2.doublep);
+                            DoublePointable doublep2 = pp.takeOne(DoublePointable.class);
+                            tvp2.getValue(doublep2);
+                            result = aOp.operateIntegerDouble(longp1, doublep2);
+                            pp.giveBack(doublep2);
+                            break;
+
+                        default:
+                            throw new SystemException(ErrorCode.XPTY0004);
                     }
-                    break;
+                    pp.giveBack(longp1);
+                    return result;
 
                 case ValueTag.XS_FLOAT_TAG:
-                    tvp1.getValue(tp1.floatp);
+                    FloatPointable floatp1 = pp.takeOne(FloatPointable.class);
+                    tvp1.getValue(floatp1);
                     switch (tid2) {
                         case ValueTag.XS_DECIMAL_TAG:
-                            tvp2.getValue(tp2.decp);
-                            return aOp.operateFloatDecimal(tp1.floatp, tp2.decp);
+                            XSDecimalPointable decp2 = pp.takeOne(XSDecimalPointable.class);
+                            tvp2.getValue(decp2);
+                            result = aOp.operateFloatDecimal(floatp1, decp2);
+                            pp.giveBack(decp2);
+                            break;
 
                         case ValueTag.XS_INTEGER_TAG:
-                            tvp2.getValue(tp2.longp);
-                            return aOp.operateFloatInteger(tp1.floatp, tp2.longp);
+                            LongPointable longp2 = pp.takeOne(LongPointable.class);
+                            tvp2.getValue(longp2);
+                            result = aOp.operateFloatInteger(floatp1, longp2);
+                            pp.giveBack(longp2);
+                            break;
 
                         case ValueTag.XS_FLOAT_TAG:
-                            tvp2.getValue(tp2.floatp);
-                            return aOp.operateFloatFloat(tp1.floatp, tp2.floatp);
+                            FloatPointable floatp2 = pp.takeOne(FloatPointable.class);
+                            tvp2.getValue(floatp2);
+                            result = aOp.operateFloatFloat(floatp1, floatp2);
+                            pp.giveBack(floatp2);
+                            break;
 
                         case ValueTag.XS_DOUBLE_TAG:
-                            tvp2.getValue(tp2.doublep);
-                            return aOp.operateFloatDouble(tp1.floatp, tp2.doublep);
+                            DoublePointable doublep2 = pp.takeOne(DoublePointable.class);
+                            tvp2.getValue(doublep2);
+                            result = aOp.operateFloatDouble(floatp1, doublep2);
+                            pp.giveBack(doublep2);
+                            break;
+
+                        default:
+                            throw new SystemException(ErrorCode.XPTY0004);
                     }
-                    break;
+                    pp.giveBack(floatp1);
+                    return result;
 
                 case ValueTag.XS_DOUBLE_TAG:
-                    tvp1.getValue(tp1.doublep);
+                    DoublePointable doublep1 = pp.takeOne(DoublePointable.class);
+                    tvp1.getValue(doublep1);
                     switch (tid2) {
                         case ValueTag.XS_DECIMAL_TAG:
-                            tvp2.getValue(tp2.decp);
-                            return aOp.operateDoubleDecimal(tp1.doublep, tp2.decp);
+                            XSDecimalPointable decp2 = pp.takeOne(XSDecimalPointable.class);
+                            tvp2.getValue(decp2);
+                            result = aOp.operateDoubleDecimal(doublep1, decp2);
+                            pp.giveBack(decp2);
+                            break;
 
                         case ValueTag.XS_INTEGER_TAG:
-                            tvp2.getValue(tp2.longp);
-                            return aOp.operateDoubleInteger(tp1.doublep, tp2.longp);
+                            LongPointable longp2 = pp.takeOne(LongPointable.class);
+                            tvp2.getValue(longp2);
+                            result = aOp.operateDoubleInteger(doublep1, longp2);
+                            pp.giveBack(longp2);
+                            break;
 
                         case ValueTag.XS_FLOAT_TAG:
-                            tvp2.getValue(tp2.floatp);
-                            return aOp.operateDoubleFloat(tp1.doublep, tp2.floatp);
+                            FloatPointable floatp2 = pp.takeOne(FloatPointable.class);
+                            tvp2.getValue(floatp2);
+                            result = aOp.operateDoubleFloat(doublep1, floatp2);
+                            pp.giveBack(floatp2);
+                            break;
 
                         case ValueTag.XS_DOUBLE_TAG:
-                            tvp2.getValue(tp2.doublep);
-                            return aOp.operateDoubleDouble(tp1.doublep, tp2.doublep);
+                            DoublePointable doublep2 = pp.takeOne(DoublePointable.class);
+                            tvp2.getValue(doublep2);
+                            result = aOp.operateDoubleDouble(doublep1, doublep2);
+                            pp.giveBack(doublep2);
+                            break;
+
+                        default:
+                            throw new SystemException(ErrorCode.XPTY0004);
                     }
-                    break;
+                    pp.giveBack(doublep1);
+                    return result;
 
                 case ValueTag.XS_BOOLEAN_TAG:
-                    tvp1.getValue(tp1.boolp);
+                    BooleanPointable boolp1 = pp.takeOne(BooleanPointable.class);
+                    tvp1.getValue(boolp1);
                     switch (tid2) {
                         case ValueTag.XS_BOOLEAN_TAG:
-                            tvp2.getValue(tp2.boolp);
-                            return aOp.operateBooleanBoolean(tp1.boolp, tp2.boolp);
+                            BooleanPointable boolp2 = pp.takeOne(BooleanPointable.class);
+                            tvp2.getValue(boolp1);
+                            result = aOp.operateBooleanBoolean(boolp1, boolp2);
+                            pp.giveBack(boolp2);
+                            break;
+
+                        default:
+                            throw new SystemException(ErrorCode.XPTY0004);
                     }
-                    break;
+                    pp.giveBack(boolp1);
+                    return result;
 
                 case ValueTag.XS_STRING_TAG:
                 case ValueTag.XS_NORMALIZED_STRING_TAG:
@@ -778,7 +850,8 @@ public class FunctionHelper {
                 case ValueTag.XS_IDREF_TAG:
                 case ValueTag.XS_ENTITY_TAG:
                 case ValueTag.XS_UNTYPED_ATOMIC_TAG:
-                    tvp1.getValue(tp1.utf8sp);
+                    UTF8StringPointable utf8sp1 = pp.takeOne(UTF8StringPointable.class);
+                    tvp1.getValue(utf8sp1);
                     switch (tid2) {
                         case ValueTag.XS_STRING_TAG:
                         case ValueTag.XS_NORMALIZED_STRING_TAG:
@@ -792,158 +865,290 @@ public class FunctionHelper {
                         case ValueTag.XS_ENTITY_TAG:
                         case ValueTag.XS_UNTYPED_ATOMIC_TAG:
                         case ValueTag.XS_ANY_URI_TAG:
-                            tvp2.getValue(tp2.utf8sp);
-                            return aOp.operateStringString(tp1.utf8sp, tp2.utf8sp);
+                            UTF8StringPointable utf8sp2 = pp.takeOne(UTF8StringPointable.class);
+                            tvp2.getValue(utf8sp2);
+                            result = aOp.operateStringString(utf8sp1, utf8sp2);
+                            pp.giveBack(utf8sp2);
+                            break;
+
+                        default:
+                            throw new SystemException(ErrorCode.XPTY0004);
                     }
-                    break;
+                    pp.giveBack(utf8sp1);
+                    return result;
 
                 case ValueTag.XS_DATE_TAG:
-                    tvp1.getValue(tp1.datep);
+                    XSDatePointable datep1 = pp.takeOne(XSDatePointable.class);
+                    tvp1.getValue(datep1);
                     switch (tid2) {
                         case ValueTag.XS_DATE_TAG:
-                            tvp2.getValue(tp2.datep);
-                            return aOp.operateDateDate(tp1.datep, tp2.datep, dCtx);
+                            XSDatePointable datep2 = pp.takeOne(XSDatePointable.class);
+                            tvp2.getValue(datep2);
+                            result = aOp.operateDateDate(datep1, datep2, dCtx);
+                            pp.giveBack(datep2);
+                            break;
+
+                        default:
+                            throw new SystemException(ErrorCode.XPTY0004);
                     }
-                    break;
+                    pp.giveBack(datep1);
+                    return result;
 
                 case ValueTag.XS_DATETIME_TAG:
-                    tvp1.getValue(tp1.datetimep);
+                    XSDateTimePointable datetimep1 = pp.takeOne(XSDateTimePointable.class);
+                    tvp1.getValue(datetimep1);
                     switch (tid2) {
                         case ValueTag.XS_DATETIME_TAG:
-                            tvp2.getValue(tp2.datetimep);
-                            return aOp.operateDatetimeDatetime(tp1.datetimep, tp2.datetimep, dCtx);
+                            XSDateTimePointable datetimep2 = pp.takeOne(XSDateTimePointable.class);
+                            tvp2.getValue(datetimep2);
+                            result = aOp.operateDatetimeDatetime(datetimep1, datetimep2, dCtx);
+                            pp.giveBack(datetimep2);
+                            break;
+
+                        default:
+                            throw new SystemException(ErrorCode.XPTY0004);
                     }
-                    break;
+                    pp.giveBack(datetimep1);
+                    return result;
 
                 case ValueTag.XS_TIME_TAG:
-                    tvp1.getValue(tp1.timep);
+                    XSTimePointable timep1 = pp.takeOne(XSTimePointable.class);
+                    tvp1.getValue(timep1);
                     switch (tid2) {
                         case ValueTag.XS_TIME_TAG:
-                            tvp2.getValue(tp2.timep);
-                            return aOp.operateTimeTime(tp1.timep, tp2.timep, dCtx);
+                            XSTimePointable timep2 = pp.takeOne(XSTimePointable.class);
+                            tvp2.getValue(timep2);
+                            result = aOp.operateTimeTime(timep1, timep2, dCtx);
+                            pp.giveBack(timep2);
+                            break;
+
+                        default:
+                            throw new SystemException(ErrorCode.XPTY0004);
                     }
-                    break;
+                    pp.giveBack(timep1);
+                    return result;
 
                 case ValueTag.XS_DURATION_TAG:
-                    tvp1.getValue(tp1.durationp);
+                    XSDurationPointable durationp1 = pp.takeOne(XSDurationPointable.class);
+                    tvp1.getValue(durationp1);
                     switch (tid2) {
                         case ValueTag.XS_DAY_TIME_DURATION_TAG:
-                            tvp2.getValue(tp2.longp);
-                            return aOp.operateDurationDTDuration(tp1.durationp, tp2.longp);
+                            LongPointable longp2 = pp.takeOne(LongPointable.class);
+                            tvp2.getValue(longp2);
+                            result = aOp.operateDurationDTDuration(durationp1, longp2);
+                            pp.giveBack(longp2);
+                            break;
 
                         case ValueTag.XS_DURATION_TAG:
-                            tvp2.getValue(tp2.durationp);
-                            return aOp.operateDurationDuration(tp1.durationp, tp2.durationp);
+                            XSDurationPointable durationp2 = pp.takeOne(XSDurationPointable.class);
+                            tvp2.getValue(durationp2);
+                            result = aOp.operateDurationDuration(durationp1, durationp2);
+                            pp.giveBack(durationp2);
+                            break;
 
                         case ValueTag.XS_YEAR_MONTH_DURATION_TAG:
-                            tvp2.getValue(tp2.intp);
-                            return aOp.operateDurationYMDuration(tp1.durationp, tp2.intp);
+                            IntegerPointable intp2 = pp.takeOne(IntegerPointable.class);
+                            tvp2.getValue(intp2);
+                            result = aOp.operateDurationYMDuration(durationp1, intp2);
+                            pp.giveBack(intp2);
+                            break;
+
+                        default:
+                            throw new SystemException(ErrorCode.XPTY0004);
                     }
-                    break;
+                    pp.giveBack(durationp1);
+                    return result;
 
                 case ValueTag.XS_DAY_TIME_DURATION_TAG:
-                    tvp1.getValue(tp1.longp);
+                    LongPointable dtdurationp1 = pp.takeOne(LongPointable.class);
+                    tvp1.getValue(dtdurationp1);
                     switch (tid2) {
                         case ValueTag.XS_DAY_TIME_DURATION_TAG:
-                            tvp2.getValue(tp2.longp);
-                            return aOp.operateDTDurationDTDuration(tp1.longp, tp2.longp);
+                            LongPointable longp2 = pp.takeOne(LongPointable.class);
+                            tvp2.getValue(longp2);
+                            result = aOp.operateDTDurationDTDuration(dtdurationp1, longp2);
+                            pp.giveBack(longp2);
+                            break;
 
                         case ValueTag.XS_DURATION_TAG:
-                            tvp2.getValue(tp2.durationp);
-                            return aOp.operateDTDurationDuration(tp1.longp, tp2.durationp);
+                            XSDurationPointable durationp2 = pp.takeOne(XSDurationPointable.class);
+                            tvp2.getValue(durationp2);
+                            result = aOp.operateDTDurationDuration(dtdurationp1, durationp2);
+                            pp.giveBack(durationp2);
+                            break;
 
                         case ValueTag.XS_YEAR_MONTH_DURATION_TAG:
-                            tvp2.getValue(tp2.intp);
-                            return aOp.operateDTDurationYMDuration(tp1.longp, tp2.intp);
+                            IntegerPointable intp2 = pp.takeOne(IntegerPointable.class);
+                            tvp2.getValue(intp2);
+                            result = aOp.operateDTDurationYMDuration(dtdurationp1, intp2);
+                            pp.giveBack(intp2);
+                            break;
+
+                        default:
+                            throw new SystemException(ErrorCode.XPTY0004);
                     }
-                    break;
+                    pp.giveBack(dtdurationp1);
+                    return result;
 
                 case ValueTag.XS_YEAR_MONTH_DURATION_TAG:
-                    tvp1.getValue(tp1.intp);
+                    IntegerPointable ymdurationp1 = pp.takeOne(IntegerPointable.class);
+                    tvp1.getValue(ymdurationp1);
                     switch (tid2) {
                         case ValueTag.XS_DAY_TIME_DURATION_TAG:
-                            tvp2.getValue(tp2.longp);
-                            return aOp.operateYMDurationDTDuration(tp1.intp, tp2.longp);
+                            LongPointable longp2 = pp.takeOne(LongPointable.class);
+                            tvp2.getValue(longp2);
+                            result = aOp.operateYMDurationDTDuration(ymdurationp1, longp2);
+                            pp.giveBack(longp2);
+                            break;
 
                         case ValueTag.XS_DURATION_TAG:
-                            tvp2.getValue(tp2.durationp);
-                            return aOp.operateYMDurationDuration(tp1.intp, tp2.durationp);
+                            XSDurationPointable durationp2 = pp.takeOne(XSDurationPointable.class);
+                            tvp2.getValue(durationp2);
+                            result = aOp.operateYMDurationDuration(ymdurationp1, durationp2);
+                            pp.giveBack(durationp2);
+                            break;
 
                         case ValueTag.XS_YEAR_MONTH_DURATION_TAG:
-                            tvp2.getValue(tp2.intp);
-                            return aOp.operateYMDurationYMDuration(tp1.intp, tp2.intp);
+                            IntegerPointable intp2 = pp.takeOne(IntegerPointable.class);
+                            tvp2.getValue(intp2);
+                            result = aOp.operateYMDurationYMDuration(ymdurationp1, intp2);
+                            pp.giveBack(intp2);
+                            break;
+
+                        default:
+                            throw new SystemException(ErrorCode.XPTY0004);
                     }
-                    break;
+                    pp.giveBack(ymdurationp1);
+                    return result;
 
                 case ValueTag.XS_G_DAY_TAG:
-                    tvp1.getValue(tp1.datep);
+                    XSDatePointable gdayp1 = pp.takeOne(XSDatePointable.class);
+                    tvp1.getValue(gdayp1);
                     switch (tid2) {
                         case ValueTag.XS_G_DAY_TAG:
-                            tvp2.getValue(tp2.datep);
-                            return aOp.operateGDayGDay(tp1.datep, tp2.datep, dCtx);
+                            XSDatePointable gdayp2 = pp.takeOne(XSDatePointable.class);
+                            tvp2.getValue(gdayp2);
+                            result = aOp.operateGDayGDay(gdayp1, gdayp2, dCtx);
+                            pp.giveBack(gdayp2);
+                            break;
+
+                        default:
+                            throw new SystemException(ErrorCode.XPTY0004);
                     }
-                    break;
+                    pp.giveBack(gdayp1);
+                    return result;
 
                 case ValueTag.XS_G_MONTH_DAY_TAG:
-                    tvp1.getValue(tp1.datep);
+                    XSDatePointable gmonthday = pp.takeOne(XSDatePointable.class);
+                    tvp1.getValue(gmonthday);
                     switch (tid2) {
                         case ValueTag.XS_G_MONTH_DAY_TAG:
-                            tvp2.getValue(tp2.datep);
-                            return aOp.operateGMonthDayGMonthDay(tp1.datep, tp2.datep, dCtx);
+                            XSDatePointable gmonthdayp2 = pp.takeOne(XSDatePointable.class);
+                            tvp2.getValue(gmonthdayp2);
+                            result = aOp.operateGMonthDayGMonthDay(gmonthday, gmonthdayp2, dCtx);
+                            pp.giveBack(gmonthdayp2);
+                            break;
+
+                        default:
+                            throw new SystemException(ErrorCode.XPTY0004);
                     }
-                    break;
+                    pp.giveBack(gmonthday);
+                    return result;
 
                 case ValueTag.XS_G_MONTH_TAG:
-                    tvp1.getValue(tp1.datep);
+                    XSDatePointable gmonthp1 = pp.takeOne(XSDatePointable.class);
+                    tvp1.getValue(gmonthp1);
                     switch (tid2) {
                         case ValueTag.XS_G_MONTH_TAG:
-                            tvp2.getValue(tp2.datep);
-                            return aOp.operateGMonthGMonth(tp1.datep, tp2.datep, dCtx);
+                            XSDatePointable gmonthp2 = pp.takeOne(XSDatePointable.class);
+                            tvp2.getValue(gmonthp2);
+                            result = aOp.operateGMonthGMonth(gmonthp1, gmonthp2, dCtx);
+                            pp.giveBack(gmonthp2);
+                            break;
+
+                        default:
+                            throw new SystemException(ErrorCode.XPTY0004);
                     }
-                    break;
+                    pp.giveBack(gmonthp1);
+                    return result;
 
                 case ValueTag.XS_G_YEAR_MONTH_TAG:
-                    tvp1.getValue(tp1.datep);
+                    XSDatePointable gyearmonthp1 = pp.takeOne(XSDatePointable.class);
+                    tvp1.getValue(gyearmonthp1);
                     switch (tid2) {
                         case ValueTag.XS_G_YEAR_MONTH_TAG:
-                            tvp2.getValue(tp2.datep);
-                            return aOp.operateGYearMonthGYearMonth(tp1.datep, tp2.datep, dCtx);
+                            XSDatePointable gyearmonthp2 = pp.takeOne(XSDatePointable.class);
+                            tvp2.getValue(gyearmonthp2);
+                            result = aOp.operateGYearMonthGYearMonth(gyearmonthp1, gyearmonthp2, dCtx);
+                            pp.giveBack(gyearmonthp2);
+                            break;
+
+                        default:
+                            throw new SystemException(ErrorCode.XPTY0004);
                     }
-                    break;
+                    pp.giveBack(gyearmonthp1);
+                    return result;
 
                 case ValueTag.XS_G_YEAR_TAG:
-                    tvp1.getValue(tp1.datep);
+                    XSDatePointable gyearp1 = pp.takeOne(XSDatePointable.class);
+                    tvp1.getValue(gyearp1);
                     switch (tid2) {
                         case ValueTag.XS_G_YEAR_TAG:
-                            tvp2.getValue(tp2.datep);
-                            return aOp.operateGYearGYear(tp1.datep, tp2.datep, dCtx);
+                            XSDatePointable gyearp2 = pp.takeOne(XSDatePointable.class);
+                            tvp2.getValue(gyearp2);
+                            result = aOp.operateGYearGYear(gyearp1, gyearp2, dCtx);
+                            pp.giveBack(gyearp2);
+                            break;
+
+                        default:
+                            throw new SystemException(ErrorCode.XPTY0004);
                     }
-                    break;
+                    pp.giveBack(gyearp1);
+                    return result;
 
                 case ValueTag.XS_HEX_BINARY_TAG:
-                    tvp1.getValue(tp1.binaryp);
+                    XSBinaryPointable binaryp1 = pp.takeOne(XSBinaryPointable.class);
+                    tvp1.getValue(binaryp1);
                     switch (tid2) {
                         case ValueTag.XS_HEX_BINARY_TAG:
-                            tvp2.getValue(tp2.binaryp);
-                            return aOp.operateHexBinaryHexBinary(tp1.binaryp, tp2.binaryp);
+                            XSBinaryPointable binaryp2 = pp.takeOne(XSBinaryPointable.class);
+                            tvp2.getValue(binaryp2);
+                            result = aOp.operateHexBinaryHexBinary(binaryp1, binaryp2);
+                            pp.giveBack(binaryp2);
+                            break;
+
+                        default:
+                            throw new SystemException(ErrorCode.XPTY0004);
                     }
-                    break;
+                    pp.giveBack(binaryp1);
+                    return result;
 
                 case ValueTag.XS_BASE64_BINARY_TAG:
-                    tvp1.getValue(tp1.binaryp);
+                    XSBinaryPointable base64p1 = pp.takeOne(XSBinaryPointable.class);
+                    tvp1.getValue(base64p1);
                     switch (tid2) {
                         case ValueTag.XS_BASE64_BINARY_TAG:
-                            tvp2.getValue(tp2.binaryp);
-                            return aOp.operateBase64BinaryBase64Binary(tp1.binaryp, tp2.binaryp);
+                            XSBinaryPointable base64p2 = pp.takeOne(XSBinaryPointable.class);
+                            tvp2.getValue(base64p2);
+                            result = aOp.operateBase64BinaryBase64Binary(base64p1, base64p2);
+                            pp.giveBack(base64p2);
+                            break;
+
+                        default:
+                            throw new SystemException(ErrorCode.XPTY0004);
                     }
-                    break;
+                    pp.giveBack(base64p1);
+                    return result;
 
                 case ValueTag.XS_ANY_URI_TAG:
-                    tvp1.getValue(tp1.utf8sp);
+                    UTF8StringPointable anyurip1 = pp.takeOne(UTF8StringPointable.class);
+                    tvp1.getValue(anyurip1);
+                    UTF8StringPointable utf8sp2 = pp.takeOne(UTF8StringPointable.class);
                     switch (tid2) {
                         case ValueTag.XS_ANY_URI_TAG:
-                            tvp2.getValue(tp2.utf8sp);
-                            return aOp.operateAnyURIAnyURI(tp1.utf8sp, tp2.utf8sp);
+                            tvp2.getValue(utf8sp2);
+                            result = aOp.operateAnyURIAnyURI(anyurip1, utf8sp2);
+                            break;
 
                         case ValueTag.XS_STRING_TAG:
                         case ValueTag.XS_NORMALIZED_STRING_TAG:
@@ -956,28 +1161,50 @@ public class FunctionHelper {
                         case ValueTag.XS_IDREF_TAG:
                         case ValueTag.XS_ENTITY_TAG:
                         case ValueTag.XS_UNTYPED_ATOMIC_TAG:
-                            tvp2.getValue(tp2.utf8sp);
-                            return aOp.operateStringString(tp1.utf8sp, tp2.utf8sp);
+                            tvp2.getValue(utf8sp2);
+                            result = aOp.operateStringString(anyurip1, utf8sp2);
+                            break;
+
+                        default:
+                            throw new SystemException(ErrorCode.XPTY0004);
                     }
-                    break;
+                    pp.giveBack(utf8sp2);
+                    pp.giveBack(anyurip1);
+                    return result;
 
                 case ValueTag.XS_QNAME_TAG:
-                    tvp1.getValue(tp1.qnamep);
+                    XSQNamePointable qnamep1 = pp.takeOne(XSQNamePointable.class);
+                    tvp1.getValue(qnamep1);
                     switch (tid2) {
                         case ValueTag.XS_QNAME_TAG:
-                            tvp2.getValue(tp2.qnamep);
-                            return aOp.operateQNameQName(tp1.qnamep, tp2.qnamep);
+                            XSQNamePointable qnamep2 = pp.takeOne(XSQNamePointable.class);
+                            tvp2.getValue(qnamep2);
+                            result = aOp.operateQNameQName(qnamep1, qnamep2);
+                            pp.giveBack(qnamep2);
+                            break;
+
+                        default:
+                            throw new SystemException(ErrorCode.XPTY0004);
                     }
-                    break;
+                    pp.giveBack(qnamep1);
+                    return result;
 
                 case ValueTag.XS_NOTATION_TAG:
-                    tvp1.getValue(tp1.utf8sp);
+                    UTF8StringPointable notationp1 = pp.takeOne(UTF8StringPointable.class);
+                    tvp1.getValue(notationp1);
                     switch (tid2) {
                         case ValueTag.XS_NOTATION_TAG:
-                            tvp2.getValue(tp2.utf8sp);
-                            return aOp.operateNotationNotation(tp1.utf8sp, tp2.utf8sp);
+                            UTF8StringPointable notationp2 = pp.takeOne(UTF8StringPointable.class);
+                            tvp2.getValue(notationp2);
+                            result = aOp.operateNotationNotation(notationp1, notationp2);
+                            pp.giveBack(notationp2);
+                            break;
+
+                        default:
+                            throw new SystemException(ErrorCode.XPTY0004);
                     }
-                    break;
+                    pp.giveBack(notationp1);
+                    return result;
             }
         } catch (SystemException se) {
             throw se;
@@ -1141,24 +1368,29 @@ public class FunctionHelper {
         }
     }
 
-    public static void getDoublePointable(TaggedValuePointable tvp, DataOutput dOut) throws SystemException,
-            IOException {
-        TypedPointables tp = new TypedPointables();
+    public static void getDoublePointable(TaggedValuePointable tvp, PointablePool ppool, DataOutput dOut)
+            throws SystemException, IOException {
         double value;
         switch (tvp.getTag()) {
             case ValueTag.XS_DECIMAL_TAG:
-                tvp.getValue(tp.decp);
-                value = tp.decp.doubleValue();
+                XSDecimalPointable decp = ppool.takeOne(XSDecimalPointable.class);
+                tvp.getValue(decp);
+                value = decp.doubleValue();
+                ppool.giveBack(decp);
                 break;
 
             case ValueTag.XS_DOUBLE_TAG:
-                tvp.getValue(tp.doublep);
-                value = tp.doublep.doubleValue();
+                DoublePointable doublep = ppool.takeOne(DoublePointable.class);
+                tvp.getValue(doublep);
+                value = doublep.doubleValue();
+                ppool.giveBack(doublep);
                 break;
 
             case ValueTag.XS_FLOAT_TAG:
-                tvp.getValue(tp.floatp);
-                value = tp.floatp.doubleValue();
+                FloatPointable floatp = ppool.takeOne(FloatPointable.class);
+                tvp.getValue(floatp);
+                value = floatp.doubleValue();
+                ppool.giveBack(floatp);
                 break;
 
             case ValueTag.XS_INTEGER_TAG:
@@ -1169,25 +1401,33 @@ public class FunctionHelper {
             case ValueTag.XS_POSITIVE_INTEGER_TAG:
             case ValueTag.XS_UNSIGNED_INT_TAG:
             case ValueTag.XS_UNSIGNED_LONG_TAG:
-                tvp.getValue(tp.longp);
-                value = tp.longp.doubleValue();
+                LongPointable longp = ppool.takeOne(LongPointable.class);
+                tvp.getValue(longp);
+                value = longp.doubleValue();
+                ppool.giveBack(longp);
                 break;
 
             case ValueTag.XS_INT_TAG:
             case ValueTag.XS_UNSIGNED_SHORT_TAG:
-                tvp.getValue(tp.intp);
-                value = tp.intp.doubleValue();
+                IntegerPointable intp = ppool.takeOne(IntegerPointable.class);
+                tvp.getValue(intp);
+                value = intp.doubleValue();
+                ppool.giveBack(intp);
                 break;
 
             case ValueTag.XS_SHORT_TAG:
             case ValueTag.XS_UNSIGNED_BYTE_TAG:
-                tvp.getValue(tp.shortp);
-                value = tp.shortp.doubleValue();
+                ShortPointable shortp = ppool.takeOne(ShortPointable.class);
+                tvp.getValue(shortp);
+                value = shortp.doubleValue();
+                ppool.giveBack(shortp);
                 break;
 
             case ValueTag.XS_BYTE_TAG:
-                tvp.getValue(tp.bytep);
-                value = tp.bytep.doubleValue();
+                BytePointable bytep = ppool.takeOne(BytePointable.class);
+                tvp.getValue(bytep);
+                value = bytep.doubleValue();
+                ppool.giveBack(bytep);
                 break;
 
             default:
@@ -1197,9 +1437,8 @@ public class FunctionHelper {
         dOut.writeDouble(value);
     }
 
-    public static void getIntegerPointable(TaggedValuePointable tvp, DataOutput dOut) throws SystemException,
-            IOException {
-        TypedPointables tp = new TypedPointables();
+    public static void getIntegerPointable(TaggedValuePointable tvp, PointablePool ppool, DataOutput dOut)
+            throws SystemException, IOException {
         long value;
         switch (tvp.getTag()) {
             case ValueTag.XS_INTEGER_TAG:
@@ -1210,25 +1449,33 @@ public class FunctionHelper {
             case ValueTag.XS_POSITIVE_INTEGER_TAG:
             case ValueTag.XS_UNSIGNED_INT_TAG:
             case ValueTag.XS_UNSIGNED_LONG_TAG:
-                tvp.getValue(tp.longp);
-                value = tp.longp.longValue();
+                LongPointable longp = ppool.takeOne(LongPointable.class);
+                tvp.getValue(longp);
+                value = longp.longValue();
+                ppool.giveBack(longp);
                 break;
 
             case ValueTag.XS_INT_TAG:
             case ValueTag.XS_UNSIGNED_SHORT_TAG:
-                tvp.getValue(tp.intp);
-                value = tp.intp.longValue();
+                IntegerPointable intp = ppool.takeOne(IntegerPointable.class);
+                tvp.getValue(intp);
+                value = intp.longValue();
+                ppool.giveBack(intp);
                 break;
 
             case ValueTag.XS_SHORT_TAG:
             case ValueTag.XS_UNSIGNED_BYTE_TAG:
-                tvp.getValue(tp.shortp);
-                value = tp.shortp.longValue();
+                ShortPointable shortp = ppool.takeOne(ShortPointable.class);
+                tvp.getValue(shortp);
+                value = shortp.longValue();
+                ppool.giveBack(shortp);
                 break;
 
             case ValueTag.XS_BYTE_TAG:
-                tvp.getValue(tp.bytep);
-                value = tp.bytep.longValue();
+                BytePointable bytep = ppool.takeOne(BytePointable.class);
+                tvp.getValue(bytep);
+                value = bytep.longValue();
+                ppool.giveBack(bytep);
                 break;
 
             default:
@@ -1243,37 +1490,65 @@ public class FunctionHelper {
      */
     public static int getLocalNodeId(TaggedValuePointable tvp1) {
         final TaggedValuePointable tvp = (TaggedValuePointable) TaggedValuePointable.FACTORY.createPointable();
-        final TypedPointables tp = new TypedPointables();
+        final PointablePool ppool = PointablePoolFactory.INSTANCE.createPointablePool();
+
         int localNodeId = -1;
         if (tvp1.getTag() == ValueTag.NODE_TREE_TAG) {
-            tvp1.getValue(tp.ntp);
-            tp.ntp.getRootNode(tvp);
+            NodeTreePointable ntp = ppool.takeOne(NodeTreePointable.class);
+            tvp1.getValue(ntp);
+            ntp.getRootNode(tvp);
             switch (tvp.getTag()) {
                 case ValueTag.ATTRIBUTE_NODE_TAG:
-                    tvp.getValue(tp.anp);
-                    localNodeId = tp.anp.getLocalNodeId(tp.ntp);
+                    AttributeNodePointable anp = ppool.takeOne(AttributeNodePointable.class);
+                    try {
+                        tvp.getValue(anp);
+                        localNodeId = anp.getLocalNodeId(ntp);
+                    } finally {
+                        ppool.giveBack(anp);
+                    }
                     break;
                 case ValueTag.COMMENT_NODE_TAG:
                 case ValueTag.TEXT_NODE_TAG:
-                    tvp.getValue(tp.tocnp);
-                    localNodeId = tp.tocnp.getLocalNodeId(tp.ntp);
+                    TextOrCommentNodePointable tocnp = ppool.takeOne(TextOrCommentNodePointable.class);
+                    try {
+                        tvp.getValue(tocnp);
+                        localNodeId = tocnp.getLocalNodeId(ntp);
+                    } finally {
+                        ppool.giveBack(tocnp);
+                    }
                     break;
                 case ValueTag.DOCUMENT_NODE_TAG:
-                    tvp.getValue(tp.dnp);
-                    localNodeId = tp.dnp.getLocalNodeId(tp.ntp);
+                    DocumentNodePointable dnp = ppool.takeOne(DocumentNodePointable.class);
+                    try {
+                        tvp.getValue(dnp);
+                        localNodeId = dnp.getLocalNodeId(ntp);
+                    } finally {
+                        ppool.giveBack(dnp);
+                    }
                     break;
                 case ValueTag.ELEMENT_NODE_TAG:
-                    tvp.getValue(tp.enp);
-                    localNodeId = tp.enp.getLocalNodeId(tp.ntp);
+                    ElementNodePointable enp = ppool.takeOne(ElementNodePointable.class);
+                    try {
+                        tvp.getValue(enp);
+                        localNodeId = enp.getLocalNodeId(ntp);
+                    } finally {
+                        ppool.giveBack(enp);
+                    }
                     break;
                 case ValueTag.PI_NODE_TAG:
-                    tvp.getValue(tp.pinp);
-                    localNodeId = tp.pinp.getLocalNodeId(tp.ntp);
+                    PINodePointable pinp = ppool.takeOne(PINodePointable.class);
+                    try {
+                        tvp.getValue(pinp);
+                        localNodeId = pinp.getLocalNodeId(ntp);
+                    } finally {
+                        ppool.giveBack(pinp);
+                    }
                     break;
                 default:
                     localNodeId = -1;
                     break;
             }
+            ppool.giveBack(ntp);
         }
         return localNodeId;
     }
@@ -1411,10 +1686,6 @@ public class FunctionHelper {
 
     public static void readInDocFromString(String fName, InputSource in, ArrayBackedValueStorage abvs,
             ITreeNodeIdProvider treeNodeIdProvider) throws SystemException {
-        File file = new File(fName);
-        if (!file.exists()) {
-            throw new RuntimeException("The file (" + fName + ") does not exist.");
-        }
         try {
             if (fName.toLowerCase().endsWith(".xml.gz")) {
                 in.setCharacterStream(new InputStreamReader(new GZIPInputStream(new FileInputStream(fName))));
@@ -1422,13 +1693,16 @@ public class FunctionHelper {
                 in.setCharacterStream(new InputStreamReader(new FileInputStream(fName)));
             }
             XMLParser.parseInputSource(in, abvs, false, treeNodeIdProvider);
+        } catch (FileNotFoundException e) {
+            throw new RuntimeException("The file (" + fName + ") does not exist.");
         } catch (IOException e) {
             throw new SystemException(ErrorCode.SYSE0001, e);
         }
     }
 
     public static boolean transformThenCompareMinMaxTaggedValues(AbstractValueComparisonOperation aOp,
-            TaggedValuePointable tvp1, TaggedValuePointable tvp2, DynamicContext dCtx) throws SystemException {
+            TaggedValuePointable tvp1, TaggedValuePointable tvp2, PointablePool ppool, DynamicContext dCtx)
+            throws SystemException {
         TaggedValuePointable tvp1new = (TaggedValuePointable) TaggedValuePointable.FACTORY.createPointable();
         TaggedValuePointable tvp2new = (TaggedValuePointable) TaggedValuePointable.FACTORY.createPointable();
 
@@ -1448,7 +1722,7 @@ public class FunctionHelper {
                 tvp1new.set(abvsArgument1.getByteArray(), abvsArgument1.getStartOffset(),
                         DoublePointable.TYPE_TRAITS.getFixedLength() + 1);
             } else if (isDerivedFromInteger(tvp1.getTag())) {
-                getIntegerPointable(tvp1, dOutArgument1);
+                getIntegerPointable(tvp1, ppool, dOutArgument1);
                 tvp1new.set(abvsArgument1.getByteArray(), abvsArgument1.getStartOffset(),
                         LongPointable.TYPE_TRAITS.getFixedLength() + 1);
             } else {
@@ -1461,14 +1735,14 @@ public class FunctionHelper {
                 tvp2new.set(abvsArgument2.getByteArray(), abvsArgument2.getStartOffset(),
                         DoublePointable.TYPE_TRAITS.getFixedLength() + 1);
             } else if (isDerivedFromInteger(tvp2.getTag())) {
-                getIntegerPointable(tvp2, dOutArgument2);
+                getIntegerPointable(tvp2, ppool, dOutArgument2);
                 tvp2new.set(abvsArgument2.getByteArray(), abvsArgument2.getStartOffset(),
                         LongPointable.TYPE_TRAITS.getFixedLength() + 1);
             } else {
                 tvp2new = tvp2;
             }
 
-            return compareTaggedValues(aOp, tvp1new, tvp2new, dCtx);
+            return compareTaggedValues(aOp, tvp1new, tvp2new, ppool, dCtx);
         } catch (SystemException se) {
             throw se;
         } catch (Exception e) {