mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 06:45:07 +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
|
@ -36,6 +36,7 @@ import sun.invoke.util.Wrapper;
|
|||
import java.lang.ref.WeakReference;
|
||||
import java.util.Arrays;
|
||||
import java.util.Objects;
|
||||
import java.util.function.Function;
|
||||
|
||||
import static java.lang.invoke.LambdaForm.*;
|
||||
import static java.lang.invoke.LambdaForm.Kind.*;
|
||||
|
@ -387,10 +388,12 @@ class DirectMethodHandle extends MethodHandle {
|
|||
private void ensureInitialized() {
|
||||
if (checkInitialized(member)) {
|
||||
// The coast is clear. Delete the <clinit> barrier.
|
||||
if (member.isField())
|
||||
updateForm(preparedFieldLambdaForm(member));
|
||||
else
|
||||
updateForm(preparedLambdaForm(member));
|
||||
updateForm(new Function<>() {
|
||||
public LambdaForm apply(LambdaForm oldForm) {
|
||||
return (member.isField() ? preparedFieldLambdaForm(member)
|
||||
: preparedLambdaForm(member));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
private static boolean checkInitialized(MemberName member) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue