2007-12-01 00:00:00 +00:00
|
|
|
/*
|
2019-01-10 15:13:51 -05:00
|
|
|
* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
|
2007-12-01 00:00:00 +00:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
|
|
*
|
|
|
|
* This code is free software; you can redistribute it and/or modify it
|
|
|
|
* under the terms of the GNU General Public License version 2 only, as
|
|
|
|
* published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
|
|
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
|
|
* version 2 for more details (a copy is included in the LICENSE file that
|
|
|
|
* accompanied this code).
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License version
|
|
|
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
|
|
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*
|
2010-05-27 19:08:38 -07:00
|
|
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
|
|
|
* or visit www.oracle.com if you need additional information or have any
|
|
|
|
* questions.
|
2007-12-01 00:00:00 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2019-01-10 15:13:51 -05:00
|
|
|
#ifndef SHARE_CODE_SCOPEDESC_HPP
|
|
|
|
#define SHARE_CODE_SCOPEDESC_HPP
|
2010-11-23 13:22:55 -08:00
|
|
|
|
|
|
|
#include "code/debugInfo.hpp"
|
|
|
|
#include "code/pcDesc.hpp"
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
#include "oops/method.hpp"
|
2010-11-23 13:22:55 -08:00
|
|
|
#include "utilities/growableArray.hpp"
|
|
|
|
|
2007-12-01 00:00:00 +00:00
|
|
|
// SimpleScopeDesc is used when all you need to extract from
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
// a given pc,nmethod pair is a Method* and a bci. This is
|
2007-12-01 00:00:00 +00:00
|
|
|
// quite a bit faster than allocating a full ScopeDesc, but
|
|
|
|
// very limited in abilities.
|
|
|
|
|
|
|
|
class SimpleScopeDesc : public StackObj {
|
|
|
|
private:
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
Method* _method;
|
2007-12-01 00:00:00 +00:00
|
|
|
int _bci;
|
|
|
|
|
|
|
|
public:
|
2016-04-26 10:28:51 +02:00
|
|
|
SimpleScopeDesc(CompiledMethod* code, address pc) {
|
2007-12-01 00:00:00 +00:00
|
|
|
PcDesc* pc_desc = code->pc_desc_at(pc);
|
|
|
|
assert(pc_desc != NULL, "Must be able to find matching PcDesc");
|
|
|
|
DebugInfoReadStream buffer(code, pc_desc->scope_decode_offset());
|
|
|
|
int ignore_sender = buffer.read_int();
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
_method = buffer.read_method();
|
2009-08-20 12:42:57 -07:00
|
|
|
_bci = buffer.read_bci();
|
2007-12-01 00:00:00 +00:00
|
|
|
}
|
|
|
|
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
Method* method() { return _method; }
|
2007-12-01 00:00:00 +00:00
|
|
|
int bci() { return _bci; }
|
|
|
|
};
|
|
|
|
|
|
|
|
// ScopeDescs contain the information that makes source-level debugging of
|
|
|
|
// nmethods possible; each scopeDesc describes a method activation
|
|
|
|
|
|
|
|
class ScopeDesc : public ResourceObj {
|
|
|
|
public:
|
|
|
|
// Constructor
|
2016-04-26 10:28:51 +02:00
|
|
|
ScopeDesc(const CompiledMethod* code, int decode_offset, int obj_decode_offset, bool reexecute, bool rethrow_exception, bool return_oop);
|
2007-12-01 00:00:00 +00:00
|
|
|
|
|
|
|
// Calls above, giving default value of "serialized_null" to the
|
|
|
|
// "obj_decode_offset" argument. (We don't use a default argument to
|
|
|
|
// avoid a .hpp-.hpp dependency.)
|
2016-04-26 10:28:51 +02:00
|
|
|
ScopeDesc(const CompiledMethod* code, int decode_offset, bool reexecute, bool rethrow_exception, bool return_oop);
|
2007-12-01 00:00:00 +00:00
|
|
|
|
2018-12-18 12:36:27 -08:00
|
|
|
// Direct access to scope
|
|
|
|
ScopeDesc* at_offset(int decode_offset) { return new ScopeDesc(this, decode_offset); }
|
|
|
|
|
2007-12-01 00:00:00 +00:00
|
|
|
// JVM state
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
Method* method() const { return _method; }
|
2009-07-31 17:12:33 -07:00
|
|
|
int bci() const { return _bci; }
|
|
|
|
bool should_reexecute() const { return _reexecute; }
|
2015-10-08 12:49:30 -10:00
|
|
|
bool rethrow_exception() const { return _rethrow_exception; }
|
2010-02-09 01:31:13 -08:00
|
|
|
bool return_oop() const { return _return_oop; }
|
2007-12-01 00:00:00 +00:00
|
|
|
|
|
|
|
GrowableArray<ScopeValue*>* locals();
|
|
|
|
GrowableArray<ScopeValue*>* expressions();
|
|
|
|
GrowableArray<MonitorValue*>* monitors();
|
|
|
|
GrowableArray<ScopeValue*>* objects();
|
|
|
|
|
|
|
|
// Stack walking, returns NULL if this is the outer most scope.
|
|
|
|
ScopeDesc* sender() const;
|
|
|
|
|
|
|
|
// Returns where the scope was decoded
|
|
|
|
int decode_offset() const { return _decode_offset; }
|
|
|
|
|
2018-12-18 12:36:27 -08:00
|
|
|
int sender_decode_offset() const { return _sender_decode_offset; }
|
|
|
|
|
2007-12-01 00:00:00 +00:00
|
|
|
// Tells whether sender() returns NULL
|
|
|
|
bool is_top() const;
|
|
|
|
|
|
|
|
private:
|
2018-12-18 12:36:27 -08:00
|
|
|
void initialize(const ScopeDesc* parent, int decode_offset);
|
|
|
|
// Alternative constructors
|
2007-12-01 00:00:00 +00:00
|
|
|
ScopeDesc(const ScopeDesc* parent);
|
2018-12-18 12:36:27 -08:00
|
|
|
ScopeDesc(const ScopeDesc* parent, int decode_offset);
|
2007-12-01 00:00:00 +00:00
|
|
|
|
|
|
|
// JVM state
|
6964458: Reimplement class meta-data storage to use native memory
Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Co-authored-by: Stefan Karlsson <stefan.karlsson@oracle.com>
Co-authored-by: Mikael Gerdin <mikael.gerdin@oracle.com>
Co-authored-by: Tom Rodriguez <tom.rodriguez@oracle.com>
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
2012-09-01 13:25:18 -04:00
|
|
|
Method* _method;
|
2007-12-01 00:00:00 +00:00
|
|
|
int _bci;
|
2009-07-31 17:12:33 -07:00
|
|
|
bool _reexecute;
|
2015-10-08 12:49:30 -10:00
|
|
|
bool _rethrow_exception;
|
2010-02-09 01:31:13 -08:00
|
|
|
bool _return_oop;
|
2007-12-01 00:00:00 +00:00
|
|
|
|
|
|
|
// Decoding offsets
|
|
|
|
int _decode_offset;
|
|
|
|
int _sender_decode_offset;
|
|
|
|
int _locals_decode_offset;
|
|
|
|
int _expressions_decode_offset;
|
|
|
|
int _monitors_decode_offset;
|
|
|
|
|
|
|
|
// Object pool
|
|
|
|
GrowableArray<ScopeValue*>* _objects;
|
|
|
|
|
|
|
|
// Nmethod information
|
2016-04-26 10:28:51 +02:00
|
|
|
const CompiledMethod* _code;
|
2007-12-01 00:00:00 +00:00
|
|
|
|
|
|
|
// Decoding operations
|
|
|
|
void decode_body();
|
|
|
|
GrowableArray<ScopeValue*>* decode_scope_values(int decode_offset);
|
|
|
|
GrowableArray<MonitorValue*>* decode_monitor_values(int decode_offset);
|
|
|
|
GrowableArray<ScopeValue*>* decode_object_values(int decode_offset);
|
|
|
|
|
|
|
|
DebugInfoReadStream* stream_at(int decode_offset) const;
|
|
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
// Verification
|
|
|
|
void verify();
|
|
|
|
|
|
|
|
#ifndef PRODUCT
|
|
|
|
public:
|
|
|
|
// Printing support
|
|
|
|
void print_on(outputStream* st) const;
|
|
|
|
void print_on(outputStream* st, PcDesc* pd) const;
|
|
|
|
void print_value_on(outputStream* st) const;
|
|
|
|
#endif
|
|
|
|
};
|
2010-11-23 13:22:55 -08:00
|
|
|
|
2019-01-10 15:13:51 -05:00
|
|
|
#endif // SHARE_CODE_SCOPEDESC_HPP
|