@@ -58,6 +58,13 @@ void VM_Version::useRVA23U64Profile() {
58
58
}
59
59
60
60
void VM_Version::initialize () {
61
+ common_initialize ();
62
+ #ifdef COMPILER2
63
+ c2_initialize ();
64
+ #endif // COMPILER2
65
+ }
66
+
67
+ void VM_Version::common_initialize () {
61
68
_supports_atomic_getset4 = true ;
62
69
_supports_atomic_getadd4 = true ;
63
70
_supports_atomic_getset8 = true ;
@@ -152,10 +159,6 @@ void VM_Version::initialize() {
152
159
FLAG_SET_DEFAULT (UseVectorizedMismatchIntrinsic, false );
153
160
}
154
161
155
- if (FLAG_IS_DEFAULT (UseMD5Intrinsics)) {
156
- FLAG_SET_DEFAULT (UseMD5Intrinsics, true );
157
- }
158
-
159
162
if (FLAG_IS_DEFAULT (UsePoly1305Intrinsics)) {
160
163
FLAG_SET_DEFAULT (UsePoly1305Intrinsics, true );
161
164
}
@@ -230,15 +233,105 @@ void VM_Version::initialize() {
230
233
_initial_vector_length = cpu_vector_length ();
231
234
}
232
235
}
236
+ }
233
237
234
238
#ifdef COMPILER2
235
- c2_initialize ();
236
- #endif // COMPILER2
239
+ void VM_Version::c2_initialize () {
240
+ if (UseCMoveUnconditionally) {
241
+ FLAG_SET_DEFAULT (UseCMoveUnconditionally, false );
242
+ }
243
+
244
+ if (ConditionalMoveLimit > 0 ) {
245
+ FLAG_SET_DEFAULT (ConditionalMoveLimit, 0 );
246
+ }
237
247
238
- // NOTE: Make sure codes dependent on UseRVV are put after c2_initialize(),
248
+ if (!UseRVV) {
249
+ FLAG_SET_DEFAULT (MaxVectorSize, 0 );
250
+ FLAG_SET_DEFAULT (UseRVVForBigIntegerShiftIntrinsics, false );
251
+ } else {
252
+ if (!FLAG_IS_DEFAULT (MaxVectorSize) && MaxVectorSize != _initial_vector_length) {
253
+ warning (" Current system does not support RVV vector length for MaxVectorSize %d. Set MaxVectorSize to %d" ,
254
+ (int )MaxVectorSize, _initial_vector_length);
255
+ }
256
+ MaxVectorSize = _initial_vector_length;
257
+ if (MaxVectorSize < 16 ) {
258
+ warning (" RVV does not support vector length less than 16 bytes. Disabling RVV." );
259
+ UseRVV = false ;
260
+ FLAG_SET_DEFAULT (MaxVectorSize, 0 );
261
+ }
262
+ }
263
+
264
+ // NOTE: Make sure codes dependent on UseRVV are put after MaxVectorSize initialize,
239
265
// as there are extra checks inside it which could disable UseRVV
240
266
// in some situations.
241
267
268
+ if (FLAG_IS_DEFAULT (UseVectorizedHashCodeIntrinsic)) {
269
+ FLAG_SET_DEFAULT (UseVectorizedHashCodeIntrinsic, true );
270
+ }
271
+
272
+ if (!UseZicbop) {
273
+ if (!FLAG_IS_DEFAULT (AllocatePrefetchStyle)) {
274
+ warning (" Zicbop is not available on this CPU" );
275
+ }
276
+ FLAG_SET_DEFAULT (AllocatePrefetchStyle, 0 );
277
+ } else {
278
+ // Limit AllocatePrefetchDistance so that it does not exceed the
279
+ // static constraint of 512 defined in runtime/globals.hpp.
280
+ if (FLAG_IS_DEFAULT (AllocatePrefetchDistance)) {
281
+ FLAG_SET_DEFAULT (AllocatePrefetchDistance, MIN2 (512 , 3 * (int )CacheLineSize));
282
+ }
283
+ if (FLAG_IS_DEFAULT (AllocatePrefetchStepSize)) {
284
+ FLAG_SET_DEFAULT (AllocatePrefetchStepSize, (int )CacheLineSize);
285
+ }
286
+ if (FLAG_IS_DEFAULT (PrefetchScanIntervalInBytes)) {
287
+ FLAG_SET_DEFAULT (PrefetchScanIntervalInBytes, 3 * (int )CacheLineSize);
288
+ }
289
+ if (FLAG_IS_DEFAULT (PrefetchCopyIntervalInBytes)) {
290
+ FLAG_SET_DEFAULT (PrefetchCopyIntervalInBytes, 3 * (int )CacheLineSize);
291
+ }
292
+
293
+ if (PrefetchCopyIntervalInBytes != -1 &&
294
+ ((PrefetchCopyIntervalInBytes & 7 ) || (PrefetchCopyIntervalInBytes >= 32768 ))) {
295
+ warning (" PrefetchCopyIntervalInBytes must be -1, or a multiple of 8 and < 32768" );
296
+ PrefetchCopyIntervalInBytes &= ~7 ;
297
+ if (PrefetchCopyIntervalInBytes >= 32768 ) {
298
+ PrefetchCopyIntervalInBytes = 32760 ;
299
+ }
300
+ }
301
+ if (AllocatePrefetchDistance !=-1 && (AllocatePrefetchDistance & 7 )) {
302
+ warning (" AllocatePrefetchDistance must be multiple of 8" );
303
+ AllocatePrefetchDistance &= ~7 ;
304
+ }
305
+ if (AllocatePrefetchStepSize & 7 ) {
306
+ warning (" AllocatePrefetchStepSize must be multiple of 8" );
307
+ AllocatePrefetchStepSize &= ~7 ;
308
+ }
309
+ }
310
+
311
+ if (FLAG_IS_DEFAULT (UseMulAddIntrinsic)) {
312
+ FLAG_SET_DEFAULT (UseMulAddIntrinsic, true );
313
+ }
314
+
315
+ if (FLAG_IS_DEFAULT (UseMultiplyToLenIntrinsic)) {
316
+ FLAG_SET_DEFAULT (UseMultiplyToLenIntrinsic, true );
317
+ }
318
+
319
+ if (FLAG_IS_DEFAULT (UseSquareToLenIntrinsic)) {
320
+ FLAG_SET_DEFAULT (UseSquareToLenIntrinsic, true );
321
+ }
322
+
323
+ if (FLAG_IS_DEFAULT (UseMontgomeryMultiplyIntrinsic)) {
324
+ FLAG_SET_DEFAULT (UseMontgomeryMultiplyIntrinsic, true );
325
+ }
326
+
327
+ if (FLAG_IS_DEFAULT (UseMontgomerySquareIntrinsic)) {
328
+ FLAG_SET_DEFAULT (UseMontgomerySquareIntrinsic, true );
329
+ }
330
+
331
+ if (FLAG_IS_DEFAULT (UseMD5Intrinsics)) {
332
+ FLAG_SET_DEFAULT (UseMD5Intrinsics, true );
333
+ }
334
+
242
335
// Adler32
243
336
if (UseRVV) {
244
337
if (FLAG_IS_DEFAULT (UseAdler32Intrinsics)) {
@@ -332,96 +425,6 @@ void VM_Version::initialize() {
332
425
FLAG_SET_DEFAULT (UseSHA, false );
333
426
}
334
427
}
335
-
336
- #ifdef COMPILER2
337
- void VM_Version::c2_initialize () {
338
- if (UseCMoveUnconditionally) {
339
- FLAG_SET_DEFAULT (UseCMoveUnconditionally, false );
340
- }
341
-
342
- if (ConditionalMoveLimit > 0 ) {
343
- FLAG_SET_DEFAULT (ConditionalMoveLimit, 0 );
344
- }
345
-
346
- if (!UseRVV) {
347
- FLAG_SET_DEFAULT (MaxVectorSize, 0 );
348
- FLAG_SET_DEFAULT (UseRVVForBigIntegerShiftIntrinsics, false );
349
- } else {
350
- if (!FLAG_IS_DEFAULT (MaxVectorSize) && MaxVectorSize != _initial_vector_length) {
351
- warning (" Current system does not support RVV vector length for MaxVectorSize %d. Set MaxVectorSize to %d" ,
352
- (int )MaxVectorSize, _initial_vector_length);
353
- }
354
- MaxVectorSize = _initial_vector_length;
355
- if (MaxVectorSize < 16 ) {
356
- warning (" RVV does not support vector length less than 16 bytes. Disabling RVV." );
357
- UseRVV = false ;
358
- FLAG_SET_DEFAULT (MaxVectorSize, 0 );
359
- }
360
- }
361
-
362
- if (FLAG_IS_DEFAULT (UseVectorizedHashCodeIntrinsic)) {
363
- FLAG_SET_DEFAULT (UseVectorizedHashCodeIntrinsic, true );
364
- }
365
-
366
- if (!UseZicbop) {
367
- if (!FLAG_IS_DEFAULT (AllocatePrefetchStyle)) {
368
- warning (" Zicbop is not available on this CPU" );
369
- }
370
- FLAG_SET_DEFAULT (AllocatePrefetchStyle, 0 );
371
- } else {
372
- // Limit AllocatePrefetchDistance so that it does not exceed the
373
- // static constraint of 512 defined in runtime/globals.hpp.
374
- if (FLAG_IS_DEFAULT (AllocatePrefetchDistance)) {
375
- FLAG_SET_DEFAULT (AllocatePrefetchDistance, MIN2 (512 , 3 * (int )CacheLineSize));
376
- }
377
- if (FLAG_IS_DEFAULT (AllocatePrefetchStepSize)) {
378
- FLAG_SET_DEFAULT (AllocatePrefetchStepSize, (int )CacheLineSize);
379
- }
380
- if (FLAG_IS_DEFAULT (PrefetchScanIntervalInBytes)) {
381
- FLAG_SET_DEFAULT (PrefetchScanIntervalInBytes, 3 * (int )CacheLineSize);
382
- }
383
- if (FLAG_IS_DEFAULT (PrefetchCopyIntervalInBytes)) {
384
- FLAG_SET_DEFAULT (PrefetchCopyIntervalInBytes, 3 * (int )CacheLineSize);
385
- }
386
-
387
- if (PrefetchCopyIntervalInBytes != -1 &&
388
- ((PrefetchCopyIntervalInBytes & 7 ) || (PrefetchCopyIntervalInBytes >= 32768 ))) {
389
- warning (" PrefetchCopyIntervalInBytes must be -1, or a multiple of 8 and < 32768" );
390
- PrefetchCopyIntervalInBytes &= ~7 ;
391
- if (PrefetchCopyIntervalInBytes >= 32768 ) {
392
- PrefetchCopyIntervalInBytes = 32760 ;
393
- }
394
- }
395
- if (AllocatePrefetchDistance !=-1 && (AllocatePrefetchDistance & 7 )) {
396
- warning (" AllocatePrefetchDistance must be multiple of 8" );
397
- AllocatePrefetchDistance &= ~7 ;
398
- }
399
- if (AllocatePrefetchStepSize & 7 ) {
400
- warning (" AllocatePrefetchStepSize must be multiple of 8" );
401
- AllocatePrefetchStepSize &= ~7 ;
402
- }
403
- }
404
-
405
- if (FLAG_IS_DEFAULT (UseMulAddIntrinsic)) {
406
- FLAG_SET_DEFAULT (UseMulAddIntrinsic, true );
407
- }
408
-
409
- if (FLAG_IS_DEFAULT (UseMultiplyToLenIntrinsic)) {
410
- FLAG_SET_DEFAULT (UseMultiplyToLenIntrinsic, true );
411
- }
412
-
413
- if (FLAG_IS_DEFAULT (UseSquareToLenIntrinsic)) {
414
- FLAG_SET_DEFAULT (UseSquareToLenIntrinsic, true );
415
- }
416
-
417
- if (FLAG_IS_DEFAULT (UseMontgomeryMultiplyIntrinsic)) {
418
- FLAG_SET_DEFAULT (UseMontgomeryMultiplyIntrinsic, true );
419
- }
420
-
421
- if (FLAG_IS_DEFAULT (UseMontgomerySquareIntrinsic)) {
422
- FLAG_SET_DEFAULT (UseMontgomerySquareIntrinsic, true );
423
- }
424
- }
425
428
#endif // COMPILER2
426
429
427
430
void VM_Version::initialize_cpu_information (void ) {
0 commit comments