8345325: SM cleanup of GetPropertyAction in java.base

Reviewed-by: alanb, lancea, naoto, mchung
This commit is contained in:
Roger Riggs 2024-12-03 14:59:30 +00:00
parent eac00f6d11
commit fcf185c8b4
11 changed files with 13 additions and 241 deletions

View file

@ -38,7 +38,6 @@ import jdk.internal.javac.PreviewFeature;
import jdk.internal.vm.annotation.ForceInline;
import jdk.internal.vm.annotation.Hidden;
import jdk.internal.vm.ScopedValueContainer;
import sun.security.action.GetPropertyAction;
/**
* A value that may be safely and efficiently shared to methods without using method
@ -740,7 +739,7 @@ public final class ScopedValue<T> {
static {
final String propertyName = "java.lang.ScopedValue.cacheSize";
var sizeString = GetPropertyAction.privilegedGetProperty(propertyName, "16");
var sizeString = System.getProperty(propertyName, "16");
var cacheSize = Integer.valueOf(sizeString);
if (cacheSize < 2 || cacheSize > MAX_CACHE_SIZE) {
cacheSize = MAX_CACHE_SIZE;

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 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
@ -45,7 +45,6 @@ import java.util.stream.Stream;
import java.util.stream.StreamSupport;
import jdk.internal.vm.Continuation;
import jdk.internal.vm.ContinuationScope;
import sun.security.action.GetPropertyAction;
import static java.lang.StackStreamFactory.WalkerState.*;
@ -82,13 +81,8 @@ final class StackStreamFactory {
@Native private static final int SHOW_HIDDEN_FRAMES = 0x20; // LambdaForms are hidden by the VM
@Native private static final int FILL_LIVE_STACK_FRAMES = 0x100;
/*
* For Throwable to use StackWalker, set useNewThrowable to true.
* Performance work and extensive testing is needed to replace the
* VM built-in backtrace filled in Throwable with the StackWalker.
*/
static final boolean isDebug =
"true".equals(GetPropertyAction.privilegedGetProperty("stackwalk.debug"));
"true".equals(System.getProperty("stackwalk.debug"));
static <T> StackFrameTraverser<T>
makeStackTraverser(StackWalker walker, Function<? super Stream<StackFrame>, ? extends T> function)

View file

@ -33,7 +33,6 @@ import java.util.stream.Collectors;
import jdk.internal.misc.CarrierThreadLocal;
import jdk.internal.misc.TerminatingThreadLocal;
import sun.security.action.GetPropertyAction;
/**
* This class provides thread-local variables. These variables differ from
@ -804,7 +803,7 @@ public class ThreadLocal<T> {
* a stack trace should be printed when a virtual thread sets a thread local.
*/
private static boolean traceVirtualThreadLocals() {
String propValue = GetPropertyAction.privilegedGetProperty("jdk.traceVirtualThreadLocals");
String propValue = System.getProperty("jdk.traceVirtualThreadLocals");
return (propValue != null)
&& (propValue.isEmpty() || Boolean.parseBoolean(propValue));
}

View file

@ -28,11 +28,9 @@ package java.lang.invoke;
import jdk.internal.misc.VM;
import jdk.internal.ref.CleanerFactory;
import sun.invoke.util.Wrapper;
import sun.security.action.GetPropertyAction;
import java.lang.invoke.MethodHandles.Lookup;
import java.lang.reflect.Field;
import java.util.Properties;
import static java.lang.invoke.MethodHandleNatives.Constants.*;
import static java.lang.invoke.MethodHandleStatics.TRACE_METHOD_LINKAGE;
@ -707,8 +705,7 @@ class MethodHandleNatives {
static final boolean USE_SOFT_CACHE;
static {
Properties props = GetPropertyAction.privilegedGetProperties();
USE_SOFT_CACHE = Boolean.parseBoolean(
props.getProperty("java.lang.invoke.MethodHandleNatives.USE_SOFT_CACHE", "true"));
System.getProperty("java.lang.invoke.MethodHandleNatives.USE_SOFT_CACHE", "true"));
}
}