This commit is contained in:
Prasanta Sadhukhan 2019-02-19 11:52:19 +05:30
commit 493a77061f
31 changed files with 165 additions and 125 deletions

View File

@ -1,6 +1,6 @@
/*
* Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2017, SAP SE. All rights reserved.
* Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2019, SAP SE. 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
@ -1842,6 +1842,51 @@ class StubGenerator: public StubCodeGenerator {
}
// Compute GHASH function.
address generate_ghash_processBlocks() {
__ align(CodeEntryAlignment);
StubCodeMark mark(this, "StubRoutines", "ghash_processBlocks");
unsigned int start_off = __ offset(); // Remember stub start address (is rtn value).
const Register state = Z_ARG1;
const Register subkeyH = Z_ARG2;
const Register data = Z_ARG3; // 1st of even-odd register pair.
const Register blocks = Z_ARG4;
const Register len = blocks; // 2nd of even-odd register pair.
const int param_block_size = 4 * 8;
const int frame_resize = param_block_size + 8; // Extra space for copy of fp.
// Reserve stack space for parameter block (R1).
__ z_lgr(Z_R1, Z_SP);
__ resize_frame(-frame_resize, Z_R0, true);
__ z_aghi(Z_R1, -param_block_size);
// Fill parameter block.
__ z_mvc(Address(Z_R1) , Address(state) , 16);
__ z_mvc(Address(Z_R1, 16), Address(subkeyH), 16);
// R4+5: data pointer + length
__ z_llgfr(len, blocks); // Cast to 64-bit.
// R0: function code
__ load_const_optimized(Z_R0, (int)VM_Version::MsgDigest::_GHASH);
// Compute.
__ z_sllg(len, len, 4); // In bytes.
__ kimd(data);
// Copy back result and free parameter block.
__ z_mvc(Address(state), Address(Z_R1), 16);
__ z_xc(Address(Z_R1), param_block_size, Address(Z_R1));
__ z_aghi(Z_SP, frame_resize);
__ z_br(Z_R14);
return __ addr_at(start_off);
}
// Call interface for all SHA* stubs.
//
// Z_ARG1 - source data block. Ptr to leftmost byte to be processed.
@ -2305,6 +2350,11 @@ class StubGenerator: public StubCodeGenerator {
StubRoutines::_cipherBlockChaining_decryptAESCrypt = generate_cipherBlockChaining_AES_decrypt("AES_decryptBlock_chaining");
}
// Generate GHASH intrinsics code
if (UseGHASHIntrinsics) {
StubRoutines::_ghash_processBlocks = generate_ghash_processBlocks();
}
// Generate SHA1/SHA256/SHA512 intrinsics code.
if (UseSHA1Intrinsics) {
StubRoutines::_sha1_implCompress = generate_SHA1_stub(false, "SHA1_singleBlock");

View File

@ -1,6 +1,6 @@
/*
* Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2018 SAP SE. All rights reserved.
* Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2019 SAP SE. 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
@ -165,8 +165,10 @@ void VM_Version::initialize() {
FLAG_SET_DEFAULT(UseAESCTRIntrinsics, false);
}
// TODO: implement GHASH intrinsics
if (UseGHASHIntrinsics) {
if (FLAG_IS_DEFAULT(UseGHASHIntrinsics) && has_Crypto_GHASH()) {
FLAG_SET_DEFAULT(UseGHASHIntrinsics, true);
}
if (UseGHASHIntrinsics && !has_Crypto_GHASH()) {
warning("GHASH intrinsics are not available on this CPU");
FLAG_SET_DEFAULT(UseGHASHIntrinsics, false);
}

View File

@ -2761,7 +2761,7 @@ CMSPhaseAccounting::CMSPhaseAccounting(CMSCollector *collector,
CMSPhaseAccounting::~CMSPhaseAccounting() {
_collector->gc_timer_cm()->register_gc_concurrent_end();
_collector->stopTimer();
log_debug(gc)("Concurrent active time: %.3fms", TimeHelper::counter_to_seconds(_collector->timerTicks()));
log_debug(gc)("Concurrent active time: %.3fms", TimeHelper::counter_to_millis(_collector->timerTicks()));
log_trace(gc)(" (CMS %s yielded %d times)", _title, _collector->yields());
}

View File

@ -29,7 +29,6 @@
#include "oops/oop.hpp"
class Generation;
class HeapWord;
class CardTableRS;
class CardTableBarrierSet;
class DefNewGeneration;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 2019, 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
@ -36,7 +36,7 @@
// pattern.
bool SpaceMangler::is_mangled(HeapWord* q) {
// This test loses precision but is good enough
return badHeapWord == (max_juint & (uintptr_t) q->value());
return badHeapWord == (max_juint & reinterpret_cast<uintptr_t>(*q));
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 2019, 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
@ -156,8 +156,6 @@
nonstatic_field(GenCollectedHeap, _young_gen_spec, GenerationSpec*) \
nonstatic_field(GenCollectedHeap, _old_gen_spec, GenerationSpec*) \
\
nonstatic_field(HeapWord, i, char*) \
\
nonstatic_field(MemRegion, _start, HeapWord*) \
nonstatic_field(MemRegion, _word_size, size_t) \
\

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, Red Hat, Inc. All rights reserved.
* Copyright (c) 2018, 2019, Red Hat, Inc. All rights reserved.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
@ -29,8 +29,6 @@
#include "memory/memRegion.hpp"
#include "oops/oopsHierarchy.hpp"
class HeapWord;
/**
* Encapsulate a marking bitmap with the top-at-mark-start and top-bitmaps array.
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, Red Hat, Inc. All rights reserved.
* Copyright (c) 2018, 2019, Red Hat, Inc. All rights reserved.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
@ -27,7 +27,6 @@
#include "memory/allocation.hpp"
#include "oops/oopsHierarchy.hpp"
class HeapWord;
class JavaThread;
class oopDesc;

View File

@ -40,8 +40,6 @@
// create MemRegions (in CardTableBarrierSet) in heap so operator
// new and operator new [] added for this special case.
class MetaWord;
class MemRegion {
friend class VMStructs;
private:

View File

@ -57,7 +57,6 @@
class ClassLoaderData;
class MetaspaceTracer;
class MetaWord;
class Mutex;
class outputStream;

View File

@ -165,29 +165,18 @@ const int BitsPerSize_t = size_tSize * BitsPerByte;
// Size of a char[] needed to represent a jint as a string in decimal.
const int jintAsStringSize = 12;
// An opaque struct of heap-word width, so that HeapWord* can be a generic
// pointer into the heap. We require that object sizes be measured in
// units of heap words, so that that
// HeapWord* hw;
// An opaque type, so that HeapWord* can be a generic pointer into the heap.
// We require that object sizes be measured in units of heap words (e.g.
// pointer-sized values), so that given HeapWord* hw,
// hw += oop(hw)->foo();
// works, where foo is a method (like size or scavenge) that returns the
// object size.
class HeapWord {
friend class VMStructs;
private:
char* i;
#ifndef PRODUCT
public:
char* value() { return i; }
#endif
};
class HeapWordImpl; // Opaque, never defined.
typedef HeapWordImpl* HeapWord;
// Analogous opaque struct for metadata allocated from
// metaspaces.
class MetaWord {
private:
char* i;
};
// Analogous opaque struct for metadata allocated from metaspaces.
class MetaWordImpl; // Opaque, never defined.
typedef MetaWordImpl* MetaWord;
// HeapWordSize must be 2^LogHeapWordSize.
const int HeapWordSize = sizeof(HeapWord);

View File

@ -188,7 +188,7 @@ vmTestbase/vm/mlvm/meth/stress/compiler/sequences/Test.java 8058176 generic-all
vmTestbase/vm/mlvm/meth/stress/gc/callSequencesDuringGC/Test.java 8058176 generic-all
vmTestbase/vm/mlvm/meth/stress/java/sequences/Test.java 8058176 generic-all
vmTestbase/vm/mlvm/meth/stress/jdi/breakpointInCompiledCode/Test.java 8058176 generic-all
vmTestbase/vm/mlvm/mixed/stress/java/findDeadlock/TestDescription.java 8208278 generic-all
vmTestbase/vm/mlvm/mixed/stress/java/findDeadlock/TestDescription.java 8208278 macosx-all
vmTestbase/vm/mlvm/indy/func/jvmti/mergeCP_indy2none_a/TestDescription.java 8013267 generic-all
vmTestbase/vm/mlvm/indy/func/jvmti/mergeCP_indy2manyDiff_b/TestDescription.java 8013267 generic-all
vmTestbase/vm/mlvm/indy/func/jvmti/mergeCP_indy2manySame_b/TestDescription.java 8013267 generic-all

View File

@ -120,19 +120,16 @@ public class TestMaxNewSize {
public static void main(String args[]) throws Exception {
String gcName = args[0];
final int M32 = 32 * 1024 * 1024;
final int M64 = 64 * 1024 * 1024;
final int M96 = 96 * 1024 * 1024;
final int M128 = 128 * 1024 * 1024;
checkMaxNewSize(new String[] { gcName, "-Xmx128M" }, M128);
checkMaxNewSize(new String[] { gcName, "-Xmx128M", "-XX:NewRatio=5" }, M128);
checkMaxNewSize(new String[] { gcName, "-Xmx128M", "-XX:NewSize=32M" }, M128);
checkMaxNewSize(new String[] { gcName, "-Xmx128M", "-XX:OldSize=96M" }, M128);
checkMaxNewSize(new String[] { gcName, "-Xmx128M", "-XX:MaxNewSize=32M" }, M32);
checkMaxNewSize(new String[] { gcName, "-Xmx128M", "-XX:NewSize=32M", "-XX:MaxNewSize=32M" }, M32);
checkMaxNewSize(new String[] { gcName, "-Xmx128M", "-XX:NewRatio=6", "-XX:MaxNewSize=32M" }, M32);
checkMaxNewSize(new String[] { gcName, "-Xmx128M", "-Xms96M" }, M128);
checkMaxNewSize(new String[] { gcName, "-Xmx96M", "-Xms96M" }, M96);
checkMaxNewSize(new String[] { gcName, "-XX:NewSize=128M", "-XX:MaxNewSize=50M"}, M128);
final int M = 1024 * 1024;
checkMaxNewSize(new String[] { gcName, "-Xmx128M" }, 128 * M);
checkMaxNewSize(new String[] { gcName, "-Xmx128M", "-XX:NewRatio=5" }, 128 * M);
checkMaxNewSize(new String[] { gcName, "-Xmx128M", "-XX:NewSize=32M" }, 128 * M);
checkMaxNewSize(new String[] { gcName, "-Xmx128M", "-XX:OldSize=96M" }, 128 * M);
checkMaxNewSize(new String[] { gcName, "-Xmx128M", "-XX:MaxNewSize=32M" }, 32 * M);
checkMaxNewSize(new String[] { gcName, "-Xmx128M", "-XX:NewSize=32M", "-XX:MaxNewSize=32M" }, 32 * M);
checkMaxNewSize(new String[] { gcName, "-Xmx128M", "-XX:NewRatio=6", "-XX:MaxNewSize=32M" }, 32 * M);
checkMaxNewSize(new String[] { gcName, "-Xmx128M", "-Xms96M" }, 128 * M);
checkMaxNewSize(new String[] { gcName, "-Xmx96M", "-Xms96M" }, 96 * M);
checkMaxNewSize(new String[] { gcName, "-XX:NewSize=128M", "-XX:MaxNewSize=50M"}, 128 * M);
}
}

View File

@ -23,6 +23,8 @@
package gc.arguments;
import static java.lang.ref.Reference.reachabilityFence;
/*
* @test TestTargetSurvivorRatioFlag
* @key gc
@ -297,7 +299,7 @@ public class TestTargetSurvivorRatioFlag {
// force minor GC
while (youngGCBean.getCollectionCount() <= initialGcId + MAX_TENURING_THRESHOLD * 2) {
byte b[] = new byte[ARRAY_LENGTH];
reachabilityFence(new byte[ARRAY_LENGTH]);
}
allocator.release();

View File

@ -23,6 +23,8 @@
package gc.cms;
import static java.lang.ref.Reference.reachabilityFence;
/*
* @test DisableResizePLAB
* @key gc
@ -41,7 +43,7 @@ public class DisableResizePLAB {
}
long startTime = System.currentTimeMillis();
while (System.currentTimeMillis() - startTime < 10_000) {
Object o = new byte[1024];
reachabilityFence(new byte[1024]);
}
}
}

View File

@ -23,6 +23,8 @@
package gc.cslocker;
import static java.lang.ref.Reference.reachabilityFence;
/*
* @test TestCSLocker
* @key gc
@ -73,8 +75,7 @@ class GarbageProducer extends Thread
while (isRunning) {
try {
int[] arr = null;
arr = new int[size];
reachabilityFence(new int[size]);
sleep(sleepTime);
} catch (InterruptedException e) {
isRunning = false;

View File

@ -57,8 +57,8 @@ public class TestMemoryMXBeans {
MemoryMXBean memoryMXBean = ManagementFactory.getMemoryMXBean();
long heapInit = memoryMXBean.getHeapMemoryUsage().getInit();
long heapMax = memoryMXBean.getHeapMemoryUsage().getMax();
long nonHeapInit = memoryMXBean.getNonHeapMemoryUsage().getInit();
long nonHeapMax = memoryMXBean.getNonHeapMemoryUsage().getMax();
memoryMXBean.getNonHeapMemoryUsage().getInit(); // value not used
memoryMXBean.getNonHeapMemoryUsage().getMax(); // value not used
if (initSize > 0 && heapInit != initSize) {
throw new IllegalStateException("Init heap size is wrong: " + heapInit + " vs " + initSize);

View File

@ -130,7 +130,7 @@ public class TestFromCardCacheIndex {
if (target == null) {
continue;
}
final long startAddress = WB.getObjectAddress(target);
WB.getObjectAddress(target); // startAddress not used
final long lastAddress = getObjectLastAddress(target);
final int card = getCardIndex32bit(lastAddress);
if (card == -1) {

View File

@ -23,6 +23,8 @@
package gc.g1;
import static java.lang.ref.Reference.reachabilityFence;
/*
* @test TestHumongousAllocNearlyFullRegion
* @bug 8143587
@ -62,7 +64,7 @@ public class TestHumongousAllocNearlyFullRegion {
for (int i = 0; i < heapSize; i++) {
// 131069 is the number of longs it takes to fill a heapRegion except
// for 8 bytes on 64 bit.
long[] largeObect = new long[131069];
reachabilityFence(new long[131069]);
}
}
}

View File

@ -54,10 +54,6 @@ public class TestRemsetLoggingThreads {
OutputAnalyzer output = new OutputAnalyzer(pb.start());
// a zero in refinement thread numbers indicates that the value in ParallelGCThreads should be used.
// Additionally use at least one thread.
int expectedNumRefinementThreads = refinementThreads;
String pattern = "Concurrent RS threads times \\(s\\)$";
Matcher m = Pattern.compile(pattern, Pattern.MULTILINE).matcher(output.getStdout());

View File

@ -156,6 +156,7 @@ public class TestHumongousClassLoader {
URLClassLoader urlLoader = new URLClassLoader(url);
Class<?> simpleClassLoaderClass = urlLoader.loadClass(SIMPLE_CLASSLOADER_NAME);
urlLoader.close();
ClassLoader simpleClassLoader = (ClassLoader) simpleClassLoaderClass
.getConstructor(java.lang.ClassLoader.class)

View File

@ -26,6 +26,8 @@ package gc.g1.humongousObjects;
import jdk.test.lib.Utils;
import sun.hotspot.WhiteBox;
import static java.lang.ref.Reference.reachabilityFence;
import java.util.LinkedList;
import java.util.List;
import java.util.Random;
@ -139,7 +141,7 @@ public class TestNoAllocationsInHRegions {
// Dead object allocation
() -> {
int size = RND.nextInt(DEAD_OBJECT_MAX_SIZE);
byte[] deadObject = new byte[size];
reachabilityFence(new byte[size]);
},
// Check

View File

@ -95,36 +95,37 @@ final public class LogParser {
}
private PlabReport parseLines() throws NumberFormatException {
Scanner lineScanner = new Scanner(log);
PlabReport plabReport = new PlabReport();
Optional<Long> gc_id;
while (lineScanner.hasNextLine()) {
String line = lineScanner.nextLine();
gc_id = getGcId(line, GC_ID_PATTERN);
if (gc_id.isPresent()) {
Matcher matcher = PAIRS_PATTERN.matcher(line);
if (matcher.find()) {
if (!plabReport.containsKey(gc_id.get())) {
plabReport.put(gc_id.get(), new PlabGCStatistics());
}
ReportType reportType = line.contains("Young") ? ReportType.SURVIVOR_STATS : ReportType.OLD_STATS;
try (Scanner lineScanner = new Scanner(log)) {
PlabReport plabReport = new PlabReport();
Optional<Long> gc_id;
while (lineScanner.hasNextLine()) {
String line = lineScanner.nextLine();
gc_id = getGcId(line, GC_ID_PATTERN);
if (gc_id.isPresent()) {
Matcher matcher = PAIRS_PATTERN.matcher(line);
if (matcher.find()) {
if (!plabReport.containsKey(gc_id.get())) {
plabReport.put(gc_id.get(), new PlabGCStatistics());
}
ReportType reportType = line.contains("Young") ? ReportType.SURVIVOR_STATS : ReportType.OLD_STATS;
PlabGCStatistics gcStat = plabReport.get(gc_id.get());
if (!gcStat.containsKey(reportType)) {
gcStat.put(reportType, new PlabInfo());
}
PlabGCStatistics gcStat = plabReport.get(gc_id.get());
if (!gcStat.containsKey(reportType)) {
gcStat.put(reportType, new PlabInfo());
}
// Extract all pairs from log.
PlabInfo plabInfo = gcStat.get(reportType);
do {
String pair = matcher.group();
String[] nameValue = pair.replaceAll(": ", ":").split(":");
plabInfo.put(nameValue[0].trim(), Long.parseLong(nameValue[1]));
} while (matcher.find());
// Extract all pairs from log.
PlabInfo plabInfo = gcStat.get(reportType);
do {
String pair = matcher.group();
String[] nameValue = pair.replaceAll(": ", ":").split(":");
plabInfo.put(nameValue[0].trim(), Long.parseLong(nameValue[1]));
} while (matcher.find());
}
}
}
return plabReport;
}
return plabReport;
}
private static Optional<Long> getGcId(String line, Pattern pattern) {

View File

@ -27,7 +27,6 @@ package gc.logging;
import java.io.File;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.function.Predicate;
import java.util.regex.Pattern;
import java.util.regex.Matcher;
@ -67,8 +66,6 @@ public class TestMetaSpaceLog {
}
private static void verifyContainsMetaSpaceUpdate(OutputAnalyzer output) {
Predicate<String> collectedMetaSpace = line -> check(line);
// At least one metaspace line from GC should show GC being collected.
boolean foundCollectedMetaSpace = output.asLines().stream()
.filter(s -> s.contains("[gc,metaspace"))

View File

@ -131,7 +131,6 @@ public class TestPrintReferences {
// Find the first Reference Processing log and check its format.
private static void checkLogFormat(OutputAnalyzer output, boolean parallelRefProcEnabled) {
String countRegex = "[0-9]+";
String timeRegex = doubleRegex + "ms";
/* Total Reference processing time */

