mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 23:04:50 +02:00
8297784: Optimize @Stable field for Method.isCallerSensitive
Reviewed-by: redestad, jvernee, alanb
This commit is contained in:
parent
11ba7591df
commit
9bbcb546c8
1 changed files with 9 additions and 5 deletions
|
@ -605,13 +605,17 @@ public final class Method extends Executable {
|
|||
return callerSensitive ? ma.invoke(obj, args, caller) : ma.invoke(obj, args);
|
||||
}
|
||||
|
||||
@Stable private Boolean callerSensitive; // lazily initialize
|
||||
// 0 = not initialized (@Stable contract)
|
||||
// 1 = initialized, CS
|
||||
// -1 = initialized, not CS
|
||||
@Stable private byte callerSensitive;
|
||||
|
||||
private boolean isCallerSensitive() {
|
||||
Boolean cs = callerSensitive;
|
||||
if (cs == null) {
|
||||
callerSensitive = cs = Reflection.isCallerSensitive(this);
|
||||
byte cs = callerSensitive;
|
||||
if (cs == 0) {
|
||||
callerSensitive = cs = (byte)(Reflection.isCallerSensitive(this) ? 1 : -1);
|
||||
}
|
||||
return cs;
|
||||
return (cs > 0);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue