mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 14:54:52 +02:00
8255299: Drop explicit zeroing at instantiation of Atomic* objects
Reviewed-by: redestad, serb, prr
This commit is contained in:
parent
6b2d11ba24
commit
3c4fc79326
17 changed files with 16 additions and 19 deletions
|
@ -87,7 +87,7 @@ import static jdk.internal.org.objectweb.asm.Opcodes.*;
|
||||||
private static final String[] EMPTY_STRING_ARRAY = new String[0];
|
private static final String[] EMPTY_STRING_ARRAY = new String[0];
|
||||||
|
|
||||||
// Used to ensure that each spun class name is unique
|
// Used to ensure that each spun class name is unique
|
||||||
private static final AtomicInteger counter = new AtomicInteger(0);
|
private static final AtomicInteger counter = new AtomicInteger();
|
||||||
|
|
||||||
// For dumping generated classes to disk, for debugging purposes
|
// For dumping generated classes to disk, for debugging purposes
|
||||||
private static final ProxyClassesDumper dumper;
|
private static final ProxyClassesDumper dumper;
|
||||||
|
|
|
@ -120,7 +120,7 @@ public class Timer {
|
||||||
/**
|
/**
|
||||||
* This ID is used to generate thread names.
|
* This ID is used to generate thread names.
|
||||||
*/
|
*/
|
||||||
private static final AtomicInteger nextSerialNumber = new AtomicInteger(0);
|
private static final AtomicInteger nextSerialNumber = new AtomicInteger();
|
||||||
private static int serialNumber() {
|
private static int serialNumber() {
|
||||||
return nextSerialNumber.getAndIncrement();
|
return nextSerialNumber.getAndIncrement();
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,7 +68,7 @@ abstract class AbstractShortCircuitTask<P_IN, P_OUT, R,
|
||||||
protected AbstractShortCircuitTask(PipelineHelper<P_OUT> helper,
|
protected AbstractShortCircuitTask(PipelineHelper<P_OUT> helper,
|
||||||
Spliterator<P_IN> spliterator) {
|
Spliterator<P_IN> spliterator) {
|
||||||
super(helper, spliterator);
|
super(helper, spliterator);
|
||||||
sharedResult = new AtomicReference<>(null);
|
sharedResult = new AtomicReference<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -62,7 +62,7 @@ public class ResourceManager {
|
||||||
}
|
}
|
||||||
} catch (NumberFormatException e) {}
|
} catch (NumberFormatException e) {}
|
||||||
maxSockets = defmax;
|
maxSockets = defmax;
|
||||||
numSockets = new AtomicInteger(0);
|
numSockets = new AtomicInteger();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void beforeUdpCreate() throws SocketException {
|
public static void beforeUdpCreate() throws SocketException {
|
||||||
|
|
|
@ -95,7 +95,7 @@ import jdk.internal.access.JavaSecurityAccess;
|
||||||
* @since 1.1
|
* @since 1.1
|
||||||
*/
|
*/
|
||||||
public class EventQueue {
|
public class EventQueue {
|
||||||
private static final AtomicInteger threadInitNumber = new AtomicInteger(0);
|
private static final AtomicInteger threadInitNumber = new AtomicInteger();
|
||||||
|
|
||||||
private static final int LOW_PRIORITY = 0;
|
private static final int LOW_PRIORITY = 0;
|
||||||
private static final int NORM_PRIORITY = 1;
|
private static final int NORM_PRIORITY = 1;
|
||||||
|
|
|
@ -248,7 +248,7 @@ class TimerQueue implements Runnable
|
||||||
* Sequence number to break scheduling ties, and in turn to
|
* Sequence number to break scheduling ties, and in turn to
|
||||||
* guarantee FIFO order among tied entries.
|
* guarantee FIFO order among tied entries.
|
||||||
*/
|
*/
|
||||||
private static final AtomicLong sequencer = new AtomicLong(0);
|
private static final AtomicLong sequencer = new AtomicLong();
|
||||||
|
|
||||||
/** Sequence number to break ties FIFO */
|
/** Sequence number to break ties FIFO */
|
||||||
private final long sequenceNumber;
|
private final long sequenceNumber;
|
||||||
|
|
|
@ -208,7 +208,7 @@ public final class AppContext {
|
||||||
* number is 1. If so, it returns the sole AppContext without
|
* number is 1. If so, it returns the sole AppContext without
|
||||||
* checking Thread.currentThread().
|
* checking Thread.currentThread().
|
||||||
*/
|
*/
|
||||||
private static final AtomicInteger numAppContexts = new AtomicInteger(0);
|
private static final AtomicInteger numAppContexts = new AtomicInteger();
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -72,7 +72,7 @@ import static jdk.internal.logger.SurrogateLogger.isFilteredFrame;
|
||||||
|
|
||||||
public class LogRecord implements java.io.Serializable {
|
public class LogRecord implements java.io.Serializable {
|
||||||
private static final AtomicLong globalSequenceNumber
|
private static final AtomicLong globalSequenceNumber
|
||||||
= new AtomicLong(0);
|
= new AtomicLong();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Logging message level
|
* Logging message level
|
||||||
|
|
|
@ -39,7 +39,7 @@ abstract class WindowUpdateSender {
|
||||||
|
|
||||||
final int limit;
|
final int limit;
|
||||||
final Http2Connection connection;
|
final Http2Connection connection;
|
||||||
final AtomicInteger received = new AtomicInteger(0);
|
final AtomicInteger received = new AtomicInteger();
|
||||||
|
|
||||||
WindowUpdateSender(Http2Connection connection) {
|
WindowUpdateSender(Http2Connection connection) {
|
||||||
this(connection, connection.clientSettings.getParameter(SettingsFrame.INITIAL_WINDOW_SIZE));
|
this(connection, connection.clientSettings.getParameter(SettingsFrame.INITIAL_WINDOW_SIZE));
|
||||||
|
|
|
@ -375,7 +375,7 @@ public class SSLFlowDelegate {
|
||||||
scheduler.stop();
|
scheduler.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
AtomicInteger count = new AtomicInteger(0);
|
AtomicInteger count = new AtomicInteger();
|
||||||
|
|
||||||
// minimum number of bytes required to call unwrap.
|
// minimum number of bytes required to call unwrap.
|
||||||
// Usually this is 0, unless there was a buffer underflow.
|
// Usually this is 0, unless there was a buffer underflow.
|
||||||
|
|
|
@ -74,7 +74,7 @@ public abstract class SubscriberWrapper
|
||||||
private final CompletableFuture<Void> cf;
|
private final CompletableFuture<Void> cf;
|
||||||
private final SequentialScheduler pushScheduler;
|
private final SequentialScheduler pushScheduler;
|
||||||
private final AtomicReference<Throwable> errorRef = new AtomicReference<>();
|
private final AtomicReference<Throwable> errorRef = new AtomicReference<>();
|
||||||
final AtomicLong upstreamWindow = new AtomicLong(0);
|
final AtomicLong upstreamWindow = new AtomicLong();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Wraps the given downstream subscriber. For each call to {@link
|
* Wraps the given downstream subscriber. For each call to {@link
|
||||||
|
|
|
@ -84,7 +84,7 @@ public final class ObjID implements Serializable {
|
||||||
/** indicate compatibility with JDK 1.1.x version of class */
|
/** indicate compatibility with JDK 1.1.x version of class */
|
||||||
private static final long serialVersionUID = -6386392263968365220L;
|
private static final long serialVersionUID = -6386392263968365220L;
|
||||||
|
|
||||||
private static final AtomicLong nextObjNum = new AtomicLong(0);
|
private static final AtomicLong nextObjNum = new AtomicLong();
|
||||||
private static final UID mySpace = new UID();
|
private static final UID mySpace = new UID();
|
||||||
private static final SecureRandom secureRandom = new SecureRandom();
|
private static final SecureRandom secureRandom = new SecureRandom();
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,6 @@ import java.security.Permission;
|
||||||
import java.security.PrivilegedAction;
|
import java.security.PrivilegedAction;
|
||||||
import java.util.concurrent.ScheduledThreadPoolExecutor;
|
import java.util.concurrent.ScheduledThreadPoolExecutor;
|
||||||
import java.util.concurrent.ThreadFactory;
|
import java.util.concurrent.ThreadFactory;
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
|
@ -70,7 +69,7 @@ public final class RuntimeUtil {
|
||||||
scheduler = new ScheduledThreadPoolExecutor(
|
scheduler = new ScheduledThreadPoolExecutor(
|
||||||
schedulerThreads,
|
schedulerThreads,
|
||||||
new ThreadFactory() {
|
new ThreadFactory() {
|
||||||
private final AtomicInteger count = new AtomicInteger(0);
|
private final AtomicInteger count = new AtomicInteger();
|
||||||
public Thread newThread(Runnable runnable) {
|
public Thread newThread(Runnable runnable) {
|
||||||
try {
|
try {
|
||||||
return AccessController.doPrivileged(
|
return AccessController.doPrivileged(
|
||||||
|
|
|
@ -128,8 +128,6 @@ public class UnicastServerRef extends UnicastRef
|
||||||
private static final Map<Class<?>,?> withoutSkeletons =
|
private static final Map<Class<?>,?> withoutSkeletons =
|
||||||
Collections.synchronizedMap(new WeakHashMap<Class<?>,Void>());
|
Collections.synchronizedMap(new WeakHashMap<Class<?>,Void>());
|
||||||
|
|
||||||
private final AtomicInteger methodCallIDCount = new AtomicInteger(0);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new (empty) Unicast server remote reference.
|
* Create a new (empty) Unicast server remote reference.
|
||||||
* The filter is null to defer to the default ObjectInputStream filter, if any.
|
* The filter is null to defer to the default ObjectInputStream filter, if any.
|
||||||
|
|
|
@ -115,7 +115,7 @@ public class TCPTransport extends Transport {
|
||||||
});
|
});
|
||||||
|
|
||||||
/** total connections handled */
|
/** total connections handled */
|
||||||
private static final AtomicInteger connectionCount = new AtomicInteger(0);
|
private static final AtomicInteger connectionCount = new AtomicInteger();
|
||||||
|
|
||||||
/** client host for the current thread's connection */
|
/** client host for the current thread's connection */
|
||||||
private static final ThreadLocal<ConnectionHandler>
|
private static final ThreadLocal<ConnectionHandler>
|
||||||
|
|
|
@ -48,7 +48,7 @@ import jdk.jfr.internal.SecuritySupport;
|
||||||
* an event stream.
|
* an event stream.
|
||||||
*/
|
*/
|
||||||
abstract class AbstractEventStream implements EventStream {
|
abstract class AbstractEventStream implements EventStream {
|
||||||
private final static AtomicLong counter = new AtomicLong(0);
|
private final static AtomicLong counter = new AtomicLong();
|
||||||
|
|
||||||
private final Object terminated = new Object();
|
private final Object terminated = new Object();
|
||||||
private final Runnable flushOperation = () -> dispatcher().runFlushActions();
|
private final Runnable flushOperation = () -> dispatcher().runFlushActions();
|
||||||
|
|
|
@ -32,7 +32,7 @@ import jdk.jfr.internal.handlers.EventHandler;
|
||||||
|
|
||||||
public final class ThrowableTracer {
|
public final class ThrowableTracer {
|
||||||
|
|
||||||
private static final AtomicLong numThrowables = new AtomicLong(0);
|
private static final AtomicLong numThrowables = new AtomicLong();
|
||||||
|
|
||||||
public static void traceError(Error e, String message) {
|
public static void traceError(Error e, String message) {
|
||||||
if (e instanceof OutOfMemoryError) {
|
if (e instanceof OutOfMemoryError) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue