mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-20 11:04:34 +02:00
8166188: G1 Needs pre barrier on dereference of weak JNI handles
Add low tag to jweaks and G1 barrier for jweak loads. Co-authored-by: Martin Doerr <martin.doerr@sap.com> Co-authored-by: Volker Simonis <volker.simonis@sap.com> Reviewed-by: mgerdin, mdoerr, pliden, dlong, dcubed, coleenp, aph, tschatzl
This commit is contained in:
parent
6a5e6f2ae1
commit
28477cf493
37 changed files with 1061 additions and 429 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -5129,6 +5129,36 @@ void MacroAssembler::vxorps(XMMRegister dst, XMMRegister nds, AddressLiteral src
|
|||
}
|
||||
|
||||
|
||||
void MacroAssembler::resolve_jobject(Register value,
|
||||
Register thread,
|
||||
Register tmp) {
|
||||
assert_different_registers(value, thread, tmp);
|
||||
Label done, not_weak;
|
||||
testptr(value, value);
|
||||
jcc(Assembler::zero, done); // Use NULL as-is.
|
||||
testptr(value, JNIHandles::weak_tag_mask); // Test for jweak tag.
|
||||
jcc(Assembler::zero, not_weak);
|
||||
// Resolve jweak.
|
||||
movptr(value, Address(value, -JNIHandles::weak_tag_value));
|
||||
verify_oop(value);
|
||||
#if INCLUDE_ALL_GCS
|
||||
if (UseG1GC) {
|
||||
g1_write_barrier_pre(noreg /* obj */,
|
||||
value /* pre_val */,
|
||||
thread /* thread */,
|
||||
tmp /* tmp */,
|
||||
true /* tosca_live */,
|
||||
true /* expand_call */);
|
||||
}
|
||||
#endif // INCLUDE_ALL_GCS
|
||||
jmp(done);
|
||||
bind(not_weak);
|
||||
// Resolve (untagged) jobject.
|
||||
movptr(value, Address(value, 0));
|
||||
verify_oop(value);
|
||||
bind(done);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
#if INCLUDE_ALL_GCS
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue