equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1997, 2018, 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. |
163 |
163 |
164 // Reference counting. See comments above this class for when to use. |
164 // Reference counting. See comments above this class for when to use. |
165 int refcount() const { return _refcount; } |
165 int refcount() const { return _refcount; } |
166 void increment_refcount(); |
166 void increment_refcount(); |
167 void decrement_refcount(); |
167 void decrement_refcount(); |
168 // Set _refcount non zero to avoid being reclaimed by GC. |
|
169 void set_permanent() { |
|
170 assert(LogTouchedMethods, "Should not be called with LogTouchedMethods off"); |
|
171 if (_refcount != PERM_REFCOUNT) { |
|
172 _refcount = PERM_REFCOUNT; |
|
173 } |
|
174 } |
|
175 bool is_permanent() { |
168 bool is_permanent() { |
176 return (_refcount == PERM_REFCOUNT); |
169 return (_refcount == PERM_REFCOUNT); |
177 } |
170 } |
178 |
171 |
179 int byte_at(int index) const { |
172 int byte_at(int index) const { |