mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 07:14:30 +02:00
8257189: Handle concurrent updates of MH.form better
Reviewed-by: redestad, psandoz
This commit is contained in:
parent
670426646d
commit
692b273ec5
5 changed files with 69 additions and 53 deletions
|
@ -596,21 +596,17 @@ class Invokers {
|
|||
@ForceInline
|
||||
/*non-public*/
|
||||
static void checkCustomized(MethodHandle mh) {
|
||||
if (MethodHandleImpl.isCompileConstant(mh)) return;
|
||||
if (mh.form.customized == null) {
|
||||
maybeCustomize(mh);
|
||||
if (MethodHandleImpl.isCompileConstant(mh)) {
|
||||
return; // no need to customize a MH when the instance is known to JIT
|
||||
}
|
||||
if (mh.form.customized == null) { // fast approximate check that the underlying form is already customized
|
||||
maybeCustomize(mh); // marked w/ @DontInline
|
||||
}
|
||||
}
|
||||
|
||||
@DontInline
|
||||
/*non-public*/
|
||||
static void maybeCustomize(MethodHandle mh) {
|
||||
byte count = mh.customizationCount;
|
||||
if (count >= CUSTOMIZE_THRESHOLD) {
|
||||
mh.customize();
|
||||
} else {
|
||||
mh.customizationCount = (byte)(count+1);
|
||||
}
|
||||
mh.maybeCustomize();
|
||||
}
|
||||
|
||||
// Local constant functions:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue