src/share/vm/code/scopeDesc.hpp

Mon, 19 Aug 2019 10:11:31 +0200

author
neugens
date
Mon, 19 Aug 2019 10:11:31 +0200
changeset 9861
a248d0be1309
parent 4037
da91efe96a93
child 6876
710a3c8b516e
permissions
-rw-r--r--

8229401: Fix JFR code cache test failures
8223689: Add JFR Thread Sampling Support
8223690: Add JFR BiasedLock Event Support
8223691: Add JFR G1 Region Type Change Event Support
8223692: Add JFR G1 Heap Summary Event Support
Summary: Backport JFR from JDK11, additional fixes
Reviewed-by: neugens, apetushkov
Contributed-by: denghui.ddh@alibaba-inc.com

duke@435 1 /*
coleenp@4037 2 * Copyright (c) 1997, 2012, 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 */
duke@435 24
stefank@2314 25 #ifndef SHARE_VM_CODE_SCOPEDESC_HPP
stefank@2314 26 #define SHARE_VM_CODE_SCOPEDESC_HPP
stefank@2314 27
stefank@2314 28 #include "code/debugInfo.hpp"
stefank@2314 29 #include "code/pcDesc.hpp"
coleenp@4037 30 #include "oops/method.hpp"
stefank@2314 31 #include "utilities/growableArray.hpp"
stefank@2314 32
duke@435 33 // SimpleScopeDesc is used when all you need to extract from
coleenp@4037 34 // a given pc,nmethod pair is a Method* and a bci. This is
duke@435 35 // quite a bit faster than allocating a full ScopeDesc, but
duke@435 36 // very limited in abilities.
duke@435 37
duke@435 38 class SimpleScopeDesc : public StackObj {
duke@435 39 private:
coleenp@4037 40 Method* _method;
duke@435 41 int _bci;
duke@435 42
duke@435 43 public:
duke@435 44 SimpleScopeDesc(nmethod* code,address pc) {
duke@435 45 PcDesc* pc_desc = code->pc_desc_at(pc);
duke@435 46 assert(pc_desc != NULL, "Must be able to find matching PcDesc");
duke@435 47 DebugInfoReadStream buffer(code, pc_desc->scope_decode_offset());
duke@435 48 int ignore_sender = buffer.read_int();
coleenp@4037 49 _method = buffer.read_method();
cfang@1366 50 _bci = buffer.read_bci();
duke@435 51 }
duke@435 52
coleenp@4037 53 Method* method() { return _method; }
duke@435 54 int bci() { return _bci; }
duke@435 55 };
duke@435 56
duke@435 57 // ScopeDescs contain the information that makes source-level debugging of
duke@435 58 // nmethods possible; each scopeDesc describes a method activation
duke@435 59
duke@435 60 class ScopeDesc : public ResourceObj {
duke@435 61 public:
duke@435 62 // Constructor
kvn@1688 63 ScopeDesc(const nmethod* code, int decode_offset, int obj_decode_offset, bool reexecute, bool return_oop);
duke@435 64
duke@435 65 // Calls above, giving default value of "serialized_null" to the
duke@435 66 // "obj_decode_offset" argument. (We don't use a default argument to
duke@435 67 // avoid a .hpp-.hpp dependency.)
kvn@1688 68 ScopeDesc(const nmethod* code, int decode_offset, bool reexecute, bool return_oop);
duke@435 69
duke@435 70 // JVM state
coleenp@4037 71 Method* method() const { return _method; }
cfang@1335 72 int bci() const { return _bci; }
cfang@1335 73 bool should_reexecute() const { return _reexecute; }
kvn@1688 74 bool return_oop() const { return _return_oop; }
duke@435 75
duke@435 76 GrowableArray<ScopeValue*>* locals();
duke@435 77 GrowableArray<ScopeValue*>* expressions();
duke@435 78 GrowableArray<MonitorValue*>* monitors();
duke@435 79 GrowableArray<ScopeValue*>* objects();
duke@435 80
duke@435 81 // Stack walking, returns NULL if this is the outer most scope.
duke@435 82 ScopeDesc* sender() const;
duke@435 83
duke@435 84 // Returns where the scope was decoded
duke@435 85 int decode_offset() const { return _decode_offset; }
duke@435 86
duke@435 87 // Tells whether sender() returns NULL
duke@435 88 bool is_top() const;
duke@435 89 // Tells whether sd is equal to this
duke@435 90 bool is_equal(ScopeDesc* sd) const;
duke@435 91
duke@435 92 private:
duke@435 93 // Alternative constructor
duke@435 94 ScopeDesc(const ScopeDesc* parent);
duke@435 95
duke@435 96 // JVM state
coleenp@4037 97 Method* _method;
duke@435 98 int _bci;
cfang@1335 99 bool _reexecute;
kvn@1688 100 bool _return_oop;
duke@435 101
duke@435 102 // Decoding offsets
duke@435 103 int _decode_offset;
duke@435 104 int _sender_decode_offset;
duke@435 105 int _locals_decode_offset;
duke@435 106 int _expressions_decode_offset;
duke@435 107 int _monitors_decode_offset;
duke@435 108
duke@435 109 // Object pool
duke@435 110 GrowableArray<ScopeValue*>* _objects;
duke@435 111
duke@435 112 // Nmethod information
duke@435 113 const nmethod* _code;
duke@435 114
duke@435 115 // Decoding operations
duke@435 116 void decode_body();
duke@435 117 GrowableArray<ScopeValue*>* decode_scope_values(int decode_offset);
duke@435 118 GrowableArray<MonitorValue*>* decode_monitor_values(int decode_offset);
duke@435 119 GrowableArray<ScopeValue*>* decode_object_values(int decode_offset);
duke@435 120
duke@435 121 DebugInfoReadStream* stream_at(int decode_offset) const;
duke@435 122
duke@435 123
duke@435 124 public:
duke@435 125 // Verification
duke@435 126 void verify();
duke@435 127
duke@435 128 #ifndef PRODUCT
duke@435 129 public:
duke@435 130 // Printing support
duke@435 131 void print_on(outputStream* st) const;
duke@435 132 void print_on(outputStream* st, PcDesc* pd) const;
duke@435 133 void print_value_on(outputStream* st) const;
duke@435 134 #endif
duke@435 135 };
stefank@2314 136
stefank@2314 137 #endif // SHARE_VM_CODE_SCOPEDESC_HPP

mercurial