70 static final int VECTOR_OP_LOG = 112;
71 static final int VECTOR_OP_LOG10 = 113;
72 static final int VECTOR_OP_LOG1P = 114;
73 static final int VECTOR_OP_POW = 115;
74 static final int VECTOR_OP_EXP = 116;
75 static final int VECTOR_OP_EXPM1 = 117;
76 static final int VECTOR_OP_HYPOT = 118;
77
78 // enum BoolTest
79 static final int BT_eq = 0;
80 static final int BT_ne = 4;
81 static final int BT_le = 5;
82 static final int BT_ge = 7;
83 static final int BT_lt = 3;
84 static final int BT_gt = 1;
85 static final int BT_overflow = 2;
86 static final int BT_no_overflow = 6;
87
88 /* ============================================================================ */
89 interface BroadcastOperation<V, E> {
90 V broadcast(long l, Vector.Species<E> s);
91 }
92
93 @HotSpotIntrinsicCandidate
94 static
95 <VM, E>
96 VM broadcastCoerced(Class<VM> vmClass, Class<?> E, int length,
97 long bits, Vector.Species<E> s,
98 BroadcastOperation<VM, E> defaultImpl) {
99 assert isNonCapturingLambda(defaultImpl) : defaultImpl;
100 return defaultImpl.broadcast(bits, s);
101 }
102
103 /* ============================================================================ */
104
105 @HotSpotIntrinsicCandidate
106 static
107 <V extends Vector<?>>
108 long reductionCoerced(int oprId, Class<?> vectorClass, Class<?> elementType, int length,
109 V v,
110 Function<V,Long> defaultImpl) {
111 assert isNonCapturingLambda(defaultImpl) : defaultImpl;
112 return defaultImpl.apply(v);
113 }
114
115 /* ============================================================================ */
116
117 interface VecExtractOp<V> {
132
133 interface VecInsertOp<V> {
134 V apply(V v1, int idx, long val);
135 }
136
137 @HotSpotIntrinsicCandidate
138 static <V extends Vector<?>>
139 V insert(Class<V> vectorClass, Class<?> elementType, int vlen,
140 V vec, int ix, long val,
141 VecInsertOp<V> defaultImpl) {
142 assert isNonCapturingLambda(defaultImpl) : defaultImpl;
143 return defaultImpl.apply(vec, ix, val);
144 }
145
146 /* ============================================================================ */
147
148 @HotSpotIntrinsicCandidate
149 static
150 <VM>
151 VM unaryOp(int oprId, Class<VM> vmClass, Class<?> elementType, int length,
152 VM vm, /*Vector.Mask<E,S> m,*/
153 Function<VM, VM> defaultImpl) {
154 assert isNonCapturingLambda(defaultImpl) : defaultImpl;
155 return defaultImpl.apply(vm);
156 }
157
158 /* ============================================================================ */
159
160 @HotSpotIntrinsicCandidate
161 static
162 <VM>
163 VM binaryOp(int oprId, Class<? extends VM> vmClass, Class<?> elementType, int length,
164 VM vm1, VM vm2, /*Vector.Mask<E,S> m,*/
165 BiFunction<VM, VM, VM> defaultImpl) {
166 assert isNonCapturingLambda(defaultImpl) : defaultImpl;
167 return defaultImpl.apply(vm1, vm2);
168 }
169
170 /* ============================================================================ */
171
172 interface TernaryOperation<V> {
173 V apply(V v1, V v2, V v3);
174 }
175
176 @HotSpotIntrinsicCandidate
177 static
178 <VM>
179 VM ternaryOp(int oprId, Class<VM> vmClass, Class<?> elementType, int length,
180 VM vm1, VM vm2, VM vm3, /*Vector.Mask<E,S> m,*/
181 TernaryOperation<VM> defaultImpl) {
182 assert isNonCapturingLambda(defaultImpl) : defaultImpl;
183 return defaultImpl.apply(vm1, vm2, vm3);
184 }
185
186 /* ============================================================================ */
187
188 // Memory operations
189
190 interface LoadOperation<C, V, E> {
191 V load(C container, int index, Vector.Species<E> s);
192 }
193
194 @HotSpotIntrinsicCandidate
195 static
196 <C, VM, E>
197 VM load(Class<VM> vmClass, Class<?> E, int length,
198 Object base, long offset, // Unsafe addressing
199 // Vector.Mask<E,S> m,
200 C container, int index, Vector.Species<E> s, // Arguments for default implementation
201 LoadOperation<C, VM, E> defaultImpl) {
202 assert isNonCapturingLambda(defaultImpl) : defaultImpl;
203 return defaultImpl.load(container, index, s);
204 }
205
206 /* ============================================================================ */
207
208 interface LoadVectorOperationWithMap<C, V extends Vector<?>, E> {
209 V loadWithMap(C container, int index, int[] indexMap, int indexM, Vector.Species<E> s);
210 }
211
212 @HotSpotIntrinsicCandidate
213 static
214 <C, V extends Vector<?>, W extends IntVector, E>
215 V loadWithMap(Class<?> vectorClass, Class<?> E, int length, Class<?> vectorIndexClass,
216 Object base, long offset, // Unsafe addressing
217 W index_vector,
218 C container, int index, int[] indexMap, int indexM, Vector.Species<E> s, // Arguments for default implementation
219 LoadVectorOperationWithMap<C, V, E> defaultImpl) {
220 assert isNonCapturingLambda(defaultImpl) : defaultImpl;
221 return defaultImpl.loadWithMap(container, index, indexMap, indexM, s);
222 }
223
224 /* ============================================================================ */
225
226 interface StoreVectorOperation<C, V extends Vector<?>> {
227 void store(C container, int index, V v);
228 }
229
230 @HotSpotIntrinsicCandidate
231 static
232 <C, V extends Vector<?>>
233 void store(Class<?> vectorClass, Class<?> elementType, int length,
234 Object base, long offset, // Unsafe addressing
235 V v,
236 // Vector.Mask<E,S> m,
237 C container, int index, // Arguments for default implementation
238 StoreVectorOperation<C, V> defaultImpl) {
239 assert isNonCapturingLambda(defaultImpl) : defaultImpl;
240 defaultImpl.store(container, index, v);
241 }
242
243 /* ============================================================================ */
244
245 interface StoreVectorOperationWithMap<C, V extends Vector<?>> {
246 void storeWithMap(C container, int index, V v, int[] indexMap, int indexM);
247 }
248
249 @HotSpotIntrinsicCandidate
250 static
251 <C, V extends Vector<?>, W extends IntVector>
252 void storeWithMap(Class<?> vectorClass, Class<?> elementType, int length, Class<?> vectorIndexClass,
253 Object base, long offset, // Unsafe addressing
254 W index_vector, V v,
255 C container, int index, int[] indexMap, int indexM, // Arguments for default implementation
256 StoreVectorOperationWithMap<C, V> defaultImpl) {
261 /* ============================================================================ */
262
263 @HotSpotIntrinsicCandidate
264 static
265 <VM>
266 boolean test(int cond, Class<?> vmClass, Class<?> elementType, int length,
267 VM vm1, VM vm2,
268 BiFunction<VM, VM, Boolean> defaultImpl) {
269 assert isNonCapturingLambda(defaultImpl) : defaultImpl;
270 return defaultImpl.apply(vm1, vm2);
271 }
272
273 /* ============================================================================ */
274
275 interface VectorCompareOp<V,M> {
276 M apply(V v1, V v2);
277 }
278
279 @HotSpotIntrinsicCandidate
280 static <V extends Vector<E>,
281 M extends Vector.Mask<E>,
282 E>
283 M compare(int cond, Class<V> vectorClass, Class<M> maskClass, Class<?> elementType, int length,
284 V v1, V v2,
285 VectorCompareOp<V,M> defaultImpl) {
286 assert isNonCapturingLambda(defaultImpl) : defaultImpl;
287 return defaultImpl.apply(v1, v2);
288 }
289
290 /* ============================================================================ */
291
292 interface VectorRearrangeOp<V extends Vector<E>,
293 Sh extends Vector.Shuffle<E>,
294 E> {
295 V apply(V v1, Sh shuffle);
296 }
297
298 @HotSpotIntrinsicCandidate
299 static
300 <V extends Vector<E>,
301 Sh extends Vector.Shuffle<E>,
302 E>
303 V rearrangeOp(Class<V> vectorClass, Class<Sh> shuffleClass, Class<?> elementType, int vlen,
304 V v1, Sh sh,
305 VectorRearrangeOp<V,Sh, E> defaultImpl) {
306 assert isNonCapturingLambda(defaultImpl) : defaultImpl;
307 return defaultImpl.apply(v1, sh);
308 }
309
310 /* ============================================================================ */
311
312 interface VectorBlendOp<V extends Vector<E>,
313 M extends Vector.Mask<E>,
314 E> {
315 V apply(V v1, V v2, M mask);
316 }
317
318 @HotSpotIntrinsicCandidate
319 static
320 <V extends Vector<E>,
321 M extends Vector.Mask<E>,
322 E>
323 V blend(Class<V> vectorClass, Class<M> maskClass, Class<?> elementType, int length,
324 V v1, V v2, M m,
325 VectorBlendOp<V,M, E> defaultImpl) {
326 assert isNonCapturingLambda(defaultImpl) : defaultImpl;
327 return defaultImpl.apply(v1, v2, m);
328 }
329
330 /* ============================================================================ */
331
332 interface VectorBroadcastIntOp<V extends Vector<?>> {
333 V apply(V v, int i);
334 }
335
336 @HotSpotIntrinsicCandidate
337 static
338 <V extends Vector<?>>
339 V broadcastInt(int opr, Class<V> vectorClass, Class<?> elementType, int length,
340 V v, int i,
341 VectorBroadcastIntOp<V> defaultImpl) {
|
70 static final int VECTOR_OP_LOG = 112;
71 static final int VECTOR_OP_LOG10 = 113;
72 static final int VECTOR_OP_LOG1P = 114;
73 static final int VECTOR_OP_POW = 115;
74 static final int VECTOR_OP_EXP = 116;
75 static final int VECTOR_OP_EXPM1 = 117;
76 static final int VECTOR_OP_HYPOT = 118;
77
78 // enum BoolTest
79 static final int BT_eq = 0;
80 static final int BT_ne = 4;
81 static final int BT_le = 5;
82 static final int BT_ge = 7;
83 static final int BT_lt = 3;
84 static final int BT_gt = 1;
85 static final int BT_overflow = 2;
86 static final int BT_no_overflow = 6;
87
88 /* ============================================================================ */
89 interface BroadcastOperation<V, E> {
90 V broadcast(long l, VectorSpecies<E> s);
91 }
92
93 @HotSpotIntrinsicCandidate
94 static
95 <VM, E>
96 VM broadcastCoerced(Class<VM> vmClass, Class<?> E, int length,
97 long bits, VectorSpecies<E> s,
98 BroadcastOperation<VM, E> defaultImpl) {
99 assert isNonCapturingLambda(defaultImpl) : defaultImpl;
100 return defaultImpl.broadcast(bits, s);
101 }
102
103 /* ============================================================================ */
104
105 @HotSpotIntrinsicCandidate
106 static
107 <V extends Vector<?>>
108 long reductionCoerced(int oprId, Class<?> vectorClass, Class<?> elementType, int length,
109 V v,
110 Function<V,Long> defaultImpl) {
111 assert isNonCapturingLambda(defaultImpl) : defaultImpl;
112 return defaultImpl.apply(v);
113 }
114
115 /* ============================================================================ */
116
117 interface VecExtractOp<V> {
132
133 interface VecInsertOp<V> {
134 V apply(V v1, int idx, long val);
135 }
136
137 @HotSpotIntrinsicCandidate
138 static <V extends Vector<?>>
139 V insert(Class<V> vectorClass, Class<?> elementType, int vlen,
140 V vec, int ix, long val,
141 VecInsertOp<V> defaultImpl) {
142 assert isNonCapturingLambda(defaultImpl) : defaultImpl;
143 return defaultImpl.apply(vec, ix, val);
144 }
145
146 /* ============================================================================ */
147
148 @HotSpotIntrinsicCandidate
149 static
150 <VM>
151 VM unaryOp(int oprId, Class<VM> vmClass, Class<?> elementType, int length,
152 VM vm,
153 Function<VM, VM> defaultImpl) {
154 assert isNonCapturingLambda(defaultImpl) : defaultImpl;
155 return defaultImpl.apply(vm);
156 }
157
158 /* ============================================================================ */
159
160 @HotSpotIntrinsicCandidate
161 static
162 <VM>
163 VM binaryOp(int oprId, Class<? extends VM> vmClass, Class<?> elementType, int length,
164 VM vm1, VM vm2,
165 BiFunction<VM, VM, VM> defaultImpl) {
166 assert isNonCapturingLambda(defaultImpl) : defaultImpl;
167 return defaultImpl.apply(vm1, vm2);
168 }
169
170 /* ============================================================================ */
171
172 interface TernaryOperation<V> {
173 V apply(V v1, V v2, V v3);
174 }
175
176 @HotSpotIntrinsicCandidate
177 static
178 <VM>
179 VM ternaryOp(int oprId, Class<VM> vmClass, Class<?> elementType, int length,
180 VM vm1, VM vm2, VM vm3,
181 TernaryOperation<VM> defaultImpl) {
182 assert isNonCapturingLambda(defaultImpl) : defaultImpl;
183 return defaultImpl.apply(vm1, vm2, vm3);
184 }
185
186 /* ============================================================================ */
187
188 // Memory operations
189
190 interface LoadOperation<C, V, E> {
191 V load(C container, int index, VectorSpecies<E> s);
192 }
193
194 @HotSpotIntrinsicCandidate
195 static
196 <C, VM, E>
197 VM load(Class<VM> vmClass, Class<?> E, int length,
198 Object base, long offset, // Unsafe addressing
199 C container, int index, VectorSpecies<E> s, // Arguments for default implementation
200 LoadOperation<C, VM, E> defaultImpl) {
201 assert isNonCapturingLambda(defaultImpl) : defaultImpl;
202 return defaultImpl.load(container, index, s);
203 }
204
205 /* ============================================================================ */
206
207 interface LoadVectorOperationWithMap<C, V extends Vector<?>, E> {
208 V loadWithMap(C container, int index, int[] indexMap, int indexM, VectorSpecies<E> s);
209 }
210
211 @HotSpotIntrinsicCandidate
212 static
213 <C, V extends Vector<?>, W extends IntVector, E>
214 V loadWithMap(Class<?> vectorClass, Class<?> E, int length, Class<?> vectorIndexClass,
215 Object base, long offset, // Unsafe addressing
216 W index_vector,
217 C container, int index, int[] indexMap, int indexM, VectorSpecies<E> s, // Arguments for default implementation
218 LoadVectorOperationWithMap<C, V, E> defaultImpl) {
219 assert isNonCapturingLambda(defaultImpl) : defaultImpl;
220 return defaultImpl.loadWithMap(container, index, indexMap, indexM, s);
221 }
222
223 /* ============================================================================ */
224
225 interface StoreVectorOperation<C, V extends Vector<?>> {
226 void store(C container, int index, V v);
227 }
228
229 @HotSpotIntrinsicCandidate
230 static
231 <C, V extends Vector<?>>
232 void store(Class<?> vectorClass, Class<?> elementType, int length,
233 Object base, long offset, // Unsafe addressing
234 V v,
235 C container, int index, // Arguments for default implementation
236 StoreVectorOperation<C, V> defaultImpl) {
237 assert isNonCapturingLambda(defaultImpl) : defaultImpl;
238 defaultImpl.store(container, index, v);
239 }
240
241 /* ============================================================================ */
242
243 interface StoreVectorOperationWithMap<C, V extends Vector<?>> {
244 void storeWithMap(C container, int index, V v, int[] indexMap, int indexM);
245 }
246
247 @HotSpotIntrinsicCandidate
248 static
249 <C, V extends Vector<?>, W extends IntVector>
250 void storeWithMap(Class<?> vectorClass, Class<?> elementType, int length, Class<?> vectorIndexClass,
251 Object base, long offset, // Unsafe addressing
252 W index_vector, V v,
253 C container, int index, int[] indexMap, int indexM, // Arguments for default implementation
254 StoreVectorOperationWithMap<C, V> defaultImpl) {
259 /* ============================================================================ */
260
261 @HotSpotIntrinsicCandidate
262 static
263 <VM>
264 boolean test(int cond, Class<?> vmClass, Class<?> elementType, int length,
265 VM vm1, VM vm2,
266 BiFunction<VM, VM, Boolean> defaultImpl) {
267 assert isNonCapturingLambda(defaultImpl) : defaultImpl;
268 return defaultImpl.apply(vm1, vm2);
269 }
270
271 /* ============================================================================ */
272
273 interface VectorCompareOp<V,M> {
274 M apply(V v1, V v2);
275 }
276
277 @HotSpotIntrinsicCandidate
278 static <V extends Vector<E>,
279 M extends VectorMask<E>,
280 E>
281 M compare(int cond, Class<V> vectorClass, Class<M> maskClass, Class<?> elementType, int length,
282 V v1, V v2,
283 VectorCompareOp<V,M> defaultImpl) {
284 assert isNonCapturingLambda(defaultImpl) : defaultImpl;
285 return defaultImpl.apply(v1, v2);
286 }
287
288 /* ============================================================================ */
289
290 interface VectorRearrangeOp<V extends Vector<E>,
291 Sh extends VectorShuffle<E>,
292 E> {
293 V apply(V v1, Sh shuffle);
294 }
295
296 @HotSpotIntrinsicCandidate
297 static
298 <V extends Vector<E>,
299 Sh extends VectorShuffle<E>,
300 E>
301 V rearrangeOp(Class<V> vectorClass, Class<Sh> shuffleClass, Class<?> elementType, int vlen,
302 V v1, Sh sh,
303 VectorRearrangeOp<V,Sh, E> defaultImpl) {
304 assert isNonCapturingLambda(defaultImpl) : defaultImpl;
305 return defaultImpl.apply(v1, sh);
306 }
307
308 /* ============================================================================ */
309
310 interface VectorBlendOp<V extends Vector<E>,
311 M extends VectorMask<E>,
312 E> {
313 V apply(V v1, V v2, M mask);
314 }
315
316 @HotSpotIntrinsicCandidate
317 static
318 <V extends Vector<E>,
319 M extends VectorMask<E>,
320 E>
321 V blend(Class<V> vectorClass, Class<M> maskClass, Class<?> elementType, int length,
322 V v1, V v2, M m,
323 VectorBlendOp<V,M, E> defaultImpl) {
324 assert isNonCapturingLambda(defaultImpl) : defaultImpl;
325 return defaultImpl.apply(v1, v2, m);
326 }
327
328 /* ============================================================================ */
329
330 interface VectorBroadcastIntOp<V extends Vector<?>> {
331 V apply(V v, int i);
332 }
333
334 @HotSpotIntrinsicCandidate
335 static
336 <V extends Vector<?>>
337 V broadcastInt(int opr, Class<V> vectorClass, Class<?> elementType, int length,
338 V v, int i,
339 VectorBroadcastIntOp<V> defaultImpl) {
|