jdk

Форк
0
/
compilationLog.cpp 
75 строк · 2.7 Кб
1
/*
2
 * Copyright (c) 2022, 2023, Oracle and/or its affiliates. All rights reserved.
3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
 *
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
7
 * published by the Free Software Foundation.
8
 *
9
 * This code is distributed in the hope that it will be useful, but WITHOUT
10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12
 * version 2 for more details (a copy is included in the LICENSE file that
13
 * accompanied this code).
14
 *
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 "code/nmethod.hpp"
27
#include "compiler/compilationLog.hpp"
28
#include "compiler/compileTask.hpp"
29
#include "logging/log.hpp"
30
#include "memory/resourceArea.hpp"
31
#include "runtime/thread.hpp"
32
#include "utilities/ostream.hpp"
33

34
CompilationLog* CompilationLog::_log;
35

36
CompilationLog::CompilationLog() : StringEventLog("Compilation events", "jit") {
37
}
38

39
void CompilationLog::log_compile(JavaThread* thread, CompileTask* task) {
40
  StringLogMessage lm;
41
  stringStream sstr(lm.buffer(), lm.size());
42
  // msg.time_stamp().update_to(tty->time_stamp().ticks());
43
  task->print(&sstr, nullptr, true, false);
44
  log(thread, "%s", (const char*)lm);
45
}
46

47
void CompilationLog::log_nmethod(JavaThread* thread, nmethod* nm) {
48
  log(thread, "nmethod %d%s " INTPTR_FORMAT " code [" INTPTR_FORMAT ", " INTPTR_FORMAT "]",
49
      nm->compile_id(), nm->is_osr_method() ? "%" : "",
50
      p2i(nm), p2i(nm->code_begin()), p2i(nm->code_end()));
51
}
52

53
void CompilationLog::log_failure(JavaThread* thread, CompileTask* task, const char* reason, const char* retry_message) {
54
  StringLogMessage lm;
55
  lm.print("%4d   COMPILE SKIPPED: %s", task->compile_id(), reason);
56
  if (retry_message != nullptr) {
57
    lm.append(" (%s)", retry_message);
58
  }
59
  lm.print("\n");
60
  log(thread, "%s", (const char*)lm);
61
}
62

63
void CompilationLog::log_metaspace_failure(const char* reason) {
64
  // Note: This method can be called from non-Java/compiler threads to
65
  // log the global metaspace failure that might affect profiling.
66
  ResourceMark rm;
67
  StringLogMessage lm;
68
  lm.print("%4d   COMPILE PROFILING SKIPPED: %s", -1, reason);
69
  lm.print("\n");
70
  log(Thread::current(), "%s", (const char*)lm);
71
}
72

73
void CompilationLog::init() {
74
  _log = new CompilationLog();
75
}
76

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.