< 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);


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


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







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


< prev index next >