< prev index next >
src/share/vm/classfile/resolutionErrors.cpp
Print this page
rev 11945 : 8023697: failed class resolution reports different class name in detail message for the first and subsequent times
Summary: Cache detail message when we cache exception for constant pool resolution.
Reviewed-by: acorn, twisti, jrose
*** 1,7 ****
/*
! * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
--- 1,7 ----
/*
! * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*** 30,45 ****
#include "runtime/safepoint.hpp"
#include "utilities/hashtable.inline.hpp"
// add new entry to the table
void ResolutionErrorTable::add_entry(int index, unsigned int hash,
! constantPoolHandle pool, int cp_index, Symbol* error)
{
assert_locked_or_safepoint(SystemDictionary_lock);
assert(!pool.is_null() && error != NULL, "adding NULL obj");
! ResolutionErrorEntry* entry = new_entry(hash, pool(), cp_index, error);
add_entry(index, entry);
}
// find entry in the table
ResolutionErrorEntry* ResolutionErrorTable::find_entry(int index, unsigned int hash,
--- 30,46 ----
#include "runtime/safepoint.hpp"
#include "utilities/hashtable.inline.hpp"
// add new entry to the table
void ResolutionErrorTable::add_entry(int index, unsigned int hash,
! constantPoolHandle pool, int cp_index,
! Symbol* error, Symbol* message)
{
assert_locked_or_safepoint(SystemDictionary_lock);
assert(!pool.is_null() && error != NULL, "adding NULL obj");
! ResolutionErrorEntry* entry = new_entry(hash, pool(), cp_index, error, message);
add_entry(index, entry);
}
// find entry in the table
ResolutionErrorEntry* ResolutionErrorTable::find_entry(int index, unsigned int hash,
*** 56,86 ****
}
return NULL;
}
void ResolutionErrorEntry::set_error(Symbol* e) {
! assert(e == NULL || _error == NULL, "cannot reset error");
_error = e;
! if (_error != NULL) _error->increment_refcount();
}
// create new error entry
ResolutionErrorEntry* ResolutionErrorTable::new_entry(int hash, ConstantPool* pool,
! int cp_index, Symbol* error)
{
ResolutionErrorEntry* entry = (ResolutionErrorEntry*)Hashtable<ConstantPool*, mtClass>::new_entry(hash, pool);
entry->set_cp_index(cp_index);
- NOT_PRODUCT(entry->set_error(NULL);)
entry->set_error(error);
return entry;
}
void ResolutionErrorTable::free_entry(ResolutionErrorEntry *entry) {
// decrement error refcount
assert(entry->error() != NULL, "error should be set");
entry->error()->decrement_refcount();
Hashtable<ConstantPool*, mtClass>::free_entry(entry);
}
// create resolution error table
--- 57,95 ----
}
return NULL;
}
void ResolutionErrorEntry::set_error(Symbol* e) {
! assert(e != NULL, "must set a value");
_error = e;
! _error->increment_refcount();
! }
!
! void ResolutionErrorEntry::set_message(Symbol* c) {
! assert(c != NULL, "must set a value");
! _message = c;
! _message->increment_refcount();
}
// create new error entry
ResolutionErrorEntry* ResolutionErrorTable::new_entry(int hash, ConstantPool* pool,
! int cp_index, Symbol* error,
! Symbol* message)
{
ResolutionErrorEntry* entry = (ResolutionErrorEntry*)Hashtable<ConstantPool*, mtClass>::new_entry(hash, pool);
entry->set_cp_index(cp_index);
entry->set_error(error);
+ entry->set_message(message);
return entry;
}
void ResolutionErrorTable::free_entry(ResolutionErrorEntry *entry) {
// decrement error refcount
assert(entry->error() != NULL, "error should be set");
entry->error()->decrement_refcount();
+ entry->message()->decrement_refcount();
Hashtable<ConstantPool*, mtClass>::free_entry(entry);
}
// create resolution error table
< prev index next >