View File

@ -31,6 +31,9 @@ import javax.management.MBeanServer;
import javax.management.MalformedObjectNameException;
import javax.management.ObjectName;
import javax.management.ReflectionException;
import static java.lang.ref.Reference.reachabilityFence;
import java.lang.management.ManagementFactory;
import java.util.LinkedList;
import java.util.List;
@ -128,7 +131,7 @@ class MemoryStresser implements Runnable {
// Dead object allocation
() -> {
int size = RND.nextInt(DEAD_OBJECT_MAX_SIZE);
byte[] deadObject = new byte[size];
reachabilityFence(new byte[size]);
}
};

View File

@ -111,13 +111,12 @@ public class G1AddMetaspaceDependency {
Loader f_loader = new Loader(b_name, b_bytes, a_name, a_loader);
Loader g_loader = new Loader(b_name, b_bytes, a_name, a_loader);
Class<?> c;
c = b_loader.loadClass(b_name);
c = c_loader.loadClass(b_name);
c = d_loader.loadClass(b_name);
c = e_loader.loadClass(b_name);
c = f_loader.loadClass(b_name);
c = g_loader.loadClass(b_name);
b_loader.loadClass(b_name);
c_loader.loadClass(b_name);
d_loader.loadClass(b_name);
e_loader.loadClass(b_name);
f_loader.loadClass(b_name);
g_loader.loadClass(b_name);
}
public class A {
}

