7014998: assert(is_T_family(features) == is_niagara(features)) failed: Niagara should be T series
authorkvn
Tue, 01 Feb 2011 10:27:02 -0800
changeset 8317 34de38f6de90
parent 8316 0816329cc3ee
child 8318 f23dc75398b2
7014998: assert(is_T_family(features) == is_niagara(features)) failed: Niagara should be T series Summary: Use substring search instead of compare and convert string to upper case before search. Reviewed-by: never, phh, iveresov
hotspot/src/os_cpu/solaris_sparc/vm/vm_version_solaris_sparc.cpp
--- a/hotspot/src/os_cpu/solaris_sparc/vm/vm_version_solaris_sparc.cpp	Tue Feb 01 05:51:24 2011 -0800
+++ b/hotspot/src/os_cpu/solaris_sparc/vm/vm_version_solaris_sparc.cpp	Tue Feb 01 10:27:02 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -189,14 +189,22 @@
               tty->print_cr("cpu_info.implementation: %s", implementation);
             }
 #endif
-            if (strncmp(implementation, "SPARC64", 7) == 0) {
+            // Convert to UPPER case before compare.
+            char* impl = strdup(implementation);
+
+            for (int i = 0; impl[i] != 0; i++)
+              impl[i] = (char)toupper((uint)impl[i]);
+            if (strstr(impl, "SPARC64") != NULL) {
               features |= sparc64_family_m;
-            } else if (strncmp(implementation, "UltraSPARC-T", 12) == 0) {
+            } else if (strstr(impl, "SPARC-T") != NULL) {
               features |= T_family_m;
-              if (strncmp(implementation, "UltraSPARC-T1", 13) == 0) {
+              if (strstr(impl, "SPARC-T1") != NULL) {
                 features |= T1_model_m;
               }
+            } else {
+              assert(strstr(impl, "SPARC") != NULL, "should be sparc");
             }
+            free((void*)impl);
             break;
           }
         } // for(