mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-20 19:14:38 +02:00
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
A referent object that is only weakly reachable at the start of concurrent marking but is re-attached to the strongly reachable object graph during marking may not be marked as live. This can cause the reference object to be processed prematurely and leave dangling pointers to the referent object. Implement a read barrier for the java.lang.ref.Reference::referent field by intrinsifying the Reference.get() method, and intercepting accesses though JNI, reflection, and Unsafe, so that when a non-null referent object is read it is also logged in an SATB buffer. Reviewed-by: kvn, iveresov, never, tonyp, dholmes
This commit is contained in:
parent
aac4647e6e
commit
a08e1ce906
41 changed files with 1423 additions and 268 deletions
|
@ -629,7 +629,7 @@ Compile::Compile( ciEnv* ci_env, C2Compiler* compiler, ciMethod* target, int osr
|
|||
initial_gvn()->transform_no_reclaim(top());
|
||||
|
||||
// Set up tf(), start(), and find a CallGenerator.
|
||||
CallGenerator* cg;
|
||||
CallGenerator* cg = NULL;
|
||||
if (is_osr_compilation()) {
|
||||
const TypeTuple *domain = StartOSRNode::osr_domain();
|
||||
const TypeTuple *range = TypeTuple::make_range(method()->signature());
|
||||
|
@ -644,9 +644,24 @@ Compile::Compile( ciEnv* ci_env, C2Compiler* compiler, ciMethod* target, int osr
|
|||
StartNode* s = new (this, 2) StartNode(root(), tf()->domain());
|
||||
initial_gvn()->set_type_bottom(s);
|
||||
init_start(s);
|
||||
float past_uses = method()->interpreter_invocation_count();
|
||||
float expected_uses = past_uses;
|
||||
cg = CallGenerator::for_inline(method(), expected_uses);
|
||||
if (method()->intrinsic_id() == vmIntrinsics::_Reference_get && UseG1GC) {
|
||||
// With java.lang.ref.reference.get() we must go through the
|
||||
// intrinsic when G1 is enabled - even when get() is the root
|
||||
// method of the compile - so that, if necessary, the value in
|
||||
// the referent field of the reference object gets recorded by
|
||||
// the pre-barrier code.
|
||||
// Specifically, if G1 is enabled, the value in the referent
|
||||
// field is recorded by the G1 SATB pre barrier. This will
|
||||
// result in the referent being marked live and the reference
|
||||
// object removed from the list of discovered references during
|
||||
// reference processing.
|
||||
cg = find_intrinsic(method(), false);
|
||||
}
|
||||
if (cg == NULL) {
|
||||
float past_uses = method()->interpreter_invocation_count();
|
||||
float expected_uses = past_uses;
|
||||
cg = CallGenerator::for_inline(method(), expected_uses);
|
||||
}
|
||||
}
|
||||
if (failing()) return;
|
||||
if (cg == NULL) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue