annotate src/share/vm/ci/ciSymbol.cpp @ 1994:6cd6d394f280

7001033: assert(gch->gc_cause() == GCCause::_scavenge_alot || !gch->incremental_collection_failed()) 7002546: regression on SpecJbb2005 on 7b118 comparing to 7b117 on small heaps Summary: Relaxed assertion checking related to incremental_collection_failed flag to allow for ExplicitGCInvokesConcurrent behaviour where we do not want a failing scavenge to bail to a stop-world collection. Parameterized incremental_collection_will_fail() so we can selectively use, or not use, as appropriate, the statistical prediction at specific use sites. This essentially reverts the scavenge bail-out logic to what it was prior to some recent changes that had inadvertently started using the statistical prediction which can be noisy in the presence of bursty loads. Added some associated verbose non-product debugging messages. Reviewed-by: johnc, tonyp
author ysr
date Tue, 07 Dec 2010 21:55:53 -0800
parents f95d63e2154a
children 3582bf76420e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 /*
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
2 * Copyright (c) 1999, 2010, 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 //
a61af66fc99e Initial load
duke
parents:
diff changeset
33 // Preallocated handle variant. Used with handles from vmSymboHandles.
1507
cd5dbf694d45 6939134: JSR 292 adjustments to method handle invocation
jrose
parents: 1138
diff changeset
34 ciSymbol::ciSymbol(symbolHandle h_s, vmSymbols::SID sid)
cd5dbf694d45 6939134: JSR 292 adjustments to method handle invocation
jrose
parents: 1138
diff changeset
35 : ciObject(h_s), _sid(sid)
cd5dbf694d45 6939134: JSR 292 adjustments to method handle invocation
jrose
parents: 1138
diff changeset
36 {
cd5dbf694d45 6939134: JSR 292 adjustments to method handle invocation
jrose
parents: 1138
diff changeset
37 assert(sid_ok(), "must be in vmSymbols");
cd5dbf694d45 6939134: JSR 292 adjustments to method handle invocation
jrose
parents: 1138
diff changeset
38 }
cd5dbf694d45 6939134: JSR 292 adjustments to method handle invocation
jrose
parents: 1138
diff changeset
39
cd5dbf694d45 6939134: JSR 292 adjustments to method handle invocation
jrose
parents: 1138
diff changeset
40 // Normal case for non-famous symbols.
cd5dbf694d45 6939134: JSR 292 adjustments to method handle invocation
jrose
parents: 1138
diff changeset
41 ciSymbol::ciSymbol(symbolOop s)
cd5dbf694d45 6939134: JSR 292 adjustments to method handle invocation
jrose
parents: 1138
diff changeset
42 : ciObject(s), _sid(vmSymbols::NO_SID)
cd5dbf694d45 6939134: JSR 292 adjustments to method handle invocation
jrose
parents: 1138
diff changeset
43 {
cd5dbf694d45 6939134: JSR 292 adjustments to method handle invocation
jrose
parents: 1138
diff changeset
44 assert(sid_ok(), "must not be in vmSymbols");
0
a61af66fc99e Initial load
duke
parents:
diff changeset
45 }
a61af66fc99e Initial load
duke
parents:
diff changeset
46
a61af66fc99e Initial load
duke
parents:
diff changeset
47 // ciSymbol
a61af66fc99e Initial load
duke
parents:
diff changeset
48 //
a61af66fc99e Initial load
duke
parents:
diff changeset
49 // This class represents a symbolOop in the HotSpot virtual
a61af66fc99e Initial load
duke
parents:
diff changeset
50 // machine.
a61af66fc99e Initial load
duke
parents:
diff changeset
51
a61af66fc99e Initial load
duke
parents:
diff changeset
52 // ------------------------------------------------------------------
a61af66fc99e Initial load
duke
parents:
diff changeset
53 // ciSymbol::as_utf8
a61af66fc99e Initial load
duke
parents:
diff changeset
54 //
a61af66fc99e Initial load
duke
parents:
diff changeset
55 // The text of the symbol as a null-terminated C string.
a61af66fc99e Initial load
duke
parents:
diff changeset
56 const char* ciSymbol::as_utf8() {
a61af66fc99e Initial load
duke
parents:
diff changeset
57 VM_QUICK_ENTRY_MARK;
a61af66fc99e Initial load
duke
parents:
diff changeset
58 symbolOop s = get_symbolOop();
a61af66fc99e Initial load
duke
parents:
diff changeset
59 return s->as_utf8();
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::base
a61af66fc99e Initial load
duke
parents:
diff changeset
64 jbyte* ciSymbol::base() {
a61af66fc99e Initial load
duke
parents:
diff changeset
65 GUARDED_VM_ENTRY(return get_symbolOop()->base();)
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::byte_at
a61af66fc99e Initial load
duke
parents:
diff changeset
70 int ciSymbol::byte_at(int i) {
a61af66fc99e Initial load
duke
parents:
diff changeset
71 GUARDED_VM_ENTRY(return get_symbolOop()->byte_at(i);)
a61af66fc99e Initial load
duke
parents:
diff changeset
72 }
a61af66fc99e Initial load
duke
parents:
diff changeset
73
a61af66fc99e Initial load
duke
parents:
diff changeset
74 // ------------------------------------------------------------------
1138
dd57230ba8fe 6893268: additional dynamic language related optimizations in C2
twisti
parents: 0
diff changeset
75 // ciSymbol::starts_with
dd57230ba8fe 6893268: additional dynamic language related optimizations in C2
twisti
parents: 0
diff changeset
76 //
dd57230ba8fe 6893268: additional dynamic language related optimizations in C2
twisti
parents: 0
diff changeset
77 // Tests if the symbol starts with the given prefix.
dd57230ba8fe 6893268: additional dynamic language related optimizations in C2
twisti
parents: 0
diff changeset
78 bool ciSymbol::starts_with(const char* prefix, int len) const {
dd57230ba8fe 6893268: additional dynamic language related optimizations in C2
twisti
parents: 0
diff changeset
79 GUARDED_VM_ENTRY(return get_symbolOop()->starts_with(prefix, len);)
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
dd57230ba8fe 6893268: additional dynamic language related optimizations in C2
twisti
parents: 0
diff changeset
82 // ------------------------------------------------------------------
dd57230ba8fe 6893268: additional dynamic language related optimizations in C2
twisti
parents: 0
diff changeset
83 // ciSymbol::index_of
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 // Determines where the symbol contains the given substring.
dd57230ba8fe 6893268: additional dynamic language related optimizations in C2
twisti
parents: 0
diff changeset
86 int ciSymbol::index_of_at(int i, const char* str, int len) const {
dd57230ba8fe 6893268: additional dynamic language related optimizations in C2
twisti
parents: 0
diff changeset
87 GUARDED_VM_ENTRY(return get_symbolOop()->index_of_at(i, str, len);)
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
dd57230ba8fe 6893268: additional dynamic language related optimizations in C2
twisti
parents: 0
diff changeset
90 // ------------------------------------------------------------------
0
a61af66fc99e Initial load
duke
parents:
diff changeset
91 // ciSymbol::utf8_length
a61af66fc99e Initial load
duke
parents:
diff changeset
92 int ciSymbol::utf8_length() {
a61af66fc99e Initial load
duke
parents:
diff changeset
93 GUARDED_VM_ENTRY(return get_symbolOop()->utf8_length();)
a61af66fc99e Initial load
duke
parents:
diff changeset
94 }
a61af66fc99e Initial load
duke
parents:
diff changeset
95
a61af66fc99e Initial load
duke
parents:
diff changeset
96 // ------------------------------------------------------------------
a61af66fc99e Initial load
duke
parents:
diff changeset
97 // ciSymbol::print_impl
a61af66fc99e Initial load
duke
parents:
diff changeset
98 //
a61af66fc99e Initial load
duke
parents:
diff changeset
99 // Implementation of the print method
a61af66fc99e Initial load
duke
parents:
diff changeset
100 void ciSymbol::print_impl(outputStream* st) {
a61af66fc99e Initial load
duke
parents:
diff changeset
101 st->print(" value=");
a61af66fc99e Initial load
duke
parents:
diff changeset
102 print_symbol_on(st);
a61af66fc99e Initial load
duke
parents:
diff changeset
103 }
a61af66fc99e Initial load
duke
parents:
diff changeset
104
a61af66fc99e Initial load
duke
parents:
diff changeset
105 // ------------------------------------------------------------------
a61af66fc99e Initial load
duke
parents:
diff changeset
106 // ciSymbol::print_symbol_on
a61af66fc99e Initial load
duke
parents:
diff changeset
107 //
a61af66fc99e Initial load
duke
parents:
diff changeset
108 // Print the value of this symbol on an outputStream
a61af66fc99e Initial load
duke
parents:
diff changeset
109 void ciSymbol::print_symbol_on(outputStream *st) {
a61af66fc99e Initial load
duke
parents:
diff changeset
110 GUARDED_VM_ENTRY(get_symbolOop()->print_symbol_on(st);)
a61af66fc99e Initial load
duke
parents:
diff changeset
111 }
a61af66fc99e Initial load
duke
parents:
diff changeset
112
a61af66fc99e Initial load
duke
parents:
diff changeset
113 // ------------------------------------------------------------------
a61af66fc99e Initial load
duke
parents:
diff changeset
114 // ciSymbol::make_impl
a61af66fc99e Initial load
duke
parents:
diff changeset
115 //
a61af66fc99e Initial load
duke
parents:
diff changeset
116 // Make a ciSymbol from a C string (implementation).
a61af66fc99e Initial load
duke
parents:
diff changeset
117 ciSymbol* ciSymbol::make_impl(const char* s) {
a61af66fc99e Initial load
duke
parents:
diff changeset
118 EXCEPTION_CONTEXT;
a61af66fc99e Initial load
duke
parents:
diff changeset
119 // For some reason, oopFactory::new_symbol doesn't declare its
a61af66fc99e Initial load
duke
parents:
diff changeset
120 // char* argument as const.
a61af66fc99e Initial load
duke
parents:
diff changeset
121 symbolOop sym = oopFactory::new_symbol((char*)s, (int)strlen(s), THREAD);
a61af66fc99e Initial load
duke
parents:
diff changeset
122 if (HAS_PENDING_EXCEPTION) {
a61af66fc99e Initial load
duke
parents:
diff changeset
123 CLEAR_PENDING_EXCEPTION;
a61af66fc99e Initial load
duke
parents:
diff changeset
124 CURRENT_THREAD_ENV->record_out_of_memory_failure();
a61af66fc99e Initial load
duke
parents:
diff changeset
125 return ciEnv::_unloaded_cisymbol;
a61af66fc99e Initial load
duke
parents:
diff changeset
126 }
a61af66fc99e Initial load
duke
parents:
diff changeset
127 return CURRENT_THREAD_ENV->get_object(sym)->as_symbol();
a61af66fc99e Initial load
duke
parents:
diff changeset
128 }
a61af66fc99e Initial load
duke
parents:
diff changeset
129
a61af66fc99e Initial load
duke
parents:
diff changeset
130 // ------------------------------------------------------------------
a61af66fc99e Initial load
duke
parents:
diff changeset
131 // ciSymbol::make
a61af66fc99e Initial load
duke
parents:
diff changeset
132 //
a61af66fc99e Initial load
duke
parents:
diff changeset
133 // Make a ciSymbol from a C string.
a61af66fc99e Initial load
duke
parents:
diff changeset
134 ciSymbol* ciSymbol::make(const char* s) {
a61af66fc99e Initial load
duke
parents:
diff changeset
135 GUARDED_VM_ENTRY(return make_impl(s);)
a61af66fc99e Initial load
duke
parents:
diff changeset
136 }