ibessonov commented on code in PR #6377:
URL: https://github.com/apache/ignite-3/pull/6377#discussion_r2260426703


##########
modules/storage-page-memory/src/main/java/org/apache/ignite/internal/storage/pagememory/index/sorted/comparator/JitComparatorGenerator.java:
##########
@@ -211,18 +217,31 @@ public static JitComparator createComparator(
         Variable outerEntrySize = scope.declareVariable(int.class, 
"outerEntrySize");
         Variable innerEntrySize = scope.declareVariable(int.class, 
"innerEntrySize");
 
+        // Variables for outer flag and its "isPrefix" state.
+        // The latter will only be used if "options.supportPrefixes()" is 
"true".
+        Variable outerFlag = scope.declareVariable(byte.class, "outerFlag");
+        Variable outerIsPrefix = scope.declareVariable(boolean.class, 
"outerIsPrefix");
+
+        if (options.supportPrefixes() || maxEntrySizeLog != 0) {
+            // We only read outer accessor header if we need its bits.
+            // Otherwise we optimize the code by avoiding this read.
+            body.append(outerFlag.set(outerAccessor.invoke("get", byte.class, 
constantInt(0))));
+        }
+
+        if (options.supportPrefixes()) {
+            
body.append(outerIsPrefix.set(notEqual(bitwiseAnd(outerFlag.cast(int.class), 
constantInt(PREFIX_FLAG)), constantInt(0))));
+        }
+
         if (maxEntrySizeLog != 0) {
             // If entry size can be larger than 1 byte (and its logarithm 
larger than 0), then we read it from headers of tuples like this:
             //  int outerEntrySize = outerAccessor.get(0) & 
BinaryTupleCommon.VARSIZE_MASK;
             // Here "Size" still means logarithmic scale.
-            Variable outerFlag = scope.declareVariable(byte.class, 
"outerFlag");
             Variable innerFlag = scope.declareVariable(byte.class, 
"innerFlag");
 
-            body.append(outerFlag.set(outerAccessor.invoke("get", byte.class, 
constantInt(0))));
             body.append(innerFlag.set(innerAccessor.invoke("get", byte.class, 
constantInt(0))));
 
-            
body.append(outerEntrySize.set(bitwiseAnd(outerFlag.cast(int.class), 
constantInt(BinaryTupleCommon.VARSIZE_MASK))));
-            
body.append(innerEntrySize.set(bitwiseAnd(innerFlag.cast(int.class), 
constantInt(BinaryTupleCommon.VARSIZE_MASK))));
+            
body.append(outerEntrySize.set(bitwiseAnd(outerFlag.cast(int.class), 
constantInt(VARSIZE_MASK))));

Review Comment:
   Yes



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to