src/cpu/mips/vm/vm_version_mips.cpp

changeset 358
abbcdc1adadb
parent 254
a280f2ced33e
child 392
4bfb40d1e17a
equal deleted inserted replaced
357:9aa06ad514df 358:abbcdc1adadb
73 73
74 void VM_Version::get_processor_features() { 74 void VM_Version::get_processor_features() {
75 } 75 }
76 */ 76 */
77 void VM_Version::initialize() { 77 void VM_Version::initialize() {
78
78 _features = determine_features(); 79 _features = determine_features();
79 //no need, Abstract_VM_Version already define it as false 80 //no need, Abstract_VM_Version already define it as false
80 _supports_cx8 = true; 81 _supports_cx8 = true;
81 82
82 char buf[256]; 83 //////////////////////add some other feature here//////////////////
83 jio_snprintf(buf, sizeof(buf), "%s, %s"
84 #ifdef OPT_RANGECHECK
85 ", optimized range check"
86 #endif
87 #ifdef OPT_PHI_1
88 ", optimized phi"
89 #endif
90 #ifdef OPT_MERGE
91 ", optimized merge"
92 #endif
93 , (has_l2_cache() ? "has_l2_cache" : ""), (has_16k_page() ? "has_16k_page" : "")
94 );
95 //////////////////////add some other feature here//////////////////
96 #ifdef COMPILER2 84 #ifdef COMPILER2
97 if (MaxVectorSize > 0) { 85 if (MaxVectorSize > 0) {
98 if (!is_power_of_2(MaxVectorSize)) { 86 if (!is_power_of_2(MaxVectorSize)) {
99 warning("MaxVectorSize must be a power of 2"); 87 warning("MaxVectorSize must be a power of 2");
100 MaxVectorSize = 8; 88 MaxVectorSize = 8;
101 } 89 }
102 if (MaxVectorSize > 0 && supports_ps()) { 90 if (MaxVectorSize > 0 && supports_ps()) {
103 MaxVectorSize = 8; 91 MaxVectorSize = 8;
104 } 92 }
105 } 93 }
106 if (UseLoongsonISA) 94
107 UseCountTrailingZerosInstruction = false; // 2017.01.22 Now this guy is only supported on 3A2000/3A3000. 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 }
108 #endif 104 #endif
109 UseSSE = 0; // Only on x86 and x64 105 UseSSE = 0; // Only on x86 and x64
106
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 }
116
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 }
126
127 char buf[256];
128 jio_snprintf(buf, sizeof(buf), "%s%s%s%s%s%s%s%s%s",
129 (has_l2_cache() ? ", has_l2_cache" : ""),
130 (has_16k_page() ? ", has_16k_page" : ""),
131 (is_loongson() ? ", on_loongson" : ""),
132 (is_gs464() ? ", 3A1000" : ""),
133 (is_gs464v() ? ", 3B1500" : "" ),
134 (is_gs464e() ? ", 3A2000/3A3000" : ""),
135 (UseLoongsonISA ? ", UseLoongsonISA" : ""),
136 (UseCountTrailingZerosInstruction ? ", UseCountTrailingZerosInstruction" : ""),
137 (Use3A2000 ? ", Use3A2000" : ""));
138
139 // buf is started with ", " or is empty
140 _features_str = strdup(strlen(buf) > 2 ? buf + 2 : buf);
110 141
111 if (FLAG_IS_DEFAULT(AllocatePrefetchStyle)) { 142 if (FLAG_IS_DEFAULT(AllocatePrefetchStyle)) {
112 FLAG_SET_DEFAULT(AllocatePrefetchStyle, 1); 143 FLAG_SET_DEFAULT(AllocatePrefetchStyle, 1);
113 } 144 }
114 145
117 } 148 }
118 149
119 if (FLAG_IS_DEFAULT(AllocatePrefetchStepSize)) { 150 if (FLAG_IS_DEFAULT(AllocatePrefetchStepSize)) {
120 FLAG_SET_DEFAULT(AllocatePrefetchStepSize, 64); 151 FLAG_SET_DEFAULT(AllocatePrefetchStepSize, 64);
121 } 152 }
122 153
123 if (FLAG_IS_DEFAULT(AllocatePrefetchDistance)) { 154 if (FLAG_IS_DEFAULT(AllocatePrefetchDistance)) {
124 FLAG_SET_DEFAULT(AllocatePrefetchDistance, 64); 155 FLAG_SET_DEFAULT(AllocatePrefetchDistance, 64);
125 } 156 }
126 157
127 if (FLAG_IS_DEFAULT(AllocateInstancePrefetchLines)) { 158 if (FLAG_IS_DEFAULT(AllocateInstancePrefetchLines)) {
128 FLAG_SET_DEFAULT(AllocateInstancePrefetchLines, 1); 159 FLAG_SET_DEFAULT(AllocateInstancePrefetchLines, 1);
129 } 160 }
130 161
131 // buf is started with ", " or is empty
132 _features_str = strdup(buf);
133 NOT_PRODUCT( if (PrintMiscellaneous && Verbose) print_features(); ); 162 NOT_PRODUCT( if (PrintMiscellaneous && Verbose) print_features(); );
134 } 163 }
135 164
136 void VM_Version::print_features() { 165 void VM_Version::print_features() {
137 tty->print_cr("Version:%s", cpu_features()); 166 tty->print_cr("Version:%s", cpu_features());
138 } 167 }
139 168
140 int VM_Version::determine_features() { 169 int VM_Version::determine_features() {
141 //////////////////////add some other feature here////////////////// 170 //////////////////////add some other feature here//////////////////
142 return spt_16k_page_m; 171 int features = platform_features(unknown_m);
172 //spt_16k_page_m;
173 return features;
143 } 174 }
144 175
145 static int saved_features = 0; 176 static int saved_features = 0;
146 177
147 void VM_Version::allow_all() { 178 void VM_Version::allow_all() {
148 saved_features = _features; 179 saved_features = _features;
149 _features = all_features_m; 180 _features = all_features_m;
150 } 181 }
151 182
152 void VM_Version::revert() { 183 void VM_Version::revert() {
153 _features = saved_features; 184 _features = saved_features;
154 } 185 }

mercurial