annotate src/share/vm/ci/ciSymbol.cpp @ 17467:55fb97c4c58d hs25-b65

8029233: Update copyright year to match last edit in jdk8 hotspot repository for 2013 Summary: Copyright year updated for files modified during 2013 Reviewed-by: twisti, iveresov
author mikael
date Tue, 24 Dec 2013 11:48:39 -0800
parents bd7a7ce2e264
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 /*
6842
b9a9ed0f8eeb 7197424: update copyright year to match last edit in jdk8 hotspot repository
mikael
parents: 6266
diff changeset
2 * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
0
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 *
1552
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1507
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1507
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1507
diff changeset
21 * questions.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
22 *
a61af66fc99e Initial load
duke
parents:
diff changeset
23 */
a61af66fc99e Initial load
duke
parents:
diff changeset
24
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
25 #include "precompiled.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
26 #include "ci/ciSymbol.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
27 #include "ci/ciUtilities.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
28 #include "memory/oopFactory.hpp"
0
a61af66fc99e Initial load
duke
parents:
diff changeset
29
a61af66fc99e Initial load
duke
parents:
diff changeset
30 // ------------------------------------------------------------------
a61af66fc99e Initial load
duke
parents:
diff changeset
31 // ciSymbol::ciSymbol
a61af66fc99e Initial load
duke
parents:
diff changeset
32 //
2177
3582bf76420e 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 1972
diff changeset
33 // Preallocated symbol variant. Used with symbols from vmSymbols.
3582bf76420e 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 1972
diff changeset
34 ciSymbol::ciSymbol(Symbol* s, vmSymbols::SID sid)
3582bf76420e 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 1972
diff changeset
35 : _symbol(s), _sid(sid)
1507
cd5dbf694d45 6939134: JSR 292 adjustments to method handle invocation
jrose
parents: 1138
diff changeset
36 {
2177
3582bf76420e 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 1972
diff changeset
37 assert(_symbol != NULL, "adding null symbol");
3582bf76420e 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 1972
diff changeset
38 _symbol->increment_refcount(); // increment ref count
1507
cd5dbf694d45 6939134: JSR 292 adjustments to method handle invocation
jrose
parents: 1138
diff changeset
39 assert(sid_ok(), "must be in vmSymbols");
cd5dbf694d45 6939134: JSR 292 adjustments to method handle invocation
jrose
parents: 1138
diff changeset
40 }
cd5dbf694d45 6939134: JSR 292 adjustments to method handle invocation
jrose
parents: 1138
diff changeset
41
cd5dbf694d45 6939134: JSR 292 adjustments to method handle invocation
jrose
parents: 1138
diff changeset
42 // Normal case for non-famous symbols.
2177
3582bf76420e 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 1972
diff changeset
43 ciSymbol::ciSymbol(Symbol* s)
3582bf76420e 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 1972
diff changeset
44 : _symbol(s), _sid(vmSymbols::NO_SID)
1507
cd5dbf694d45 6939134: JSR 292 adjustments to method handle invocation
jrose
parents: 1138
diff changeset
45 {
2177
3582bf76420e 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 1972
diff changeset
46 assert(_symbol != NULL, "adding null symbol");
3582bf76420e 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 1972
diff changeset
47 _symbol->increment_refcount(); // increment ref count
1507
cd5dbf694d45 6939134: JSR 292 adjustments to method handle invocation
jrose
parents: 1138
diff changeset
48 assert(sid_ok(), "must not be in vmSymbols");
0
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
a61af66fc99e Initial load
duke
parents:
diff changeset
52 //
2177
3582bf76420e 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 1972
diff changeset
53 // This class represents a Symbol* in the HotSpot virtual
0
a61af66fc99e Initial load
duke
parents:
diff changeset
54 // machine.
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::as_utf8
a61af66fc99e Initial load
duke
parents:
diff changeset
58 //
a61af66fc99e Initial load
duke
parents:
diff changeset
59 // The text of the symbol as a null-terminated C string.
a61af66fc99e Initial load
duke
parents:
diff changeset
60 const char* ciSymbol::as_utf8() {
a61af66fc99e Initial load
duke
parents:
diff changeset
61 VM_QUICK_ENTRY_MARK;
2177
3582bf76420e 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 1972
diff changeset
62 Symbol* s = get_symbol();
0
a61af66fc99e Initial load
duke
parents:
diff changeset
63 return s->as_utf8();
a61af66fc99e Initial load
duke
parents:
diff changeset
64 }
a61af66fc99e Initial load
duke
parents:
diff changeset
65
6972
bd7a7ce2e264 6830717: replay of compilations would help with debugging
minqi
parents: 6842
diff changeset
66 // The text of the symbol as a null-terminated C string.
bd7a7ce2e264 6830717: replay of compilations would help with debugging
minqi
parents: 6842
diff changeset
67 const char* ciSymbol::as_quoted_ascii() {
bd7a7ce2e264 6830717: replay of compilations would help with debugging
minqi
parents: 6842
diff changeset
68 GUARDED_VM_QUICK_ENTRY(return get_symbol()->as_quoted_ascii();)
bd7a7ce2e264 6830717: replay of compilations would help with debugging
minqi
parents: 6842
diff changeset
69 }
bd7a7ce2e264 6830717: replay of compilations would help with debugging
minqi
parents: 6842
diff changeset
70
0
a61af66fc99e Initial load
duke
parents:
diff changeset
71 // ------------------------------------------------------------------
a61af66fc99e Initial load
duke
parents:
diff changeset
72 // ciSymbol::base
2177
3582bf76420e 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 1972
diff changeset
73 const jbyte* ciSymbol::base() {
3582bf76420e 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 1972
diff changeset
74 GUARDED_VM_ENTRY(return get_symbol()->base();)
0
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::byte_at
a61af66fc99e Initial load
duke
parents:
diff changeset
79 int ciSymbol::byte_at(int i) {
2177
3582bf76420e 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 1972
diff changeset
80 GUARDED_VM_ENTRY(return get_symbol()->byte_at(i);)
0
a61af66fc99e Initial load
duke
parents:
diff changeset
81 }
a61af66fc99e Initial load
duke
parents:
diff changeset
82
a61af66fc99e Initial load
duke
parents:
diff changeset
83 // ------------------------------------------------------------------
1138
dd57230ba8fe 6893268: additional dynamic language related optimizations in C2
twisti
parents: 0
diff changeset
84 // ciSymbol::starts_with
dd57230ba8fe 6893268: additional dynamic language related optimizations in C2
twisti
parents: 0
diff changeset
85 //
dd57230ba8fe 6893268: additional dynamic language related optimizations in C2
twisti
parents: 0
diff changeset
86 // Tests if the symbol starts with the given prefix.
dd57230ba8fe 6893268: additional dynamic language related optimizations in C2
twisti
parents: 0
diff changeset
87 bool ciSymbol::starts_with(const char* prefix, int len) const {
2177
3582bf76420e 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 1972
diff changeset
88 GUARDED_VM_ENTRY(return get_symbol()->starts_with(prefix, len);)
1138
dd57230ba8fe 6893268: additional dynamic language related optimizations in C2
twisti
parents: 0
diff changeset
89 }
dd57230ba8fe 6893268: additional dynamic language related optimizations in C2
twisti
parents: 0
diff changeset
90
6266
1d7922586cf6 7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents: 2426
diff changeset
91 bool ciSymbol::is_signature_polymorphic_name() const {
1d7922586cf6 7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents: 2426
diff changeset
92 GUARDED_VM_ENTRY(return MethodHandles::is_signature_polymorphic_name(get_symbol());)
1d7922586cf6 7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents: 2426
diff changeset
93 }
1d7922586cf6 7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents: 2426
diff changeset
94
1138
dd57230ba8fe 6893268: additional dynamic language related optimizations in C2
twisti
parents: 0
diff changeset
95 // ------------------------------------------------------------------
dd57230ba8fe 6893268: additional dynamic language related optimizations in C2
twisti
parents: 0
diff changeset
96 // ciSymbol::index_of
dd57230ba8fe 6893268: additional dynamic language related optimizations in C2
twisti
parents: 0
diff changeset
97 //
dd57230ba8fe 6893268: additional dynamic language related optimizations in C2
twisti
parents: 0
diff changeset
98 // Determines where the symbol contains the given substring.
dd57230ba8fe 6893268: additional dynamic language related optimizations in C2
twisti
parents: 0
diff changeset
99 int ciSymbol::index_of_at(int i, const char* str, int len) const {
2177
3582bf76420e 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 1972
diff changeset
100 GUARDED_VM_ENTRY(return get_symbol()->index_of_at(i, str, len);)
1138
dd57230ba8fe 6893268: additional dynamic language related optimizations in C2
twisti
parents: 0
diff changeset
101 }
dd57230ba8fe 6893268: additional dynamic language related optimizations in C2
twisti
parents: 0
diff changeset
102
dd57230ba8fe 6893268: additional dynamic language related optimizations in C2
twisti
parents: 0
diff changeset
103 // ------------------------------------------------------------------
0
a61af66fc99e Initial load
duke
parents:
diff changeset
104 // ciSymbol::utf8_length
a61af66fc99e Initial load
duke
parents:
diff changeset
105 int ciSymbol::utf8_length() {
2177
3582bf76420e 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 1972
diff changeset
106 GUARDED_VM_ENTRY(return get_symbol()->utf8_length();)
0
a61af66fc99e Initial load
duke
parents:
diff changeset
107 }
a61af66fc99e Initial load
duke
parents:
diff changeset
108
a61af66fc99e Initial load
duke
parents:
diff changeset
109 // ------------------------------------------------------------------
a61af66fc99e Initial load
duke
parents:
diff changeset
110 // ciSymbol::print_impl
a61af66fc99e Initial load
duke
parents:
diff changeset
111 //
a61af66fc99e Initial load
duke
parents:
diff changeset
112 // Implementation of the print method
a61af66fc99e Initial load
duke
parents:
diff changeset
113 void ciSymbol::print_impl(outputStream* st) {
a61af66fc99e Initial load
duke
parents:
diff changeset
114 st->print(" value=");
a61af66fc99e Initial load
duke
parents:
diff changeset
115 print_symbol_on(st);
a61af66fc99e Initial load
duke
parents:
diff changeset
116 }
a61af66fc99e Initial load
duke
parents:
diff changeset
117
a61af66fc99e Initial load
duke
parents:
diff changeset
118 // ------------------------------------------------------------------
a61af66fc99e Initial load
duke
parents:
diff changeset
119 // ciSymbol::print_symbol_on
a61af66fc99e Initial load
duke
parents:
diff changeset
120 //
a61af66fc99e Initial load
duke
parents:
diff changeset
121 // Print the value of this symbol on an outputStream
a61af66fc99e Initial load
duke
parents:
diff changeset
122 void ciSymbol::print_symbol_on(outputStream *st) {
2177
3582bf76420e 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 1972
diff changeset
123 GUARDED_VM_ENTRY(get_symbol()->print_symbol_on(st);)
0
a61af66fc99e Initial load
duke
parents:
diff changeset
124 }
a61af66fc99e Initial load
duke
parents:
diff changeset
125
a61af66fc99e Initial load
duke
parents:
diff changeset
126 // ------------------------------------------------------------------
a61af66fc99e Initial load
duke
parents:
diff changeset
127 // ciSymbol::make_impl
a61af66fc99e Initial load
duke
parents:
diff changeset
128 //
a61af66fc99e Initial load
duke
parents:
diff changeset
129 // Make a ciSymbol from a C string (implementation).
a61af66fc99e Initial load
duke
parents:
diff changeset
130 ciSymbol* ciSymbol::make_impl(const char* s) {
a61af66fc99e Initial load
duke
parents:
diff changeset
131 EXCEPTION_CONTEXT;
2177
3582bf76420e 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 1972
diff changeset
132 TempNewSymbol sym = SymbolTable::new_symbol(s, THREAD);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
133 if (HAS_PENDING_EXCEPTION) {
a61af66fc99e Initial load
duke
parents:
diff changeset
134 CLEAR_PENDING_EXCEPTION;
a61af66fc99e Initial load
duke
parents:
diff changeset
135 CURRENT_THREAD_ENV->record_out_of_memory_failure();
a61af66fc99e Initial load
duke
parents:
diff changeset
136 return ciEnv::_unloaded_cisymbol;
a61af66fc99e Initial load
duke
parents:
diff changeset
137 }
2177
3582bf76420e 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 1972
diff changeset
138 return CURRENT_THREAD_ENV->get_symbol(sym);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
139 }
a61af66fc99e Initial load
duke
parents:
diff changeset
140
a61af66fc99e Initial load
duke
parents:
diff changeset
141 // ------------------------------------------------------------------
a61af66fc99e Initial load
duke
parents:
diff changeset
142 // ciSymbol::make
a61af66fc99e Initial load
duke
parents:
diff changeset
143 //
a61af66fc99e Initial load
duke
parents:
diff changeset
144 // Make a ciSymbol from a C string.
a61af66fc99e Initial load
duke
parents:
diff changeset
145 ciSymbol* ciSymbol::make(const char* s) {
a61af66fc99e Initial load
duke
parents:
diff changeset
146 GUARDED_VM_ENTRY(return make_impl(s);)
a61af66fc99e Initial load
duke
parents:
diff changeset
147 }