7014998: assert(is_T_family(features) == is_niagara(features)) failed: Niagara should be T series

Tue, 01 Feb 2011 10:27:02 -0800

author
kvn
date
Tue, 01 Feb 2011 10:27:02 -0800
changeset 2554
c52cba2a3359
parent 2553
fbf3184da15d
child 2555
194c9fdee631

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

src/os_cpu/solaris_sparc/vm/vm_version_solaris_sparc.cpp file | annotate | diff | comparison | revisions
     1.1 --- a/src/os_cpu/solaris_sparc/vm/vm_version_solaris_sparc.cpp	Tue Feb 01 05:51:24 2011 -0800
     1.2 +++ b/src/os_cpu/solaris_sparc/vm/vm_version_solaris_sparc.cpp	Tue Feb 01 10:27:02 2011 -0800
     1.3 @@ -1,5 +1,5 @@
     1.4  /*
     1.5 - * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
     1.6 + * Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
     1.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.8   *
     1.9   * This code is free software; you can redistribute it and/or modify it
    1.10 @@ -189,14 +189,22 @@
    1.11                tty->print_cr("cpu_info.implementation: %s", implementation);
    1.12              }
    1.13  #endif
    1.14 -            if (strncmp(implementation, "SPARC64", 7) == 0) {
    1.15 +            // Convert to UPPER case before compare.
    1.16 +            char* impl = strdup(implementation);
    1.17 +
    1.18 +            for (int i = 0; impl[i] != 0; i++)
    1.19 +              impl[i] = (char)toupper((uint)impl[i]);
    1.20 +            if (strstr(impl, "SPARC64") != NULL) {
    1.21                features |= sparc64_family_m;
    1.22 -            } else if (strncmp(implementation, "UltraSPARC-T", 12) == 0) {
    1.23 +            } else if (strstr(impl, "SPARC-T") != NULL) {
    1.24                features |= T_family_m;
    1.25 -              if (strncmp(implementation, "UltraSPARC-T1", 13) == 0) {
    1.26 +              if (strstr(impl, "SPARC-T1") != NULL) {
    1.27                  features |= T1_model_m;
    1.28                }
    1.29 +            } else {
    1.30 +              assert(strstr(impl, "SPARC") != NULL, "should be sparc");
    1.31              }
    1.32 +            free((void*)impl);
    1.33              break;
    1.34            }
    1.35          } // for(

mercurial