Path: blob/aarch64-shenandoah-jdk8u272-b10/hotspot/src/share/vm/classfile/resolutionErrors.hpp
32285 views
/*1* Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*22*/2324#ifndef SHARE_VM_CLASSFILE_RESOLUTIONERRORS_HPP25#define SHARE_VM_CLASSFILE_RESOLUTIONERRORS_HPP2627#include "oops/constantPool.hpp"28#include "utilities/hashtable.hpp"2930class ResolutionErrorEntry;3132// ResolutionError objects are used to record errors encountered during33// constant pool resolution (JVMS 5.4.3).3435class ResolutionErrorTable : public Hashtable<ConstantPool*, mtClass> {3637public:38ResolutionErrorTable(int table_size);3940ResolutionErrorEntry* new_entry(int hash, ConstantPool* pool, int cp_index,41Symbol* error, Symbol* message);42void free_entry(ResolutionErrorEntry *entry);4344ResolutionErrorEntry* bucket(int i) {45return (ResolutionErrorEntry*)Hashtable<ConstantPool*, mtClass>::bucket(i);46}4748ResolutionErrorEntry** bucket_addr(int i) {49return (ResolutionErrorEntry**)Hashtable<ConstantPool*, mtClass>::bucket_addr(i);50}5152void add_entry(int index, ResolutionErrorEntry* new_entry) {53Hashtable<ConstantPool*, mtClass>::add_entry(index,54(HashtableEntry<ConstantPool*, mtClass>*)new_entry);55}5657void add_entry(int index, unsigned int hash,58constantPoolHandle pool, int which, Symbol* error, Symbol* message);596061// find error given the constant pool and constant pool index62ResolutionErrorEntry* find_entry(int index, unsigned int hash,63constantPoolHandle pool, int cp_index);646566unsigned int compute_hash(constantPoolHandle pool, int cp_index) {67return (unsigned int) pool->identity_hash() + cp_index;68}6970// purges unloaded entries from the table71void purge_resolution_errors();7273// RedefineClasses support - remove obsolete constant pool entry74void delete_entry(ConstantPool* c);75};767778class ResolutionErrorEntry : public HashtableEntry<ConstantPool*, mtClass> {79private:80int _cp_index;81Symbol* _error;82Symbol* _message;8384public:85ConstantPool* pool() const { return literal(); }8687int cp_index() const { return _cp_index; }88void set_cp_index(int cp_index) { _cp_index = cp_index; }8990Symbol* error() const { return _error; }91void set_error(Symbol* e);9293Symbol* message() const { return _message; }94void set_message(Symbol* c);9596ResolutionErrorEntry* next() const {97return (ResolutionErrorEntry*)HashtableEntry<ConstantPool*, mtClass>::next();98}99100ResolutionErrorEntry** next_addr() {101return (ResolutionErrorEntry**)HashtableEntry<ConstantPool*, mtClass>::next_addr();102}103};104105#endif // SHARE_VM_CLASSFILE_RESOLUTIONERRORS_HPP106107108