1 /*
  2  * Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
  3  * Copyright 2009 Red Hat, Inc.
  4  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  5  *
  6  * This code is free software; you can redistribute it and/or modify it
  7  * under the terms of the GNU General Public License version 2 only, as
  8  * published by the Free Software Foundation.
  9  *
 10  * This code is distributed in the hope that it will be useful, but WITHOUT
 11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 12  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 13  * version 2 for more details (a copy is included in the LICENSE file that
 14  * accompanied this code).
 15  *
 16  * You should have received a copy of the GNU General Public License version
 17  * 2 along with this work; if not, write to the Free Software Foundation,
 18  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 19  *
 20  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 21  * or visit www.oracle.com if you need additional information or have any
 22  * questions.
 23  *
 24  */
 25 
 26 #include "precompiled.hpp"
 27 #include "asm/assembler.inline.hpp"
 28 #include "memory/resourceArea.hpp"
 29 #include "runtime/arguments.hpp"
 30 #include "runtime/globals_extension.hpp"
 31 #include "runtime/java.hpp"
 32 #include "runtime/stubCodeGenerator.hpp"
 33 #include "runtime/vm_version.hpp"
 34 
 35 
 36 void VM_Version::initialize() {
 37   // This machine does not allow unaligned memory accesses
 38   if (! FLAG_IS_DEFAULT(UseUnalignedAccesses)) {
 39     warning("Unaligned memory access is not available on this CPU");
 40     FLAG_SET_DEFAULT(UseUnalignedAccesses, false);
 41   }
 42   // Disable prefetching for Zero
 43   if (! FLAG_IS_DEFAULT(AllocatePrefetchDistance)) {
 44     warning("Prefetching is not available for a Zero VM");
 45   }
 46   FLAG_SET_DEFAULT(AllocatePrefetchDistance, 0);
 47 
 48   // If lock diagnostics is needed, always call to runtime
 49   if (DiagnoseSyncOnValueBasedClasses != 0) {
 50     FLAG_SET_DEFAULT(UseHeavyMonitors, true);
 51   }
 52 
 53   if (UseAESIntrinsics) {
 54     warning("AES intrinsics are not available on this CPU");
 55     FLAG_SET_DEFAULT(UseAESIntrinsics, false);
 56   }
 57 
 58   if (UseAES) {
 59     warning("AES instructions are not available on this CPU");
 60     FLAG_SET_DEFAULT(UseAES, false);
 61   }
 62 
 63   if (UseAESCTRIntrinsics) {
 64     warning("AES/CTR intrinsics are not available on this CPU");
 65     FLAG_SET_DEFAULT(UseAESCTRIntrinsics, false);
 66   }
 67 
 68   if (UseFMA) {
 69     warning("FMA instructions are not available on this CPU");
 70     FLAG_SET_DEFAULT(UseFMA, false);
 71   }
 72 
 73   if (UseMD5Intrinsics) {
 74     warning("MD5 intrinsics are not available on this CPU");
 75     FLAG_SET_DEFAULT(UseMD5Intrinsics, false);
 76   }
 77 
 78   if (UseSHA) {
 79     warning("SHA instructions are not available on this CPU");
 80     FLAG_SET_DEFAULT(UseSHA, false);
 81   }
 82 
 83   if (UseSHA1Intrinsics) {
 84     warning("Intrinsics for SHA-1 crypto hash functions not available on this CPU.");
 85     FLAG_SET_DEFAULT(UseSHA1Intrinsics, false);
 86   }
 87 
 88   if (UseSHA256Intrinsics) {
 89     warning("Intrinsics for SHA-224 and SHA-256 crypto hash functions not available on this CPU.");
 90     FLAG_SET_DEFAULT(UseSHA256Intrinsics, false);
 91   }
 92 
 93   if (UseSHA512Intrinsics) {
 94     warning("Intrinsics for SHA-384 and SHA-512 crypto hash functions not available on this CPU.");
 95     FLAG_SET_DEFAULT(UseSHA512Intrinsics, false);
 96   }
 97 
 98   if (UseSHA3Intrinsics) {
 99     warning("Intrinsics for SHA3-224, SHA3-256, SHA3-384 and SHA3-512 crypto hash functions not available on this CPU.");
100     FLAG_SET_DEFAULT(UseSHA3Intrinsics, false);
101   }
102 
103   if (UseCRC32Intrinsics) {
104     warning("CRC32 intrinsics are not available on this CPU");
105     FLAG_SET_DEFAULT(UseCRC32Intrinsics, false);
106   }
107 
108   if (UseAdler32Intrinsics) {
109     warning("Adler32 intrinsics are not available on this CPU");
110     FLAG_SET_DEFAULT(UseAdler32Intrinsics, false);
111   }
112 
113   if (UseVectorizedMismatchIntrinsic) {
114     warning("vectorizedMismatch intrinsic is not available on this CPU.");
115     FLAG_SET_DEFAULT(UseVectorizedMismatchIntrinsic, false);
116   }
117 
118   // Not implemented
119   UNSUPPORTED_OPTION(CriticalJNINatives);
120   UNSUPPORTED_OPTION(UseCompiler);
121 #ifdef ASSERT
122   UNSUPPORTED_OPTION(CountCompiledCalls);
123 #endif
124 }