Mercurial > hg > graal-compiler
comparison src/share/vm/compiler/compilerOracle.cpp @ 6275:957c266d8bc5
Merge with http://hg.openjdk.java.net/hsx/hsx24/hotspot/
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Tue, 21 Aug 2012 10:39:19 +0200 |
parents | 716a2c5c0656 90d5a592ea8f |
children | e522a00b91aa |
comparison
equal
deleted
inserted
replaced
5891:fd8832ae511d | 6275:957c266d8bc5 |
---|---|
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. |
32 #include "oops/oop.inline.hpp" | 32 #include "oops/oop.inline.hpp" |
33 #include "oops/symbol.hpp" | 33 #include "oops/symbol.hpp" |
34 #include "runtime/handles.inline.hpp" | 34 #include "runtime/handles.inline.hpp" |
35 #include "runtime/jniHandles.hpp" | 35 #include "runtime/jniHandles.hpp" |
36 | 36 |
37 class MethodMatcher : public CHeapObj { | 37 class MethodMatcher : public CHeapObj<mtCompiler> { |
38 public: | 38 public: |
39 enum Mode { | 39 enum Mode { |
40 Exact, | 40 Exact, |
41 Prefix = 1, | 41 Prefix = 1, |
42 Suffix = 2, | 42 Suffix = 2, |
548 tty->print_cr(error_msg); | 548 tty->print_cr(error_msg); |
549 } | 549 } |
550 } | 550 } |
551 } | 551 } |
552 | 552 |
553 static const char* default_cc_file = ".hotspot_compiler"; | |
554 | |
553 static const char* cc_file() { | 555 static const char* cc_file() { |
556 #ifdef ASSERT | |
554 if (CompileCommandFile == NULL) | 557 if (CompileCommandFile == NULL) |
555 return ".hotspot_compiler"; | 558 return default_cc_file; |
559 #endif | |
556 return CompileCommandFile; | 560 return CompileCommandFile; |
557 } | 561 } |
562 | |
563 bool CompilerOracle::has_command_file() { | |
564 return cc_file() != NULL; | |
565 } | |
566 | |
558 bool CompilerOracle::_quiet = false; | 567 bool CompilerOracle::_quiet = false; |
559 | 568 |
560 void CompilerOracle::parse_from_file() { | 569 void CompilerOracle::parse_from_file() { |
570 assert(has_command_file(), "command file must be specified"); | |
561 FILE* stream = fopen(cc_file(), "rt"); | 571 FILE* stream = fopen(cc_file(), "rt"); |
562 if (stream == NULL) return; | 572 if (stream == NULL) return; |
563 | 573 |
564 char token[1024]; | 574 char token[1024]; |
565 int pos = 0; | 575 int pos = 0; |
598 token[pos++] = '\0'; | 608 token[pos++] = '\0'; |
599 parse_line(token); | 609 parse_line(token); |
600 } | 610 } |
601 | 611 |
602 void CompilerOracle::append_comment_to_file(const char* message) { | 612 void CompilerOracle::append_comment_to_file(const char* message) { |
613 assert(has_command_file(), "command file must be specified"); | |
603 fileStream stream(fopen(cc_file(), "at")); | 614 fileStream stream(fopen(cc_file(), "at")); |
604 stream.print("# "); | 615 stream.print("# "); |
605 for (int index = 0; message[index] != '\0'; index++) { | 616 for (int index = 0; message[index] != '\0'; index++) { |
606 stream.put(message[index]); | 617 stream.put(message[index]); |
607 if (message[index] == '\n') stream.print("# "); | 618 if (message[index] == '\n') stream.print("# "); |
608 } | 619 } |
609 stream.cr(); | 620 stream.cr(); |
610 } | 621 } |
611 | 622 |
612 void CompilerOracle::append_exclude_to_file(methodHandle method) { | 623 void CompilerOracle::append_exclude_to_file(methodHandle method) { |
624 assert(has_command_file(), "command file must be specified"); | |
613 fileStream stream(fopen(cc_file(), "at")); | 625 fileStream stream(fopen(cc_file(), "at")); |
614 stream.print("exclude "); | 626 stream.print("exclude "); |
615 Klass::cast(method->method_holder())->name()->print_symbol_on(&stream); | 627 Klass::cast(method->method_holder())->name()->print_symbol_on(&stream); |
616 stream.print("."); | 628 stream.print("."); |
617 method->name()->print_symbol_on(&stream); | 629 method->name()->print_symbol_on(&stream); |
622 | 634 |
623 | 635 |
624 void compilerOracle_init() { | 636 void compilerOracle_init() { |
625 CompilerOracle::parse_from_string(CompileCommand, CompilerOracle::parse_from_line); | 637 CompilerOracle::parse_from_string(CompileCommand, CompilerOracle::parse_from_line); |
626 CompilerOracle::parse_from_string(CompileOnly, CompilerOracle::parse_compile_only); | 638 CompilerOracle::parse_from_string(CompileOnly, CompilerOracle::parse_compile_only); |
627 CompilerOracle::parse_from_file(); | 639 if (CompilerOracle::has_command_file()) { |
640 CompilerOracle::parse_from_file(); | |
641 } else { | |
642 struct stat buf; | |
643 if (os::stat(default_cc_file, &buf) == 0) { | |
644 warning("%s file is present but has been ignored. " | |
645 "Run with -XX:CompileCommandFile=%s to load the file.", | |
646 default_cc_file, default_cc_file); | |
647 } | |
648 } | |
628 if (lists[PrintCommand] != NULL) { | 649 if (lists[PrintCommand] != NULL) { |
629 if (PrintAssembly) { | 650 if (PrintAssembly) { |
630 warning("CompileCommand and/or .hotspot_compiler file contains 'print' commands, but PrintAssembly is also enabled"); | 651 warning("CompileCommand and/or %s file contains 'print' commands, but PrintAssembly is also enabled", default_cc_file); |
631 } else if (FLAG_IS_DEFAULT(DebugNonSafepoints)) { | 652 } else if (FLAG_IS_DEFAULT(DebugNonSafepoints)) { |
632 warning("printing of assembly code is enabled; turning on DebugNonSafepoints to gain additional output"); | 653 warning("printing of assembly code is enabled; turning on DebugNonSafepoints to gain additional output"); |
633 DebugNonSafepoints = true; | 654 DebugNonSafepoints = true; |
634 } | 655 } |
635 } | 656 } |