Commit 3f723ca 1 parent abebbe2 commit 3f723ca Copy full SHA for 3f723ca
File tree 2 files changed +14
-3
lines changed
src/java.base/share/classes/java/lang/ref
2 files changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -69,8 +69,12 @@ public T get() {
69
69
* do reference processing concurrently.
70
70
*/
71
71
@ Override
72
+ boolean refersToImpl (T obj ) {
73
+ return refersTo0 (obj );
74
+ }
75
+
72
76
@ IntrinsicCandidate
73
- native final boolean refersTo0 (Object o );
77
+ private native boolean refersTo0 (Object o );
74
78
75
79
/**
76
80
* Creates a new phantom reference that refers to the given object and
Original file line number Diff line number Diff line change @@ -363,13 +363,20 @@ public T get() {
363
363
* @since 16
364
364
*/
365
365
public final boolean refersTo (T obj ) {
366
- return refersTo0 (obj );
366
+ return refersToImpl (obj );
367
367
}
368
368
369
369
/* Implementation of refersTo(), overridden for phantom references.
370
+ * This method exists only to avoid making refersTo0() virtual. Making
371
+ * refersTo0() virtual has the undesirable effect of C2 often preferring
372
+ * to call the native implementation over the intrinsic.
370
373
*/
374
+ boolean refersToImpl (T obj ) {
375
+ return refersTo0 (obj );
376
+ }
377
+
371
378
@ IntrinsicCandidate
372
- native boolean refersTo0 (Object o );
379
+ private native boolean refersTo0 (Object o );
373
380
374
381
/**
375
382
* Clears this reference object. Invoking this method will not cause this
You can’t perform that action at this time.
0 commit comments