hotspot/src/share/vm/compiler/compileTask.hpp
author ysuenaga
Tue, 14 Feb 2017 20:00:28 -0800
changeset 46270 2e7898927798
parent 42650 1f304d0c888b
child 46630 75aa3e39d02c
permissions -rw-r--r--
8172285: UL support for PrintCompilation Reviewed-by: kvn
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
32582
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
     1
/*
37281
c4e7456d6ae1 8144964: JVMCI compilations need to be disabled until the module system is initialized
twisti
parents: 35547
diff changeset
     2
 * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
32582
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
     4
 *
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
     7
 * published by the Free Software Foundation.
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
     8
 *
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
    13
 * accompanied this code).
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
    14
 *
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
    18
 *
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
    21
 * questions.
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
    22
 *
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
    23
 */
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
    24
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
    25
#ifndef SHARE_VM_COMPILER_COMPILETASK_HPP
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
    26
#define SHARE_VM_COMPILER_COMPILETASK_HPP
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
    27
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
    28
#include "code/nmethod.hpp"
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
    29
#include "ci/ciMethod.hpp"
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
    30
#include "compiler/compileLog.hpp"
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
    31
#include "memory/allocation.inline.hpp"
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
    32
#include "utilities/xmlstream.hpp"
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
    33
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
    34
// CompileTask
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
    35
//
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
    36
// An entry in the compile queue.  It represents a pending or current
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
    37
// compilation.
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
    38
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
    39
