Thu, 05 Sep 2019 13:07:31 +0800
#9372 Refactor VM_Version, removed UseLoongsonISA and Use3A3000, added UseLEXT1, UseLEXT2, UseLEXT3.
Summary: used cpucfg to detect cpu features
Reviewed-by: wanghaomin
aoqi@1 | 1 | /* |
aoqi@1 | 2 | * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. |
aoqi@9459 | 3 | * Copyright (c) 2015, 2019, Loongson Technology. All rights reserved. |
aoqi@1 | 4 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
aoqi@1 | 5 | * |
aoqi@1 | 6 | * This code is free software; you can redistribute it and/or modify it |
aoqi@1 | 7 | * under the terms of the GNU General Public License version 2 only, as |
aoqi@1 | 8 | * published by the Free Software Foundation. |
aoqi@1 | 9 | * |
aoqi@1 | 10 | * This code is distributed in the hope that it will be useful, but WITHOUT |
aoqi@1 | 11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
aoqi@1 | 12 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
aoqi@1 | 13 | * version 2 for more details (a copy is included in the LICENSE file that |
aoqi@1 | 14 | * accompanied this code). |
aoqi@1 | 15 | * |
aoqi@1 | 16 | * You should have received a copy of the GNU General Public License version |
aoqi@1 | 17 | * 2 along with this work; if not, write to the Free Software Foundation, |
aoqi@1 | 18 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
aoqi@1 | 19 | * |
aoqi@1 | 20 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
aoqi@1 | 21 | * or visit www.oracle.com if you need additional information or have any |
aoqi@1 | 22 | * questions. |
aoqi@1 | 23 | * |
aoqi@1 | 24 | */ |
aoqi@1 | 25 | |
aoqi@1 | 26 | #include "precompiled.hpp" |
aoqi@1 | 27 | #include "asm/macroAssembler.hpp" |
aoqi@1 | 28 | #include "asm/macroAssembler.inline.hpp" |
aoqi@1 | 29 | #include "memory/resourceArea.hpp" |
aoqi@1 | 30 | #include "runtime/java.hpp" |
aoqi@1 | 31 | #include "runtime/stubCodeGenerator.hpp" |
aoqi@1 | 32 | #include "vm_version_mips.hpp" |
aoqi@1 | 33 | #ifdef TARGET_OS_FAMILY_linux |
aoqi@1 | 34 | # include "os_linux.inline.hpp" |
aoqi@1 | 35 | #endif |
aoqi@9644 | 36 | |
aoqi@9644 | 37 | int VM_Version::_cpuFeatures; |
aoqi@1 | 38 | const char* VM_Version::_features_str = ""; |
aoqi@9644 | 39 | VM_Version::CpuidInfo VM_Version::_cpuid_info = { 0, }; |
aoqi@9644 | 40 | volatile bool VM_Version::_is_determine_cpucfg_supported_running = false; |
aoqi@9644 | 41 | bool VM_Version::_is_cpucfg_instruction_supported = true; |
aoqi@9644 | 42 | bool VM_Version::_cpu_info_is_initialized = false; |
chenhaoxuan@358 | 43 | |
aoqi@9644 | 44 | static BufferBlob* stub_blob; |
aoqi@9644 | 45 | static const int stub_size = 600; |
aoqi@9644 | 46 | |
aoqi@9644 | 47 | extern "C" { |
aoqi@9644 | 48 | typedef void (*get_cpu_info_stub_t)(void*); |
aoqi@9644 | 49 | } |
aoqi@9644 | 50 | static get_cpu_info_stub_t get_cpu_info_stub = NULL; |
aoqi@9644 | 51 | |
aoqi@9644 | 52 | |
aoqi@9644 | 53 | class VM_Version_StubGenerator: public StubCodeGenerator { |
aoqi@9644 | 54 | public: |
aoqi@9644 | 55 | |
aoqi@9644 | 56 | VM_Version_StubGenerator(CodeBuffer *c) : StubCodeGenerator(c) {} |
aoqi@9644 | 57 | |
aoqi@9644 | 58 | address generate_get_cpu_info() { |
aoqi@9644 | 59 | assert(!VM_Version::cpu_info_is_initialized(), "VM_Version should not be initialized"); |
aoqi@9644 | 60 | StubCodeMark mark(this, "VM_Version", "get_cpu_info_stub"); |
aoqi@9644 | 61 | # define __ _masm-> |
aoqi@9644 | 62 | |
aoqi@9644 | 63 | address start = __ pc(); |
aoqi@9644 | 64 | |
aoqi@9644 | 65 | __ enter(); |
aoqi@9644 | 66 | __ push(AT); |
aoqi@9644 | 67 | __ push(V0); |
aoqi@9644 | 68 | |
aoqi@9644 | 69 | __ li(AT, (long)0); |
aoqi@9644 | 70 | __ cpucfg(V0, AT); |
aoqi@9644 | 71 | __ lw(AT, A0, in_bytes(VM_Version::Loongson_Cpucfg_id0_offset())); |
aoqi@9644 | 72 | __ sw(V0, A0, in_bytes(VM_Version::Loongson_Cpucfg_id0_offset())); |
aoqi@9644 | 73 | |
aoqi@9644 | 74 | __ li(AT, 1); |
aoqi@9644 | 75 | __ cpucfg(V0, AT); |
aoqi@9644 | 76 | __ lw(AT, A0, in_bytes(VM_Version::Loongson_Cpucfg_id1_offset())); |
aoqi@9644 | 77 | __ sw(V0, A0, in_bytes(VM_Version::Loongson_Cpucfg_id1_offset())); |
aoqi@9644 | 78 | |
aoqi@9644 | 79 | __ li(AT, 2); |
aoqi@9644 | 80 | __ cpucfg(V0, AT); |
aoqi@9644 | 81 | __ lw(AT, A0, in_bytes(VM_Version::Loongson_Cpucfg_id2_offset())); |
aoqi@9644 | 82 | __ sw(V0, A0, in_bytes(VM_Version::Loongson_Cpucfg_id2_offset())); |
aoqi@9644 | 83 | |
aoqi@9644 | 84 | __ pop(V0); |
aoqi@9644 | 85 | __ pop(AT); |
aoqi@9644 | 86 | __ leave(); |
aoqi@9644 | 87 | __ jr(RA); |
aoqi@9644 | 88 | __ delayed()->nop(); |
aoqi@9644 | 89 | # undef __ |
aoqi@9644 | 90 | |
aoqi@9644 | 91 | return start; |
aoqi@9644 | 92 | }; |
aoqi@9644 | 93 | }; |
aoqi@9644 | 94 | |
aoqi@9644 | 95 | uint32_t VM_Version::get_feature_flags_by_cpucfg() { |
aoqi@9644 | 96 | uint32_t result = 0; |
aoqi@9644 | 97 | if (_cpuid_info.cpucfg_info_id1.bits.MMI != 0) |
aoqi@9644 | 98 | result |= CPU_MMI; |
aoqi@9644 | 99 | if (_cpuid_info.cpucfg_info_id1.bits.MSA1 != 0) |
aoqi@9644 | 100 | result |= CPU_MSA1_0; |
aoqi@9644 | 101 | if (_cpuid_info.cpucfg_info_id1.bits.MSA2 != 0) |
aoqi@9644 | 102 | result |= CPU_MSA2_0; |
aoqi@9644 | 103 | if (_cpuid_info.cpucfg_info_id1.bits.CGP != 0) |
aoqi@9644 | 104 | result |= CPU_CGP; |
aoqi@9644 | 105 | if (_cpuid_info.cpucfg_info_id1.bits.LSX1 != 0) |
aoqi@9644 | 106 | result |= CPU_LSX1; |
aoqi@9644 | 107 | if (_cpuid_info.cpucfg_info_id1.bits.LSX2 != 0) |
aoqi@9644 | 108 | result |= CPU_LSX2; |
aoqi@9644 | 109 | if (_cpuid_info.cpucfg_info_id1.bits.LASX != 0) |
aoqi@9644 | 110 | result |= CPU_LASX; |
aoqi@9644 | 111 | if (_cpuid_info.cpucfg_info_id1.bits.LLSYNC != 0) |
aoqi@9644 | 112 | result |= CPU_LLSYNC; |
aoqi@9644 | 113 | if (_cpuid_info.cpucfg_info_id1.bits.TGTSYNC != 0) |
aoqi@9644 | 114 | result |= CPU_TGTSYNC; |
aoqi@9644 | 115 | if (_cpuid_info.cpucfg_info_id1.bits.MUALP != 0) |
aoqi@9644 | 116 | result |= CPU_MUALP; |
aoqi@9644 | 117 | if (_cpuid_info.cpucfg_info_id2.bits.LEXT1 != 0) |
aoqi@9644 | 118 | result |= CPU_LEXT1; |
aoqi@9644 | 119 | if (_cpuid_info.cpucfg_info_id2.bits.LEXT2 != 0) |
aoqi@9644 | 120 | result |= CPU_LEXT2; |
aoqi@9644 | 121 | if (_cpuid_info.cpucfg_info_id2.bits.LEXT3 != 0) |
aoqi@9644 | 122 | result |= CPU_LEXT3; |
aoqi@9644 | 123 | if (_cpuid_info.cpucfg_info_id2.bits.LAMO != 0) |
aoqi@9644 | 124 | result |= CPU_LAMO; |
aoqi@9644 | 125 | if (_cpuid_info.cpucfg_info_id2.bits.LPIXU != 0) |
aoqi@9644 | 126 | result |= CPU_LPIXU; |
aoqi@9644 | 127 | |
aoqi@9644 | 128 | result |= CPU_ULSYNC; |
aoqi@9644 | 129 | |
aoqi@9644 | 130 | return result; |
aoqi@9644 | 131 | } |
aoqi@9644 | 132 | |
aoqi@9644 | 133 | void read_cpu_info(const char *path, char *result) { |
aoqi@9644 | 134 | FILE *ptr; |
aoqi@9644 | 135 | char buf[1024]; |
aoqi@9644 | 136 | int i = 0; |
aoqi@9644 | 137 | if((ptr=fopen(path, "r")) != NULL) { |
aoqi@9644 | 138 | while(fgets(buf, 1024, ptr)!=NULL) { |
aoqi@9644 | 139 | strcat(result,buf); |
aoqi@9644 | 140 | i++; |
aoqi@9644 | 141 | if (i == 10) break; |
aoqi@9644 | 142 | } |
aoqi@9644 | 143 | fclose(ptr); |
aoqi@9644 | 144 | } else { |
aoqi@9644 | 145 | warning("Can't detect CPU info - cannot open %s", path); |
aoqi@9644 | 146 | } |
aoqi@9644 | 147 | } |
aoqi@9644 | 148 | |
aoqi@9644 | 149 | void strlwr(char *str) { |
aoqi@9644 | 150 | for (; *str!='\0'; str++) |
aoqi@9644 | 151 | *str = tolower(*str); |
aoqi@9644 | 152 | } |
aoqi@9644 | 153 | |
aoqi@9644 | 154 | int VM_Version::get_feature_flags_by_cpuinfo(int features) { |
aoqi@9644 | 155 | assert(!cpu_info_is_initialized(), "VM_Version should not be initialized"); |
aoqi@9644 | 156 | |
aoqi@9644 | 157 | char res[10240]; |
aoqi@9644 | 158 | int i; |
aoqi@9644 | 159 | memset(res, '\0', 10240 * sizeof(char)); |
aoqi@9644 | 160 | read_cpu_info("/proc/cpuinfo", res); |
aoqi@9644 | 161 | // res is converted to lower case |
aoqi@9644 | 162 | strlwr(res); |
aoqi@9644 | 163 | |
aoqi@9644 | 164 | if (strstr(res, "loongson")) { |
aoqi@9644 | 165 | // Loongson CPU |
aoqi@9644 | 166 | features |= CPU_LOONGSON; |
aoqi@9644 | 167 | |
aoqi@9644 | 168 | const struct Loongson_Cpuinfo loongson_cpuinfo[] = { |
aoqi@9644 | 169 | {L_3A1000, "3a1000"}, |
aoqi@9644 | 170 | {L_3B1500, "3b1500"}, |
aoqi@9644 | 171 | {L_3A2000, "3a2000"}, |
aoqi@9644 | 172 | {L_3B2000, "3b2000"}, |
aoqi@9644 | 173 | {L_3A3000, "3a3000"}, |
aoqi@9644 | 174 | {L_3B3000, "3b3000"}, |
aoqi@9644 | 175 | {L_2K1000, "2k1000"}, |
aoqi@9644 | 176 | {L_UNKNOWN, "unknown"} |
aoqi@9644 | 177 | }; |
aoqi@9644 | 178 | |
aoqi@9644 | 179 | // Loongson Family |
aoqi@9644 | 180 | int detected = 0; |
aoqi@9644 | 181 | for (i = 0; i <= L_UNKNOWN; i++) { |
aoqi@9644 | 182 | switch (i) { |
aoqi@9644 | 183 | // 3A1000 and 3B1500 may use an old kernel and further comparsion is needed |
aoqi@9644 | 184 | // test PRID REV in /proc/cpuinfo |
aoqi@9644 | 185 | // 3A1000: V0.5, model name: ICT Loongson-3A V0.5 FPU V0.1 |
aoqi@9644 | 186 | // 3B1500: V0.7, model name: ICT Loongson-3B V0.7 FPU V0.1 |
aoqi@9644 | 187 | case L_3A1000: |
aoqi@9644 | 188 | if (strstr(res, loongson_cpuinfo[i].match_str) || strstr(res, "loongson-3a v0.5")) { |
aoqi@9644 | 189 | features |= CPU_LOONGSON_GS464; |
aoqi@9644 | 190 | detected++; |
aoqi@9644 | 191 | //tty->print_cr("3A1000 platform"); |
aoqi@9644 | 192 | } |
aoqi@9644 | 193 | break; |
aoqi@9644 | 194 | case L_3B1500: |
aoqi@9644 | 195 | if (strstr(res, loongson_cpuinfo[i].match_str) || strstr(res, "loongson-3b v0.7")) { |
aoqi@9644 | 196 | features |= CPU_LOONGSON_GS464; |
aoqi@9644 | 197 | detected++; |
aoqi@9644 | 198 | //tty->print_cr("3B1500 platform"); |
aoqi@9644 | 199 | } |
aoqi@9644 | 200 | break; |
aoqi@9644 | 201 | case L_3A2000: |
aoqi@9644 | 202 | case L_3B2000: |
aoqi@9644 | 203 | case L_3A3000: |
aoqi@9644 | 204 | case L_3B3000: |
aoqi@9644 | 205 | if (strstr(res, loongson_cpuinfo[i].match_str)) { |
aoqi@9644 | 206 | features |= CPU_LOONGSON_GS464E; |
aoqi@9644 | 207 | detected++; |
aoqi@9644 | 208 | //tty->print_cr("3A2000/3A3000/3B2000/3B3000 platform"); |
aoqi@9644 | 209 | } |
aoqi@9644 | 210 | break; |
aoqi@9644 | 211 | case L_2K1000: |
aoqi@9644 | 212 | if (strstr(res, loongson_cpuinfo[i].match_str)) { |
aoqi@9644 | 213 | features |= CPU_LOONGSON_GS264; |
aoqi@9644 | 214 | detected++; |
aoqi@9644 | 215 | //tty->print_cr("2K1000 platform"); |
aoqi@9644 | 216 | } |
aoqi@9644 | 217 | break; |
aoqi@9644 | 218 | case L_UNKNOWN: |
aoqi@9644 | 219 | if (detected == 0) { |
aoqi@9644 | 220 | detected++; |
aoqi@9644 | 221 | //tty->print_cr("unknown Loongson platform"); |
aoqi@9644 | 222 | } |
aoqi@9644 | 223 | break; |
aoqi@9644 | 224 | default: |
aoqi@9644 | 225 | ShouldNotReachHere(); |
aoqi@9644 | 226 | } |
aoqi@9644 | 227 | } |
aoqi@9644 | 228 | assert (detected == 1, "one and only one of LOONGSON_CPU_FAMILY should be detected"); |
aoqi@9644 | 229 | } else { // not Loongson |
aoqi@9644 | 230 | // Not Loongson CPU |
aoqi@9644 | 231 | //tty->print_cr("MIPS platform"); |
aoqi@9644 | 232 | } |
aoqi@9644 | 233 | |
aoqi@9644 | 234 | if (features & CPU_LOONGSON_GS264) { |
aoqi@9644 | 235 | features |= CPU_LEXT1; |
aoqi@9644 | 236 | features |= CPU_LEXT2; |
aoqi@9644 | 237 | features |= CPU_TGTSYNC; |
aoqi@9644 | 238 | features |= CPU_ULSYNC; |
aoqi@9644 | 239 | features |= CPU_MSA1_0; |
aoqi@9644 | 240 | features |= CPU_LSX1; |
aoqi@9644 | 241 | } else if (features & CPU_LOONGSON_GS464) { |
aoqi@9644 | 242 | features |= CPU_LEXT1; |
aoqi@9644 | 243 | features |= CPU_LLSYNC; |
aoqi@9644 | 244 | features |= CPU_TGTSYNC; |
aoqi@9644 | 245 | } else if (features & CPU_LOONGSON_GS464E) { |
aoqi@9644 | 246 | features |= CPU_LEXT1; |
aoqi@9644 | 247 | features |= CPU_LEXT2; |
aoqi@9644 | 248 | features |= CPU_LEXT3; |
aoqi@9644 | 249 | features |= CPU_TGTSYNC; |
aoqi@9644 | 250 | features |= CPU_ULSYNC; |
aoqi@9644 | 251 | } else if (features & CPU_LOONGSON) { |
aoqi@9644 | 252 | // unknow loongson |
aoqi@9644 | 253 | features |= CPU_LLSYNC; |
aoqi@9644 | 254 | features |= CPU_TGTSYNC; |
aoqi@9644 | 255 | features |= CPU_ULSYNC; |
aoqi@9644 | 256 | } |
aoqi@9644 | 257 | VM_Version::_cpu_info_is_initialized = true; |
aoqi@9644 | 258 | |
aoqi@9644 | 259 | return features; |
aoqi@9644 | 260 | } |
aoqi@9644 | 261 | |
aoqi@9644 | 262 | void VM_Version::get_processor_features() { |
aoqi@9644 | 263 | |
aoqi@9644 | 264 | clean_cpuFeatures(); |
aoqi@9644 | 265 | |
aoqi@9644 | 266 | // test if cpucfg instruction is supported |
aoqi@9644 | 267 | VM_Version::_is_determine_cpucfg_supported_running = true; |
aoqi@9644 | 268 | __asm__ __volatile__( |
aoqi@9644 | 269 | ".insn \n\t" |
aoqi@9644 | 270 | ".word (0xc8080118)\n\t" // cpucfg zero, zero |
aoqi@9644 | 271 | : |
aoqi@9644 | 272 | : |
aoqi@9644 | 273 | : |
aoqi@9644 | 274 | ); |
aoqi@9644 | 275 | VM_Version::_is_determine_cpucfg_supported_running = false; |
aoqi@9644 | 276 | |
aoqi@9644 | 277 | if (supports_cpucfg()) { |
aoqi@9644 | 278 | get_cpu_info_stub(&_cpuid_info); |
aoqi@9644 | 279 | _cpuFeatures = get_feature_flags_by_cpucfg(); |
aoqi@9644 | 280 | // Only Loongson CPUs support cpucfg |
aoqi@9644 | 281 | _cpuFeatures |= CPU_LOONGSON; |
aoqi@9644 | 282 | } else { |
aoqi@9644 | 283 | _cpuFeatures = get_feature_flags_by_cpuinfo(0); |
aoqi@9644 | 284 | } |
aoqi@9644 | 285 | |
fujie@254 | 286 | _supports_cx8 = true; |
chenhaoxuan@358 | 287 | |
fujie@8014 | 288 | if (UseG1GC && FLAG_IS_DEFAULT(MaxGCPauseMillis)) { |
fujie@8014 | 289 | FLAG_SET_CMDLINE(uintx, MaxGCPauseMillis, 650); |
fujie@8014 | 290 | } |
fujie@8014 | 291 | |
aoqi@203 | 292 | #ifdef COMPILER2 |
aoqi@209 | 293 | if (MaxVectorSize > 0) { |
aoqi@209 | 294 | if (!is_power_of_2(MaxVectorSize)) { |
aoqi@209 | 295 | warning("MaxVectorSize must be a power of 2"); |
aoqi@209 | 296 | MaxVectorSize = 8; |
aoqi@209 | 297 | } |
aoqi@209 | 298 | if (MaxVectorSize > 0 && supports_ps()) { |
aoqi@209 | 299 | MaxVectorSize = 8; |
aoqi@9644 | 300 | } else { |
aoqi@9644 | 301 | MaxVectorSize = 0; |
aoqi@209 | 302 | } |
aoqi@209 | 303 | } |
aoqi@9459 | 304 | // |
aoqi@9459 | 305 | // Vector optimization of MIPS works in most cases, but cannot pass hotspot/test/compiler/6340864/TestFloatVect.java. |
aoqi@9459 | 306 | // Vector optimization was closed by default. |
aoqi@9459 | 307 | // The reasons: |
aoqi@9459 | 308 | // 1. The kernel does not have emulation of PS instructions yet, so the emulation of PS instructions must be done in JVM, see JVM_handle_linux_signal. |
aoqi@9459 | 309 | // 2. It seems the gcc4.4.7 had some bug related to ucontext_t, which is used in signal handler to emulate PS instructions. |
aoqi@9459 | 310 | // |
aoqi@409 | 311 | if (FLAG_IS_DEFAULT(MaxVectorSize)) { |
aoqi@409 | 312 | MaxVectorSize = 0; |
aoqi@409 | 313 | } |
chenhaoxuan@358 | 314 | |
aoqi@9644 | 315 | #endif |
aoqi@9644 | 316 | |
aoqi@9644 | 317 | if (needs_llsync() && needs_tgtsync() && !needs_ulsync()) { |
aoqi@9644 | 318 | if (FLAG_IS_DEFAULT(UseSyncLevel)) { |
aoqi@9644 | 319 | FLAG_SET_DEFAULT(UseSyncLevel, 1000); |
aoqi@9644 | 320 | } |
aoqi@9644 | 321 | } else if (!needs_llsync() && needs_tgtsync() && needs_ulsync()) { |
aoqi@9644 | 322 | if (FLAG_IS_DEFAULT(UseSyncLevel)) { |
aoqi@9644 | 323 | FLAG_SET_DEFAULT(UseSyncLevel, 2000); |
aoqi@9644 | 324 | } |
aoqi@9644 | 325 | } else if (needs_llsync() && needs_llsync() && needs_ulsync()) { |
aoqi@9644 | 326 | if (FLAG_IS_DEFAULT(UseSyncLevel)) { |
aoqi@9644 | 327 | FLAG_SET_DEFAULT(UseSyncLevel, 3000); |
aoqi@9644 | 328 | } |
aoqi@9644 | 329 | } else if (!needs_llsync() && !needs_llsync() && !needs_ulsync()) { |
aoqi@9644 | 330 | if (FLAG_IS_DEFAULT(UseSyncLevel)) { |
aoqi@9644 | 331 | FLAG_SET_DEFAULT(UseSyncLevel, 0); |
aoqi@9644 | 332 | } |
aoqi@9644 | 333 | } else { |
aoqi@9644 | 334 | assert(false, "Should Not Reach Here, what is the cpu type?"); |
aoqi@9644 | 335 | } |
aoqi@9644 | 336 | |
aoqi@9644 | 337 | if (supports_lext1()) { |
aoqi@9644 | 338 | if (FLAG_IS_DEFAULT(UseLEXT1)) { |
aoqi@9644 | 339 | FLAG_SET_DEFAULT(UseLEXT1, true); |
aoqi@9644 | 340 | } |
aoqi@9644 | 341 | } else if (UseLEXT1) { |
aoqi@9644 | 342 | warning("LEXT1 instructions are not available on this CPU"); |
aoqi@9644 | 343 | FLAG_SET_DEFAULT(UseLEXT1, false); |
aoqi@9644 | 344 | } |
aoqi@9644 | 345 | |
aoqi@9644 | 346 | if (supports_lext2()) { |
aoqi@9644 | 347 | if (FLAG_IS_DEFAULT(UseLEXT2)) { |
aoqi@9644 | 348 | FLAG_SET_DEFAULT(UseLEXT2, true); |
aoqi@9644 | 349 | } |
aoqi@9644 | 350 | } else if (UseLEXT2) { |
aoqi@9644 | 351 | warning("LEXT2 instructions are not available on this CPU"); |
aoqi@9644 | 352 | FLAG_SET_DEFAULT(UseLEXT2, false); |
aoqi@9644 | 353 | } |
aoqi@9644 | 354 | |
aoqi@9644 | 355 | if (supports_lext3()) { |
aoqi@9644 | 356 | if (FLAG_IS_DEFAULT(UseLEXT3)) { |
aoqi@9644 | 357 | FLAG_SET_DEFAULT(UseLEXT3, true); |
aoqi@9644 | 358 | } |
aoqi@9644 | 359 | } else if (UseLEXT3) { |
aoqi@9644 | 360 | warning("LEXT3 instructions are not available on this CPU"); |
aoqi@9644 | 361 | FLAG_SET_DEFAULT(UseLEXT3, false); |
aoqi@9644 | 362 | } |
aoqi@9644 | 363 | |
aoqi@9644 | 364 | if (UseLEXT2) { |
huangxuguang@9155 | 365 | if (FLAG_IS_DEFAULT(UseCountTrailingZerosInstructionMIPS64)) { |
huangxuguang@9155 | 366 | FLAG_SET_DEFAULT(UseCountTrailingZerosInstructionMIPS64, 1); |
chenhaoxuan@358 | 367 | } |
huangxuguang@9155 | 368 | } else if (UseCountTrailingZerosInstructionMIPS64) { |
huangxuguang@9155 | 369 | if (!FLAG_IS_DEFAULT(UseCountTrailingZerosInstructionMIPS64)) |
aoqi@9644 | 370 | warning("ctz/dctz instructions are not available on this CPU"); |
huangxuguang@9155 | 371 | FLAG_SET_DEFAULT(UseCountTrailingZerosInstructionMIPS64, 0); |
chenhaoxuan@358 | 372 | } |
aoqi@8019 | 373 | |
aoqi@392 | 374 | if (TieredCompilation) { |
aoqi@392 | 375 | if (!FLAG_IS_DEFAULT(TieredCompilation)) |
aoqi@392 | 376 | warning("TieredCompilation not supported"); |
aoqi@392 | 377 | FLAG_SET_DEFAULT(TieredCompilation, false); |
aoqi@392 | 378 | } |
aoqi@392 | 379 | |
chenhaoxuan@358 | 380 | char buf[256]; |
aoqi@9644 | 381 | bool is_unknown_loongson_cpu = is_loongson() && !is_gs464() && !is_gs464e() && !is_gs264() && !supports_cpucfg(); |
aoqi@9644 | 382 | |
aoqi@9644 | 383 | jio_snprintf(buf, sizeof(buf), "%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s, UseSyncLevel:%d", |
aoqi@9644 | 384 | (is_loongson() ? "MIPS-compatible Loongson CPU" : "MIPS CPU"), |
aoqi@9644 | 385 | (is_gs464() ? ", GS464 (3A1000/3B1500)" : ""), |
aoqi@9644 | 386 | (is_gs464e() ? ", GS464E (3A2000/3A3000/3B2000/3B3000)" : ""), |
aoqi@9644 | 387 | (is_gs264() ? ", GS264 (2K1000)" : ""), |
aoqi@9578 | 388 | (is_unknown_loongson_cpu ? ", Unknown Loongson CPU" : ""), |
aoqi@9644 | 389 | (supports_dsp() ? ", dsp" : ""), |
aoqi@9644 | 390 | (supports_ps() ? ", ps" : ""), |
aoqi@9644 | 391 | (supports_3d() ? ", 3d" : ""), |
aoqi@9644 | 392 | (supports_mmi() ? ", mmi" : ""), |
aoqi@9644 | 393 | (supports_msa1_0() ? ", msa1_0" : ""), |
aoqi@9644 | 394 | (supports_msa2_0() ? ", msa2_0" : ""), |
aoqi@9644 | 395 | (supports_lsx1() ? ", lsx1" : ""), |
aoqi@9644 | 396 | (supports_lsx2() ? ", lsx2" : ""), |
aoqi@9644 | 397 | (supports_lasx() ? ", lasx" : ""), |
aoqi@9644 | 398 | (supports_lext1() ? ", lext1" : ""), |
aoqi@9644 | 399 | (supports_lext2() ? ", lext2" : ""), |
aoqi@9644 | 400 | (supports_lext3() ? ", lext3" : ""), |
aoqi@9644 | 401 | (supports_cgp() ? ", aes, crc, sha1, sha256, sha512" : ""), |
aoqi@9644 | 402 | (supports_lamo() ? ", lamo" : ""), |
aoqi@9644 | 403 | (supports_lpixu() ? ", lpixu" : ""), |
aoqi@9644 | 404 | (needs_llsync() ? ", llsync" : ""), |
aoqi@9644 | 405 | (needs_tgtsync() ? ", tgtsync": ""), |
aoqi@9644 | 406 | (needs_ulsync() ? ", ulsync": ""), |
aoqi@9644 | 407 | (supports_mualp() ? ", mualp" : ""), |
aoqi@9578 | 408 | UseSyncLevel); |
aoqi@9644 | 409 | _features_str = strdup(buf); |
chenhaoxuan@358 | 410 | |
fujie@254 | 411 | if (FLAG_IS_DEFAULT(AllocatePrefetchStyle)) { |
fujie@254 | 412 | FLAG_SET_DEFAULT(AllocatePrefetchStyle, 1); |
fujie@254 | 413 | } |
fujie@254 | 414 | |
fujie@254 | 415 | if (FLAG_IS_DEFAULT(AllocatePrefetchLines)) { |
fujie@254 | 416 | FLAG_SET_DEFAULT(AllocatePrefetchLines, 1); |
fujie@254 | 417 | } |
fujie@254 | 418 | |
fujie@254 | 419 | if (FLAG_IS_DEFAULT(AllocatePrefetchStepSize)) { |
fujie@254 | 420 | FLAG_SET_DEFAULT(AllocatePrefetchStepSize, 64); |
fujie@254 | 421 | } |
chenhaoxuan@358 | 422 | |
fujie@254 | 423 | if (FLAG_IS_DEFAULT(AllocatePrefetchDistance)) { |
fujie@254 | 424 | FLAG_SET_DEFAULT(AllocatePrefetchDistance, 64); |
fujie@254 | 425 | } |
fujie@254 | 426 | |
fujie@254 | 427 | if (FLAG_IS_DEFAULT(AllocateInstancePrefetchLines)) { |
fujie@254 | 428 | FLAG_SET_DEFAULT(AllocateInstancePrefetchLines, 1); |
fujie@254 | 429 | } |
fujie@254 | 430 | |
huangxuguang@9150 | 431 | if (UseSHA) { |
huangxuguang@9150 | 432 | warning("SHA instructions are not available on this CPU"); |
huangxuguang@9150 | 433 | FLAG_SET_DEFAULT(UseSHA, false); |
huangxuguang@9150 | 434 | } |
huangxuguang@9150 | 435 | |
huangxuguang@9150 | 436 | if (UseSHA1Intrinsics || UseSHA256Intrinsics || UseSHA512Intrinsics) { |
huangxuguang@9150 | 437 | warning("SHA intrinsics are not available on this CPU"); |
huangxuguang@9150 | 438 | FLAG_SET_DEFAULT(UseSHA1Intrinsics, false); |
huangxuguang@9150 | 439 | FLAG_SET_DEFAULT(UseSHA256Intrinsics, false); |
huangxuguang@9150 | 440 | FLAG_SET_DEFAULT(UseSHA512Intrinsics, false); |
huangxuguang@9150 | 441 | } |
huangxuguang@9150 | 442 | |
aoqi@9644 | 443 | if (UseAES) { |
aoqi@9644 | 444 | if (!FLAG_IS_DEFAULT(UseAES)) { |
aoqi@9644 | 445 | warning("AES instructions are not available on this CPU"); |
aoqi@9644 | 446 | FLAG_SET_DEFAULT(UseAES, false); |
aoqi@9644 | 447 | } |
aoqi@9644 | 448 | } |
aoqi@9644 | 449 | |
aoqi@9644 | 450 | if (UseCRC32Intrinsics) { |
aoqi@9644 | 451 | if (!FLAG_IS_DEFAULT(UseCRC32Intrinsics)) { |
aoqi@9644 | 452 | warning("CRC32Intrinsics instructions are not available on this CPU"); |
aoqi@9644 | 453 | FLAG_SET_DEFAULT(UseCRC32Intrinsics, false); |
aoqi@9644 | 454 | } |
aoqi@9644 | 455 | } |
aoqi@9644 | 456 | |
aoqi@9644 | 457 | if (UseAESIntrinsics) { |
aoqi@9644 | 458 | if (!FLAG_IS_DEFAULT(UseAESIntrinsics)) { |
aoqi@9644 | 459 | warning("AES intrinsics are not available on this CPU"); |
aoqi@9644 | 460 | FLAG_SET_DEFAULT(UseAESIntrinsics, false); |
aoqi@9644 | 461 | } |
aoqi@9644 | 462 | } |
aoqi@9644 | 463 | |
wanghaomin@9639 | 464 | if (FLAG_IS_DEFAULT(UseMontgomeryMultiplyIntrinsic)) { |
wanghaomin@9639 | 465 | UseMontgomeryMultiplyIntrinsic = true; |
wanghaomin@9639 | 466 | } |
wanghaomin@9639 | 467 | if (FLAG_IS_DEFAULT(UseMontgomerySquareIntrinsic)) { |
wanghaomin@9639 | 468 | UseMontgomerySquareIntrinsic = true; |
wanghaomin@9639 | 469 | } |
wanghaomin@9639 | 470 | |
aoqi@1 | 471 | } |
aoqi@1 | 472 | |
aoqi@9644 | 473 | void VM_Version::initialize() { |
aoqi@9644 | 474 | ResourceMark rm; |
aoqi@9644 | 475 | // Making this stub must be FIRST use of assembler |
aoqi@9644 | 476 | |
aoqi@9644 | 477 | stub_blob = BufferBlob::create("get_cpu_info_stub", stub_size); |
aoqi@9644 | 478 | if (stub_blob == NULL) { |
aoqi@9644 | 479 | vm_exit_during_initialization("Unable to allocate get_cpu_info_stub"); |
aoqi@9644 | 480 | } |
aoqi@9644 | 481 | CodeBuffer c(stub_blob); |
aoqi@9644 | 482 | VM_Version_StubGenerator g(&c); |
aoqi@9644 | 483 | get_cpu_info_stub = CAST_TO_FN_PTR(get_cpu_info_stub_t, |
aoqi@9644 | 484 | g.generate_get_cpu_info()); |
aoqi@9644 | 485 | |
aoqi@9644 | 486 | get_processor_features(); |
aoqi@1 | 487 | } |