Sat, 28 Sep 2013 12:42:22 -0700
8025613: clang: remove -Wno-unused-value
Reviewed-by: iveresov
duke@435 | 1 | /* |
coleenp@4037 | 2 | * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. |
duke@435 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
duke@435 | 4 | * |
duke@435 | 5 | * This code is free software; you can redistribute it and/or modify it |
duke@435 | 6 | * under the terms of the GNU General Public License version 2 only, as |
duke@435 | 7 | * published by the Free Software Foundation. |
duke@435 | 8 | * |
duke@435 | 9 | * This code is distributed in the hope that it will be useful, but WITHOUT |
duke@435 | 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
duke@435 | 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
duke@435 | 12 | * version 2 for more details (a copy is included in the LICENSE file that |
duke@435 | 13 | * accompanied this code). |
duke@435 | 14 | * |
duke@435 | 15 | * You should have received a copy of the GNU General Public License version |
duke@435 | 16 | * 2 along with this work; if not, write to the Free Software Foundation, |
duke@435 | 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
duke@435 | 18 | * |
trims@1907 | 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
trims@1907 | 20 | * or visit www.oracle.com if you need additional information or have any |
trims@1907 | 21 | * questions. |
duke@435 | 22 | * |
duke@435 | 23 | */ |
duke@435 | 24 | |
stefank@2314 | 25 | #ifndef SHARE_VM_CLASSFILE_RESOLUTIONERRORS_HPP |
stefank@2314 | 26 | #define SHARE_VM_CLASSFILE_RESOLUTIONERRORS_HPP |
stefank@2314 | 27 | |
coleenp@4037 | 28 | #include "oops/constantPool.hpp" |
stefank@2314 | 29 | #include "utilities/hashtable.hpp" |
stefank@2314 | 30 | |
duke@435 | 31 | class ResolutionErrorEntry; |
duke@435 | 32 | |
duke@435 | 33 | // ResolutionError objects are used to record errors encountered during |
duke@435 | 34 | // constant pool resolution (JVMS 5.4.3). |
duke@435 | 35 | |
coleenp@4037 | 36 | class ResolutionErrorTable : public Hashtable<ConstantPool*, mtClass> { |
duke@435 | 37 | |
duke@435 | 38 | public: |
duke@435 | 39 | ResolutionErrorTable(int table_size); |
duke@435 | 40 | |
coleenp@4037 | 41 | ResolutionErrorEntry* new_entry(int hash, ConstantPool* pool, int cp_index, Symbol* error); |
coleenp@2497 | 42 | void free_entry(ResolutionErrorEntry *entry); |
duke@435 | 43 | |
duke@435 | 44 | ResolutionErrorEntry* bucket(int i) { |
coleenp@4037 | 45 | return (ResolutionErrorEntry*)Hashtable<ConstantPool*, mtClass>::bucket(i); |
duke@435 | 46 | } |
duke@435 | 47 | |
duke@435 | 48 | ResolutionErrorEntry** bucket_addr(int i) { |
coleenp@4037 | 49 | return (ResolutionErrorEntry**)Hashtable<ConstantPool*, mtClass>::bucket_addr(i); |
duke@435 | 50 | } |
duke@435 | 51 | |
duke@435 | 52 | void add_entry(int index, ResolutionErrorEntry* new_entry) { |
coleenp@4037 | 53 | Hashtable<ConstantPool*, mtClass>::add_entry(index, |
coleenp@4037 | 54 | (HashtableEntry<ConstantPool*, mtClass>*)new_entry); |
duke@435 | 55 | } |
duke@435 | 56 | |
duke@435 | 57 | void add_entry(int index, unsigned int hash, |
coleenp@2497 | 58 | constantPoolHandle pool, int which, Symbol* error); |
duke@435 | 59 | |
duke@435 | 60 | |
duke@435 | 61 | // find error given the constant pool and constant pool index |
duke@435 | 62 | ResolutionErrorEntry* find_entry(int index, unsigned int hash, |
duke@435 | 63 | constantPoolHandle pool, int cp_index); |
duke@435 | 64 | |
duke@435 | 65 | |
duke@435 | 66 | unsigned int compute_hash(constantPoolHandle pool, int cp_index) { |
duke@435 | 67 | return (unsigned int) pool->identity_hash() + cp_index; |
duke@435 | 68 | } |
duke@435 | 69 | |
duke@435 | 70 | // purges unloaded entries from the table |
coleenp@4037 | 71 | void purge_resolution_errors(); |
duke@435 | 72 | |
coleenp@4037 | 73 | // RedefineClasses support - remove obsolete constant pool entry |
coleenp@4037 | 74 | void delete_entry(ConstantPool* c); |
duke@435 | 75 | }; |
duke@435 | 76 | |
duke@435 | 77 | |
coleenp@4037 | 78 | class ResolutionErrorEntry : public HashtableEntry<ConstantPool*, mtClass> { |
duke@435 | 79 | private: |
duke@435 | 80 | int _cp_index; |
coleenp@2497 | 81 | Symbol* _error; |
duke@435 | 82 | |
duke@435 | 83 | public: |
coleenp@4037 | 84 | ConstantPool* pool() const { return (ConstantPool*)literal(); } |
coleenp@4037 | 85 | ConstantPool** pool_addr() { return (ConstantPool**)literal_addr(); } |
duke@435 | 86 | |
duke@435 | 87 | int cp_index() const { return _cp_index; } |
duke@435 | 88 | void set_cp_index(int cp_index) { _cp_index = cp_index; } |
duke@435 | 89 | |
coleenp@2497 | 90 | Symbol* error() const { return _error; } |
coleenp@2497 | 91 | void set_error(Symbol* e); |
duke@435 | 92 | |
duke@435 | 93 | ResolutionErrorEntry* next() const { |
coleenp@4037 | 94 | return (ResolutionErrorEntry*)HashtableEntry<ConstantPool*, mtClass>::next(); |
duke@435 | 95 | } |
duke@435 | 96 | |
duke@435 | 97 | ResolutionErrorEntry** next_addr() { |
coleenp@4037 | 98 | return (ResolutionErrorEntry**)HashtableEntry<ConstantPool*, mtClass>::next_addr(); |
duke@435 | 99 | } |
duke@435 | 100 | }; |
stefank@2314 | 101 | |
stefank@2314 | 102 | #endif // SHARE_VM_CLASSFILE_RESOLUTIONERRORS_HPP |