comparison src/share/vm/compiler/compilerOracle.cpp @ 6150:1e76463170b3

7110720: Issue with vm config file loadingIssue with vm config file loading Summary: disabling default config files if -XX:-ReadDefaultConfigFiles Reviewed-by: phh, jrose, dcubed, dholmes
author kamg
date Thu, 29 Mar 2012 18:55:32 -0400
parents 1d1603768966
children 3759236eea14 24b9c7f4cae6 bf14ed159fb0
comparison
equal deleted inserted replaced
4813:e850d8e7ea54 6150:1e76463170b3
1 /* 1 /*
2 * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 1998, 2012, 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.
549 } 549 }
550 } 550 }
551 } 551 }
552 552
553 static const char* cc_file() { 553 static const char* cc_file() {
554 #ifdef ASSERT
554 if (CompileCommandFile == NULL) 555 if (CompileCommandFile == NULL)
555 return ".hotspot_compiler"; 556 return ".hotspot_compiler";
557 #endif
556 return CompileCommandFile; 558 return CompileCommandFile;
557 } 559 }
560
561 bool CompilerOracle::has_command_file() {
562 return cc_file() != NULL;
563 }
564
558 bool CompilerOracle::_quiet = false; 565 bool CompilerOracle::_quiet = false;
559 566
560 void CompilerOracle::parse_from_file() { 567 void CompilerOracle::parse_from_file() {
568 assert(has_command_file(), "command file must be specified");
561 FILE* stream = fopen(cc_file(), "rt"); 569 FILE* stream = fopen(cc_file(), "rt");
562 if (stream == NULL) return; 570 if (stream == NULL) return;
563 571
564 char token[1024]; 572 char token[1024];
565 int pos = 0; 573 int pos = 0;
598 token[pos++] = '\0'; 606 token[pos++] = '\0';
599 parse_line(token); 607 parse_line(token);
600 } 608 }
601 609
602 void CompilerOracle::append_comment_to_file(const char* message) { 610 void CompilerOracle::append_comment_to_file(const char* message) {
611 assert(has_command_file(), "command file must be specified");
603 fileStream stream(fopen(cc_file(), "at")); 612 fileStream stream(fopen(cc_file(), "at"));
604 stream.print("# "); 613 stream.print("# ");
605 for (int index = 0; message[index] != '\0'; index++) { 614 for (int index = 0; message[index] != '\0'; index++) {
606 stream.put(message[index]); 615 stream.put(message[index]);
607 if (message[index] == '\n') stream.print("# "); 616 if (message[index] == '\n') stream.print("# ");
608 } 617 }
609 stream.cr(); 618 stream.cr();
610 } 619 }
611 620
612 void CompilerOracle::append_exclude_to_file(methodHandle method) { 621 void CompilerOracle::append_exclude_to_file(methodHandle method) {
622 assert(has_command_file(), "command file must be specified");
613 fileStream stream(fopen(cc_file(), "at")); 623 fileStream stream(fopen(cc_file(), "at"));
614 stream.print("exclude "); 624 stream.print("exclude ");
615 Klass::cast(method->method_holder())->name()->print_symbol_on(&stream); 625 Klass::cast(method->method_holder())->name()->print_symbol_on(&stream);
616 stream.print("."); 626 stream.print(".");
617 method->name()->print_symbol_on(&stream); 627 method->name()->print_symbol_on(&stream);
622 632
623 633
624 void compilerOracle_init() { 634 void compilerOracle_init() {
625 CompilerOracle::parse_from_string(CompileCommand, CompilerOracle::parse_from_line); 635 CompilerOracle::parse_from_string(CompileCommand, CompilerOracle::parse_from_line);
626 CompilerOracle::parse_from_string(CompileOnly, CompilerOracle::parse_compile_only); 636 CompilerOracle::parse_from_string(CompileOnly, CompilerOracle::parse_compile_only);
627 CompilerOracle::parse_from_file(); 637 if (CompilerOracle::has_command_file()) {
638 CompilerOracle::parse_from_file();
639 }
628 if (lists[PrintCommand] != NULL) { 640 if (lists[PrintCommand] != NULL) {
629 if (PrintAssembly) { 641 if (PrintAssembly) {
630 warning("CompileCommand and/or .hotspot_compiler file contains 'print' commands, but PrintAssembly is also enabled"); 642 warning("CompileCommand and/or .hotspot_compiler file contains 'print' commands, but PrintAssembly is also enabled");
631 } else if (FLAG_IS_DEFAULT(DebugNonSafepoints)) { 643 } else if (FLAG_IS_DEFAULT(DebugNonSafepoints)) {
632 warning("printing of assembly code is enabled; turning on DebugNonSafepoints to gain additional output"); 644 warning("printing of assembly code is enabled; turning on DebugNonSafepoints to gain additional output");