0N/A/*
2273N/A * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
0N/A * published by the Free Software Foundation.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
1472N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
1472N/A * or visit www.oracle.com if you need additional information or have any
1472N/A * questions.
0N/A *
0N/A */
0N/A
1879N/A#ifndef SHARE_VM_CLASSFILE_RESOLUTIONERRORS_HPP
1879N/A#define SHARE_VM_CLASSFILE_RESOLUTIONERRORS_HPP
1879N/A
1879N/A#include "oops/constantPoolOop.hpp"
1879N/A#include "utilities/hashtable.hpp"
1879N/A
0N/Aclass ResolutionErrorEntry;
0N/A
0N/A// ResolutionError objects are used to record errors encountered during
0N/A// constant pool resolution (JVMS 5.4.3).
0N/A
3863N/Aclass ResolutionErrorTable : public Hashtable<constantPoolOop, mtClass> {
0N/A
0N/Apublic:
0N/A ResolutionErrorTable(int table_size);
0N/A
2062N/A ResolutionErrorEntry* new_entry(int hash, constantPoolOop pool, int cp_index, Symbol* error);
2062N/A void free_entry(ResolutionErrorEntry *entry);
0N/A
0N/A ResolutionErrorEntry* bucket(int i) {
3863N/A return (ResolutionErrorEntry*)Hashtable<constantPoolOop, mtClass>::bucket(i);
0N/A }
0N/A
0N/A ResolutionErrorEntry** bucket_addr(int i) {
3863N/A return (ResolutionErrorEntry**)Hashtable<constantPoolOop, mtClass>::bucket_addr(i);
0N/A }
0N/A
0N/A void add_entry(int index, ResolutionErrorEntry* new_entry) {
3863N/A Hashtable<constantPoolOop, mtClass>::add_entry(index,
3863N/A (HashtableEntry<constantPoolOop, mtClass>*)new_entry);
0N/A }
0N/A
0N/A void add_entry(int index, unsigned int hash,
2062N/A constantPoolHandle pool, int which, Symbol* error);
0N/A
0N/A
0N/A // find error given the constant pool and constant pool index
0N/A ResolutionErrorEntry* find_entry(int index, unsigned int hash,
0N/A constantPoolHandle pool, int cp_index);
0N/A
0N/A
0N/A unsigned int compute_hash(constantPoolHandle pool, int cp_index) {
0N/A return (unsigned int) pool->identity_hash() + cp_index;
0N/A }
0N/A
0N/A // purges unloaded entries from the table
0N/A void purge_resolution_errors(BoolObjectClosure* is_alive);
0N/A
0N/A // GC support.
0N/A void oops_do(OopClosure* f);
0N/A};
0N/A
0N/A
3863N/Aclass ResolutionErrorEntry : public HashtableEntry<constantPoolOop, mtClass> {
0N/A private:
0N/A int _cp_index;
2062N/A Symbol* _error;
0N/A
0N/A public:
0N/A constantPoolOop pool() const { return (constantPoolOop)literal(); }
0N/A constantPoolOop* pool_addr() { return (constantPoolOop*)literal_addr(); }
0N/A
0N/A int cp_index() const { return _cp_index; }
0N/A void set_cp_index(int cp_index) { _cp_index = cp_index; }
0N/A
2062N/A Symbol* error() const { return _error; }
2062N/A void set_error(Symbol* e);
0N/A
0N/A ResolutionErrorEntry* next() const {
3863N/A return (ResolutionErrorEntry*)HashtableEntry<constantPoolOop, mtClass>::next();
0N/A }
0N/A
0N/A ResolutionErrorEntry** next_addr() {
3863N/A return (ResolutionErrorEntry**)HashtableEntry<constantPoolOop, mtClass>::next_addr();
0N/A }
0N/A
0N/A // GC support
0N/A void oops_do(OopClosure* blk);
0N/A};
1879N/A
1879N/A#endif // SHARE_VM_CLASSFILE_RESOLUTIONERRORS_HPP