comparison src/share/vm/oops/symbol.hpp @ 8675:63e54c37ac64

8008959: Fix non-PCH build on Linux, Windows and MacOS X Summary: Fix the build without precompiled headers by either including the missing ".inline.hpp" files into the appropriate files or by turning inline-functions declared in header files into ordinary functions in ".cpp" files. Reviewed-by: coleenp, stefank, dholmes
author simonis
date Wed, 27 Feb 2013 09:40:30 +0100
parents bd7a7ce2e264
children d9eed26d638a
comparison
equal deleted inserted replaced
8105:94478a033036 8675:63e54c37ac64
1 /* 1 /*
2 * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 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 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
25 #ifndef SHARE_VM_OOPS_SYMBOL_HPP 25 #ifndef SHARE_VM_OOPS_SYMBOL_HPP
26 #define SHARE_VM_OOPS_SYMBOL_HPP 26 #define SHARE_VM_OOPS_SYMBOL_HPP
27 27
28 #include "utilities/utf8.hpp" 28 #include "utilities/utf8.hpp"
29 #include "memory/allocation.hpp" 29 #include "memory/allocation.hpp"
30 #include "runtime/atomic.hpp"
31 30
32 // A Symbol is a canonicalized string. 31 // A Symbol is a canonicalized string.
33 // All Symbols reside in global SymbolTable and are reference counted. 32 // All Symbols reside in global SymbolTable and are reference counted.
34 33
35 // Reference counting 34 // Reference counting
148 // For symbol table alternate hashing 147 // For symbol table alternate hashing
149 unsigned int new_hash(jint seed); 148 unsigned int new_hash(jint seed);
150 149
151 // Reference counting. See comments above this class for when to use. 150 // Reference counting. See comments above this class for when to use.
152 int refcount() const { return _refcount; } 151 int refcount() const { return _refcount; }
153 inline void increment_refcount(); 152 void increment_refcount();
154 inline void decrement_refcount(); 153 void decrement_refcount();
155 154
156 int byte_at(int index) const { 155 int byte_at(int index) const {
157 assert(index >=0 && index < _length, "symbol index overflow"); 156 assert(index >=0 && index < _length, "symbol index overflow");
158 return base()[index]; 157 return base()[index];
159 } 158 }
230 // so use address comparison for speed 229 // so use address comparison for speed
231 int Symbol::fast_compare(Symbol* other) const { 230 int Symbol::fast_compare(Symbol* other) const {
232 return (((uintptr_t)this < (uintptr_t)other) ? -1 231 return (((uintptr_t)this < (uintptr_t)other) ? -1
233 : ((uintptr_t)this == (uintptr_t) other) ? 0 : 1); 232 : ((uintptr_t)this == (uintptr_t) other) ? 0 : 1);
234 } 233 }
235
236 inline void Symbol::increment_refcount() {
237 // Only increment the refcount if positive. If negative either
238 // overflow has occurred or it is a permanent symbol in a read only
239 // shared archive.
240 if (_refcount >= 0) {
241 Atomic::inc(&_refcount);
242 NOT_PRODUCT(Atomic::inc(&_total_count);)
243 }
244 }
245
246 inline void Symbol::decrement_refcount() {
247 if (_refcount >= 0) {
248 Atomic::dec(&_refcount);
249 #ifdef ASSERT
250 if (_refcount < 0) {
251 print();
252 assert(false, "reference count underflow for symbol");
253 }
254 #endif
255 }
256 }
257 #endif // SHARE_VM_OOPS_SYMBOL_HPP 234 #endif // SHARE_VM_OOPS_SYMBOL_HPP