Skip to content

Commit 3b0939a

Browse files
committed
Refactoring VectorAPIFeature
1 parent a777f55 commit 3b0939a

File tree

2 files changed

+112
-88
lines changed

2 files changed

+112
-88
lines changed

substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/Target_jdk_internal_vm_vector_VectorSupport.java

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
import java.util.function.IntFunction;
3030
import java.util.stream.Collectors;
3131

32-
import jdk.internal.vm.annotation.ForceInline;
3332
import org.graalvm.nativeimage.ImageSingletons;
3433

3534
import com.oracle.svm.core.AlwaysInline;
@@ -123,8 +122,13 @@ static final class Target_jdk_incubator_vector_VectorOperators_ImplCache<OP exte
123122

124123
@Alias Object[] cache;
125124

125+
/*
126+
* We substitute ImplCache#find to remove the call to isNonCapturingLambda. In the process,
127+
* we simplify the cache lookup by removing lazy cache initialization as we precompute the
128+
* cache.
129+
*/
126130
@Substitute
127-
@ForceInline
131+
@AlwaysInline("Vector API fast-path")
128132
@SuppressWarnings({"unchecked", "unused"})
129133
public T find(OP op, int opc, IntFunction<T> supplier) {
130134
T fn = (T) cache[opc];
@@ -142,8 +146,10 @@ final class Target_jdk_incubator_vector_AbstractSpecies {
142146

143147
@Alias private Target_jdk_incubator_vector_AbstractVector dummyVector;
144148

145-
// We initialize the `dummyVector` fields during image build-time using VectorAPIFeature. We
146-
// can have the getter method return the precomputed dummy vector directly.
149+
/*
150+
* We initialize the `dummyVector` fields during image build-time using VectorAPIFeature. We can
151+
* have the getter method return the precomputed dummy vector directly.
152+
*/
147153
@Substitute
148154
Target_jdk_incubator_vector_AbstractVector dummyVector() {
149155
return dummyVector;

0 commit comments

Comments
 (0)