hotspot/src/share/vm/compiler/compilerOracle.cpp
changeset 31615 e48d94b97b6c
parent 30281 b1608535e50f
child 33069 d8eed614f298
equal deleted inserted replaced
31614:f60b185e0bdf 31615:e48d94b97b6c
     1 /*
     1 /*
     2  * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
   576                       char class_name[],  MethodMatcher::Mode* c_mode,
   576                       char class_name[],  MethodMatcher::Mode* c_mode,
   577                       char method_name[], MethodMatcher::Mode* m_mode,
   577                       char method_name[], MethodMatcher::Mode* m_mode,
   578                       int* bytes_read, const char*& error_msg) {
   578                       int* bytes_read, const char*& error_msg) {
   579   *bytes_read = 0;
   579   *bytes_read = 0;
   580   error_msg = NULL;
   580   error_msg = NULL;
   581   if (2 == sscanf(line, "%*[ \t]%255" RANGESLASH "%*[ ]" "%255"  RANGE0 "%n", class_name, method_name, bytes_read)) {
   581   if (2 == sscanf(line, "%*[ \t]%255" RANGESLASH "%*[ ]" "%255" RANGE0 "%n", class_name, method_name, bytes_read)) {
   582     *c_mode = check_mode(class_name, error_msg);
   582     *c_mode = check_mode(class_name, error_msg);
   583     *m_mode = check_mode(method_name, error_msg);
   583     *m_mode = check_mode(method_name, error_msg);
   584     return *c_mode != MethodMatcher::Unknown && *m_mode != MethodMatcher::Unknown;
   584     return *c_mode != MethodMatcher::Unknown && *m_mode != MethodMatcher::Unknown;
   585   }
   585   }
   586   return false;
   586   return false;
   587 }
   587 }
   588 
       
   589 
       
   590 
   588 
   591 // Scan next flag and value in line, return MethodMatcher object on success, NULL on failure.
   589 // Scan next flag and value in line, return MethodMatcher object on success, NULL on failure.
   592 // On failure, error_msg contains description for the first error.
   590 // On failure, error_msg contains description for the first error.
   593 // For future extensions: set error_msg on first error.
   591 // For future extensions: set error_msg on first error.
   594 static MethodMatcher* scan_flag_and_value(const char* type, const char* line, int& total_bytes_read,
   592 static MethodMatcher* scan_flag_and_value(const char* type, const char* line, int& total_bytes_read,
   663           return add_option_string(c_name, c_match, m_name, m_match, signature, flag, false);
   661           return add_option_string(c_name, c_match, m_name, m_match, signature, flag, false);
   664         } else {
   662         } else {
   665           jio_snprintf(errorbuf, buf_size, "  Value cannot be read for flag %s of type %s", flag, type);
   663           jio_snprintf(errorbuf, buf_size, "  Value cannot be read for flag %s of type %s", flag, type);
   666         }
   664         }
   667       } else {
   665       } else {
   668         jio_snprintf(errorbuf, sizeof(errorbuf), "  Value cannot be read for flag %s of type %s", flag, type);
   666         jio_snprintf(errorbuf, buf_size, "  Value cannot be read for flag %s of type %s", flag, type);
   669       }
   667       }
   670     } else if (strcmp(type, "double") == 0) {
   668     } else if (strcmp(type, "double") == 0) {
   671       char buffer[2][256];
   669       char buffer[2][256];
   672       // Decimal separator '.' has been replaced with ' ' or '/' earlier,
   670       // Decimal separator '.' has been replaced with ' ' or '/' earlier,
   673       // so read integer and fraction part of double value separately.
   671       // so read integer and fraction part of double value separately.
   678         return add_option_string(c_name, c_match, m_name, m_match, signature, flag, atof(value));
   676         return add_option_string(c_name, c_match, m_name, m_match, signature, flag, atof(value));
   679       } else {
   677       } else {
   680         jio_snprintf(errorbuf, buf_size, "  Value cannot be read for flag %s of type %s", flag, type);
   678         jio_snprintf(errorbuf, buf_size, "  Value cannot be read for flag %s of type %s", flag, type);
   681       }
   679       }
   682     } else {
   680     } else {
   683       jio_snprintf(errorbuf, sizeof(errorbuf), "  Type %s not supported ", type);
   681       jio_snprintf(errorbuf, buf_size, "  Type %s not supported ", type);
   684     }
   682     }
   685   } else {
   683   } else {
   686     jio_snprintf(errorbuf, sizeof(errorbuf), "  Flag name for type %s should be alphanumeric ", type);
   684     jio_snprintf(errorbuf, buf_size, "  Flag name for type %s should be alphanumeric ", type);
   687   }
   685   }
   688   return NULL;
   686   return NULL;
   689 }
   687 }
   690 
   688 
   691 int skip_whitespace(char* line) {
   689 int skip_whitespace(char* line) {