--- a/jdk/make/lib/CoreLibraries.gmk Thu Sep 29 17:24:21 2016 +0000
+++ b/jdk/make/lib/CoreLibraries.gmk Fri Sep 30 02:52:42 2016 -0700
@@ -218,7 +218,7 @@
$(call SET_SHARED_LIBRARY_ORIGIN), \
LDFLAGS_windows := -export:ZIP_Open -export:ZIP_Close -export:ZIP_FindEntry \
-export:ZIP_ReadEntry -export:ZIP_GetNextEntry \
- -export:ZIP_InflateFully -export:ZIP_CRC32, \
+ -export:ZIP_InflateFully -export:ZIP_CRC32 -export:ZIP_FreeEntry, \
LIBS_unix := -ljvm -ljava $(LIBZ), \
LIBS_solaris := -lc, \
LIBS_windows := jvm.lib $(WIN_JAVA_LIB), \
--- a/jdk/make/mapfiles/libzip/mapfile-vers Thu Sep 29 17:24:21 2016 +0000
+++ b/jdk/make/mapfiles/libzip/mapfile-vers Fri Sep 30 02:52:42 2016 -0700
@@ -1,5 +1,5 @@
#
-# Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1997, 2016, 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
@@ -49,6 +49,7 @@
Java_java_util_zip_Inflater_setDictionary;
ZIP_Close;
ZIP_CRC32;
+ ZIP_FreeEntry;
ZIP_FindEntry;
ZIP_GetEntry;
ZIP_GetNextEntry;
--- a/jdk/src/java.base/share/classes/java/lang/Math.java Thu Sep 29 17:24:21 2016 +0000
+++ b/jdk/src/java.base/share/classes/java/lang/Math.java Fri Sep 30 02:52:42 2016 -0700
@@ -1626,7 +1626,7 @@
*
* @since 9
*/
- // @HotSpotIntrinsicCandidate
+ @HotSpotIntrinsicCandidate
public static double fma(double a, double b, double c) {
/*
* Infinity and NaN arithmetic is not quite the same with two
@@ -1743,7 +1743,7 @@
*
* @since 9
*/
- // @HotSpotIntrinsicCandidate
+ @HotSpotIntrinsicCandidate
public static float fma(float a, float b, float c) {
/*
* Since the double format has more than twice the precision
--- a/jdk/src/java.base/share/native/libzip/zip_util.c Thu Sep 29 17:24:21 2016 +0000
+++ b/jdk/src/java.base/share/native/libzip/zip_util.c Fri Sep 30 02:52:42 2016 -0700
@@ -1094,7 +1094,7 @@
* jzentry for each zip. This optimizes a common access pattern.
*/
-void
+void JNICALL
ZIP_FreeEntry(jzfile *jz, jzentry *ze)
{
jzentry *last;
--- a/jdk/src/java.base/share/native/libzip/zip_util.h Thu Sep 29 17:24:21 2016 +0000
+++ b/jdk/src/java.base/share/native/libzip/zip_util.h Fri Sep 30 02:52:42 2016 -0700
@@ -270,7 +270,8 @@
void ZIP_Lock(jzfile *zip);
void ZIP_Unlock(jzfile *zip);
jint ZIP_Read(jzfile *zip, jzentry *entry, jlong pos, void *buf, jint len);
-void ZIP_FreeEntry(jzfile *zip, jzentry *ze);
+void JNICALL
+ZIP_FreeEntry(jzfile *zip, jzentry *ze);
jlong ZIP_GetEntryDataOffset(jzfile *zip, jzentry *entry);
jzentry * ZIP_GetEntry2(jzfile *zip, char *name, jint ulen, jboolean addSlash);
--- a/jdk/src/java.instrument/share/native/libinstrument/JPLISAgent.c Thu Sep 29 17:24:21 2016 +0000
+++ b/jdk/src/java.instrument/share/native/libinstrument/JPLISAgent.c Fri Sep 30 02:52:42 2016 -0700
@@ -790,9 +790,10 @@
pkg_name_buf[len] = '\0';
err = (*jvmti)->GetNamedModule(jvmti, loaderObject, pkg_name_buf, &moduleObject);
+ free((void*)pkg_name_buf);
+ check_phase_ret_blob(err, NULL);
jplis_assert_msg(err == JVMTI_ERROR_NONE, "error in the JVMTI GetNamedModule");
- free((void*)pkg_name_buf);
return moduleObject;
}
--- a/jdk/src/jdk.jdwp.agent/share/native/libjdwp/invoker.c Thu Sep 29 17:24:21 2016 +0000
+++ b/jdk/src/jdk.jdwp.agent/share/native/libjdwp/invoker.c Fri Sep 30 02:52:42 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2016, 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
@@ -343,6 +343,35 @@
debugMonitorExit(invokerLock);
}
+/*
+ * Check that method is in the specified clazz or one of its super classes.
+ * We have to enforce this check at the JDWP layer because the JNI layer
+ * has different requirements.
+ */
+static jvmtiError check_methodClass(JNIEnv *env, jclass clazz, jmethodID method)
+{
+ jclass containing_class = NULL;
+ jvmtiError error;
+
+ error = JVMTI_FUNC_PTR(gdata->jvmti,GetMethodDeclaringClass)
+ (gdata->jvmti, method, &containing_class);
+ if (error != JVMTI_ERROR_NONE) {
+ return JVMTI_ERROR_NONE; /* Bad jmethodID ? This will be handled elsewhere */
+ }
+
+ if (JNI_FUNC_PTR(env,IsSameObject)(env, clazz, containing_class)) {
+ return JVMTI_ERROR_NONE;
+ }
+
+ // If not the same class then check that containing_class is a superclass of
+ // clazz (not a superinterface).
+ if (JNI_FUNC_PTR(env,IsAssignableFrom)(env, clazz, containing_class) &&
+ referenceTypeTag(containing_class) != JDWP_TYPE_TAG(INTERFACE)) {
+ return JVMTI_ERROR_NONE;
+ }
+ return JVMTI_ERROR_INVALID_METHODID;
+}
+
jvmtiError
invoker_requestInvoke(jbyte invokeType, jbyte options, jint id,
jthread thread, jclass clazz, jmethodID method,
@@ -353,6 +382,13 @@
InvokeRequest *request;
jvmtiError error = JVMTI_ERROR_NONE;
+ if (invokeType == INVOKE_STATIC) {
+ error = check_methodClass(env, clazz, method);
+ if (error != JVMTI_ERROR_NONE) {
+ return error;
+ }
+ }
+
debugMonitorEnter(invokerLock);
request = threadControl_getInvokeRequest(thread);
if (request != NULL) {
--- a/jdk/test/ProblemList.txt Thu Sep 29 17:24:21 2016 +0000
+++ b/jdk/test/ProblemList.txt Fri Sep 30 02:52:42 2016 -0700
@@ -134,8 +134,6 @@
java/lang/instrument/BootClassPath/BootClassPathTest.sh 8072130 macosx-all
-java/lang/instrument/DaemonThread/TestDaemonThread.java 8161225 generic-all
-
java/lang/management/MemoryMXBean/Pending.java 8158837 generic-all
java/lang/management/MemoryMXBean/PendingAllGC.sh 8158760 generic-all
--- a/jdk/test/com/sun/jdi/InterfaceMethodsTest.java Thu Sep 29 17:24:21 2016 +0000
+++ b/jdk/test/com/sun/jdi/InterfaceMethodsTest.java Fri Sep 30 02:52:42 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, 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
@@ -197,14 +197,18 @@
// invoke interface static method A
testInvokePos(ifaceClass, null, "staticMethodA", "()I", vm().mirrorOf(RESULT_A));
- // try to invoke static method A on the instance
- testInvokePos(ifaceClass, ref, "staticMethodA", "()I", vm().mirrorOf(RESULT_A));
+ // invoking static method A on the instance fails because static method A is
+ // not inherited by TargetClass.
+ testInvokeNeg(ifaceClass, ref, "staticMethodA", "()I", vm().mirrorOf(RESULT_A),
+ "Invalid MethodID");
// invoke interface static method B
testInvokePos(ifaceClass, null, "staticMethodB", "()I", vm().mirrorOf(RESULT_A));
- // try to invoke static method B on the instance
- testInvokePos(ifaceClass, ref, "staticMethodB", "()I", vm().mirrorOf(RESULT_A));
+ // invoking static method B on the instance fails because static method B is
+ // not inherited by TargetClass.
+ testInvokeNeg(ifaceClass, ref, "staticMethodB", "()I", vm().mirrorOf(RESULT_A),
+ "Invalid MethodID");
// try to invoke a virtual method
testInvokePos(ifaceClass, ref, "implementedMethod", "()I", vm().mirrorOf(RESULT_A), true);
@@ -239,21 +243,25 @@
testInvokeNeg(ifaceClass, null, "staticMethodA", "()I", vm().mirrorOf(RESULT_A),
"Static interface methods are not inheritable");
- // however it is possible to call "staticMethodA" on the actual instance
+ // "staticMethodA" is not inherited by InterfaceB even from an actual instance
testInvokeNeg(ifaceClass, ref, "staticMethodA", "()I", vm().mirrorOf(RESULT_A),
"Static interface methods are not inheritable");
- // "staticMethodB" is overridden in InterfaceB
+ // "staticMethodB" is re-defined in InterfaceB
testInvokePos(ifaceClass, null, "staticMethodB", "()I", vm().mirrorOf(RESULT_B));
- // the instance invokes the overriden form of "staticMethodB" from InterfaceB
- testInvokePos(ifaceClass, ref, "staticMethodB", "()I", vm().mirrorOf(RESULT_B));
+ // the instance fails to invoke the re-defined form of "staticMethodB" from
+ // InterfaceB because staticMethodB is not inherited by TargetClass
+ testInvokeNeg(ifaceClass, ref, "staticMethodB", "()I", vm().mirrorOf(RESULT_B),
+ "Invalid MethodID");
// "staticMethodC" is present only in InterfaceB
testInvokePos(ifaceClass, null, "staticMethodC", "()I", vm().mirrorOf(RESULT_B));
- // "staticMethodC" should be reachable from the instance too
- testInvokePos(ifaceClass, ref, "staticMethodC", "()I", vm().mirrorOf(RESULT_B));
+ // "staticMethodC" is not reachable from the instance because staticMethodC
+ // is not inherited by TargetClass.
+ testInvokeNeg(ifaceClass, ref, "staticMethodC", "()I", vm().mirrorOf(RESULT_B),
+ "Invalid MethodID");
}
private void testImplementationClass(ReferenceType targetClass, ObjectReference thisObject) {
--- a/jdk/test/java/lang/Math/FusedMultiplyAddTests.java Thu Sep 29 17:24:21 2016 +0000
+++ b/jdk/test/java/lang/Math/FusedMultiplyAddTests.java Fri Sep 30 02:52:42 2016 -0700
@@ -221,6 +221,9 @@
{Double.MIN_VALUE, -0.0, +0.0,
+0.0},
+
+ {1.0+Math.ulp(1.0), 1.0+Math.ulp(1.0), -1.0-2.0*Math.ulp(1.0),
+ Math.ulp(1.0)*Math.ulp(1.0)},
};
for (double[] testCase: testCases)
@@ -344,6 +347,9 @@
{Float.MAX_VALUE, 2.0f, 1.0f,
InfinityF},
+
+ {1.0f+Math.ulp(1.0f), 1.0f+Math.ulp(1.0f), -1.0f-2.0f*Math.ulp(1.0f),
+ Math.ulp(1.0f)*Math.ulp(1.0f)},
};
for (float[] testCase: testCases)
--- a/jdk/test/java/lang/instrument/DaemonThread/TestDaemonThreadLauncher.java Thu Sep 29 17:24:21 2016 +0000
+++ b/jdk/test/java/lang/instrument/DaemonThread/TestDaemonThreadLauncher.java Fri Sep 30 02:52:42 2016 -0700
@@ -1,6 +1,6 @@
/*
* Copyright 2014 Goldman Sachs.
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, 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
@@ -32,6 +32,7 @@
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-javaagent:DummyAgent.jar", "TestDaemonThread", ".");
OutputAnalyzer analyzer = ProcessTools.executeProcess(pb);
analyzer.shouldNotContain("ASSERTION FAILED");
+ analyzer.shouldHaveExitValue(0);
}
}
}
--- a/jdk/test/jdk/internal/misc/Unsafe/CopyMemory.java Thu Sep 29 17:24:21 2016 +0000
+++ b/jdk/test/jdk/internal/misc/Unsafe/CopyMemory.java Fri Sep 30 02:52:42 2016 -0700
@@ -22,7 +22,6 @@
*/
import jdk.internal.misc.Unsafe;
-import java.lang.reflect.Field;
/*
* @test
@@ -40,7 +39,6 @@
*/
private void testPositive() {
testSmallCopy(false);
- testLargeCopy(false);
}
/**
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/jdk/internal/misc/Unsafe/CopyMemoryLarge.java Fri Sep 30 02:52:42 2016 -0700
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2016, 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.
+ */
+
+import jdk.internal.misc.Unsafe;
+
+/*
+ * @test
+ * @summary Test Unsafe.copyMemory
+ * @modules java.base/jdk.internal.misc
+ * @requires os.maxMemory > 8G
+ */
+public class CopyMemoryLarge extends CopyCommon {
+ private CopyMemoryLarge() {
+ }
+
+ /**
+ * Run positive tests
+ *
+ * @throws RuntimeException if an error is found
+ */
+ private void testPositive() {
+ testLargeCopy(false);
+ }
+
+ /**
+ * Run all tests
+ *
+ * @throws RuntimeException if an error is found
+ */
+ private void test() {
+ testPositive();
+ }
+
+ public static void main(String[] args) {
+ CopyMemoryLarge cs = new CopyMemoryLarge();
+ cs.test();
+ }
+}
--- a/jdk/test/jdk/internal/misc/Unsafe/CopySwap.java Thu Sep 29 17:24:21 2016 +0000
+++ b/jdk/test/jdk/internal/misc/Unsafe/CopySwap.java Fri Sep 30 02:52:42 2016 -0700
@@ -22,7 +22,6 @@
*/
import jdk.internal.misc.Unsafe;
-import java.lang.reflect.Field;
/*
* @test
@@ -40,7 +39,6 @@
*/
private void testPositive() {
testSmallCopy(true);
- testLargeCopy(true);
}
/**
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/jdk/internal/misc/Unsafe/CopySwapLarge.java Fri Sep 30 02:52:42 2016 -0700
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2016, 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.
+ */
+
+import jdk.internal.misc.Unsafe;
+
+/*
+ * @test
+ * @summary Test Unsafe.copySwapMemory
+ * @modules java.base/jdk.internal.misc
+ * @requires os.maxMemory > 8G
+ */
+public class CopySwapLarge extends CopyCommon {
+ private CopySwapLarge() {
+ }
+
+ /**
+ * Run positive tests
+ *
+ * @throws RuntimeException if an error is found
+ */
+ private void testPositive() {
+ testLargeCopy(true);
+ }
+
+ /**
+ * Run all tests
+ *
+ * @throws RuntimeException if an error is found
+ */
+ private void test() {
+ testPositive();
+ }
+
+ public static void main(String[] args) {
+ CopySwapLarge cs = new CopySwapLarge();
+ cs.test();
+ }
+}