Skip to content

Commit 26656b9

Browse files
authored
Merge branch 'master' into goetz_backport_8361754
2 parents 60e931b + 9a19b3b commit 26656b9

File tree

25 files changed

+647
-280
lines changed

25 files changed

+647
-280
lines changed

src/hotspot/share/memory/guardedMemory.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,7 @@ class GuardedMemory : StackObj { // Wrapper on stack
330330
* @param ptr the memory to be copied
331331
* @param len the length of the copy
332332
* @param tag optional general purpose tag (see GuardedMemory::get_tag())
333+
* @param tag2 optional general purpose tag (see GuardedMemory::get_tag2())
333334
*
334335
* @return guarded wrapped memory pointer to the user area, or NULL if OOM.
335336
*/

src/jdk.jfr/share/conf/jfr/default.jfc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@
2828
</event>
2929

3030
<event name="jdk.SymbolTableStatistics">
31-
<setting name="enabled">true</setting>
31+
<setting name="enabled">false</setting>
3232
<setting name="period">10 s</setting>
3333
</event>
3434

3535
<event name="jdk.StringTableStatistics">
36-
<setting name="enabled">true</setting>
36+
<setting name="enabled">false</setting>
3737
<setting name="period">10 s</setting>
3838
</event>
3939

@@ -670,7 +670,7 @@
670670
</event>
671671

672672
<event name="jdk.ModuleExport">
673-
<setting name="enabled">true</setting>
673+
<setting name="enabled">false</setting>
674674
<setting name="period">endChunk</setting>
675675
</event>
676676

src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WindowsAppImageBuilder.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -117,8 +117,9 @@ private void createLauncherForEntryPoint(Map<String, ? super Object> params,
117117
mainParams);
118118
Path iconTarget = null;
119119
if (iconResource != null) {
120-
iconTarget = appLayout.destktopIntegrationDirectory().resolve(
121-
APP_NAME.fetchFrom(params) + ".ico");
120+
Path iconDir = StandardBundlerParam.TEMP_ROOT.fetchFrom(params).resolve(
121+
"icons");
122+
iconTarget = iconDir.resolve(APP_NAME.fetchFrom(params) + ".ico");
122123
if (null == iconResource.saveToFile(iconTarget)) {
123124
iconTarget = null;
124125
}

src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WixAppImageFragmentBuilder.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -443,17 +443,11 @@ private String addShortcutComponent(XMLStreamWriter xml, Path launcherPath,
443443

444444
Path shortcutPath = folder.getPath(this).resolve(launcherBasename);
445445
return addComponent(xml, shortcutPath, Component.Shortcut, unused -> {
446-
final Path icoFile = IOUtils.addSuffix(
447-
installedAppImage.destktopIntegrationDirectory().resolve(
448-
launcherBasename), ".ico");
449-
450446
xml.writeAttribute("Name", launcherBasename);
451447
xml.writeAttribute("WorkingDirectory", INSTALLDIR.toString());
452448
xml.writeAttribute("Advertise", "no");
453-
xml.writeAttribute("IconIndex", "0");
454449
xml.writeAttribute("Target", String.format("[#%s]",
455450
Component.File.idOf(launcherPath)));
456-
xml.writeAttribute("Icon", Id.Icon.of(icoFile));
457451
});
458452
}
459453

test/hotspot/jtreg/testlibrary/jittester/src/jdk/test/lib/jittester/Automatic.java

Lines changed: 37 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -23,13 +23,6 @@
2323

2424
package jdk.test.lib.jittester;
2525

26-
import jdk.test.lib.util.Pair;
27-
import jdk.test.lib.jittester.factories.IRNodeBuilder;
28-
import jdk.test.lib.jittester.types.TypeKlass;
29-
import jdk.test.lib.jittester.utils.FixedTrees;
30-
import jdk.test.lib.jittester.utils.OptionResolver;
31-
import jdk.test.lib.jittester.utils.OptionResolver.Option;
32-
import jdk.test.lib.jittester.utils.PseudoRandom;
3326
import java.time.LocalTime;
3427
import java.util.ArrayList;
3528
import java.util.List;
@@ -39,56 +32,6 @@
3932
public class Automatic {
4033
public static final int MINUTES_TO_WAIT = Integer.getInteger("jdk.test.lib.jittester", 3);
4134

42-
private static Pair<IRNode, IRNode> generateIRTree(String name) {
43-
SymbolTable.removeAll();
44-
TypeList.removeAll();
45-
46-
IRNodeBuilder builder = new IRNodeBuilder()
47-
.setPrefix(name)
48-
.setName(name)
49-
.setLevel(0);
50-
51-
Long complexityLimit = ProductionParams.complexityLimit.value();
52-
IRNode privateClasses = null;
53-
if (!ProductionParams.disableClasses.value()) {
54-
long privateClassComlexity = (long) (complexityLimit * PseudoRandom.random());
55-
try {
56-
privateClasses = builder.setComplexityLimit(privateClassComlexity)
57-
.getClassDefinitionBlockFactory()
58-
.produce();
59-
} catch (ProductionFailedException ex) {
60-
ex.printStackTrace(System.out);
61-
}
62-
}
63-
long mainClassComplexity = (long) (complexityLimit * PseudoRandom.random());
64-
IRNode mainClass = null;
65-
try {
66-
mainClass = builder.setComplexityLimit(mainClassComplexity)
67-
.getMainKlassFactory()
68-
.produce();
69-
TypeKlass aClass = new TypeKlass(name);
70-
mainClass.getChild(1).addChild(FixedTrees.generateMainOrExecuteMethod(aClass, true));
71-
mainClass.getChild(1).addChild(FixedTrees.generateMainOrExecuteMethod(aClass, false));
72-
} catch (ProductionFailedException ex) {
73-
ex.printStackTrace(System.out);
74-
}
75-
return new Pair<>(mainClass, privateClasses);
76-
}
77-
78-
private static void initializeTestGenerator(String[] params) {
79-
OptionResolver parser = new OptionResolver();
80-
Option<String> propertyFileOpt = parser.addStringOption('p', "property-file",
81-
"conf/default.properties", "File to read properties from");
82-
ProductionParams.register(parser);
83-
parser.parse(params, propertyFileOpt);
84-
PseudoRandom.reset(ProductionParams.seed.value());
85-
TypesParser.parseTypesAndMethods(ProductionParams.classesFile.value(),
86-
ProductionParams.excludeMethodsFile.value());
87-
if (ProductionParams.specificSeed.isSet()) {
88-
PseudoRandom.setCurrentSeed(ProductionParams.specificSeed.value());
89-
}
90-
}
91-
9235
private static List<TestsGenerator> getTestGenerators() {
9336
List<TestsGenerator> result = new ArrayList<>();
9437
Class<?> factoryClass;
@@ -108,7 +51,9 @@ private static List<TestsGenerator> getTestGenerators() {
10851
}
10952

11053
public static void main(String[] args) {
111-
initializeTestGenerator(args);
54+
ProductionParams.initializeFromCmdline(args);
55+
IRTreeGenerator.initializeWithProductionParams();
56+
11257
int counter = 0;
11358
System.out.printf("Generating %d tests...%n", ProductionParams.numberOfTests.value());
11459
System.out.printf(" %13s | %8s | %8s | %8s |%n", "start time", "count", "generat",
@@ -117,34 +62,41 @@ public static void main(String[] args) {
11762
List<TestsGenerator> generators = getTestGenerators();
11863
do {
11964
double start = System.currentTimeMillis();
120-
System.out.print("[" + LocalTime.now() + "] |");
121-
String name = "Test_" + counter;
122-
Pair<IRNode, IRNode> irTree = generateIRTree(name);
123-
System.out.printf(" %8d |", counter);
124-
long maxWaitTime = TimeUnit.MINUTES.toMillis(MINUTES_TO_WAIT);
125-
double generationTime = System.currentTimeMillis() - start;
126-
System.out.printf(" %8.0f |", generationTime);
127-
start = System.currentTimeMillis();
128-
Thread generatorThread = new Thread(() -> {
129-
for (TestsGenerator generator : generators) {
130-
generator.accept(irTree.first, irTree.second);
131-
}
132-
});
133-
generatorThread.start();
13465
try {
135-
generatorThread.join(maxWaitTime);
136-
} catch (InterruptedException ie) {
137-
throw new Error("Test generation interrupted: " + ie, ie);
138-
}
139-
if (generatorThread.isAlive()) {
140-
// maxTime reached, so, proceed to next test generation
141-
generatorThread.interrupt();
142-
} else {
143-
double runningTime = System.currentTimeMillis() - start;
144-
System.out.printf(" %8.0f |%n", runningTime);
145-
if (runningTime < maxWaitTime) {
146-
++counter;
66+
System.out.print("[" + LocalTime.now() + "] |");
67+
String name = "Test_" + counter;
68+
var test = IRTreeGenerator.generateIRTree(name);
69+
System.out.printf(" %8d |", counter);
70+
long maxWaitTime = TimeUnit.MINUTES.toMillis(MINUTES_TO_WAIT);
71+
double generationTime = System.currentTimeMillis() - start;
72+
System.out.printf(" %8.0f |", generationTime);
73+
start = System.currentTimeMillis();
74+
Thread generatorThread = new Thread(() -> {
75+
for (TestsGenerator generator : generators) {
76+
generator.accept(test);
77+
}
78+
});
79+
generatorThread.start();
80+
try {
81+
generatorThread.join(maxWaitTime);
82+
} catch (InterruptedException ie) {
83+
throw new Error("Test generation interrupted: " + ie, ie);
84+
}
85+
if (generatorThread.isAlive()) {
86+
// maxTime reached, so, proceed to next test generation
87+
generatorThread.interrupt();
88+
} else {
89+
double runningTime = System.currentTimeMillis() - start;
90+
System.out.printf(" %8.0f |%n", runningTime);
91+
if (runningTime < maxWaitTime) {
92+
++counter;
93+
}
14794
}
95+
} catch (RuntimeException ignored) {
96+
// Generation failures happen due to nature of fuzzing test generators,
97+
// such errors are ignored.
98+
System.out.println("Test_" + counter + " ignored, generation failed due to " +
99+
ignored.getMessage());
148100
}
149101
} while (counter < ProductionParams.numberOfTests.value());
150102
}

test/hotspot/jtreg/testlibrary/jittester/src/jdk/test/lib/jittester/ByteCodeGenerator.java

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -47,16 +47,17 @@ class ByteCodeGenerator extends TestsGenerator {
4747
}
4848

4949
@Override
50-
public void accept(IRNode mainClass, IRNode privateClasses) {
51-
generateClassFiles(mainClass, privateClasses);
52-
generateSeparateJtregHeader(mainClass);
50+
public void accept(IRTreeGenerator.Test test) {
51+
IRNode mainClass = test.mainClass();
52+
generateClassFiles(mainClass, test.privateClasses());
53+
generateSeparateJtregHeader(test.seed(), mainClass);
5354
compilePrinter();
5455
generateGoldenOut(mainClass.getName());
5556
}
5657

57-
private void generateSeparateJtregHeader(IRNode mainClass) {
58+
private void generateSeparateJtregHeader(long seed, IRNode mainClass) {
5859
String mainClassName = mainClass.getName();
59-
writeFile(generatorDir, mainClassName + ".java", getJtregHeader(mainClassName));
60+
writeFile(generatorDir, mainClassName + ".java", getJtregHeader(mainClassName, seed));
6061
}
6162

6263
private void generateClassFiles(IRNode mainClass, IRNode privateClasses) {
@@ -94,4 +95,17 @@ private void writeFile(String fileName, byte[] bytecode) {
9495
ex.printStackTrace();
9596
}
9697
}
98+
99+
public static void main(String[] args) throws Exception {
100+
ProductionParams.initializeFromCmdline(args);
101+
IRTreeGenerator.initializeWithProductionParams();
102+
103+
ByteCodeGenerator generator = new ByteCodeGenerator();
104+
105+
for (String mainClass : ProductionParams.mainClassNames.value()) {
106+
var test = IRTreeGenerator.generateIRTree(mainClass);
107+
generator.generateClassFiles(test.mainClass(), test.privateClasses());
108+
generator.generateSeparateJtregHeader(test.seed(), test.mainClass());
109+
}
110+
}
97111
}
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
/*
2+
* Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.
3+
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4+
*
5+
* This code is free software; you can redistribute it and/or modify it
6+
* under the terms of the GNU General Public License version 2 only, as
7+
* published by the Free Software Foundation.
8+
*
9+
* This code is distributed in the hope that it will be useful, but WITHOUT
10+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11+
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12+
* version 2 for more details (a copy is included in the LICENSE file that
13+
* accompanied this code).
14+
*
15+
* You should have received a copy of the GNU General Public License version
16+
* 2 along with this work; if not, write to the Free Software Foundation,
17+
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18+
*
19+
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20+
* or visit www.oracle.com if you need additional information or have any
21+
* questions.
22+
*/
23+
24+
package jdk.test.lib.jittester;
25+
26+
import jdk.test.lib.jittester.factories.IRNodeBuilder;
27+
import jdk.test.lib.jittester.types.TypeKlass;
28+
import jdk.test.lib.jittester.utils.FixedTrees;
29+
import jdk.test.lib.jittester.utils.PseudoRandom;
30+
31+
/**
32+
* Generates IR trees for fuzzy test classes.
33+
*/
34+
public class IRTreeGenerator {
35+
36+
/**
37+
* Generated Test - main and private classes trees along with random seed used for generation.
38+
*/
39+
public record Test (long seed, IRNode mainClass, IRNode privateClasses) {};
40+
41+
/**
42+
* Generates IR trees for main and private classes.
43+
*
44+
* @param name main class name
45+
* @return a pair (main class; private classes)
46+
*/
47+
public static Test generateIRTree(String name) {
48+
long seed = PseudoRandom.getCurrentSeed();
49+
ProductionLimiter.resetTimer();
50+
//NB: SymbolTable is a widely-used singleton, hence all the locking.
51+
SymbolTable.removeAll();
52+
TypeList.removeAll();
53+
54+
IRNodeBuilder builder = new IRNodeBuilder()
55+
.setPrefix(name)
56+
.setName(name)
57+
.setLevel(0);
58+
59+
Long complexityLimit = ProductionParams.complexityLimit.value();
60+
IRNode privateClasses = null;
61+
if (!ProductionParams.disableClasses.value()) {
62+
long privateClassComlexity = (long) (complexityLimit * PseudoRandom.random());
63+
try {
64+
privateClasses = builder.setComplexityLimit(privateClassComlexity)
65+
.getClassDefinitionBlockFactory()
66+
.produce();
67+
} catch (ProductionFailedException ex) {
68+
ex.printStackTrace(System.out);
69+
}
70+
}
71+
long mainClassComplexity = (long) (complexityLimit * PseudoRandom.random());
72+
IRNode mainClass = null;
73+
try {
74+
mainClass = builder.setComplexityLimit(mainClassComplexity)
75+
.getMainKlassFactory()
76+
.produce();
77+
TypeKlass aClass = new TypeKlass(name);
78+
mainClass.getChild(1).addChild(FixedTrees.generateMainOrExecuteMethod(aClass, true));
79+
mainClass.getChild(1).addChild(FixedTrees.generateMainOrExecuteMethod(aClass, false));
80+
} catch (ProductionFailedException ex) {
81+
ex.printStackTrace(System.out);
82+
}
83+
return new Test(seed, mainClass, privateClasses);
84+
}
85+
86+
/**
87+
* Initializes the generator from ProductionParams static class.
88+
*/
89+
public static void initializeWithProductionParams() {
90+
TypesParser.parseTypesAndMethods(ProductionParams.classesFile.value(),
91+
ProductionParams.excludeMethodsFile.value());
92+
if (ProductionParams.specificSeed.isSet()) {
93+
PseudoRandom.setCurrentSeed(ProductionParams.specificSeed.value());
94+
}
95+
}
96+
97+
}

0 commit comments

Comments
 (0)