202
203 // Alternate hashing for unbalanced symbol tables.
204 unsigned int Symbol::new_hash(juint seed) {
205 ResourceMark rm;
206 // Use alternate hashing algorithm on this symbol.
207 return AltHashing::murmur3_32(seed, (const jbyte*)as_C_string(), utf8_length());
208 }
209
210 void Symbol::increment_refcount() {
211 // Only increment the refcount if non-negative. If negative either
212 // overflow has occurred or it is a permanent symbol in a read only
213 // shared archive.
214 if (_refcount >= 0) { // not a permanent symbol
215 Atomic::inc(&_refcount);
216 NOT_PRODUCT(Atomic::inc(&_total_count);)
217 }
218 }
219
220 void Symbol::decrement_refcount() {
221 if (_refcount >= 0) { // not a permanent symbol
222 jshort new_value = Atomic::add(-1, &_refcount);
223 #ifdef ASSERT
224 if (new_value == -1) { // we have transitioned from 0 -> -1
225 print();
226 assert(false, "reference count underflow for symbol");
227 }
228 #endif
229 (void)new_value;
230 }
231 }
232
233 void Symbol::metaspace_pointers_do(MetaspaceClosure* it) {
234 if (log_is_enabled(Trace, cds)) {
235 LogStream trace_stream(Log(cds)::trace());
236 trace_stream.print("Iter(Symbol): %p ", this);
237 print_value_on(&trace_stream);
238 trace_stream.cr();
239 }
240 }
241
242 void Symbol::print_on(outputStream* st) const {
|
202
203 // Alternate hashing for unbalanced symbol tables.
204 unsigned int Symbol::new_hash(juint seed) {
205 ResourceMark rm;
206 // Use alternate hashing algorithm on this symbol.
207 return AltHashing::murmur3_32(seed, (const jbyte*)as_C_string(), utf8_length());
208 }
209
210 void Symbol::increment_refcount() {
211 // Only increment the refcount if non-negative. If negative either
212 // overflow has occurred or it is a permanent symbol in a read only
213 // shared archive.
214 if (_refcount >= 0) { // not a permanent symbol
215 Atomic::inc(&_refcount);
216 NOT_PRODUCT(Atomic::inc(&_total_count);)
217 }
218 }
219
220 void Symbol::decrement_refcount() {
221 if (_refcount >= 0) { // not a permanent symbol
222 short new_value = Atomic::add(short(-1), &_refcount);
223 #ifdef ASSERT
224 if (new_value == -1) { // we have transitioned from 0 -> -1
225 print();
226 assert(false, "reference count underflow for symbol");
227 }
228 #endif
229 (void)new_value;
230 }
231 }
232
233 void Symbol::metaspace_pointers_do(MetaspaceClosure* it) {
234 if (log_is_enabled(Trace, cds)) {
235 LogStream trace_stream(Log(cds)::trace());
236 trace_stream.print("Iter(Symbol): %p ", this);
237 print_value_on(&trace_stream);
238 trace_stream.cr();
239 }
240 }
241
242 void Symbol::print_on(outputStream* st) const {
|