View File

@ -33,6 +33,7 @@ import java.util.ArrayList;
*/
public class TestMetaspaceInitialization {
private class Internal {
@SuppressWarnings("unused")
public int x;
public Internal(int x) {
this.x = x;

View File

@ -132,7 +132,7 @@ class Decompiler {
byteCodeIndex++;
}
int def = cursor.readIntAt(byteCodeIndex);
cursor.readIntAt(byteCodeIndex); // def
byteCodeIndex +=4;
int npairs = cursor.readIntAt(byteCodeIndex);
@ -149,7 +149,7 @@ class Decompiler {
byteCodeIndex++;
}
int def = cursor.readIntAt(byteCodeIndex);
cursor.readIntAt(byteCodeIndex); // def
byteCodeIndex +=4;
int low = cursor.readIntAt(byteCodeIndex);
@ -245,7 +245,7 @@ class Decompiler {
private ConstantPoolEntry[] decodeConstantPool() {
final int CONSTANT_Utf8 = 1;
final int CONSTANT_Unicode = 2;
// final int CONSTANT_Unicode = 2;
final int CONSTANT_Integer = 3;
final int CONSTANT_Float = 4;
final int CONSTANT_Long = 5;

View File

@ -38,14 +38,15 @@ public class TestGCBasher {
HashMap<String, ClassInfo> deps = new HashMap<>();
FileSystem fs = FileSystems.getFileSystem(URI.create("jrt:/"));
Stream<Path> s = Files.walk(fs.getPath("/"));
for (Path p : (Iterable<Path>)s::iterator) {
if (p.toString().endsWith(".class") &&
!p.getFileName().toString().equals("module-info.class")) {
byte[] data = Files.readAllBytes(p);
Decompiler d = new Decompiler(data);
ClassInfo ci = d.getClassInfo();
deps.put(ci.getName(), ci);
try (Stream<Path> s = Files.walk(fs.getPath("/"))) {
for (Path p : (Iterable<Path>)s::iterator) {
if (p.toString().endsWith(".class") &&
!p.getFileName().toString().equals("module-info.class")) {
byte[] data = Files.readAllBytes(p);
Decompiler d = new Decompiler(data);
ClassInfo ci = d.getClassInfo();
deps.put(ci.getName(), ci);
}
}
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 2019, 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
@ -21,13 +21,15 @@
* questions.
*/
/* @test
@bug 8211987
@requires (os.family == "windows")
@summary Verify if Menu bar gets input focus even if Alt-released event is consumed.
@modules java.desktop/com.sun.java.swing.plaf.windows
@run main AltFocusIssueTest
*/
/**
* @test
* @bug 8211987
* @key headful
* @requires (os.family == "windows")
* @summary Verify if Menu bar gets input focus even if Alt-released event is consumed.
* @modules java.desktop/com.sun.java.swing.plaf.windows
* @run main AltFocusIssueTest
*/
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
@ -145,7 +147,9 @@ public class AltFocusIssueTest {
try {
testAltEvents();
} finally {
SwingUtilities.invokeAndWait(() -> frame.dispose());
if (frame != null) {
SwingUtilities.invokeAndWait(() -> frame.dispose());
}
}
}
}