src/share/vm/interpreter/interpreterRuntime.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File hotspot Cdiff src/share/vm/interpreter/interpreterRuntime.cpp

src/share/vm/interpreter/interpreterRuntime.cpp

Print this page

        

*** 1207,1211 **** --- 1207,1304 ---- int size_of_arguments = (asc.size() + (invoke.has_receiver() ? 1 : 0)); // receiver Copy::conjoint_jbytes(src_address, dest_address, size_of_arguments * Interpreter::stackElementSize); IRT_END #endif + + #ifdef ASSERT + static void print_field_info(TosState state, oop obj, int offset, jvalue* value) { + switch (state) { + case btos: tty->print_cr(" (old_value=" INT32_FORMAT ") (new_value=" INT32_FORMAT ")", obj->bool_field(offset), *value); break; + case ctos: tty->print_cr(" (old_value=" INT32_FORMAT ") (new_value=" INT32_FORMAT ")", obj->char_field(offset), *value); break; + case stos: tty->print_cr(" (old_value=" INT32_FORMAT ") (new_value=" INT32_FORMAT ")", obj->short_field(offset), *value); break; + case itos: tty->print_cr(" (old_value=" INT32_FORMAT ") (new_value=" INT32_FORMAT ")", obj->int_field(offset), *value); break; + case ftos: tty->print_cr(" (old_value=%f) (new_value=%f)", obj->float_field(offset), *value); break; + case dtos: tty->print_cr(" (old_value=%lf) (new_value=%lf)", obj->double_field(offset), *value); break; + case atos: tty->print_cr(" (old_value=" INTPTR_FORMAT ") (new_value=" INTPTR_FORMAT ")", obj->obj_field(offset), *value); break; + case ltos: tty->print_cr(" (old_value=" JLONG_FORMAT ") (new_value=" JLONG_FORMAT ")", obj->long_field(offset), *value); break; + default: fatal(err_msg("Unexpected field type: " INT32_FORMAT, state)); + } + } + + static void assert_stable_property(TosState state, oop obj, int offset, jvalue* value) { + switch (state) { + case btos: + assert(obj->bool_field(offset) == 0, ""); + assert((*value).b != 0, ""); + break; + case ctos: + assert(obj->char_field(offset) == 0, ""); + assert((*value).c != 0, ""); + break; + case stos: + assert(obj->short_field(offset) == 0, ""); + assert((*value).s != 0, ""); + break; + case itos: + assert(obj->int_field(offset) == 0, ""); + assert((*value).i != 0, ""); + break; + case ftos: + assert(obj->float_field(offset) == 0, ""); + assert((*value).f != 0, ""); + break; + case atos: + assert(obj->obj_field(offset) == NULL, ""); + assert((*value).l != 0, ""); + break; + case ltos: + assert(obj->long_field(offset) == 0, ""); + assert((*value).j != 0, ""); + break; + case dtos: + assert(obj->double_field(offset) == 0, ""); + assert((*value).d != 0, ""); + break; + default: + fatal(err_msg("Unexpected field type: " INT32_FORMAT, state)); + } + } + + IRT_ENTRY(void, InterpreterRuntime::verify_stable(JavaThread *thread, + oopDesc* obj, ConstantPoolCacheEntry *cp_entry, jvalue *value)) + assert(cp_entry != NULL, ""); + + Klass* k = (Klass*)cp_entry->f1_as_klass(); + // check the access_flags for the field in the klass + InstanceKlass* ik = InstanceKlass::cast(k); + int index = cp_entry->field_index(); + bool is_stable = (ik->field_access_flags(index) & JVM_ACC_FIELD_STABLE); + + if (!is_stable) return; + + bool is_static = (obj == NULL); + if (is_static) { + obj = ik->java_mirror(); + } + + int offset = ik->field_offset(index); + + if (TraceStableFieldUpdates) { + tty->print("%s::%s (static=%d) (type=%d) (index=%d) (offset=%d)", + ik->name()->as_C_string(), ik->field_name(index)->as_C_string(), + is_static, cp_entry->flag_state(), index, offset); + + if (is_static) { + tty->print(" (klass=" INTPTR_FORMAT ")", obj); + } else { + tty->print(" (obj=" INTPTR_FORMAT ")", obj); + } + + print_field_info(cp_entry->flag_state(), obj, offset, value); + } + + if (VerifyStable) { + assert_stable_property(cp_entry->flag_state(), obj, offset, value); + } + IRT_END + #endif // ASSERT
src/share/vm/interpreter/interpreterRuntime.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File