8139163: InstanceKlass::cast passes through NULL

Reduce raw (InstanceKlass*) casts and InstanceKlass::cast, which no long allows null

Reviewed-by: twisti, kbarrett
This commit is contained in:
Coleen Phillimore 2015-10-26 13:11:36 -04:00
parent 25cc742a8f
commit 5179fc3488
43 changed files with 215 additions and 252 deletions

View file

@ -2148,11 +2148,8 @@ run:
if (!constants->tag_at(index).is_unresolved_klass()) {
// Make sure klass is initialized and doesn't have a finalizer
Klass* entry = constants->slot_at(index).get_klass();
assert(entry->is_klass(), "Should be resolved klass");
Klass* k_entry = (Klass*) entry;
assert(k_entry->oop_is_instance(), "Should be InstanceKlass");
InstanceKlass* ik = (InstanceKlass*) k_entry;
if ( ik->is_initialized() && ik->can_be_fastpath_allocated() ) {
InstanceKlass* ik = InstanceKlass::cast(entry);
if (ik->is_initialized() && ik->can_be_fastpath_allocated() ) {
size_t obj_size = ik->size_helper();
oop result = NULL;
// If the TLAB isn't pre-zeroed then we'll have to do it
@ -2611,7 +2608,7 @@ run:
but using InstanceKlass::cast(STACK_OBJECT(-parms)->klass()) causes in assertion failure
because rcvr->klass()->oop_is_instance() == 0
However it seems to have a vtable in the right location. Huh?
Because vtables have the same offset for ArrayKlass and InstanceKlass.
*/
callee = (Method*) rcvrKlass->start_of_vtable()[ cache->f2_as_index()];
// Profile virtual call.