jdk

Форк
0
/
javaThread_linux_zero.cpp 
74 строки · 2.6 Кб
1
/*
2
 * Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved.
3
 * Copyright (c) 2009, 2021, Red Hat, Inc. All rights reserved.
4
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5
 *
6
 * This code is free software; you can redistribute it and/or modify it
7
 * under the terms of the GNU General Public License version 2 only, as
8
 * published by the Free Software Foundation.
9
 *
10
 * This code is distributed in the hope that it will be useful, but WITHOUT
11
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
13
 * version 2 for more details (a copy is included in the LICENSE file that
14
 * accompanied this code).
15
 *
16
 * You should have received a copy of the GNU General Public License version
17
 * 2 along with this work; if not, write to the Free Software Foundation,
18
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19
 *
20
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
21
 * or visit www.oracle.com if you need additional information or have any
22
 * questions.
23
 *
24
 */
25

26
#include "precompiled.hpp"
27
#include "runtime/frame.inline.hpp"
28
#include "runtime/javaThread.hpp"
29

30
frame JavaThread::pd_last_frame() {
31
  assert(has_last_Java_frame(), "must have last_Java_sp() when suspended");
32
  return frame(last_Java_fp(), last_Java_sp());
33
}
34

35
void JavaThread::cache_global_variables() {
36
  // nothing to do
37
}
38

39
bool JavaThread::pd_get_top_frame_for_signal_handler(frame* fr_addr,
40
                                         void* ucontext,
41
                                         bool isInJava) {
42
  if (has_last_Java_frame()) {
43
    *fr_addr = pd_last_frame();
44
    return true;
45
  }
46

47
  if (isInJava) {
48
    // We know we are in Java, but there is no frame?
49
    // Try to find the top-most Java frame on Zero stack then.
50
    intptr_t* sp = zero_stack()->sp();
51
    ZeroFrame* zf = top_zero_frame();
52
    while (zf != nullptr) {
53
      if (zf->is_interpreter_frame()) {
54
        interpreterState istate = zf->as_interpreter_frame()->interpreter_state();
55
        if (istate->self_link() == istate) {
56
          // Valid interpreter state found, this is our frame.
57
          *fr_addr = frame(zf, sp);
58
          return true;
59
        }
60
      }
61
      sp = ((intptr_t *) zf) + 1;
62
      zf = zf->next();
63
    }
64
  }
65

66
  // No dice.
67
  return false;
68
}
69

70
bool JavaThread::pd_get_top_frame_for_profiling(frame* fr_addr,
71
                                    void* ucontext,
72
                                    bool isInJava) {
73
  return pd_get_top_frame_for_signal_handler(fr_addr, ucontext, isInJava);
74
}
75

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

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

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

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