src/share/vm/ci/ciSymbol.hpp

Thu, 27 May 2010 19:08:38 -0700

author
trims
date
Thu, 27 May 2010 19:08:38 -0700
changeset 1907
c18cbe5936b8
parent 1862
cd5dbf694d45
child 2314
f95d63e2154a
permissions
-rw-r--r--

6941466: Oracle rebranding changes for Hotspot repositories
Summary: Change all the Sun copyrights to Oracle copyright
Reviewed-by: ohair

duke@435 1 /*
trims@1907 2 * Copyright (c) 1999, 2009, 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
duke@435 25 // ciSymbol
duke@435 26 //
duke@435 27 // This class represents a symbolOop in the HotSpot virtual
duke@435 28 // machine.
duke@435 29 class ciSymbol : public ciObject {
duke@435 30 CI_PACKAGE_ACCESS
twisti@1573 31 // These friends all make direct use of get_symbolOop:
duke@435 32 friend class ciEnv;
duke@435 33 friend class ciInstanceKlass;
duke@435 34 friend class ciSignature;
duke@435 35 friend class ciMethod;
duke@435 36 friend class ciObjArrayKlass;
duke@435 37
duke@435 38 private:
jrose@1862 39 const vmSymbols::SID _sid;
jrose@1862 40 DEBUG_ONLY( bool sid_ok() { return vmSymbols::find_sid(get_symbolOop()) == _sid; } )
jrose@1862 41
jrose@1862 42 ciSymbol(symbolOop s); // normal case, for symbols not mentioned in vmSymbols
jrose@1862 43 ciSymbol(symbolHandle s, vmSymbols::SID sid); // for use with vmSymbolHandles
duke@435 44
twisti@1573 45 symbolOop get_symbolOop() const { return (symbolOop)get_oop(); }
duke@435 46
duke@435 47 const char* type_string() { return "ciSymbol"; }
duke@435 48
duke@435 49 void print_impl(outputStream* st);
duke@435 50
twisti@1573 51 // This is public in symbolOop but private here, because the base can move:
duke@435 52 jbyte* base();
duke@435 53
duke@435 54 // Make a ciSymbol from a C string (implementation).
duke@435 55 static ciSymbol* make_impl(const char* s);
duke@435 56
duke@435 57 public:
jrose@1862 58 // The enumeration ID from vmSymbols, or vmSymbols::NO_SID if none.
jrose@1862 59 vmSymbols::SID sid() const { return _sid; }
jrose@1862 60
duke@435 61 // The text of the symbol as a null-terminated utf8 string.
duke@435 62 const char* as_utf8();
duke@435 63 int utf8_length();
duke@435 64
twisti@1573 65 // Return the i-th utf8 byte, where i < utf8_length
twisti@1573 66 int byte_at(int i);
twisti@1573 67
twisti@1573 68 // Tests if the symbol starts with the given prefix.
twisti@1573 69 bool starts_with(const char* prefix, int len) const;
twisti@1573 70
twisti@1573 71 // Determines where the symbol contains the given substring.
twisti@1573 72 int index_of_at(int i, const char* str, int len) const;
twisti@1573 73
duke@435 74 // What kind of ciObject is this?
duke@435 75 bool is_symbol() { return true; }
duke@435 76
duke@435 77 void print_symbol_on(outputStream* st);
duke@435 78 void print_symbol() {
duke@435 79 print_symbol_on(tty);
duke@435 80 }
duke@435 81
duke@435 82 // Make a ciSymbol from a C string.
duke@435 83 // Consider adding to vmSymbols.hpp instead of using this constructor.
duke@435 84 // (Your code will be less subject to typographical bugs.)
duke@435 85 static ciSymbol* make(const char* s);
duke@435 86
duke@435 87 #define CI_SYMBOL_DECLARE(name, ignore_def) \
duke@435 88 static ciSymbol* name() { return ciObjectFactory::vm_symbol_at(vmSymbols::VM_SYMBOL_ENUM_NAME(name)); }
duke@435 89 VM_SYMBOLS_DO(CI_SYMBOL_DECLARE, CI_SYMBOL_DECLARE)
duke@435 90 #undef CI_SYMBOL_DECLARE
duke@435 91 };

mercurial