mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 14:54:52 +02:00
8271862: C2 intrinsic for Reference.refersTo() is often not used
Reviewed-by: kbarrett, mchung
This commit is contained in:
parent
abebbe2335
commit
3f723ca457
2 changed files with 14 additions and 3 deletions
|
@ -69,8 +69,12 @@ public class PhantomReference<T> extends Reference<T> {
|
||||||
* do reference processing concurrently.
|
* do reference processing concurrently.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
boolean refersToImpl(T obj) {
|
||||||
|
return refersTo0(obj);
|
||||||
|
}
|
||||||
|
|
||||||
@IntrinsicCandidate
|
@IntrinsicCandidate
|
||||||
native final boolean refersTo0(Object o);
|
private native boolean refersTo0(Object o);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new phantom reference that refers to the given object and
|
* Creates a new phantom reference that refers to the given object and
|
||||||
|
|
|
@ -363,13 +363,20 @@ public abstract class Reference<T> {
|
||||||
* @since 16
|
* @since 16
|
||||||
*/
|
*/
|
||||||
public final boolean refersTo(T obj) {
|
public final boolean refersTo(T obj) {
|
||||||
return refersTo0(obj);
|
return refersToImpl(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Implementation of refersTo(), overridden for phantom references.
|
/* Implementation of refersTo(), overridden for phantom references.
|
||||||
|
* This method exists only to avoid making refersTo0() virtual. Making
|
||||||
|
* refersTo0() virtual has the undesirable effect of C2 often preferring
|
||||||
|
* to call the native implementation over the intrinsic.
|
||||||
*/
|
*/
|
||||||
|
boolean refersToImpl(T obj) {
|
||||||
|
return refersTo0(obj);
|
||||||
|
}
|
||||||
|
|
||||||
@IntrinsicCandidate
|
@IntrinsicCandidate
|
||||||
native boolean refersTo0(Object o);
|
private native boolean refersTo0(Object o);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clears this reference object. Invoking this method will not cause this
|
* Clears this reference object. Invoking this method will not cause this
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue