< prev index next > src/hotspot/share/interpreter/bytecodeUtils.cpp
Print this page
stack->pop(1 - Bytecodes::depth(code));
stack->push(bci, Signature::basic_type(signature));
break;
}
+ case Bytecodes::_withfield:
case Bytecodes::_putstatic:
case Bytecodes::_putfield: {
int cp_index = Bytes::get_native_u2(code_base + pos) DEBUG_ONLY(+ ConstantPool::CPCACHE_INDEX_TAG);
ConstantPool* cp = _method->constants();
int name_and_type_index = cp->name_and_type_ref_index_at(cp_index);
case Bytecodes::_getfield:
case Bytecodes::_arraylength:
case Bytecodes::_athrow:
case Bytecodes::_monitorenter:
case Bytecodes::_monitorexit:
+ case Bytecodes::_checkcast:
return 0;
case Bytecodes::_iaload:
case Bytecodes::_faload:
case Bytecodes::_aaload:
case Bytecodes::_baload:
case Bytecodes::_sastore:
return 2;
case Bytecodes::_lastore:
case Bytecodes::_dastore:
return 3;
+ case Bytecodes::_withfield:
case Bytecodes::_putfield: {
int cp_index = Bytes::get_native_u2(code_base + pos) DEBUG_ONLY(+ ConstantPool::CPCACHE_INDEX_TAG);
ConstantPool* cp = _method->constants();
int name_and_type_index = cp->name_and_type_ref_index_at(cp_index);
int type_index = cp->signature_ref_index_at(name_and_type_index);
return INVALID_BYTECODE_ENCOUNTERED;
}
bool ExceptionMessageBuilder::print_NPE_cause(outputStream* os, int bci, int slot) {
if (print_NPE_cause0(os, bci, slot, _max_cause_detail, false, " because \"")) {
- os->print("\" is null");
+ address code_base = _method->constMethod()->code_base();
+ Bytecodes::Code code = Bytecodes::java_code_at(_method, code_base + bci);
+ if (code == Bytecodes::_aastore) {
+ os->print("\" is null or is a null-free array and there's an attempt to store null in it");
+ } else {
+ os->print("\" is null");
+ }
return true;
}
return false;
}
int name_and_type_index = cp->name_and_type_ref_index_at(cp_index);
int name_index = cp->name_ref_index_at(name_and_type_index);
Symbol* name = cp->symbol_at(name_index);
os->print("Cannot read field \"%s\"", name->as_C_string());
} break;
+ case Bytecodes::_withfield:
case Bytecodes::_putfield: {
int cp_index = Bytes::get_native_u2(code_base + pos) DEBUG_ONLY(+ ConstantPool::CPCACHE_INDEX_TAG);
os->print("Cannot assign field \"%s\"", get_field_name(_method, cp_index));
} break;
case Bytecodes::_invokevirtual:
int cp_index = Bytes::get_native_u2(code_base+ pos) DEBUG_ONLY(+ ConstantPool::CPCACHE_INDEX_TAG);
os->print("Cannot invoke \"");
print_method_name(os, _method, cp_index);
os->print("\"");
} break;
+ case Bytecodes::_checkcast: {
+ int cp_index = Bytes::get_Java_u2(code_base + pos);
+ ConstantPool* cp = _method->constants();
+ os->print("Cannot cast to null-free type \"%s\"", cp->klass_at_noresolve(cp_index)->as_C_string());
+ } break;
default:
assert(0, "We should have checked this bytecode in get_NPE_null_slot().");
break;
}
< prev index next >