< prev index next >

src/share/vm/opto/compile.cpp

Print this page




  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "asm/macroAssembler.hpp"
  27 #include "asm/macroAssembler.inline.hpp"
  28 #include "ci/ciReplay.hpp"
  29 #include "classfile/systemDictionary.hpp"
  30 #include "code/exceptionHandlerTable.hpp"
  31 #include "code/nmethod.hpp"
  32 #include "compiler/compileLog.hpp"
  33 #include "compiler/disassembler.hpp"
  34 #include "compiler/oopMap.hpp"

  35 #include "opto/addnode.hpp"
  36 #include "opto/block.hpp"
  37 #include "opto/c2compiler.hpp"
  38 #include "opto/callGenerator.hpp"
  39 #include "opto/callnode.hpp"
  40 #include "opto/cfgnode.hpp"
  41 #include "opto/chaitin.hpp"
  42 #include "opto/compile.hpp"
  43 #include "opto/connode.hpp"
  44 #include "opto/divnode.hpp"
  45 #include "opto/escape.hpp"
  46 #include "opto/idealGraphPrinter.hpp"
  47 #include "opto/loopnode.hpp"
  48 #include "opto/machnode.hpp"
  49 #include "opto/macro.hpp"
  50 #include "opto/matcher.hpp"
  51 #include "opto/mathexactnode.hpp"
  52 #include "opto/memnode.hpp"
  53 #include "opto/mulnode.hpp"
  54 #include "opto/node.hpp"
  55 #include "opto/opcodes.hpp"
  56 #include "opto/output.hpp"
  57 #include "opto/parse.hpp"
  58 #include "opto/phaseX.hpp"
  59 #include "opto/rootnode.hpp"
  60 #include "opto/runtime.hpp"
  61 #include "opto/stringopts.hpp"
  62 #include "opto/type.hpp"
  63 #include "opto/vectornode.hpp"
  64 #include "runtime/arguments.hpp"
  65 #include "runtime/signature.hpp"
  66 #include "runtime/stubRoutines.hpp"
  67 #include "runtime/timer.hpp"
  68 #include "trace/tracing.hpp"
  69 #include "utilities/copy.hpp"
  70 #if defined AD_MD_HPP
  71 # include AD_MD_HPP
  72 #elif defined TARGET_ARCH_MODEL_x86_32
  73 # include "adfiles/ad_x86_32.hpp"
  74 #elif defined TARGET_ARCH_MODEL_x86_64
  75 # include "adfiles/ad_x86_64.hpp"
  76 #elif defined TARGET_ARCH_MODEL_sparc
  77 # include "adfiles/ad_sparc.hpp"
  78 #elif defined TARGET_ARCH_MODEL_zero
  79 # include "adfiles/ad_zero.hpp"
  80 #elif defined TARGET_ARCH_MODEL_ppc_64
  81 # include "adfiles/ad_ppc_64.hpp"
  82 #endif
  83 
  84 
  85 // -------------------- Compile::mach_constant_base_node -----------------------
  86 // Constant table base node singleton.
  87 MachConstantBaseNode* Compile::mach_constant_base_node() {
  88   if (_mach_constant_base_node == NULL) {
  89     _mach_constant_base_node = new (C) MachConstantBaseNode();
  90     _mach_constant_base_node->add_req(C->root());
  91   }
  92   return _mach_constant_base_node;
  93 }
  94 
  95 
  96 /// Support for intrinsics.
  97 
  98 // Return the index at which m must be inserted (or already exists).
  99 // The sort order is by the address of the ciMethod, with is_virtual as minor key.
 100 int Compile::intrinsic_insertion_index(ciMethod* m, bool is_virtual) {
 101 #ifdef ASSERT
 102   for (int i = 1; i < _intrinsics->length(); i++) {
 103     CallGenerator* cg1 = _intrinsics->at(i-1);
 104     CallGenerator* cg2 = _intrinsics->at(i);


3576     }
3577   }
3578 }
3579 
3580 #endif
3581 
3582 // The Compile object keeps track of failure reasons separately from the ciEnv.
3583 // This is required because there is not quite a 1-1 relation between the
3584 // ciEnv and its compilation task and the Compile object.  Note that one
3585 // ciEnv might use two Compile objects, if C2Compiler::compile_method decides
3586 // to backtrack and retry without subsuming loads.  Other than this backtracking
3587 // behavior, the Compile's failure reason is quietly copied up to the ciEnv
3588 // by the logic in C2Compiler.
3589 void Compile::record_failure(const char* reason) {
3590   if (log() != NULL) {
3591     log()->elem("failure reason='%s' phase='compile'", reason);
3592   }
3593   if (_failure_reason == NULL) {
3594     // Record the first failure reason.
3595     _failure_reason = reason;
3596   }
3597 
3598   EventCompilerFailure event;
3599   if (event.should_commit()) {
3600     event.set_compileID(Compile::compile_id());
3601     event.set_failure(reason);
3602     event.commit();
3603   }
3604 
3605   if (!C->failure_reason_is(C2Compiler::retry_no_subsuming_loads())) {
3606     C->print_method(PHASE_FAILURE);
3607   }
3608   _root = NULL;  // flush the graph, too
3609 }
3610 
3611 Compile::TracePhase::TracePhase(const char* name, elapsedTimer* accumulator, bool dolog)
3612   : TraceTime(NULL, accumulator, false NOT_PRODUCT( || TimeCompiler ), false),
3613     _phase_name(name), _dolog(dolog)
3614 {
3615   if (dolog) {
3616     C = Compile::current();
3617     _log = C->log();
3618   } else {
3619     C = NULL;
3620     _log = NULL;
3621   }
3622   if (_log != NULL) {




  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "asm/macroAssembler.hpp"
  27 #include "asm/macroAssembler.inline.hpp"
  28 #include "ci/ciReplay.hpp"
  29 #include "classfile/systemDictionary.hpp"
  30 #include "code/exceptionHandlerTable.hpp"
  31 #include "code/nmethod.hpp"
  32 #include "compiler/compileLog.hpp"
  33 #include "compiler/disassembler.hpp"
  34 #include "compiler/oopMap.hpp"
  35 #include "jfr/jfrEvents.hpp"
  36 #include "opto/addnode.hpp"
  37 #include "opto/block.hpp"
  38 #include "opto/c2compiler.hpp"
  39 #include "opto/callGenerator.hpp"
  40 #include "opto/callnode.hpp"
  41 #include "opto/cfgnode.hpp"
  42 #include "opto/chaitin.hpp"
  43 #include "opto/compile.hpp"
  44 #include "opto/connode.hpp"
  45 #include "opto/divnode.hpp"
  46 #include "opto/escape.hpp"
  47 #include "opto/idealGraphPrinter.hpp"
  48 #include "opto/loopnode.hpp"
  49 #include "opto/machnode.hpp"
  50 #include "opto/macro.hpp"
  51 #include "opto/matcher.hpp"
  52 #include "opto/mathexactnode.hpp"
  53 #include "opto/memnode.hpp"
  54 #include "opto/mulnode.hpp"
  55 #include "opto/node.hpp"
  56 #include "opto/opcodes.hpp"
  57 #include "opto/output.hpp"
  58 #include "opto/parse.hpp"
  59 #include "opto/phaseX.hpp"
  60 #include "opto/rootnode.hpp"
  61 #include "opto/runtime.hpp"
  62 #include "opto/stringopts.hpp"
  63 #include "opto/type.hpp"
  64 #include "opto/vectornode.hpp"
  65 #include "runtime/arguments.hpp"
  66 #include "runtime/signature.hpp"
  67 #include "runtime/stubRoutines.hpp"
  68 #include "runtime/timer.hpp"

  69 #include "utilities/copy.hpp"
  70 #if defined AD_MD_HPP
  71 # include AD_MD_HPP
  72 #elif defined TARGET_ARCH_MODEL_x86_32
  73 # include "adfiles/ad_x86_32.hpp"
  74 #elif defined TARGET_ARCH_MODEL_x86_64
  75 # include "adfiles/ad_x86_64.hpp"
  76 #elif defined TARGET_ARCH_MODEL_sparc
  77 # include "adfiles/ad_sparc.hpp"
  78 #elif defined TARGET_ARCH_MODEL_zero
  79 # include "adfiles/ad_zero.hpp"
  80 #elif defined TARGET_ARCH_MODEL_ppc_64
  81 # include "adfiles/ad_ppc_64.hpp"
  82 #endif
  83 

  84 // -------------------- Compile::mach_constant_base_node -----------------------
  85 // Constant table base node singleton.
  86 MachConstantBaseNode* Compile::mach_constant_base_node() {
  87   if (_mach_constant_base_node == NULL) {
  88     _mach_constant_base_node = new (C) MachConstantBaseNode();
  89     _mach_constant_base_node->add_req(C->root());
  90   }
  91   return _mach_constant_base_node;
  92 }
  93 
  94 
  95 /// Support for intrinsics.
  96 
  97 // Return the index at which m must be inserted (or already exists).
  98 // The sort order is by the address of the ciMethod, with is_virtual as minor key.
  99 int Compile::intrinsic_insertion_index(ciMethod* m, bool is_virtual) {
 100 #ifdef ASSERT
 101   for (int i = 1; i < _intrinsics->length(); i++) {
 102     CallGenerator* cg1 = _intrinsics->at(i-1);
 103     CallGenerator* cg2 = _intrinsics->at(i);


3575     }
3576   }
3577 }
3578 
3579 #endif
3580 
3581 // The Compile object keeps track of failure reasons separately from the ciEnv.
3582 // This is required because there is not quite a 1-1 relation between the
3583 // ciEnv and its compilation task and the Compile object.  Note that one
3584 // ciEnv might use two Compile objects, if C2Compiler::compile_method decides
3585 // to backtrack and retry without subsuming loads.  Other than this backtracking
3586 // behavior, the Compile's failure reason is quietly copied up to the ciEnv
3587 // by the logic in C2Compiler.
3588 void Compile::record_failure(const char* reason) {
3589   if (log() != NULL) {
3590     log()->elem("failure reason='%s' phase='compile'", reason);
3591   }
3592   if (_failure_reason == NULL) {
3593     // Record the first failure reason.
3594     _failure_reason = reason;







3595   }
3596 
3597   if (!C->failure_reason_is(C2Compiler::retry_no_subsuming_loads())) {
3598     C->print_method(PHASE_FAILURE);
3599   }
3600   _root = NULL;  // flush the graph, too
3601 }
3602 
3603 Compile::TracePhase::TracePhase(const char* name, elapsedTimer* accumulator, bool dolog)
3604   : TraceTime(NULL, accumulator, false NOT_PRODUCT( || TimeCompiler ), false),
3605     _phase_name(name), _dolog(dolog)
3606 {
3607   if (dolog) {
3608     C = Compile::current();
3609     _log = C->log();
3610   } else {
3611     C = NULL;
3612     _log = NULL;
3613   }
3614   if (_log != NULL) {


< prev index next >