8340838: Clean up MutableCallSite to use explicit release fence instead of AtomicInteger

Reviewed-by: jrose, redestad, shade
This commit is contained in:
Chen Liang 2024-09-25 18:29:30 +00:00
parent 1b2d40addf
commit df1959fd7a

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2008, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2008, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -26,7 +26,8 @@
package java.lang.invoke;
import java.util.Objects;
import java.util.concurrent.atomic.AtomicInteger;
import static java.lang.invoke.MethodHandleStatics.UNSAFE;
/**
* A {@code MutableCallSite} is a {@link CallSite} whose target variable
@ -274,11 +275,10 @@ public non-sealed class MutableCallSite extends CallSite {
*/
public static void syncAll(MutableCallSite[] sites) {
if (sites.length == 0) return;
STORE_BARRIER.lazySet(0);
UNSAFE.storeFence();
for (MutableCallSite site : sites) {
Objects.requireNonNull(site); // trigger NPE on first null
}
// FIXME: NYI
}
private static final AtomicInteger STORE_BARRIER = new AtomicInteger();
}