Mon, 09 Mar 2020 12:54:53 +0000
8240295: hs_err elapsed time in seconds is not accurate enough
Reviewed-by: dholmes, sspitsyn
duke@435 | 1 | /* |
trims@2708 | 2 | * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved. |
duke@435 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
duke@435 | 4 | * |
duke@435 | 5 | * This code is free software; you can redistribute it and/or modify it |
duke@435 | 6 | * under the terms of the GNU General Public License version 2 only, as |
duke@435 | 7 | * published by the Free Software Foundation. |
duke@435 | 8 | * |
duke@435 | 9 | * This code is distributed in the hope that it will be useful, but WITHOUT |
duke@435 | 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
duke@435 | 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
duke@435 | 12 | * version 2 for more details (a copy is included in the LICENSE file that |
duke@435 | 13 | * accompanied this code). |
duke@435 | 14 | * |
duke@435 | 15 | * You should have received a copy of the GNU General Public License version |
duke@435 | 16 | * 2 along with this work; if not, write to the Free Software Foundation, |
duke@435 | 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
duke@435 | 18 | * |
trims@1907 | 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
trims@1907 | 20 | * or visit www.oracle.com if you need additional information or have any |
trims@1907 | 21 | * questions. |
duke@435 | 22 | * |
duke@435 | 23 | */ |
stefank@2314 | 24 | |
stefank@2314 | 25 | #ifndef SHARE_VM_RUNTIME_JAVAFRAMEANCHOR_HPP |
stefank@2314 | 26 | #define SHARE_VM_RUNTIME_JAVAFRAMEANCHOR_HPP |
stefank@2314 | 27 | |
stefank@2314 | 28 | #include "utilities/globalDefinitions.hpp" |
goetz@6911 | 29 | #include "runtime/orderAccess.inline.hpp" |
never@3156 | 30 | |
duke@435 | 31 | // |
duke@435 | 32 | // An object for encapsulating the machine/os dependent part of a JavaThread frame state |
duke@435 | 33 | // |
duke@435 | 34 | class JavaThread; |
duke@435 | 35 | |
duke@435 | 36 | class JavaFrameAnchor VALUE_OBJ_CLASS_SPEC { |
duke@435 | 37 | // Too many friends... |
duke@435 | 38 | friend class CallNativeDirectNode; |
duke@435 | 39 | friend class OptoRuntime; |
duke@435 | 40 | friend class Runtime1; |
duke@435 | 41 | friend class StubAssembler; |
duke@435 | 42 | friend class CallRuntimeDirectNode; |
duke@435 | 43 | friend class MacroAssembler; |
duke@435 | 44 | friend class InterpreterGenerator; |
duke@435 | 45 | friend class LIR_Assembler; |
duke@435 | 46 | friend class GraphKit; |
duke@435 | 47 | friend class StubGenerator; |
duke@435 | 48 | friend class JavaThread; |
duke@435 | 49 | friend class frame; |
duke@435 | 50 | friend class VMStructs; |
duke@435 | 51 | friend class BytecodeInterpreter; |
duke@435 | 52 | friend class JavaCallWrapper; |
duke@435 | 53 | |
duke@435 | 54 | private: |
duke@435 | 55 | // |
duke@435 | 56 | // Whenever _last_Java_sp != NULL other anchor fields MUST be valid! |
duke@435 | 57 | // The stack may not be walkable [check with walkable() ] but the values must be valid. |
duke@435 | 58 | // The profiler apparently depends on this. |
duke@435 | 59 | // |
duke@435 | 60 | intptr_t* volatile _last_Java_sp; |
duke@435 | 61 | |
duke@435 | 62 | // Whenever we call from Java to native we can not be assured that the return |
duke@435 | 63 | // address that composes the last_Java_frame will be in an accessible location |
duke@435 | 64 | // so calls from Java to native store that pc (or one good enough to locate |
duke@435 | 65 | // the oopmap) in the frame anchor. Since the frames that call from Java to |
duke@435 | 66 | // native are never deoptimized we never need to patch the pc and so this |
duke@435 | 67 | // is acceptable. |
duke@435 | 68 | volatile address _last_Java_pc; |
duke@435 | 69 | |
duke@435 | 70 | // tells whether the last Java frame is set |
duke@435 | 71 | // It is important that when last_Java_sp != NULL that the rest of the frame |
duke@435 | 72 | // anchor (including platform specific) all be valid. |
duke@435 | 73 | |
duke@435 | 74 | bool has_last_Java_frame() const { return _last_Java_sp != NULL; } |
duke@435 | 75 | // This is very dangerous unless sp == NULL |
duke@435 | 76 | // Invalidate the anchor so that has_last_frame is false |
duke@435 | 77 | // and no one should look at the other fields. |
duke@435 | 78 | void zap(void) { _last_Java_sp = NULL; } |
duke@435 | 79 | |
stefank@2314 | 80 | #ifdef TARGET_ARCH_x86 |
stefank@2314 | 81 | # include "javaFrameAnchor_x86.hpp" |
stefank@2314 | 82 | #endif |
stefank@2314 | 83 | #ifdef TARGET_ARCH_sparc |
stefank@2314 | 84 | # include "javaFrameAnchor_sparc.hpp" |
stefank@2314 | 85 | #endif |
stefank@2314 | 86 | #ifdef TARGET_ARCH_zero |
stefank@2314 | 87 | # include "javaFrameAnchor_zero.hpp" |
stefank@2314 | 88 | #endif |
bobv@2508 | 89 | #ifdef TARGET_ARCH_arm |
bobv@2508 | 90 | # include "javaFrameAnchor_arm.hpp" |
bobv@2508 | 91 | #endif |
bobv@2508 | 92 | #ifdef TARGET_ARCH_ppc |
bobv@2508 | 93 | # include "javaFrameAnchor_ppc.hpp" |
bobv@2508 | 94 | #endif |
stefank@2314 | 95 | |
duke@435 | 96 | |
duke@435 | 97 | public: |
duke@435 | 98 | JavaFrameAnchor() { clear(); } |
duke@435 | 99 | JavaFrameAnchor(JavaFrameAnchor *src) { copy(src); } |
duke@435 | 100 | |
duke@435 | 101 | void set_last_Java_pc(address pc) { _last_Java_pc = pc; } |
duke@435 | 102 | |
duke@435 | 103 | // Assembly stub generation helpers |
duke@435 | 104 | |
duke@435 | 105 | static ByteSize last_Java_sp_offset() { return byte_offset_of(JavaFrameAnchor, _last_Java_sp); } |
duke@435 | 106 | static ByteSize last_Java_pc_offset() { return byte_offset_of(JavaFrameAnchor, _last_Java_pc); } |
duke@435 | 107 | |
duke@435 | 108 | }; |
stefank@2314 | 109 | |
stefank@2314 | 110 | #endif // SHARE_VM_RUNTIME_JAVAFRAMEANCHOR_HPP |