class CompileTask : public CHeapObj<mtCompiler> {
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
    40
  friend class VMStructs;
35123
b0b89d83bcf5 8134994: use separate VMStructs databases for SA and JVMCI
twisti
parents: 34196
diff changeset
    41
  friend class JVMCIVMStructs;
32582
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
    42
38218
f5ba1dea04eb 8153013: BlockingCompilation test times out
neliasso
parents: 37281
diff changeset
    43
 public:
f5ba1dea04eb 8153013: BlockingCompilation test times out
neliasso
parents: 37281
diff changeset
    44
  // Different reasons for a compilation
f5ba1dea04eb 8153013: BlockingCompilation test times out
neliasso
parents: 37281
diff changeset
    45
  // The order is important - Reason_Whitebox and higher can not become
f5ba1dea04eb 8153013: BlockingCompilation test times out
neliasso
parents: 37281
diff changeset
    46
  // stale, see CompileTask::can_become_stale()
f5ba1dea04eb 8153013: BlockingCompilation test times out
neliasso
parents: 37281
diff changeset
    47
  // Also mapped to reason_names[]
f5ba1dea04eb 8153013: BlockingCompilation test times out
neliasso
parents: 37281
diff changeset
    48
  enum CompileReason {
f5ba1dea04eb 8153013: BlockingCompilation test times out
neliasso
parents: 37281
diff changeset
    49
      Reason_None,
f5ba1dea04eb 8153013: BlockingCompilation test times out
neliasso
parents: 37281
diff changeset
    50
      Reason_InvocationCount,  // Simple/StackWalk-policy
f5ba1dea04eb 8153013: BlockingCompilation test times out
neliasso
parents: 37281
diff changeset
    51
      Reason_BackedgeCount,    // Simple/StackWalk-policy
f5ba1dea04eb 8153013: BlockingCompilation test times out
neliasso
parents: 37281
diff changeset
    52
      Reason_Tiered,           // Tiered-policy
f5ba1dea04eb 8153013: BlockingCompilation test times out
neliasso
parents: 37281
diff changeset
    53
      Reason_CTW,              // Compile the world
f5ba1dea04eb 8153013: BlockingCompilation test times out
neliasso
parents: 37281
diff changeset
    54
      Reason_Replay,           // ciReplay
f5ba1dea04eb 8153013: BlockingCompilation test times out
neliasso
parents: 37281
diff changeset
    55
      Reason_Whitebox,         // Whitebox API
f5ba1dea04eb 8153013: BlockingCompilation test times out
neliasso
parents: 37281
diff changeset
    56
      Reason_MustBeCompiled,   // Java callHelper, LinkResolver
f5ba1dea04eb 8153013: BlockingCompilation test times out
neliasso
parents: 37281
diff changeset
    57
      Reason_Bootstrap,        // JVMCI bootstrap
f5ba1dea04eb 8153013: BlockingCompilation test times out
neliasso
parents: 37281
diff changeset
    58
      Reason_Count
f5ba1dea04eb 8153013: BlockingCompilation test times out
neliasso
parents: 37281
diff changeset
    59
  };
f5ba1dea04eb 8153013: BlockingCompilation test times out
neliasso
parents: 37281
diff changeset
    60
f5ba1dea04eb 8153013: BlockingCompilation test times out
neliasso
parents: 37281
diff changeset
    61
  static const char* reason_name(CompileTask::CompileReason compile_reason) {
f5ba1dea04eb 8153013: BlockingCompilation test times out
neliasso
parents: 37281
diff changeset
    62
    static const char* reason_names[] = {
f5ba1dea04eb 8153013: BlockingCompilation test times out
neliasso
parents: 37281
diff changeset
    63
      "no_reason",
f5ba1dea04eb 8153013: BlockingCompilation test times out
neliasso
parents: 37281
diff changeset
    64
      "count",
f5ba1dea04eb 8153013: BlockingCompilation test times out
neliasso
parents: 37281
diff changeset
    65
      "backedge_count",
f5ba1dea04eb 8153013: BlockingCompilation test times out
neliasso
parents: 37281
diff changeset
    66
      "tiered",
f5ba1dea04eb 8153013: BlockingCompilation test times out
neliasso
parents: 37281
diff changeset
    67
      "CTW",
f5ba1dea04eb 8153013: BlockingCompilation test times out
neliasso
parents: 37281
diff changeset
    68
      "replay",
f5ba1dea04eb 8153013: BlockingCompilation test times out
neliasso
parents: 37281
diff changeset
    69
      "whitebox",
f5ba1dea04eb 8153013: BlockingCompilation test times out
neliasso
parents: 37281
diff changeset
    70
      "must_be_compiled",
f5ba1dea04eb 8153013: BlockingCompilation test times out
neliasso
parents: 37281
diff changeset
    71
      "bootstrap"
f5ba1dea04eb 8153013: BlockingCompilation test times out
neliasso
parents: 37281
diff changeset
    72
    };
f5ba1dea04eb 8153013: BlockingCompilation test times out
neliasso
parents: 37281
diff changeset
    73
    return reason_names[compile_reason];
f5ba1dea04eb 8153013: BlockingCompilation test times out
neliasso
parents: 37281
diff changeset
    74
  }
f5ba1dea04eb 8153013: BlockingCompilation test times out
neliasso
parents: 37281
diff changeset
    75
32582
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
    76
 private:
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
    77
  static CompileTask* _task_free_list;
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
    78
#ifdef ASSERT
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
    79
  static int          _num_allocated_tasks;
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
    80
#endif
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
    81
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
    82
  Monitor*     _lock;
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
    83
  uint         _compile_id;
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
    84
  Method*      _method;
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
    85
  jobject      _method_holder;
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
    86
  int          _osr_bci;
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
    87
  bool         _is_complete;
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
    88
  bool         _is_success;
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
    89
  bool         _is_blocking;
34196
72152eea3d39 8141330: [JVMCI] avoid deadlock between application thread and JVMCI compiler thread under -Xbatch
twisti
parents: 33593
diff changeset
    90
#if INCLUDE_JVMCI
72152eea3d39 8141330: [JVMCI] avoid deadlock between application thread and JVMCI compiler thread under -Xbatch
twisti
parents: 33593
diff changeset
    91
  bool         _has_waiter;
35547
0ee84aa8e705 8146705: Improve JVMCI support for blocking compilation
dnsimon
parents: 35123
diff changeset
    92
  // Compiler thread for a blocking JVMCI compilation
0ee84aa8e705 8146705: Improve JVMCI support for blocking compilation
dnsimon
parents: 35123
diff changeset
    93
  CompilerThread* _jvmci_compiler_thread;
34196
72152eea3d39 8141330: [JVMCI] avoid deadlock between application thread and JVMCI compiler thread under -Xbatch
twisti
parents: 33593
diff changeset
    94
#endif
32582
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
    95
  int          _comp_level;
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
    96
  int          _num_inlined_bytecodes;
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
    97
  nmethodLocker* _code_handle;  // holder of eventual result
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
    98
  CompileTask* _next, *_prev;
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
    99
  bool         _is_free;
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
   100
  // Fields used for logging why the compilation was initiated:
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
   101
  jlong        _time_queued;  // in units of os::elapsed_counter()
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
   102
  Method*      _hot_method;   // which method actually triggered this task
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
   103
  jobject      _hot_method_holder;
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
   104
  int          _hot_count;    // information about its invocation counter
38218
f5ba1dea04eb 8153013: BlockingCompilation test times out
neliasso
parents: 37281
diff changeset
   105
  CompileReason _compile_reason;      // more info about the task
32582
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
   106
  const char*  _failure_reason;
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
   107
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
   108
 public:
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
   109
  CompileTask() {
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
   110
    _lock = new Monitor(Mutex::nonleaf+2, "CompileTaskLock");
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
   111
  }
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
   112
33593
60764a78fa5c 8140274: methodHandles and constantPoolHandles should be passed as const references
coleenp
parents: 33160
diff changeset
   113
  void initialize(int compile_id, const methodHandle& method, int osr_bci, int comp_level,
38218
f5ba1dea04eb 8153013: BlockingCompilation test times out
neliasso
parents: 37281
diff changeset
   114
                  const methodHandle& hot_method, int hot_count,
f5ba1dea04eb 8153013: BlockingCompilation test times out
neliasso
parents: 37281
diff changeset
   115
                  CompileTask::CompileReason compile_reason, bool is_blocking);
32582
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
   116
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
   117
  static CompileTask* allocate();
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
   118
  static void         free(CompileTask* task);
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
   119
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
   120
  int          compile_id() const                { return _compile_id; }
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
   121
  Method*      method() const                    { return _method; }
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
   122
  Method*      hot_method() const                { return _hot_method; }
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
   123
  int          osr_bci() const                   { return _osr_bci; }
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
   124
  bool         is_complete() const               { return _is_complete; }
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
   125
  bool         is_blocking() const               { return _is_blocking; }
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
   126
  bool         is_success() const                { return _is_success; }
38218
f5ba1dea04eb 8153013: BlockingCompilation test times out
neliasso
parents: 37281
diff changeset
   127
  bool         can_become_stale() const          {
f5ba1dea04eb 8153013: BlockingCompilation test times out
neliasso
parents: 37281
diff changeset
   128
    switch (_compile_reason) {
f5ba1dea04eb 8153013: BlockingCompilation test times out
neliasso
parents: 37281
diff changeset
   129
      case Reason_BackedgeCount:
f5ba1dea04eb 8153013: BlockingCompilation test times out
neliasso
parents: 37281
diff changeset
   130
      case Reason_InvocationCount:
f5ba1dea04eb 8153013: BlockingCompilation test times out
neliasso
parents: 37281
diff changeset
   131
      case Reason_Tiered:
f5ba1dea04eb 8153013: BlockingCompilation test times out
neliasso
parents: 37281
diff changeset
   132
        return !_is_blocking;
f5ba1dea04eb 8153013: BlockingCompilation test times out
neliasso
parents: 37281
diff changeset
   133
    }
f5ba1dea04eb 8153013: BlockingCompilation test times out
neliasso
parents: 37281
diff changeset
   134
    return false;
f5ba1dea04eb 8153013: BlockingCompilation test times out
neliasso
parents: 37281
diff changeset
   135
  }
34196
72152eea3d39 8141330: [JVMCI] avoid deadlock between application thread and JVMCI compiler thread under -Xbatch
twisti
parents: 33593
diff changeset
   136
#if INCLUDE_JVMCI
72152eea3d39 8141330: [JVMCI] avoid deadlock between application thread and JVMCI compiler thread under -Xbatch
twisti
parents: 33593
diff changeset
   137
  bool         has_waiter() const                { return _has_waiter; }
72152eea3d39 8141330: [JVMCI] avoid deadlock between application thread and JVMCI compiler thread under -Xbatch
twisti
parents: 33593
diff changeset
   138
  void         clear_waiter()                    { _has_waiter = false; }
35547
0ee84aa8e705 8146705: Improve JVMCI support for blocking compilation
dnsimon
parents: 35123
diff changeset
   139
  CompilerThread* jvmci_compiler_thread() const  { return _jvmci_compiler_thread; }
0ee84aa8e705 8146705: Improve JVMCI support for blocking compilation
dnsimon
parents: 35123
diff changeset
   140
  void         set_jvmci_compiler_thread(CompilerThread* t) {
0ee84aa8e705 8146705: Improve JVMCI support for blocking compilation
dnsimon
parents: 35123
diff changeset
   141
    assert(is_blocking(), "must be");
0ee84aa8e705 8146705: Improve JVMCI support for blocking compilation
dnsimon
parents: 35123
diff changeset
   142
    assert((t == NULL) != (_jvmci_compiler_thread == NULL), "must be");
0ee84aa8e705 8146705: Improve JVMCI support for blocking compilation
dnsimon
parents: 35123
diff changeset
   143
    _jvmci_compiler_thread = t;
0ee84aa8e705 8146705: Improve JVMCI support for blocking compilation
dnsimon
parents: 35123
diff changeset
   144
  }
34196
72152eea3d39 8141330: [JVMCI] avoid deadlock between application thread and JVMCI compiler thread under -Xbatch
twisti
parents: 33593
diff changeset
   145
#endif
32582
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
   146
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
   147
  nmethodLocker* code_handle() const             { return _code_handle; }
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
   148
  void         set_code_handle(nmethodLocker* l) { _code_handle = l; }
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
   149
  nmethod*     code() const;                     // _code_handle->code()
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
   150
  void         set_code(nmethod* nm);            // _code_handle->set_code(nm)
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
   151
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
   152
  Monitor*     lock() const                      { return _lock; }
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
   153
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
   154
  void         mark_complete()                   { _is_complete = true; }
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
   155
  void         mark_success()                    { _is_success = true; }
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
   156
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
   157
  int          comp_level()                      { return _comp_level;}
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
   158
  void         set_comp_level(int comp_level)    { _comp_level = comp_level;}
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
   159
37281
c4e7456d6ae1 8144964: JVMCI compilations need to be disabled until the module system is initialized
twisti
parents: 35547
diff changeset
   160
  AbstractCompiler* compiler();
c4e7456d6ae1 8144964: JVMCI compilations need to be disabled until the module system is initialized
twisti
parents: 35547
diff changeset
   161
32582
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
   162
  int          num_inlined_bytecodes() const     { return _num_inlined_bytecodes; }
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
   163
  void         set_num_inlined_bytecodes(int n)  { _num_inlined_bytecodes = n; }
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
   164
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
   165
  CompileTask* next() const                      { return _next; }
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
   166
  void         set_next(CompileTask* next)       { _next = next; }
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
   167
  CompileTask* prev() const                      { return _prev; }
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
   168
  void         set_prev(CompileTask* prev)       { _prev = prev; }
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
   169
  bool         is_free() const                   { return _is_free; }
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
   170
  void         set_is_free(bool val)             { _is_free = val; }
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
   171
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
   172
  // RedefineClasses support
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
   173
  void         metadata_do(void f(Metadata*));
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
   174
  void         mark_on_stack();
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
   175
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
   176
private:
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
   177
  static void  print_impl(outputStream* st, Method* method, int compile_id, int comp_level,
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
   178
                                      bool is_osr_method = false, int osr_bci = -1, bool is_blocking = false,
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
   179
                                      const char* msg = NULL, bool short_form = false, bool cr = true);
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
   180
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
   181
public:
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
   182
  void         print(outputStream* st = tty, const char* msg = NULL, bool short_form = false, bool cr = true);
46270
2e7898927798 8172285: UL support for PrintCompilation
ysuenaga
parents: 42650
diff changeset
   183
  void         print_ul(const char* msg = NULL){
2e7898927798 8172285: UL support for PrintCompilation
ysuenaga
parents: 42650
diff changeset
   184
    Log(jit, compilation) log;
2e7898927798 8172285: UL support for PrintCompilation
ysuenaga
parents: 42650
diff changeset
   185
    if (log.is_debug()) {
2e7898927798 8172285: UL support for PrintCompilation
ysuenaga
parents: 42650
diff changeset
   186
      print(log.debug_stream(), msg, /* short form */ true, /* cr */ true);
2e7898927798 8172285: UL support for PrintCompilation
ysuenaga
parents: 42650
diff changeset
   187
    }
2e7898927798 8172285: UL support for PrintCompilation
ysuenaga
parents: 42650
diff changeset
   188
  }
32582
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
   189
  static void  print(outputStream* st, const nmethod* nm, const char* msg = NULL, bool short_form = false, bool cr = true) {
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
   190
    print_impl(st, nm->method(), nm->compile_id(), nm->comp_level(),
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
   191
                           nm->is_osr_method(), nm->is_osr_method() ? nm->osr_entry_bci() : -1, /*is_blocking*/ false,
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
   192
                           msg, short_form, cr);
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
   193
  }
46270
2e7898927798 8172285: UL support for PrintCompilation
ysuenaga
parents: 42650
diff changeset
   194
  static void  print_ul(const nmethod* nm, const char* msg = NULL) {
2e7898927798 8172285: UL support for PrintCompilation
ysuenaga
parents: 42650
diff changeset
   195
    Log(jit, compilation) log;
2e7898927798 8172285: UL support for PrintCompilation
ysuenaga
parents: 42650
diff changeset
   196
    if (log.is_debug()) {
2e7898927798 8172285: UL support for PrintCompilation
ysuenaga
parents: 42650
diff changeset
   197
      print_impl(log.debug_stream(), nm->method(), nm->compile_id(),
2e7898927798 8172285: UL support for PrintCompilation
ysuenaga
parents: 42650
diff changeset
   198
                 nm->comp_level(), nm->is_osr_method(),
2e7898927798 8172285: UL support for PrintCompilation
ysuenaga
parents: 42650
diff changeset
   199
                 nm->is_osr_method() ? nm->osr_entry_bci() : -1,
2e7898927798 8172285: UL support for PrintCompilation
ysuenaga
parents: 42650
diff changeset
   200
                 /*is_blocking*/ false,
2e7898927798 8172285: UL support for PrintCompilation
ysuenaga
parents: 42650
diff changeset
   201
                 msg, /* short form */ true, /* cr */ true);
2e7898927798 8172285: UL support for PrintCompilation
ysuenaga
parents: 42650
diff changeset
   202
    }
2e7898927798 8172285: UL support for PrintCompilation
ysuenaga
parents: 42650
diff changeset
   203
  }
32582
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
   204
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
   205
  static void  print_inline_indent(int inline_level, outputStream* st = tty);
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
   206
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
   207
  void         print_tty();
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
   208
  void         print_line_on_error(outputStream* st, char* buf, int buflen);
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
   209
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
   210
  void         log_task(xmlStream* log);
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
   211
  void         log_task_queued();
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
   212
  void         log_task_start(CompileLog* log);
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
   213
  void         log_task_done(CompileLog* log);
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
   214
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
   215
  void         set_failure_reason(const char* reason) {
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
   216
    _failure_reason = reason;
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
   217
  }
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
   218
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
   219
  bool         check_break_at_flags();
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
   220
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
   221
  static void print_inlining_inner(outputStream* st, ciMethod* method, int inline_level, int bci, const char* msg = NULL);
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
   222
  static void print_inlining_tty(ciMethod* method, int inline_level, int bci, const char* msg = NULL) {
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
   223
    print_inlining_inner(tty, method, inline_level, bci, msg);
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
   224
  }
46270
2e7898927798 8172285: UL support for PrintCompilation
ysuenaga
parents: 42650
diff changeset
   225
  static void print_inlining_ul(ciMethod* method, int inline_level, int bci, const char* msg = NULL) {
2e7898927798 8172285: UL support for PrintCompilation
ysuenaga
parents: 42650
diff changeset
   226
    Log(jit, inlining) log;
2e7898927798 8172285: UL support for PrintCompilation
ysuenaga
parents: 42650
diff changeset
   227
    if (log.is_debug()) {
2e7898927798 8172285: UL support for PrintCompilation
ysuenaga
parents: 42650
diff changeset
   228
      print_inlining_inner(log.debug_stream(), method, inline_level, bci, msg);
2e7898927798 8172285: UL support for PrintCompilation
ysuenaga
parents: 42650
diff changeset
   229
    }
2e7898927798 8172285: UL support for PrintCompilation
ysuenaga
parents: 42650
diff changeset
   230
  }
32582
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
   231
};
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
   232
56619bb8bcaa 8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff changeset
   233
#endif // SHARE_VM_COMPILER_COMPILETASK_HPP