src/share/vm/ci/ciSymbol.hpp

Mon, 12 Nov 2012 14:03:53 -0800

author
minqi
date
Mon, 12 Nov 2012 14:03:53 -0800
changeset 4267
bd7a7ce2e264
parent 4037
da91efe96a93
child 5732
b2e698d2276c
permissions
-rw-r--r--

6830717: replay of compilations would help with debugging
Summary: When java process crashed in compiler thread, repeat the compilation process will help finding root cause. This is done with using SA dump application class data and replay data from core dump, then use debug version of jvm to recompile the problematic java method.
Reviewed-by: kvn, twisti, sspitsyn
Contributed-by: yumin.qi@oracle.com

duke@435 1 /*
coleenp@4037 2 * Copyright (c) 1999, 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_CI_CISYMBOL_HPP
stefank@2314 26 #define SHARE_VM_CI_CISYMBOL_HPP
stefank@2314 27
coleenp@4037 28 #include "ci/ciBaseObject.hpp"
stefank@2314 29 #include "ci/ciObject.hpp"
stefank@2314 30 #include "ci/ciObjectFactory.hpp"
stefank@2314 31 #include "classfile/vmSymbols.hpp"
coleenp@2497 32 #include "oops/symbol.hpp"
stefank@2314 33
duke@435 34 // ciSymbol
duke@435 35 //
coleenp@2497 36 // This class represents a Symbol* in the HotSpot virtual
duke@435 37 // machine.
coleenp@4037 38 class ciSymbol : public ciBaseObject {
coleenp@2497 39 Symbol* _symbol;
coleenp@2497 40
duke@435 41 CI_PACKAGE_ACCESS
coleenp@2497 42 // These friends all make direct use of get_symbol:
duke@435 43 friend class ciEnv;
duke@435 44 friend class ciInstanceKlass;
duke@435 45 friend class ciSignature;
duke@435 46 friend class ciMethod;
duke@435 47 friend class ciObjArrayKlass;
duke@435 48
duke@435 49 private:
jrose@1862 50 const vmSymbols::SID _sid;
coleenp@2497 51 DEBUG_ONLY( bool sid_ok() { return vmSymbols::find_sid(get_symbol()) == _sid; } )
jrose@1862 52
coleenp@2497 53 ciSymbol(Symbol* s); // normal case, for symbols not mentioned in vmSymbols
coleenp@2497 54 ciSymbol(Symbol* s, vmSymbols::SID sid); // for use with vmSymbols
duke@435 55
coleenp@2497 56 Symbol* get_symbol() const { return _symbol; }
duke@435 57
duke@435 58 const char* type_string() { return "ciSymbol"; }
duke@435 59
duke@435 60 void print_impl(outputStream* st);
duke@435 61
coleenp@2497 62 // This is public in Symbol* but private here, because the base can move:
coleenp@2497 63 const jbyte* base();
duke@435 64
duke@435 65 // Make a ciSymbol from a C string (implementation).
duke@435 66 static ciSymbol* make_impl(const char* s);
duke@435 67
duke@435 68 public:
jrose@1862 69 // The enumeration ID from vmSymbols, or vmSymbols::NO_SID if none.
jrose@1862 70 vmSymbols::SID sid() const { return _sid; }
jrose@1862 71
duke@435 72 // The text of the symbol as a null-terminated utf8 string.
duke@435 73 const char* as_utf8();
duke@435 74 int utf8_length();
duke@435 75
minqi@4267 76 // The text of the symbol as ascii with all non-printable characters quoted as \u####
minqi@4267 77 const char* as_quoted_ascii();
minqi@4267 78
twisti@1573 79 // Return the i-th utf8 byte, where i < utf8_length
twisti@1573 80 int byte_at(int i);
twisti@1573 81
twisti@1573 82 // Tests if the symbol starts with the given prefix.
twisti@1573 83 bool starts_with(const char* prefix, int len) const;
twisti@1573 84
twisti@1573 85 // Determines where the symbol contains the given substring.
twisti@1573 86 int index_of_at(int i, const char* str, int len) const;
twisti@1573 87
duke@435 88 void print_symbol_on(outputStream* st);
duke@435 89 void print_symbol() {
duke@435 90 print_symbol_on(tty);
duke@435 91 }
duke@435 92
duke@435 93 // Make a ciSymbol from a C string.
duke@435 94 // Consider adding to vmSymbols.hpp instead of using this constructor.
duke@435 95 // (Your code will be less subject to typographical bugs.)
duke@435 96 static ciSymbol* make(const char* s);
duke@435 97
duke@435 98 #define CI_SYMBOL_DECLARE(name, ignore_def) \
duke@435 99 static ciSymbol* name() { return ciObjectFactory::vm_symbol_at(vmSymbols::VM_SYMBOL_ENUM_NAME(name)); }
duke@435 100 VM_SYMBOLS_DO(CI_SYMBOL_DECLARE, CI_SYMBOL_DECLARE)
duke@435 101 #undef CI_SYMBOL_DECLARE
coleenp@2497 102
coleenp@2497 103 void print() {
coleenp@2497 104 _symbol->print();
coleenp@2497 105 }
coleenp@2497 106
coleenp@4037 107 virtual bool is_symbol() const { return true; }
coleenp@4037 108
coleenp@2497 109 // Are two ciSymbols equal?
coleenp@2497 110 bool equals(ciSymbol* obj) { return this->_symbol == obj->get_symbol(); }
twisti@3969 111
twisti@3969 112 bool is_signature_polymorphic_name() const;
duke@435 113 };
stefank@2314 114
stefank@2314 115 #endif // SHARE_VM_CI_CISYMBOL_HPP

mercurial