8160399: is_oop_or_null involves undefined behavior

8164984: Improper use of is_oop in production code

Replace oop->is_oop*() with oopDesc::is_oop*(oop) so this pointer can be verified

Reviewed-by: iklam, kvn, dholmes
This commit is contained in:
Coleen Phillimore 2017-08-23 14:52:55 -04:00
parent 61a9f88ca7
commit 3d6d1ec64b
61 changed files with 195 additions and 209 deletions

View file

@ -209,7 +209,7 @@ JRT_LEAF(void, SharedRuntime::g1_wb_pre(oopDesc* orig, JavaThread *thread))
assert(false, "should be optimized out");
return;
}
assert(orig->is_oop(true /* ignore mark word */), "Error");
assert(oopDesc::is_oop(orig, true /* ignore mark word */), "Error");
// store the original value that was in the field reference
thread->satb_mark_queue().enqueue(orig);
JRT_END
@ -585,7 +585,7 @@ oop SharedRuntime::retrieve_receiver( Symbol* sig, frame caller ) {
int args_size = ArgumentSizeComputer(sig).size() + 1;
assert(args_size <= caller.interpreter_frame_expression_stack_size(), "receiver must be on interpreter stack");
oop result = cast_to_oop(*caller.interpreter_frame_tos_at(args_size - 1));
assert(Universe::heap()->is_in(result) && result->is_oop(), "receiver must be an oop");
assert(Universe::heap()->is_in(result) && oopDesc::is_oop(result), "receiver must be an oop");
return result;
}
@ -997,7 +997,7 @@ JRT_ENTRY_NO_ASYNC(void, SharedRuntime::register_finalizer(JavaThread* thread, o
return;
}
#endif // INCLUDE_JVMCI
assert(obj->is_oop(), "must be a valid oop");
assert(oopDesc::is_oop(obj), "must be a valid oop");
assert(obj->klass()->has_finalizer(), "shouldn't be here otherwise");
InstanceKlass::register_finalizer(instanceOop(obj), CHECK);
JRT_END
@ -1165,8 +1165,6 @@ Handle SharedRuntime::find_callee_info_helper(JavaThread* thread,
}
}
assert(receiver.is_null() || receiver->is_oop(), "wrong receiver");
// Resolve method
if (attached_method.not_null()) {
// Parameterized by attached method.