annotate src/share/vm/ci/ciSymbol.cpp @ 666:ebebd376f657

6805522: Server VM fails with assertion (block1->start() != block2->start(),"successors have unique bcis") Reviewed-by: kvn
author never
date Mon, 23 Mar 2009 13:58:58 -0700
parents a61af66fc99e
children dd57230ba8fe
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 /*
a61af66fc99e Initial load
duke
parents:
diff changeset
2 * Copyright 1999-2007 Sun Microsystems, Inc. All Rights Reserved.
a61af66fc99e Initial load
duke
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
a61af66fc99e Initial load
duke
parents:
diff changeset
4 *
a61af66fc99e Initial load
duke
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
a61af66fc99e Initial load
duke
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
a61af66fc99e Initial load
duke
parents:
diff changeset
7 * published by the Free Software Foundation.
a61af66fc99e Initial load
duke
parents:
diff changeset
8 *
a61af66fc99e Initial load
duke
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
a61af66fc99e Initial load
duke
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
a61af66fc99e Initial load
duke
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
a61af66fc99e Initial load
duke
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
a61af66fc99e Initial load
duke
parents:
diff changeset
13 * accompanied this code).
a61af66fc99e Initial load
duke
parents:
diff changeset
14 *
a61af66fc99e Initial load
duke
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
a61af66fc99e Initial load
duke
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
a61af66fc99e Initial load
duke
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
a61af66fc99e Initial load
duke
parents:
diff changeset
18 *
a61af66fc99e Initial load
duke
parents:
diff changeset
19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
a61af66fc99e Initial load
duke
parents:
diff changeset
20 * CA 95054 USA or visit www.sun.com if you need additional information or
a61af66fc99e Initial load
duke
parents:
diff changeset
21 * have any questions.
a61af66fc99e Initial load
duke
parents:
diff changeset
22 *
a61af66fc99e Initial load
duke
parents:
diff changeset
23 */
a61af66fc99e Initial load
duke
parents:
diff changeset
24
a61af66fc99e Initial load
duke
parents:
diff changeset
25 #include "incls/_precompiled.incl"
a61af66fc99e Initial load
duke
parents:
diff changeset
26 #include "incls/_ciSymbol.cpp.incl"
a61af66fc99e Initial load
duke
parents:
diff changeset
27
a61af66fc99e Initial load
duke
parents:
diff changeset
28 // ------------------------------------------------------------------
a61af66fc99e Initial load
duke
parents:
diff changeset
29 // ciSymbol::ciSymbol
a61af66fc99e Initial load
duke
parents:
diff changeset
30 //
a61af66fc99e Initial load
duke
parents:
diff changeset
31 // Preallocated handle variant. Used with handles from vmSymboHandles.
a61af66fc99e Initial load
duke
parents:
diff changeset
32 ciSymbol::ciSymbol(symbolHandle h_s) : ciObject(h_s) {
a61af66fc99e Initial load
duke
parents:
diff changeset
33 }
a61af66fc99e Initial load
duke
parents:
diff changeset
34
a61af66fc99e Initial load
duke
parents:
diff changeset
35 // ciSymbol
a61af66fc99e Initial load
duke
parents:
diff changeset
36 //
a61af66fc99e Initial load
duke
parents:
diff changeset
37 // This class represents a symbolOop in the HotSpot virtual
a61af66fc99e Initial load
duke
parents:
diff changeset
38 // machine.
a61af66fc99e Initial load
duke
parents:
diff changeset
39
a61af66fc99e Initial load
duke
parents:
diff changeset
40 // ------------------------------------------------------------------
a61af66fc99e Initial load
duke
parents:
diff changeset
41 // ciSymbol::as_utf8
a61af66fc99e Initial load
duke
parents:
diff changeset
42 //
a61af66fc99e Initial load
duke
parents:
diff changeset
43 // The text of the symbol as a null-terminated C string.
a61af66fc99e Initial load
duke
parents:
diff changeset
44 const char* ciSymbol::as_utf8() {
a61af66fc99e Initial load
duke
parents:
diff changeset
45 VM_QUICK_ENTRY_MARK;
a61af66fc99e Initial load
duke
parents:
diff changeset
46 symbolOop s = get_symbolOop();
a61af66fc99e Initial load
duke
parents:
diff changeset
47 return s->as_utf8();
a61af66fc99e Initial load
duke
parents:
diff changeset
48 }
a61af66fc99e Initial load
duke
parents:
diff changeset
49
a61af66fc99e Initial load
duke
parents:
diff changeset
50 // ------------------------------------------------------------------
a61af66fc99e Initial load
duke
parents:
diff changeset
51 // ciSymbol::base
a61af66fc99e Initial load
duke
parents:
diff changeset
52 jbyte* ciSymbol::base() {
a61af66fc99e Initial load
duke
parents:
diff changeset
53 GUARDED_VM_ENTRY(return get_symbolOop()->base();)
a61af66fc99e Initial load
duke
parents:
diff changeset
54 }
a61af66fc99e Initial load
duke
parents:
diff changeset
55
a61af66fc99e Initial load
duke
parents:
diff changeset
56 // ------------------------------------------------------------------
a61af66fc99e Initial load
duke
parents:
diff changeset
57 // ciSymbol::byte_at
a61af66fc99e Initial load
duke
parents:
diff changeset
58 int ciSymbol::byte_at(int i) {
a61af66fc99e Initial load
duke
parents:
diff changeset
59 GUARDED_VM_ENTRY(return get_symbolOop()->byte_at(i);)
a61af66fc99e Initial load
duke
parents:
diff changeset
60 }
a61af66fc99e Initial load
duke
parents:
diff changeset
61
a61af66fc99e Initial load
duke
parents:
diff changeset
62 // ------------------------------------------------------------------
a61af66fc99e Initial load
duke
parents:
diff changeset
63 // ciSymbol::utf8_length
a61af66fc99e Initial load
duke
parents:
diff changeset
64 int ciSymbol::utf8_length() {
a61af66fc99e Initial load
duke
parents:
diff changeset
65 GUARDED_VM_ENTRY(return get_symbolOop()->utf8_length();)
a61af66fc99e Initial load
duke
parents:
diff changeset
66 }
a61af66fc99e Initial load
duke
parents:
diff changeset
67
a61af66fc99e Initial load
duke
parents:
diff changeset
68 // ------------------------------------------------------------------
a61af66fc99e Initial load
duke
parents:
diff changeset
69 // ciSymbol::print_impl
a61af66fc99e Initial load
duke
parents:
diff changeset
70 //
a61af66fc99e Initial load
duke
parents:
diff changeset
71 // Implementation of the print method
a61af66fc99e Initial load
duke
parents:
diff changeset
72 void ciSymbol::print_impl(outputStream* st) {
a61af66fc99e Initial load
duke
parents:
diff changeset
73 st->print(" value=");
a61af66fc99e Initial load
duke
parents:
diff changeset
74 print_symbol_on(st);
a61af66fc99e Initial load
duke
parents:
diff changeset
75 }
a61af66fc99e Initial load
duke
parents:
diff changeset
76
a61af66fc99e Initial load
duke
parents:
diff changeset
77 // ------------------------------------------------------------------
a61af66fc99e Initial load
duke
parents:
diff changeset
78 // ciSymbol::print_symbol_on
a61af66fc99e Initial load
duke
parents:
diff changeset
79 //
a61af66fc99e Initial load
duke
parents:
diff changeset
80 // Print the value of this symbol on an outputStream
a61af66fc99e Initial load
duke
parents:
diff changeset
81 void ciSymbol::print_symbol_on(outputStream *st) {
a61af66fc99e Initial load
duke
parents:
diff changeset
82 GUARDED_VM_ENTRY(get_symbolOop()->print_symbol_on(st);)
a61af66fc99e Initial load
duke
parents:
diff changeset
83 }
a61af66fc99e Initial load
duke
parents:
diff changeset
84
a61af66fc99e Initial load
duke
parents:
diff changeset
85 // ------------------------------------------------------------------
a61af66fc99e Initial load
duke
parents:
diff changeset
86 // ciSymbol::make_impl
a61af66fc99e Initial load
duke
parents:
diff changeset
87 //
a61af66fc99e Initial load
duke
parents:
diff changeset
88 // Make a ciSymbol from a C string (implementation).
a61af66fc99e Initial load
duke
parents:
diff changeset
89 ciSymbol* ciSymbol::make_impl(const char* s) {
a61af66fc99e Initial load
duke
parents:
diff changeset
90 EXCEPTION_CONTEXT;
a61af66fc99e Initial load
duke
parents:
diff changeset
91 // For some reason, oopFactory::new_symbol doesn't declare its
a61af66fc99e Initial load
duke
parents:
diff changeset
92 // char* argument as const.
a61af66fc99e Initial load
duke
parents:
diff changeset
93 symbolOop sym = oopFactory::new_symbol((char*)s, (int)strlen(s), THREAD);
a61af66fc99e Initial load
duke
parents:
diff changeset
94 if (HAS_PENDING_EXCEPTION) {
a61af66fc99e Initial load
duke
parents:
diff changeset
95 CLEAR_PENDING_EXCEPTION;
a61af66fc99e Initial load
duke
parents:
diff changeset
96 CURRENT_THREAD_ENV->record_out_of_memory_failure();
a61af66fc99e Initial load
duke
parents:
diff changeset
97 return ciEnv::_unloaded_cisymbol;
a61af66fc99e Initial load
duke
parents:
diff changeset
98 }
a61af66fc99e Initial load
duke
parents:
diff changeset
99 return CURRENT_THREAD_ENV->get_object(sym)->as_symbol();
a61af66fc99e Initial load
duke
parents:
diff changeset
100 }
a61af66fc99e Initial load
duke
parents:
diff changeset
101
a61af66fc99e Initial load
duke
parents:
diff changeset
102 // ------------------------------------------------------------------
a61af66fc99e Initial load
duke
parents:
diff changeset
103 // ciSymbol::make
a61af66fc99e Initial load
duke
parents:
diff changeset
104 //
a61af66fc99e Initial load
duke
parents:
diff changeset
105 // Make a ciSymbol from a C string.
a61af66fc99e Initial load
duke
parents:
diff changeset
106 ciSymbol* ciSymbol::make(const char* s) {
a61af66fc99e Initial load
duke
parents:
diff changeset
107 GUARDED_VM_ENTRY(return make_impl(s);)
a61af66fc99e Initial load
duke
parents:
diff changeset
108 }