Skip to content

Commit 1ccfbf8

Browse files
authored
Make some native vectorization classes package private to be consistent and a minor fix (#15866)
1 parent 169b9ea commit 1ccfbf8

3 files changed

Lines changed: 6 additions & 4 deletions

File tree

lucene/core/src/java/org/apache/lucene/internal/vectorization/VectorizationProvider.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ static VectorizationProvider lookup(boolean testMode) {
171171
return new DefaultVectorizationProvider();
172172
}
173173

174-
static VectorizationProvider lookup(String className) {
174+
private static VectorizationProvider lookup(String className) {
175175
try {
176176
// we use method handles with lookup, so we do not need to deal with setAccessible as we
177177
// have private access through the lookup:

lucene/core/src/java25/org/apache/lucene/internal/vectorization/NativeVectorUtilSupport.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
* overhead of ensuring MemorySegments are allocated off-heap before native calls.
5151
*/
5252
@SuppressWarnings("restricted")
53-
public final class NativeVectorUtilSupport implements VectorUtilSupport {
53+
final class NativeVectorUtilSupport implements VectorUtilSupport {
5454

5555
private final VectorUtilSupport delegateVectorUtilSupport;
5656

@@ -259,7 +259,9 @@ private static float invokeFloatMethodHandle(MethodHandle mh, MemorySegment a, M
259259
private static <T> T invokeOrDelegate(MethodHandle mh, Supplier<T> delegate, Object... args) {
260260
if (mh != null) {
261261
try {
262-
return (T) mh.invokeExact(args);
262+
// TODO: This is slow and we should avoid dynamic invocations and improve the test coverage
263+
// (https://github.com/apache/lucene/issues/15840)
264+
return (T) mh.invokeWithArguments(args);
263265
} catch (Throwable ex) {
264266
throw new AssertionError("should not reach here", ex);
265267
}

lucene/core/src/java25/org/apache/lucene/internal/vectorization/NativeVectorizationProvider.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
import org.apache.lucene.util.SuppressForbidden;
2727

2828
/** Native provider returning native implementations which delegates to Panama implementation. */
29-
public final class NativeVectorizationProvider extends VectorizationProvider {
29+
final class NativeVectorizationProvider extends VectorizationProvider {
3030

3131
private final VectorizationProvider delegateVectorUtilProvider =
3232
new PanamaVectorizationProvider();

0 commit comments

Comments
 (0)