src/share/vm/compiler/compilerOracle.cpp

changeset 3853
1e76463170b3
parent 2708
1d1603768966
child 3899
3759236eea14
child 3901
24b9c7f4cae6
child 4211
bf14ed159fb0
     1.1 --- a/src/share/vm/compiler/compilerOracle.cpp	Fri Jan 20 16:56:31 2012 -0800
     1.2 +++ b/src/share/vm/compiler/compilerOracle.cpp	Thu Mar 29 18:55:32 2012 -0400
     1.3 @@ -1,5 +1,5 @@
     1.4  /*
     1.5 - * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
     1.6 + * Copyright (c) 1998, 2012, 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 @@ -551,13 +551,21 @@
    1.11  }
    1.12  
    1.13  static const char* cc_file() {
    1.14 +#ifdef ASSERT
    1.15    if (CompileCommandFile == NULL)
    1.16      return ".hotspot_compiler";
    1.17 +#endif
    1.18    return CompileCommandFile;
    1.19  }
    1.20 +
    1.21 +bool CompilerOracle::has_command_file() {
    1.22 +  return cc_file() != NULL;
    1.23 +}
    1.24 +
    1.25  bool CompilerOracle::_quiet = false;
    1.26  
    1.27  void CompilerOracle::parse_from_file() {
    1.28 +  assert(has_command_file(), "command file must be specified");
    1.29    FILE* stream = fopen(cc_file(), "rt");
    1.30    if (stream == NULL) return;
    1.31  
    1.32 @@ -600,6 +608,7 @@
    1.33  }
    1.34  
    1.35  void CompilerOracle::append_comment_to_file(const char* message) {
    1.36 +  assert(has_command_file(), "command file must be specified");
    1.37    fileStream stream(fopen(cc_file(), "at"));
    1.38    stream.print("# ");
    1.39    for (int index = 0; message[index] != '\0'; index++) {
    1.40 @@ -610,6 +619,7 @@
    1.41  }
    1.42  
    1.43  void CompilerOracle::append_exclude_to_file(methodHandle method) {
    1.44 +  assert(has_command_file(), "command file must be specified");
    1.45    fileStream stream(fopen(cc_file(), "at"));
    1.46    stream.print("exclude ");
    1.47    Klass::cast(method->method_holder())->name()->print_symbol_on(&stream);
    1.48 @@ -624,7 +634,9 @@
    1.49  void compilerOracle_init() {
    1.50    CompilerOracle::parse_from_string(CompileCommand, CompilerOracle::parse_from_line);
    1.51    CompilerOracle::parse_from_string(CompileOnly, CompilerOracle::parse_compile_only);
    1.52 -  CompilerOracle::parse_from_file();
    1.53 +  if (CompilerOracle::has_command_file()) {
    1.54 +    CompilerOracle::parse_from_file();
    1.55 +  }
    1.56    if (lists[PrintCommand] != NULL) {
    1.57      if (PrintAssembly) {
    1.58        warning("CompileCommand and/or .hotspot_compiler file contains 'print' commands, but PrintAssembly is also enabled");

mercurial