Skip to content

Commit 4002ded

Browse files
committed
Merge master HEAD into openj9-staging
Conflicts: src/java.base/share/classes/jdk/internal/ref/PhantomCleanable.java Signed-off-by: Jason Feng <[email protected]>
2 parents a43a394 + 7e2f4f1 commit 4002ded

File tree

266 files changed

+4480
-4270
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

266 files changed

+4480
-4270
lines changed

make/ModuleWrapper.gmk

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ ifeq ($(MAKEFILE_PREFIX), Lib)
5151
# which static library files to include. The variable $(MODULE)_INCLUDED_LIBS is
5252
# added to for each call to SetupJdkLibrary. The file module-included-libs.txt is then
5353
# read in StaticLibs.gmk.
54-
ifneq ($($(MODULE)_JDK_LIBS), )
54+
ifneq ($($(MODULE)_INCLUDED_LIBS), )
5555
LIBLIST := $(SUPPORT_OUTPUTDIR)/modules_static-libs/$(MODULE)/module-included-libs.txt
5656

5757
$(LIBLIST): $(TARGETS)

make/autoconf/util.m4

+1-1
Original file line numberDiff line numberDiff line change
@@ -562,7 +562,7 @@ AC_DEFUN([UTIL_CHECK_TYPE_directory],
562562
563563
if test "[x]ARG_CHECK_FOR_FILES" != "x:"; then
564564
for file in ARG_CHECK_FOR_FILES; do
565-
found_files=$($ECHO $(ls $1/$file 2> /dev/null))
565+
found_files=$($ECHO $($LS -d $1/$file 2> /dev/null))
566566
if test "x$found_files" = x; then
567567
FAILURE="Directory $1 does not contain $file"
568568
break

make/test/BuildMicrobenchmark.gmk

+1
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ $(eval $(call SetupJavaCompilation, BUILD_JDK_MICROBENCHMARK, \
8989
SRC := $(MICROBENCHMARK_SRC), \
9090
BIN := $(MICROBENCHMARK_CLASSES), \
9191
JAVAC_FLAGS := \
92+
--add-exports java.base/jdk.internal.classfile.components=ALL-UNNAMED \
9293
--add-exports java.base/jdk.internal.classfile.impl=ALL-UNNAMED \
9394
--add-exports java.base/jdk.internal.event=ALL-UNNAMED \
9495
--add-exports java.base/jdk.internal.foreign=ALL-UNNAMED \

src/java.base/linux/classes/jdk/internal/platform/CgroupSubsystemController.java

+10-9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/*
22
* Copyright (c) 2020, 2022, Red Hat Inc.
3+
* Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.
34
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
45
*
56
* This code is free software; you can redistribute it and/or modify it
@@ -28,8 +29,8 @@
2829
import java.io.IOException;
2930
import java.io.UncheckedIOException;
3031
import java.math.BigInteger;
32+
import java.nio.file.Files;
3133
import java.nio.file.Path;
32-
import java.nio.file.Paths;
3334
import java.util.ArrayList;
3435
import java.util.List;
3536
import java.util.Optional;
@@ -61,13 +62,13 @@ public interface CgroupSubsystemController {
6162
public static String getStringValue(CgroupSubsystemController controller, String param) {
6263
if (controller == null) return null;
6364

64-
try {
65-
return CgroupUtil.readStringValue(controller, param);
66-
}
67-
catch (IOException e) {
65+
Path filePath = Path.of(controller.path(), param);
66+
try (Stream<String> lines = Files.lines(filePath)) {
67+
Optional<String> firstLine = lines.findFirst();
68+
return firstLine.orElse(null);
69+
} catch (UncheckedIOException | IOException e) {
6870
return null;
6971
}
70-
7172
}
7273

7374
/**
@@ -92,8 +93,8 @@ public static long getLongValueMatchingLine(CgroupSubsystemController controller
9293
return retval;
9394
}
9495
try {
95-
Path filePath = Paths.get(controller.path(), param);
96-
List<String> lines = CgroupUtil.readAllLinesPrivileged(filePath);
96+
Path filePath = Path.of(controller.path(), param);
97+
List<String> lines = Files.readAllLines(filePath);
9798
for (String line : lines) {
9899
if (line.startsWith(match)) {
99100
retval = conversion.apply(line);
@@ -161,7 +162,7 @@ public static double getDoubleValue(CgroupSubsystemController controller, String
161162
public static long getLongEntry(CgroupSubsystemController controller, String param, String entryname, long defaultRetval) {
162163
if (controller == null) return defaultRetval;
163164

164-
try (Stream<String> lines = CgroupUtil.readFilePrivileged(Paths.get(controller.path(), param))) {
165+
try (Stream<String> lines = Files.lines(Path.of(controller.path(), param))) {
165166

166167
Optional<String> result = lines.map(line -> line.split(" "))
167168
.filter(line -> (line.length == 2 &&

src/java.base/linux/classes/jdk/internal/platform/CgroupSubsystemFactory.java

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/*
22
* Copyright (c) 2020, 2022, Red Hat Inc.
3+
* Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.
34
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
45
*
56
* This code is free software; you can redistribute it and/or modify it
@@ -29,8 +30,8 @@
2930
import java.io.UncheckedIOException;
3031
import java.lang.System.Logger;
3132
import java.lang.System.Logger.Level;
33+
import java.nio.file.Files;
3234
import java.nio.file.Path;
33-
import java.nio.file.Paths;
3435
import java.util.Collections;
3536
import java.util.HashMap;
3637
import java.util.List;
@@ -140,7 +141,7 @@ public static Optional<CgroupTypeResult> determineType(String mountInfo,
140141
String cgroups,
141142
String selfCgroup) throws IOException {
142143
final Map<String, CgroupInfo> infos = new HashMap<>();
143-
List<String> lines = CgroupUtil.readAllLinesPrivileged(Paths.get(cgroups));
144+
List<String> lines = Files.readAllLines(Path.of(cgroups));
144145
for (String line : lines) {
145146
if (line.startsWith("#")) {
146147
continue;
@@ -180,7 +181,7 @@ public static Optional<CgroupTypeResult> determineType(String mountInfo,
180181
// However, continuing in that case does not make sense as we'd need
181182
// information from mountinfo for the mounted controller paths which we wouldn't
182183
// find anyway in that case.
183-
lines = CgroupUtil.readAllLinesPrivileged(Paths.get(mountInfo));
184+
lines = Files.readAllLines(Path.of(mountInfo));
184185
boolean anyCgroupMounted = false;
185186
for (String line: lines) {
186187
boolean cgroupsControllerFound = amendCgroupInfos(line, infos, isCgroupsV2);
@@ -196,8 +197,7 @@ public static Optional<CgroupTypeResult> determineType(String mountInfo,
196197
// See:
197198
// setCgroupV1Path() for the action run for cgroups v1 systems
198199
// setCgroupV2Path() for the action run for cgroups v2 systems
199-
try (Stream<String> selfCgroupLines =
200-
CgroupUtil.readFilePrivileged(Paths.get(selfCgroup))) {
200+
try (Stream<String> selfCgroupLines = Files.lines(Path.of(selfCgroup))) {
201201
Consumer<String[]> action = (tokens -> setCgroupV1Path(infos, tokens));
202202
if (isCgroupsV2) {
203203
action = (tokens -> setCgroupV2Path(infos, tokens));
@@ -311,7 +311,7 @@ private static boolean amendCgroupInfos(String mntInfoLine,
311311
String mountPath = lineMatcher.group(2);
312312
String fsType = lineMatcher.group(3);
313313
if (fsType.equals("cgroup")) {
314-
Path p = Paths.get(mountPath);
314+
Path p = Path.of(mountPath);
315315
String[] controllerNames = p.getFileName().toString().split(",");
316316
for (String controllerName: controllerNames) {
317317
switch (controllerName) {

src/java.base/linux/classes/jdk/internal/platform/CgroupUtil.java

-92
This file was deleted.

src/java.base/linux/classes/jdk/internal/platform/cgroupv2/CgroupV2Subsystem.java

+7-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/*
22
* Copyright (c) 2020, 2022, Red Hat Inc.
3+
* Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.
34
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
45
*
56
* This code is free software; you can redistribute it and/or modify it
@@ -27,15 +28,16 @@
2728

2829
import java.io.IOException;
2930
import java.io.UncheckedIOException;
30-
import java.nio.file.Paths;
31+
import java.nio.file.Files;
32+
import java.nio.file.Path;
3133
import java.util.concurrent.TimeUnit;
3234
import java.util.function.Function;
3335
import java.util.stream.Collectors;
36+
import java.util.stream.Stream;
3437

3538
import jdk.internal.platform.CgroupInfo;
3639
import jdk.internal.platform.CgroupSubsystem;
3740
import jdk.internal.platform.CgroupSubsystemController;
38-
import jdk.internal.platform.CgroupUtil;
3941

4042
public class CgroupV2Subsystem implements CgroupSubsystem {
4143

@@ -328,10 +330,9 @@ public long getBlkIOServiced() {
328330
}
329331

330332
private long sumTokensIOStat(Function<String, Long> mapFunc) {
331-
try {
332-
return CgroupUtil.readFilePrivileged(Paths.get(unified.path(), "io.stat"))
333-
.map(mapFunc)
334-
.collect(Collectors.summingLong(e -> e));
333+
try (Stream<String> lines = Files.lines(Path.of(unified.path(), "io.stat"))) {
334+
return lines.map(mapFunc)
335+
.collect(Collectors.summingLong(e -> e));
335336
} catch (UncheckedIOException | IOException e) {
336337
return CgroupSubsystem.LONG_RETVAL_UNLIMITED;
337338
}

0 commit comments

Comments
 (0)