You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by "jpountz (via GitHub)" <gi...@apache.org> on 2023/12/10 21:26:07 UTC

Re: [PR] [branch_9_9] Reflow computeCommonPrefixLengthAndBuildHistogram to avoid crash [lucene]

jpountz commented on code in PR #12903:
URL: https://github.com/apache/lucene/pull/12903#discussion_r1421819068


##########
lucene/core/src/java/org/apache/lucene/util/MSBRadixSorter.java:
##########
@@ -214,6 +214,12 @@ protected int getBucket(int i, int k) {
    * @see #buildHistogram
    */
   private int computeCommonPrefixLengthAndBuildHistogram(int from, int to, int k, int[] histogram) {
+    int commonPrefixLength = computeInitialCommonPrefixLength(from, k);
+    return computeCommonPrefixLengthAndBuildHistogramPart1(
+        from, to, k, histogram, commonPrefixLength);
+  }
+
+  private int computeInitialCommonPrefixLength(int from, int k) {

Review Comment:
   Can you add a comment here and in other places that you touched, explaining that this works around a C2 compiler bug?



##########
lucene/core/src/test/org/apache/lucene/util/bkd/TestDocIdsWriter.java:
##########
@@ -150,4 +154,18 @@ public Relation compare(byte[] minPackedValue, byte[] maxPackedValue) {
     }
     dir.deleteFile("tmp");
   }
+
+  // This simple test tickles a JVM JIT crash on JDK's less than 21.0.1
+  // Needs to be run with C2, so with the environment variable `CI` set
+  public void testCrash() throws IOException {
+    for (int i = 0; i < 100; i++) {
+      try (Directory dir = newDirectory();
+          IndexWriter iw = new IndexWriter(dir, newIndexWriterConfig(null))) {
+        for (int d = 0; d < 20_000; d++) {
+          iw.addDocument(
+              List.of(new IntPoint("foo", 0), new SortedNumericDocValuesField("bar", 0)));
+        }
+      }
+    }
+  }

Review Comment:
   How long does this test take? If it's multiple seconds, should it only run nightly?



-- 
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: issues-unsubscribe@lucene.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org