2007-12-01 00:00:00 +00:00
|
|
|
/*
|
2019-01-10 15:13:51 -05:00
|
|
|
* Copyright (c) 1999, 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_CI_CISYMBOL_HPP
|
|
|
|
#define SHARE_CI_CISYMBOL_HPP
|
2010-11-23 13:22:55 -08: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
|
|
|
#include "ci/ciBaseObject.hpp"
|
2010-11-23 13:22:55 -08:00
|
|
|
#include "ci/ciObject.hpp"
|
|
|
|
#include "ci/ciObjectFactory.hpp"
|
|
|
|
#include "classfile/vmSymbols.hpp"
|
2011-01-27 16:11:27 -08:00
|
|
|
#include "oops/symbol.hpp"
|
2010-11-23 13:22:55 -08:00
|
|
|
|
2007-12-01 00:00:00 +00:00
|
|
|
// ciSymbol
|
|
|
|
//
|
2011-01-27 16:11:27 -08:00
|
|
|
// This class represents a Symbol* in the HotSpot virtual
|
2007-12-01 00:00:00 +00:00
|
|
|
// machine.
|
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
|
|
|
class ciSymbol : public ciBaseObject {
|
2011-01-27 16:11:27 -08:00
|
|
|
Symbol* _symbol;
|
|
|
|
|
2007-12-01 00:00:00 +00:00
|
|
|
CI_PACKAGE_ACCESS
|
2011-01-27 16:11:27 -08:00
|
|
|
// These friends all make direct use of get_symbol:
|
2007-12-01 00:00:00 +00:00
|
|
|
friend class ciEnv;
|
|
|
|
friend class ciInstanceKlass;
|
|
|
|
friend class ciSignature;
|
|
|
|
friend class ciMethod;
|
2013-09-13 22:38:02 -04:00
|
|
|
friend class ciField;
|
2007-12-01 00:00:00 +00:00
|
|
|
friend class ciObjArrayKlass;
|
|
|
|
|
|
|
|
private:
|
2010-05-01 02:42:18 -07:00
|
|
|
const vmSymbols::SID _sid;
|
2011-01-27 16:11:27 -08:00
|
|
|
DEBUG_ONLY( bool sid_ok() { return vmSymbols::find_sid(get_symbol()) == _sid; } )
|
2010-05-01 02:42:18 -07:00
|
|
|
|
2011-01-27 16:11:27 -08:00
|
|
|
ciSymbol(Symbol* s); // normal case, for symbols not mentioned in vmSymbols
|
|
|
|
ciSymbol(Symbol* s, vmSymbols::SID sid); // for use with vmSymbols
|
2007-12-01 00:00:00 +00:00
|
|
|
|
2011-01-27 16:11:27 -08:00
|
|
|
Symbol* get_symbol() const { return _symbol; }
|
2007-12-01 00:00:00 +00:00
|
|
|
|
|
|
|
const char* type_string() { return "ciSymbol"; }
|
|
|
|
|
|
|
|
void print_impl(outputStream* st);
|
|
|
|
|
2011-01-27 16:11:27 -08:00
|
|
|
// This is public in Symbol* but private here, because the base can move:
|
2018-10-03 09:46:46 -04:00
|
|
|
const u1* base();
|
2007-12-01 00:00:00 +00:00
|
|
|
|
|
|
|
// Make a ciSymbol from a C string (implementation).
|
|
|
|
static ciSymbol* make_impl(const char* s);
|
|
|
|
|
|
|
|
public:
|
2010-05-01 02:42:18 -07:00
|
|
|
// The enumeration ID from vmSymbols, or vmSymbols::NO_SID if none.
|
|
|
|
vmSymbols::SID sid() const { return _sid; }
|
|
|
|
|
2007-12-01 00:00:00 +00:00
|
|
|
// The text of the symbol as a null-terminated utf8 string.
|
|
|
|
const char* as_utf8();
|
|
|
|
int utf8_length();
|
|
|
|
|
2012-11-12 14:03:53 -08:00
|
|
|
// The text of the symbol as ascii with all non-printable characters quoted as \u####
|
|
|
|
const char* as_quoted_ascii();
|
|
|
|
|
2018-10-03 09:46:46 -04:00
|
|
|
// Return the i-th utf byte as a char, where i < utf8_length
|
|
|
|
char char_at(int i);
|
2010-01-05 15:21:25 +01:00
|
|
|
|
|
|
|
// Tests if the symbol starts with the given prefix.
|
|
|
|
bool starts_with(const char* prefix, int len) const;
|
|
|
|
|
|
|
|
// Determines where the symbol contains the given substring.
|
|
|
|
int index_of_at(int i, const char* str, int len) const;
|
|
|
|
|
2007-12-01 00:00:00 +00:00
|
|
|
void print_symbol_on(outputStream* st);
|
|
|
|
void print_symbol() {
|
|
|
|
print_symbol_on(tty);
|
|
|
|
}
|
2014-04-10 11:38:12 +02:00
|
|
|
const char* as_klass_external_name() const;
|
2007-12-01 00:00:00 +00:00
|
|
|
|
|
|
|
// Make a ciSymbol from a C string.
|
|
|
|
// Consider adding to vmSymbols.hpp instead of using this constructor.
|
|
|
|
// (Your code will be less subject to typographical bugs.)
|
|
|
|
static ciSymbol* make(const char* s);
|
|
|
|
|
|
|
|
#define CI_SYMBOL_DECLARE(name, ignore_def) \
|
|
|
|
static ciSymbol* name() { return ciObjectFactory::vm_symbol_at(vmSymbols::VM_SYMBOL_ENUM_NAME(name)); }
|
|
|
|
VM_SYMBOLS_DO(CI_SYMBOL_DECLARE, CI_SYMBOL_DECLARE)
|
|
|
|
#undef CI_SYMBOL_DECLARE
|
2011-01-27 16:11:27 -08:00
|
|
|
|
|
|
|
void print() {
|
|
|
|
_symbol->print();
|
|
|
|
}
|
|
|
|
|
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
|
|
|
virtual bool is_symbol() const { return true; }
|
|
|
|
|
2011-01-27 16:11:27 -08:00
|
|
|
// Are two ciSymbols equal?
|
|
|
|
bool equals(ciSymbol* obj) { return this->_symbol == obj->get_symbol(); }
|
2012-07-24 10:51:00 -07:00
|
|
|
|
|
|
|
bool is_signature_polymorphic_name() const;
|
2007-12-01 00:00:00 +00:00
|
|
|
};
|
2010-11-23 13:22:55 -08:00
|
|
|
|
2019-01-10 15:13:51 -05:00
|
|
|
#endif // SHARE_CI_CISYMBOL_HPP
|