mariofusco commented on code in PR #6488:
URL:
https://github.com/apache/incubator-kie-drools/pull/6488#discussion_r2433122753
##########
drools-core/src/main/java/org/drools/core/reteoo/SegmentMemory.java:
##########
@@ -282,32 +297,77 @@ public void addPathMemory(PathMemory pathMemory) {
}
}
+ public void splitBitMasks(SegmentMemory sm, int pos) {
+ int splitPos = pos + 1; // +1 as zero based
+ long currentAllLinkedMaskTest = allLinkedMaskTest;
+ long currentLinkedNodeMask = linkedNodeMask;
+ long mask = (1L << splitPos) - 1;
+
+ this.allLinkedMaskTest = mask & currentAllLinkedMaskTest;
+ this.linkedNodeMask = linkedNodeMask & allLinkedMaskTest;
+
+ mask = currentAllLinkedMaskTest >> splitPos;
+ sm.allLinkedMaskTest = mask;
+ sm.linkedNodeMask = mask & (currentLinkedNodeMask >> splitPos);
+ }
+
+ public void splitBitMasks(SegmentMemory sm, long currentLinkedNodeMask) {
+ // @TODO Haven't made this work for more than 64 nodes, as per
SegmentUtilities.nextNodePosMask (mdp)
+ int splitPos = proto.getNodesInSegment().length; // +1 as zero based
+ long currentDirtyNodeMask = dirtyNodeMask;
+ long splitMask = ((1L << (splitPos)) - 1);
+
+ this.dirtyNodeMask = currentDirtyNodeMask & splitMask;
+ this.linkedNodeMask = currentLinkedNodeMask & splitMask;
+
+ sm.linkedNodeMask = currentLinkedNodeMask >> splitPos;
+ sm.dirtyNodeMask = currentDirtyNodeMask >> splitPos;
+ }
+
+ public void mergeBitMasks(SegmentMemory sm) {
+ long mask = sm.allLinkedMaskTest << sm.nodeMemories.length;
+ this.allLinkedMaskTest = mask & allLinkedMaskTest;
+
+ mask = sm.allLinkedMaskTest << sm.nodeMemories.length;
Review Comment:
Yes , you're right. Not sure what are the implications of changing this, but
you could try to fix this according to your intuition and rerun the test suite.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]