src/cpu/mips/vm/vm_version_mips.cpp

Wed, 29 Mar 2017 09:41:51 +0800

author
aoqi
date
Wed, 29 Mar 2017 09:41:51 +0800
changeset 392
4bfb40d1e17a
parent 358
abbcdc1adadb
child 393
671cd2b861b4
permissions
-rw-r--r--

#4662 TieredCompilation is turned off.
TieredCompilation is not supported yet.

     1 /*
     2  * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
     3  * Copyright (c) 2015, 2016, Loongson Technology. All rights reserved.
     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  */
    26 #include "precompiled.hpp"
    27 #include "asm/macroAssembler.hpp"
    28 #include "asm/macroAssembler.inline.hpp"
    29 #include "memory/resourceArea.hpp"
    30 #include "runtime/java.hpp"
    31 #include "runtime/stubCodeGenerator.hpp"
    32 #include "vm_version_mips.hpp"
    33 #ifdef TARGET_OS_FAMILY_linux
    34 # include "os_linux.inline.hpp"
    35 #endif
    36 #ifdef TARGET_OS_FAMILY_solaris
    37 # include "os_solaris.inline.hpp"
    38 #endif
    39 #ifdef TARGET_OS_FAMILY_windows
    40 # include "os_windows.inline.hpp"
    41 #endif
    42 #ifdef TARGET_OS_FAMILY_bsd
    43 # include "os_bsd.inline.hpp"
    44 #endif
    45 /*
    46 int VM_Version::_cpu;
    47 int VM_Version::_model;
    48 int VM_Version::_stepping;
    49 int VM_Version::_cpuFeatures;
    50 const char*           VM_Version::_features_str = "";
    51 VM_Version::CpuidInfo VM_Version::_cpuid_info   = { 0, };
    53 static BufferBlob* stub_blob;
    54 static const int stub_size = 300;
    56 extern "C" {
    57   typedef void (*getPsrInfo_stub_t)(void*);
    58 }
    59 static getPsrInfo_stub_t getPsrInfo_stub = NULL;
    60 */
    61 int VM_Version::_features = VM_Version::unknown_m;
    62 const char* VM_Version::_features_str = "";
    63 /*
    64 class VM_Version_StubGenerator: public StubCodeGenerator {
    65  public:
    67   VM_Version_StubGenerator(CodeBuffer *c) : StubCodeGenerator(c) {}
    69   address generate_getPsrInfo() {
    70   };
    71 };
    74 void VM_Version::get_processor_features() {
    75 }
    76 */
    77 void VM_Version::initialize() {
    79   _features = determine_features();
    80   //no need, Abstract_VM_Version already define it as false
    81   _supports_cx8 = true;
    83   //////////////////////add some other feature here//////////////////
    84 #ifdef COMPILER2
    85   if (MaxVectorSize > 0) {
    86     if (!is_power_of_2(MaxVectorSize)) {
    87       warning("MaxVectorSize must be a power of 2");
    88       MaxVectorSize = 8;
    89     }
    90     if (MaxVectorSize > 0 && supports_ps()) {
    91       MaxVectorSize = 8;
    92     }
    93   }
    95   if (is_gs464e()) {
    96     if (FLAG_IS_DEFAULT(UseCountTrailingZerosInstruction)) {
    97       FLAG_SET_DEFAULT(UseCountTrailingZerosInstruction, 1);
    98     }
    99   } else if (UseCountTrailingZerosInstruction) {
   100     if (!FLAG_IS_DEFAULT(UseCountTrailingZerosInstruction))
   101       warning("Only 3A2000/3000 CPUs support UseCountTrailingZerosInstruction");
   102     FLAG_SET_DEFAULT(UseCountTrailingZerosInstruction, 0);
   103   }
   104 #endif
   105   UseSSE = 0; // Only on x86 and x64
   107   if (is_loongson()) {
   108     if (FLAG_IS_DEFAULT(UseLoongsonISA)) {
   109       FLAG_SET_DEFAULT(UseLoongsonISA, 1);
   110     }
   111   } else if (UseLoongsonISA) {
   112     if (!FLAG_IS_DEFAULT(UseLoongsonISA))
   113       warning("Only Loongson CPUs support LoongISA");
   114     FLAG_SET_DEFAULT(UseLoongsonISA, 0);
   115   }
   117   if (is_gs464e()) {
   118     if (FLAG_IS_DEFAULT(Use3A2000)) {
   119       FLAG_SET_DEFAULT(Use3A2000, 1);
   120     }
   121   } else if (Use3A2000) {
   122     if (!FLAG_IS_DEFAULT(Use3A2000))
   123       warning("Only 3A2000/3000 CPUs support this option");
   124     FLAG_SET_DEFAULT(Use3A2000, 0);
   125   }
   127   if (TieredCompilation) {
   128     if (!FLAG_IS_DEFAULT(TieredCompilation))
   129       warning("TieredCompilation not supported");
   130     FLAG_SET_DEFAULT(TieredCompilation, false);
   131   }
   133   char buf[256];
   134   jio_snprintf(buf, sizeof(buf), "%s%s%s%s%s%s%s%s%s",
   135               (has_l2_cache() ? ", has_l2_cache" : ""),
   136               (has_16k_page() ? ", has_16k_page" : ""),
   137               (is_loongson()  ? ", on_loongson"  : ""),
   138               (is_gs464() ? ", 3A1000" : ""),
   139               (is_gs464v() ? ", 3B1500" : "" ),
   140               (is_gs464e() ? ", 3A2000/3A3000" : ""),
   141               (UseLoongsonISA ? ", UseLoongsonISA" : ""),
   142               (UseCountTrailingZerosInstruction ? ", UseCountTrailingZerosInstruction" : ""),
   143               (Use3A2000 ? ", Use3A2000" : ""));
   145   // buf is started with ", " or is empty
   146   _features_str = strdup(strlen(buf) > 2 ? buf + 2 : buf);
   148   if (FLAG_IS_DEFAULT(AllocatePrefetchStyle)) {
   149     FLAG_SET_DEFAULT(AllocatePrefetchStyle, 1);
   150   }
   152   if (FLAG_IS_DEFAULT(AllocatePrefetchLines)) {
   153     FLAG_SET_DEFAULT(AllocatePrefetchLines, 1);
   154   }
   156   if (FLAG_IS_DEFAULT(AllocatePrefetchStepSize)) {
   157     FLAG_SET_DEFAULT(AllocatePrefetchStepSize, 64);
   158   }
   160   if (FLAG_IS_DEFAULT(AllocatePrefetchDistance)) {
   161     FLAG_SET_DEFAULT(AllocatePrefetchDistance, 64);
   162   }
   164   if (FLAG_IS_DEFAULT(AllocateInstancePrefetchLines)) {
   165     FLAG_SET_DEFAULT(AllocateInstancePrefetchLines, 1);
   166   }
   168   NOT_PRODUCT( if (PrintMiscellaneous && Verbose) print_features(); );
   169 }
   171 void VM_Version::print_features() {
   172   tty->print_cr("Version:%s", cpu_features());
   173 }
   175 int VM_Version::determine_features() {
   176   //////////////////////add some other feature here//////////////////
   177   int features = platform_features(unknown_m);
   178   //spt_16k_page_m; 
   179   return features;
   180 }
   182 static int saved_features = 0;
   184 void VM_Version::allow_all() {
   185   saved_features = _features;
   186   _features      = all_features_m;
   187 }
   189 void VM_Version::revert() {
   190   _features = saved_features;
   191 }

mercurial