Mercurial > hg > truffle
annotate src/share/vm/ci/ciSymbol.cpp @ 3187:6ff76a1b8339
The benchmark tool should now print zero values to the csv file, if a benchmark fails
author | Josef Haider <josef.haider@khg.jku.at> |
---|---|
date | Thu, 07 Jul 2011 19:43:17 +0200 |
parents | 1d1603768966 |
children | 1d7922586cf6 |
rev | line source |
---|---|
0 | 1 /* |
2426
1d1603768966
7010070: Update all 2010 Oracle-changed OpenJDK files to have the proper copyright dates - second pass
trims
parents:
2177
diff
changeset
|
2 * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved. |
0 | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | |
5 * This code is free software; you can redistribute it and/or modify it | |
6 * under the terms of the GNU General Public License version 2 only, as | |
7 * published by the Free Software Foundation. | |
8 * | |
9 * This code is distributed in the hope that it will be useful, but WITHOUT | |
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
12 * version 2 for more details (a copy is included in the LICENSE file that | |
13 * accompanied this code). | |
14 * | |
15 * You should have received a copy of the GNU General Public License version | |
16 * 2 along with this work; if not, write to the Free Software Foundation, | |
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | |
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 | 22 * |
23 */ | |
24 | |
1972 | 25 #include "precompiled.hpp" |
26 #include "ci/ciSymbol.hpp" | |
27 #include "ci/ciUtilities.hpp" | |
28 #include "memory/oopFactory.hpp" | |
0 | 29 |
30 // ------------------------------------------------------------------ | |
31 // ciSymbol::ciSymbol | |
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 | 49 } |
50 | |
51 // ciSymbol | |
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 | 54 // machine. |
55 | |
56 // ------------------------------------------------------------------ | |
57 // ciSymbol::as_utf8 | |
58 // | |
59 // The text of the symbol as a null-terminated C string. | |
60 const char* ciSymbol::as_utf8() { | |
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 | 63 return s->as_utf8(); |
64 } | |
65 | |
66 // ------------------------------------------------------------------ | |
67 // ciSymbol::base | |
2177
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
68 const jbyte* ciSymbol::base() { |
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
69 GUARDED_VM_ENTRY(return get_symbol()->base();) |
0 | 70 } |
71 | |
72 // ------------------------------------------------------------------ | |
73 // ciSymbol::byte_at | |
74 int ciSymbol::byte_at(int i) { | |
2177
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
75 GUARDED_VM_ENTRY(return get_symbol()->byte_at(i);) |
0 | 76 } |
77 | |
78 // ------------------------------------------------------------------ | |
1138
dd57230ba8fe
6893268: additional dynamic language related optimizations in C2
twisti
parents:
0
diff
changeset
|
79 // ciSymbol::starts_with |
dd57230ba8fe
6893268: additional dynamic language related optimizations in C2
twisti
parents:
0
diff
changeset
|
80 // |
dd57230ba8fe
6893268: additional dynamic language related optimizations in C2
twisti
parents:
0
diff
changeset
|
81 // Tests if the symbol starts with the given prefix. |
dd57230ba8fe
6893268: additional dynamic language related optimizations in C2
twisti
parents:
0
diff
changeset
|
82 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
|
83 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
|
84 } |
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 // ------------------------------------------------------------------ |
dd57230ba8fe
6893268: additional dynamic language related optimizations in C2
twisti
parents:
0
diff
changeset
|
87 // ciSymbol::index_of |
dd57230ba8fe
6893268: additional dynamic language related optimizations in C2
twisti
parents:
0
diff
changeset
|
88 // |
dd57230ba8fe
6893268: additional dynamic language related optimizations in C2
twisti
parents:
0
diff
changeset
|
89 // Determines where the symbol contains the given substring. |
dd57230ba8fe
6893268: additional dynamic language related optimizations in C2
twisti
parents:
0
diff
changeset
|
90 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
|
91 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
|
92 } |
dd57230ba8fe
6893268: additional dynamic language related optimizations in C2
twisti
parents:
0
diff
changeset
|
93 |
dd57230ba8fe
6893268: additional dynamic language related optimizations in C2
twisti
parents:
0
diff
changeset
|
94 // ------------------------------------------------------------------ |
0 | 95 // ciSymbol::utf8_length |
96 int ciSymbol::utf8_length() { | |
2177
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
97 GUARDED_VM_ENTRY(return get_symbol()->utf8_length();) |
0 | 98 } |
99 | |
100 // ------------------------------------------------------------------ | |
101 // ciSymbol::print_impl | |
102 // | |
103 // Implementation of the print method | |
104 void ciSymbol::print_impl(outputStream* st) { | |
105 st->print(" value="); | |
106 print_symbol_on(st); | |
107 } | |
108 | |
109 // ------------------------------------------------------------------ | |
110 // ciSymbol::print_symbol_on | |
111 // | |
112 // Print the value of this symbol on an outputStream | |
113 void ciSymbol::print_symbol_on(outputStream *st) { | |
2177
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
114 GUARDED_VM_ENTRY(get_symbol()->print_symbol_on(st);) |
0 | 115 } |
116 | |
117 // ------------------------------------------------------------------ | |
118 // ciSymbol::make_impl | |
119 // | |
120 // Make a ciSymbol from a C string (implementation). | |
121 ciSymbol* ciSymbol::make_impl(const char* s) { | |
122 EXCEPTION_CONTEXT; | |
2177
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
123 TempNewSymbol sym = SymbolTable::new_symbol(s, THREAD); |
0 | 124 if (HAS_PENDING_EXCEPTION) { |
125 CLEAR_PENDING_EXCEPTION; | |
126 CURRENT_THREAD_ENV->record_out_of_memory_failure(); | |
127 return ciEnv::_unloaded_cisymbol; | |
128 } | |
2177
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
129 return CURRENT_THREAD_ENV->get_symbol(sym); |
0 | 130 } |
131 | |
132 // ------------------------------------------------------------------ | |
133 // ciSymbol::make | |
134 // | |
135 // Make a ciSymbol from a C string. | |
136 ciSymbol* ciSymbol::make(const char* s) { | |
137 GUARDED_VM_ENTRY(return make_impl(s);) | |
138 } |