mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 23:04:50 +02:00
8267614: Outline VarHandleGuards exact behavior checks
Reviewed-by: psandoz, mchung
This commit is contained in:
parent
f6909596ca
commit
c519ba2e43
3 changed files with 95 additions and 324 deletions
|
@ -40,6 +40,7 @@ import java.util.function.BiFunction;
|
|||
import java.util.function.Function;
|
||||
|
||||
import jdk.internal.util.Preconditions;
|
||||
import jdk.internal.vm.annotation.DontInline;
|
||||
import jdk.internal.vm.annotation.ForceInline;
|
||||
import jdk.internal.vm.annotation.IntrinsicCandidate;
|
||||
import jdk.internal.vm.annotation.Stable;
|
||||
|
@ -2028,6 +2029,19 @@ public abstract class VarHandle implements Constable {
|
|||
return accessModeType(accessMode.at.ordinal());
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
final void checkExactAccessMode(VarHandle.AccessDescriptor ad) {
|
||||
if (exact && accessModeType(ad.type) != ad.symbolicMethodTypeExact) {
|
||||
throwWrongMethodTypeException(ad);
|
||||
}
|
||||
}
|
||||
|
||||
@DontInline
|
||||
private final void throwWrongMethodTypeException(VarHandle.AccessDescriptor ad) {
|
||||
throw new WrongMethodTypeException("expected " + accessModeType(ad.type) + " but found "
|
||||
+ ad.symbolicMethodTypeExact);
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
final MethodType accessModeType(int accessTypeOrdinal) {
|
||||
TypesAndInvokers tis = getTypesAndInvokers();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue