Skip to content

Commit

Permalink
Merging latest jdk from level jdk-12+8
Browse files Browse the repository at this point in the history
  • Loading branch information
HursleyJavaTest committed Aug 26, 2018
2 parents 963c575 + e3eb46a commit ec5b733
Show file tree
Hide file tree
Showing 10 changed files with 327 additions and 29 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2018, 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
Expand Down Expand Up @@ -188,7 +188,7 @@ private byte[] doTransmit(byte[] command) throws CardException {
byte[] response = SCardTransmit
(card.cardId, card.protocol, command, 0, n);
int rn = response.length;
if (getresponse && (rn >= 2)) {
if (getresponse && (rn >= 2) && (n >= 1)) {
// see ISO 7816/2005, 5.1.3
if ((rn == 2) && (response[0] == 0x6c)) {
// Resend command using SW2 as short Le field
Expand All @@ -201,14 +201,18 @@ private byte[] doTransmit(byte[] command) throws CardException {
if (rn > 2) {
result = concat(result, response, rn - 2);
}
if (command.length < 5) {
byte cla = command[0];
command = new byte[5];
command[0] = cla;
}
command[1] = (byte)0xC0;
command[2] = 0;
command[3] = 0;
command[4] = response[rn - 1];
n = 5;
continue;
}

}
result = concat(result, response, rn);
break;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2009, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2009, 2018, 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
Expand Down Expand Up @@ -539,7 +539,13 @@ public Void visitClassType(ClassType t, Void ignored) {
}
nameSimplifier.addUsage(t.tsym);
visit(t.getTypeArguments());
if (t.getEnclosingType() != Type.noType)
Type enclosingType;
try {
enclosingType = t.getEnclosingType();
} catch (CompletionFailure cf) {
return null;
}
if (enclosingType != Type.noType)
visit(t.getEnclosingType());
return null;
}
Expand Down
25 changes: 25 additions & 0 deletions src/jdk.jfr/share/classes/jdk/jfr/internal/OldObjectSample.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,28 @@
/*
* Copyright (c) 2018, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/

package jdk.jfr.internal;

import java.util.HashMap;
Expand Down
72 changes: 72 additions & 0 deletions test/hotspot/jtreg/compiler/c2/SubsumingLoadsCauseFlagSpill.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
/*
* Copyright (c) 2018, Red Hat, Inc. 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/

/**
* @test
* @bug 8209639
* @summary assert failure in coalesce.cpp: attempted to spill a non-spillable item
*
* @run main/othervm -XX:-BackgroundCompilation -XX:CompileCommand=dontinline,SubsumingLoadsCauseFlagSpill::not_inlined -Xmx1024m SubsumingLoadsCauseFlagSpill
*
*/

public class SubsumingLoadsCauseFlagSpill {
private static Object field;
private static boolean do_throw;
private static volatile boolean barrier;

public static void main(String[] args) {
for (int i = 0; i < 20_000; i++) {
do_throw = true;
field = null;
test(0);
do_throw = false;
field = new Object();
test(0);
}
}

private static float test(float f) {
Object v = null;
try {
not_inlined();
v = field;
} catch (MyException me) {
v = field;
barrier = true;
}
if (v == null) {
return f * f;
}
return f;
}

private static void not_inlined() throws MyException{
if (do_throw) {
throw new MyException();
}
}

private static class MyException extends Throwable {
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@
/*
* @test TestVerifyStackAfterDeopt
* @bug 8148871
* @bug 8209825
* @summary Checks VerifyStack after deoptimization of array allocation slow call
* @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:TieredStopAtLevel=1
* -XX:MinTLABSize=1k -XX:TLABSize=1k
* -XX:+DeoptimizeALot -XX:+VerifyStack
* compiler.interpreter.TestVerifyStackAfterDeopt
*/
Expand All @@ -35,17 +37,19 @@

public class TestVerifyStackAfterDeopt {

private void method(Object[] a) {

private long method(long l1, long l2, Object[] a) {
return l1 + l2;
}

private long result[] = new long[1];

private void test() {
// For the array allocation, C1 emits a slow call into the runtime
// that deoptimizes the caller frame due to -XX:+DeoptimizeALot.
// The VerifyStack code then gets confused because the following
// bytecode instruction is an invoke and the interpreter oop map
// generator reports the oop map after execution of that invoke.
method(new Object[0]);
this.result[0] = method(1L, 2L, new Object[0]);
}

public static void main(String[] args) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,11 @@
* @requires vm.cds.archived.java.heap
* @requires (vm.gc=="null")
* @library /test/lib /test/hotspot/jtreg/runtime/appcds
* @modules java.base/jdk.internal.misc
* @modules java.management
* jdk.jartool/sun.tools.jar
* @modules jdk.jartool/sun.tools.jar
* @build sun.hotspot.WhiteBox
* @run driver ClassFileInstaller sun.hotspot.WhiteBox sun.hotspot.WhiteBox$WhiteBoxPermission
* @build HelloString
* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. IncompatibleOptions
* @run main/othervm -XX:+UseStringDeduplication -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. IncompatibleOptions
* @run main/othervm -XX:-CompactStrings -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. IncompatibleOptions
*/

import jdk.test.lib.Asserts;
Expand All @@ -59,8 +55,10 @@ public class IncompatibleOptions {
"The shared archive file's CompactStrings setting .* does not equal the current CompactStrings setting";

static String appJar;
static String[] globalVmOptions;

public static void main(String[] args) throws Exception {
globalVmOptions = args; // specified by "@run main" in IncompatibleOptions_*.java
appJar = JarBuilder.build("IncompatibleOptions", "HelloString");

// Uncompressed OOPs
Expand Down Expand Up @@ -116,14 +114,16 @@ static void testDump(int testCaseNr, String collectorOption, String extraOption,

System.out.println("Testcase: " + testCaseNr);
OutputAnalyzer output = TestCommon.dump(appJar, TestCommon.list("Hello"),
"-XX:+UseCompressedOops",
collectorOption,
"-XX:SharedArchiveConfigFile=" + TestCommon.getSourceFile("SharedStringsBasic.txt"),
"-Xlog:cds,cds+hashtables",
extraOption);

if (expectedWarning != null)
TestCommon.concat(globalVmOptions,
"-XX:+UseCompressedOops",
collectorOption,
"-XX:SharedArchiveConfigFile=" + TestCommon.getSourceFile("SharedStringsBasic.txt"),
"-Xlog:cds,cds+hashtables",
extraOption));

if (expectedWarning != null) {
output.shouldContain(expectedWarning);
}

if (expectedToFail) {
Asserts.assertNE(output.getExitValue(), 0,
Expand All @@ -140,19 +140,25 @@ static void testExec(int testCaseNr, String collectorOption, String extraOption,
// needed, otherwise system considers empty extra option as a
// main class param, and fails with "Could not find or load main class"
if (!extraOption.isEmpty()) {
output = TestCommon.exec(appJar, "-XX:+UseCompressedOops",
collectorOption, "-Xlog:cds", extraOption, "HelloString");
output = TestCommon.exec(appJar,
TestCommon.concat(globalVmOptions,
"-XX:+UseCompressedOops",
collectorOption, "-Xlog:cds", extraOption, "HelloString"));
} else {
output = TestCommon.exec(appJar, "-XX:+UseCompressedOops",
collectorOption, "-Xlog:cds", "HelloString");
output = TestCommon.exec(appJar,
TestCommon.concat(globalVmOptions,
"-XX:+UseCompressedOops",
collectorOption, "-Xlog:cds", "HelloString"));
}

if (expectedWarning != null)
if (expectedWarning != null) {
output.shouldMatch(expectedWarning);
}

if (expectedToFail)
if (expectedToFail) {
Asserts.assertNE(output.getExitValue(), 0);
else
} else {
SharedStringsUtils.checkExec(output);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* Copyright (c) 2018, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/

/*
* @test
* @summary Test options that are incompatible with use of shared strings
* Also test mismatch in oops encoding between dump time and run time
* @requires vm.cds.archived.java.heap
* @requires (vm.gc=="null")
* @library /test/lib /test/hotspot/jtreg/runtime/appcds
* @modules jdk.jartool/sun.tools.jar
* @build sun.hotspot.WhiteBox
* @run driver ClassFileInstaller sun.hotspot.WhiteBox sun.hotspot.WhiteBox$WhiteBoxPermission
* @build HelloString
* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. IncompatibleOptions -XX:-CompactStrings
*/
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* Copyright (c) 2018, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/

/*
* @test
* @summary Test options that are incompatible with use of shared strings
* Also test mismatch in oops encoding between dump time and run time
* @requires vm.cds.archived.java.heap
* @requires (vm.gc=="null")
* @library /test/lib /test/hotspot/jtreg/runtime/appcds
* @modules jdk.jartool/sun.tools.jar
* @build sun.hotspot.WhiteBox
* @run driver ClassFileInstaller sun.hotspot.WhiteBox sun.hotspot.WhiteBox$WhiteBoxPermission
* @build HelloString
* @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. IncompatibleOptions -XX:+UseStringDeduplication
*/
11 changes: 9 additions & 2 deletions test/jdk/sun/security/smartcardio/TestTransmit.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2018, 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
Expand All @@ -23,7 +23,7 @@

/*
* @test
* @bug 6293769 6294527
* @bug 6293769 6294527 6474858
* @summary test transmit() works
* @author Andreas Sterbenz
* @modules java.smartcardio/javax.smartcardio
Expand Down Expand Up @@ -90,6 +90,13 @@ public static void main(String[] args) throws Exception {
} // else ignore
}

// JDK-6474858 : CardChannel.transmit(CommandAPDU) throws
// unexpected ArrayIndexOutOfBoundsException
{
CommandAPDU capdu2 = new CommandAPDU(0x00, 0xA4, 0x00, 0x00);
channel.transmit(capdu2);
}

// disconnect
card.disconnect(true);

Expand Down
Loading

0 comments on commit ec5b733

Please sign in to comment.