--- a/jdk/make/launcher/Launcher-jdk.hotspot.agent.gmk Fri Aug 05 18:16:45 2016 +0530
+++ b/jdk/make/launcher/Launcher-jdk.hotspot.agent.gmk Fri Aug 05 09:50:29 2016 -0700
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 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
@@ -25,12 +25,6 @@
include LauncherCommon.gmk
-$(eval $(call SetupBuildLauncher, jsadebugd, \
- MAIN_CLASS := sun.jvm.hotspot.jdi.SADebugServer, \
- MACOSX_SIGNED := true, \
-))
-
-
$(eval $(call SetupBuildLauncher, jhsdb, \
MAIN_CLASS := sun.jvm.hotspot.SALauncher, \
MACOSX_SIGNED := true, \
--- a/jdk/make/lib/Awt2dLibraries.gmk Fri Aug 05 18:16:45 2016 +0530
+++ b/jdk/make/lib/Awt2dLibraries.gmk Fri Aug 05 09:50:29 2016 -0700
@@ -350,8 +350,6 @@
BUILD_LIBAWT_XAWT_awt_Font.c_CFLAGS := -w
# initializing a declared 'extern'
BUILD_LIBAWT_XAWT_debug_mem.c_CFLAGS := -w
- # decimal constant is unsigned only in ISO C90 (JAVASE_EMBEDDED)
- BUILD_LIBAWT_XAWT_XToolkit.c_CFLAGS := -w
endif
$(eval $(call SetupNativeCompilation,BUILD_LIBAWT_XAWT, \
--- a/jdk/src/demo/share/jvmti/compiledMethodLoad/sample.makefile.txt Fri Aug 05 18:16:45 2016 +0530
+++ b/jdk/src/demo/share/jvmti/compiledMethodLoad/sample.makefile.txt Fri Aug 05 09:50:29 2016 -0700
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
@@ -45,12 +45,12 @@
LIBNAME=compiledMethodLoad
SOURCES=compiledMethodLoad.c ../agent_util/agent_util.c
-# Solaris Sun C Compiler Version 5.5
+# Solaris Studio C Compiler Version 12.4
ifeq ($(OSNAME), solaris)
# Sun Solaris Compiler options needed
COMMON_FLAGS=-mt -KPIC
# Options that help find errors
- COMMON_FLAGS+= -Xa -v -xstrconst -xc99=%none
+ COMMON_FLAGS+= -Xa -v -xc99=%none
# Check LIBARCH for any special compiler options
LIBARCH=$(shell uname -p)
ifeq ($(LIBARCH), sparc)
--- a/jdk/src/demo/share/jvmti/gctest/sample.makefile.txt Fri Aug 05 18:16:45 2016 +0530
+++ b/jdk/src/demo/share/jvmti/gctest/sample.makefile.txt Fri Aug 05 09:50:29 2016 -0700
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2004, 2016, Oracle and/or its affiliates. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
@@ -45,12 +45,12 @@
LIBNAME=gctest
SOURCES=gctest.c ../agent_util/agent_util.c
-# Solaris Sun C Compiler Version 5.5
+# Solaris Studio C Compiler Version 12.4
ifeq ($(OSNAME), solaris)
# Sun Solaris Compiler options needed
COMMON_FLAGS=-mt -KPIC
# Options that help find errors
- COMMON_FLAGS+= -Xa -v -xstrconst -xc99=%none
+ COMMON_FLAGS+= -Xa -v -xc99=%none
# Check LIBARCH for any special compiler options
LIBARCH=$(shell uname -p)
ifeq ($(LIBARCH), sparc)
--- a/jdk/src/demo/share/jvmti/heapTracker/sample.makefile.txt Fri Aug 05 18:16:45 2016 +0530
+++ b/jdk/src/demo/share/jvmti/heapTracker/sample.makefile.txt Fri Aug 05 09:50:29 2016 -0700
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2004, 2016, Oracle and/or its affiliates. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
@@ -49,12 +49,12 @@
# Name of jar file that needs to be created
JARFILE=heapTracker.jar
-# Solaris Sun C Compiler Version 5.5
+# Solaris Studio C Compiler Version 12.4
ifeq ($(OSNAME), solaris)
# Sun Solaris Compiler options needed
COMMON_FLAGS=-mt -KPIC
# Options that help find errors
- COMMON_FLAGS+= -Xa -v -xstrconst -xc99=%none
+ COMMON_FLAGS+= -Xa -v -xc99=%none
# Check LIBARCH for any special compiler options
LIBARCH=$(shell uname -p)
ifeq ($(LIBARCH), sparc)
--- a/jdk/src/demo/share/jvmti/heapViewer/sample.makefile.txt Fri Aug 05 18:16:45 2016 +0530
+++ b/jdk/src/demo/share/jvmti/heapViewer/sample.makefile.txt Fri Aug 05 09:50:29 2016 -0700
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2004, 2016, Oracle and/or its affiliates. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
@@ -45,12 +45,12 @@
LIBNAME=heapViewer
SOURCES=heapViewer.c ../agent_util/agent_util.c
-# Solaris Sun C Compiler Version 5.5
+# Solaris Studio C Compiler Version 12.4
ifeq ($(OSNAME), solaris)
# Sun Solaris Compiler options needed
COMMON_FLAGS=-mt -KPIC
# Options that help find errors
- COMMON_FLAGS+= -Xa -v -xstrconst -xc99=%none
+ COMMON_FLAGS+= -Xa -v -xc99=%none
# Check LIBARCH for any special compiler options
LIBARCH=$(shell uname -p)
ifeq ($(LIBARCH), sparc)
--- a/jdk/src/demo/share/jvmti/java_crw_demo/sample.makefile.txt Fri Aug 05 18:16:45 2016 +0530
+++ b/jdk/src/demo/share/jvmti/java_crw_demo/sample.makefile.txt Fri Aug 05 09:50:29 2016 -0700
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2004, 2016, Oracle and/or its affiliates. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
@@ -45,12 +45,12 @@
LIBNAME=java_crw_demo
SOURCES=java_crw_demo.c
-# Solaris Sun C Compiler Version 5.5
+# Solaris Studio C Compiler Version 12.4
ifeq ($(OSNAME), solaris)
# Sun Solaris Compiler options needed
COMMON_FLAGS=-mt -KPIC
# Options that help find errors
- COMMON_FLAGS+= -Xa -v -xstrconst -xc99=%none
+ COMMON_FLAGS+= -Xa -v -xc99=%none
# Check LIBARCH for any special compiler options
LIBARCH=$(shell uname -p)
ifeq ($(LIBARCH), sparc)
--- a/jdk/src/demo/share/jvmti/minst/sample.makefile.txt Fri Aug 05 18:16:45 2016 +0530
+++ b/jdk/src/demo/share/jvmti/minst/sample.makefile.txt Fri Aug 05 09:50:29 2016 -0700
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2006, 2016, Oracle and/or its affiliates. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
@@ -49,12 +49,12 @@
# Name of jar file that needs to be created
JARFILE=minst.jar
-# Solaris Sun C Compiler Version 5.5
+# Solaris Studio C Compiler Version 12.4
ifeq ($(OSNAME), solaris)
# Sun Solaris Compiler options needed
COMMON_FLAGS=-mt -KPIC
# Options that help find errors
- COMMON_FLAGS+= -Xa -v -xstrconst -xc99=%none
+ COMMON_FLAGS+= -Xa -v -xc99=%none
# Check LIBARCH for any special compiler options
LIBARCH=$(shell uname -p)
ifeq ($(LIBARCH), sparc)
--- a/jdk/src/demo/share/jvmti/mtrace/sample.makefile.txt Fri Aug 05 18:16:45 2016 +0530
+++ b/jdk/src/demo/share/jvmti/mtrace/sample.makefile.txt Fri Aug 05 09:50:29 2016 -0700
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2004, 2016, Oracle and/or its affiliates. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
@@ -49,12 +49,12 @@
# Name of jar file that needs to be created
JARFILE=mtrace.jar
-# Solaris Sun C Compiler Version 5.5
+# Solaris Studio C Compiler Version 12.4
ifeq ($(OSNAME), solaris)
# Sun Solaris Compiler options needed
COMMON_FLAGS=-mt -KPIC
# Options that help find errors
- COMMON_FLAGS+= -Xa -v -xstrconst -xc99=%none
+ COMMON_FLAGS+= -Xa -v -xc99=%none
# Check LIBARCH for any special compiler options
LIBARCH=$(shell uname -p)
ifeq ($(LIBARCH), sparc)
--- a/jdk/src/demo/share/jvmti/versionCheck/sample.makefile.txt Fri Aug 05 18:16:45 2016 +0530
+++ b/jdk/src/demo/share/jvmti/versionCheck/sample.makefile.txt Fri Aug 05 09:50:29 2016 -0700
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2004, 2016, Oracle and/or its affiliates. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
@@ -45,12 +45,12 @@
LIBNAME=versionCheck
SOURCES=versionCheck.c ../agent_util/agent_util.c
-# Solaris Sun C Compiler Version 5.5
+# Solaris Studio C Compiler Version 12.4
ifeq ($(OSNAME), solaris)
# Sun Solaris Compiler options needed
COMMON_FLAGS=-mt -KPIC
# Options that help find errors
- COMMON_FLAGS+= -Xa -v -xstrconst -xc99=%none
+ COMMON_FLAGS+= -Xa -v -xc99=%none
# Check LIBARCH for any special compiler options
LIBARCH=$(shell uname -p)
ifeq ($(LIBARCH), sparc)
--- a/jdk/src/java.base/share/classes/java/lang/VersionProps.java.template Fri Aug 05 18:16:45 2016 +0530
+++ b/jdk/src/java.base/share/classes/java/lang/VersionProps.java.template Fri Aug 05 09:50:29 2016 -0700
@@ -166,10 +166,6 @@
ps.print(java_runtime_name + " (" + jdk_debug_level + "build " + java_runtime_version);
- if (java_runtime_name.indexOf("Embedded") != -1 && isHeadless) {
- // embedded builds report headless state
- ps.print(", headless");
- }
ps.println(')');
/* Third line: JVM information. */
--- a/jdk/src/java.base/share/classes/java/nio/Bits.java Fri Aug 05 18:16:45 2016 +0530
+++ b/jdk/src/java.base/share/classes/java/nio/Bits.java Fri Aug 05 09:50:29 2016 -0700
@@ -25,14 +25,14 @@
package java.nio;
-import java.util.concurrent.atomic.AtomicLong;
-
+import jdk.internal.misc.JavaLangRefAccess;
import jdk.internal.misc.JavaNioAccess;
-import jdk.internal.misc.JavaLangRefAccess;
import jdk.internal.misc.SharedSecrets;
import jdk.internal.misc.Unsafe;
import jdk.internal.misc.VM;
+import java.util.concurrent.atomic.AtomicLong;
+
/**
* Access to bits, native and otherwise.
*/
@@ -61,504 +61,10 @@
}
- // -- get/put char --
-
- private static char makeChar(byte b1, byte b0) {
- return (char)((b1 << 8) | (b0 & 0xff));
- }
-
- static char getCharL(ByteBuffer bb, int bi) {
- return makeChar(bb._get(bi + 1),
- bb._get(bi ));
- }
-
- static char getCharL(long a) {
- return makeChar(_get(a + 1),
- _get(a ));
- }
-
- static char getCharB(ByteBuffer bb, int bi) {
- return makeChar(bb._get(bi ),
- bb._get(bi + 1));
- }
-
- static char getCharB(long a) {
- return makeChar(_get(a ),
- _get(a + 1));
- }
-
- static char getChar(ByteBuffer bb, int bi, boolean bigEndian) {
- return bigEndian ? getCharB(bb, bi) : getCharL(bb, bi);
- }
-
- static char getChar(long a, boolean bigEndian) {
- return bigEndian ? getCharB(a) : getCharL(a);
- }
-
- private static byte char1(char x) { return (byte)(x >> 8); }
- private static byte char0(char x) { return (byte)(x ); }
-
- static void putCharL(ByteBuffer bb, int bi, char x) {
- bb._put(bi , char0(x));
- bb._put(bi + 1, char1(x));
- }
-
- static void putCharL(long a, char x) {
- _put(a , char0(x));
- _put(a + 1, char1(x));
- }
-
- static void putCharB(ByteBuffer bb, int bi, char x) {
- bb._put(bi , char1(x));
- bb._put(bi + 1, char0(x));
- }
-
- static void putCharB(long a, char x) {
- _put(a , char1(x));
- _put(a + 1, char0(x));
- }
-
- static void putChar(ByteBuffer bb, int bi, char x, boolean bigEndian) {
- if (bigEndian)
- putCharB(bb, bi, x);
- else
- putCharL(bb, bi, x);
- }
-
- static void putChar(long a, char x, boolean bigEndian) {
- if (bigEndian)
- putCharB(a, x);
- else
- putCharL(a, x);
- }
-
-
- // -- get/put short --
-
- private static short makeShort(byte b1, byte b0) {
- return (short)((b1 << 8) | (b0 & 0xff));
- }
-
- static short getShortL(ByteBuffer bb, int bi) {
- return makeShort(bb._get(bi + 1),
- bb._get(bi ));
- }
-
- static short getShortL(long a) {
- return makeShort(_get(a + 1),
- _get(a ));
- }
-
- static short getShortB(ByteBuffer bb, int bi) {
- return makeShort(bb._get(bi ),
- bb._get(bi + 1));
- }
-
- static short getShortB(long a) {
- return makeShort(_get(a ),
- _get(a + 1));
- }
-
- static short getShort(ByteBuffer bb, int bi, boolean bigEndian) {
- return bigEndian ? getShortB(bb, bi) : getShortL(bb, bi);
- }
-
- static short getShort(long a, boolean bigEndian) {
- return bigEndian ? getShortB(a) : getShortL(a);
- }
-
- private static byte short1(short x) { return (byte)(x >> 8); }
- private static byte short0(short x) { return (byte)(x ); }
-
- static void putShortL(ByteBuffer bb, int bi, short x) {
- bb._put(bi , short0(x));
- bb._put(bi + 1, short1(x));
- }
-
- static void putShortL(long a, short x) {
- _put(a , short0(x));
- _put(a + 1, short1(x));
- }
-
- static void putShortB(ByteBuffer bb, int bi, short x) {
- bb._put(bi , short1(x));
- bb._put(bi + 1, short0(x));
- }
-
- static void putShortB(long a, short x) {
- _put(a , short1(x));
- _put(a + 1, short0(x));
- }
-
- static void putShort(ByteBuffer bb, int bi, short x, boolean bigEndian) {
- if (bigEndian)
- putShortB(bb, bi, x);
- else
- putShortL(bb, bi, x);
- }
-
- static void putShort(long a, short x, boolean bigEndian) {
- if (bigEndian)
- putShortB(a, x);
- else
- putShortL(a, x);
- }
-
-
- // -- get/put int --
-
- private static int makeInt(byte b3, byte b2, byte b1, byte b0) {
- return (((b3 ) << 24) |
- ((b2 & 0xff) << 16) |
- ((b1 & 0xff) << 8) |
- ((b0 & 0xff) ));
- }
-
- static int getIntL(ByteBuffer bb, int bi) {
- return makeInt(bb._get(bi + 3),
- bb._get(bi + 2),
- bb._get(bi + 1),
- bb._get(bi ));
- }
-
- static int getIntL(long a) {
- return makeInt(_get(a + 3),
- _get(a + 2),
- _get(a + 1),
- _get(a ));
- }
-
- static int getIntB(ByteBuffer bb, int bi) {
- return makeInt(bb._get(bi ),
- bb._get(bi + 1),
- bb._get(bi + 2),
- bb._get(bi + 3));
- }
-
- static int getIntB(long a) {
- return makeInt(_get(a ),
- _get(a + 1),
- _get(a + 2),
- _get(a + 3));
- }
-
- static int getInt(ByteBuffer bb, int bi, boolean bigEndian) {
- return bigEndian ? getIntB(bb, bi) : getIntL(bb, bi) ;
- }
-
- static int getInt(long a, boolean bigEndian) {
- return bigEndian ? getIntB(a) : getIntL(a) ;
- }
-
- private static byte int3(int x) { return (byte)(x >> 24); }
- private static byte int2(int x) { return (byte)(x >> 16); }
- private static byte int1(int x) { return (byte)(x >> 8); }
- private static byte int0(int x) { return (byte)(x ); }
-
- static void putIntL(ByteBuffer bb, int bi, int x) {
- bb._put(bi + 3, int3(x));
- bb._put(bi + 2, int2(x));
- bb._put(bi + 1, int1(x));
- bb._put(bi , int0(x));
- }
-
- static void putIntL(long a, int x) {
- _put(a + 3, int3(x));
- _put(a + 2, int2(x));
- _put(a + 1, int1(x));
- _put(a , int0(x));
- }
-
- static void putIntB(ByteBuffer bb, int bi, int x) {
- bb._put(bi , int3(x));
- bb._put(bi + 1, int2(x));
- bb._put(bi + 2, int1(x));
- bb._put(bi + 3, int0(x));
- }
-
- static void putIntB(long a, int x) {
- _put(a , int3(x));
- _put(a + 1, int2(x));
- _put(a + 2, int1(x));
- _put(a + 3, int0(x));
- }
-
- static void putInt(ByteBuffer bb, int bi, int x, boolean bigEndian) {
- if (bigEndian)
- putIntB(bb, bi, x);
- else
- putIntL(bb, bi, x);
- }
-
- static void putInt(long a, int x, boolean bigEndian) {
- if (bigEndian)
- putIntB(a, x);
- else
- putIntL(a, x);
- }
-
-
- // -- get/put long --
-
- private static long makeLong(byte b7, byte b6, byte b5, byte b4,
- byte b3, byte b2, byte b1, byte b0)
- {
- return ((((long)b7 ) << 56) |
- (((long)b6 & 0xff) << 48) |
- (((long)b5 & 0xff) << 40) |
- (((long)b4 & 0xff) << 32) |
- (((long)b3 & 0xff) << 24) |
- (((long)b2 & 0xff) << 16) |
- (((long)b1 & 0xff) << 8) |
- (((long)b0 & 0xff) ));
- }
-
- static long getLongL(ByteBuffer bb, int bi) {
- return makeLong(bb._get(bi + 7),
- bb._get(bi + 6),
- bb._get(bi + 5),
- bb._get(bi + 4),
- bb._get(bi + 3),
- bb._get(bi + 2),
- bb._get(bi + 1),
- bb._get(bi ));
- }
-
- static long getLongL(long a) {
- return makeLong(_get(a + 7),
- _get(a + 6),
- _get(a + 5),
- _get(a + 4),
- _get(a + 3),
- _get(a + 2),
- _get(a + 1),
- _get(a ));
- }
-
- static long getLongB(ByteBuffer bb, int bi) {
- return makeLong(bb._get(bi ),
- bb._get(bi + 1),
- bb._get(bi + 2),
- bb._get(bi + 3),
- bb._get(bi + 4),
- bb._get(bi + 5),
- bb._get(bi + 6),
- bb._get(bi + 7));
- }
-
- static long getLongB(long a) {
- return makeLong(_get(a ),
- _get(a + 1),
- _get(a + 2),
- _get(a + 3),
- _get(a + 4),
- _get(a + 5),
- _get(a + 6),
- _get(a + 7));
- }
-
- static long getLong(ByteBuffer bb, int bi, boolean bigEndian) {
- return bigEndian ? getLongB(bb, bi) : getLongL(bb, bi);
- }
-
- static long getLong(long a, boolean bigEndian) {
- return bigEndian ? getLongB(a) : getLongL(a);
- }
-
- private static byte long7(long x) { return (byte)(x >> 56); }
- private static byte long6(long x) { return (byte)(x >> 48); }
- private static byte long5(long x) { return (byte)(x >> 40); }
- private static byte long4(long x) { return (byte)(x >> 32); }
- private static byte long3(long x) { return (byte)(x >> 24); }
- private static byte long2(long x) { return (byte)(x >> 16); }
- private static byte long1(long x) { return (byte)(x >> 8); }
- private static byte long0(long x) { return (byte)(x ); }
-
- static void putLongL(ByteBuffer bb, int bi, long x) {
- bb._put(bi + 7, long7(x));
- bb._put(bi + 6, long6(x));
- bb._put(bi + 5, long5(x));
- bb._put(bi + 4, long4(x));
- bb._put(bi + 3, long3(x));
- bb._put(bi + 2, long2(x));
- bb._put(bi + 1, long1(x));
- bb._put(bi , long0(x));
- }
-
- static void putLongL(long a, long x) {
- _put(a + 7, long7(x));
- _put(a + 6, long6(x));
- _put(a + 5, long5(x));
- _put(a + 4, long4(x));
- _put(a + 3, long3(x));
- _put(a + 2, long2(x));
- _put(a + 1, long1(x));
- _put(a , long0(x));
- }
-
- static void putLongB(ByteBuffer bb, int bi, long x) {
- bb._put(bi , long7(x));
- bb._put(bi + 1, long6(x));
- bb._put(bi + 2, long5(x));
- bb._put(bi + 3, long4(x));
- bb._put(bi + 4, long3(x));
- bb._put(bi + 5, long2(x));
- bb._put(bi + 6, long1(x));
- bb._put(bi + 7, long0(x));
- }
-
- static void putLongB(long a, long x) {
- _put(a , long7(x));
- _put(a + 1, long6(x));
- _put(a + 2, long5(x));
- _put(a + 3, long4(x));
- _put(a + 4, long3(x));
- _put(a + 5, long2(x));
- _put(a + 6, long1(x));
- _put(a + 7, long0(x));
- }
-
- static void putLong(ByteBuffer bb, int bi, long x, boolean bigEndian) {
- if (bigEndian)
- putLongB(bb, bi, x);
- else
- putLongL(bb, bi, x);
- }
-
- static void putLong(long a, long x, boolean bigEndian) {
- if (bigEndian)
- putLongB(a, x);
- else
- putLongL(a, x);
- }
-
-
- // -- get/put float --
-
- static float getFloatL(ByteBuffer bb, int bi) {
- return Float.intBitsToFloat(getIntL(bb, bi));
- }
-
- static float getFloatL(long a) {
- return Float.intBitsToFloat(getIntL(a));
- }
-
- static float getFloatB(ByteBuffer bb, int bi) {
- return Float.intBitsToFloat(getIntB(bb, bi));
- }
-
- static float getFloatB(long a) {
- return Float.intBitsToFloat(getIntB(a));
- }
-
- static float getFloat(ByteBuffer bb, int bi, boolean bigEndian) {
- return bigEndian ? getFloatB(bb, bi) : getFloatL(bb, bi);
- }
-
- static float getFloat(long a, boolean bigEndian) {
- return bigEndian ? getFloatB(a) : getFloatL(a);
- }
-
- static void putFloatL(ByteBuffer bb, int bi, float x) {
- putIntL(bb, bi, Float.floatToRawIntBits(x));
- }
-
- static void putFloatL(long a, float x) {
- putIntL(a, Float.floatToRawIntBits(x));
- }
-
- static void putFloatB(ByteBuffer bb, int bi, float x) {
- putIntB(bb, bi, Float.floatToRawIntBits(x));
- }
-
- static void putFloatB(long a, float x) {
- putIntB(a, Float.floatToRawIntBits(x));
- }
-
- static void putFloat(ByteBuffer bb, int bi, float x, boolean bigEndian) {
- if (bigEndian)
- putFloatB(bb, bi, x);
- else
- putFloatL(bb, bi, x);
- }
-
- static void putFloat(long a, float x, boolean bigEndian) {
- if (bigEndian)
- putFloatB(a, x);
- else
- putFloatL(a, x);
- }
-
-
- // -- get/put double --
-
- static double getDoubleL(ByteBuffer bb, int bi) {
- return Double.longBitsToDouble(getLongL(bb, bi));
- }
-
- static double getDoubleL(long a) {
- return Double.longBitsToDouble(getLongL(a));
- }
-
- static double getDoubleB(ByteBuffer bb, int bi) {
- return Double.longBitsToDouble(getLongB(bb, bi));
- }
-
- static double getDoubleB(long a) {
- return Double.longBitsToDouble(getLongB(a));
- }
-
- static double getDouble(ByteBuffer bb, int bi, boolean bigEndian) {
- return bigEndian ? getDoubleB(bb, bi) : getDoubleL(bb, bi);
- }
-
- static double getDouble(long a, boolean bigEndian) {
- return bigEndian ? getDoubleB(a) : getDoubleL(a);
- }
-
- static void putDoubleL(ByteBuffer bb, int bi, double x) {
- putLongL(bb, bi, Double.doubleToRawLongBits(x));
- }
-
- static void putDoubleL(long a, double x) {
- putLongL(a, Double.doubleToRawLongBits(x));
- }
-
- static void putDoubleB(ByteBuffer bb, int bi, double x) {
- putLongB(bb, bi, Double.doubleToRawLongBits(x));
- }
-
- static void putDoubleB(long a, double x) {
- putLongB(a, Double.doubleToRawLongBits(x));
- }
-
- static void putDouble(ByteBuffer bb, int bi, double x, boolean bigEndian) {
- if (bigEndian)
- putDoubleB(bb, bi, x);
- else
- putDoubleL(bb, bi, x);
- }
-
- static void putDouble(long a, double x, boolean bigEndian) {
- if (bigEndian)
- putDoubleB(a, x);
- else
- putDoubleL(a, x);
- }
-
-
// -- Unsafe access --
private static final Unsafe unsafe = Unsafe.getUnsafe();
- private static byte _get(long a) {
- return unsafe.getByte(a);
- }
-
- private static void _put(long a, byte b) {
- unsafe.putByte(a, b);
- }
-
static Unsafe unsafe() {
return unsafe;
}
--- a/jdk/src/java.base/share/classes/java/nio/ByteBufferAs-X-Buffer.java.template Fri Aug 05 18:16:45 2016 +0530
+++ b/jdk/src/java.base/share/classes/java/nio/ByteBufferAs-X-Buffer.java.template Fri Aug 05 09:50:29 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
@@ -27,6 +27,8 @@
package java.nio;
+import jdk.internal.misc.Unsafe;
+
class ByteBufferAs$Type$Buffer$RW$$BO$ // package-private
extends {#if[ro]?ByteBufferAs}$Type$Buffer{#if[ro]?$BO$}
@@ -34,8 +36,10 @@
#if[rw]
+ // Cached unsafe-access object
+ private static final Unsafe unsafe = Bits.unsafe();
+
protected final ByteBuffer bb;
- protected final int offset;
#end[rw]
@@ -50,7 +54,7 @@
this.limit(cap);
int pos = this.position();
assert (pos <= cap);
- offset = pos;
+ address = bb.address;
#else[rw]
super(bb);
#end[rw]
@@ -58,14 +62,15 @@
ByteBufferAs$Type$Buffer$RW$$BO$(ByteBuffer bb,
int mark, int pos, int lim, int cap,
- int off)
+ long addr)
{
#if[rw]
super(mark, pos, lim, cap);
this.bb = bb;
- offset = off;
+ address = addr;
+ assert address >= bb.address;
#else[rw]
- super(bb, mark, pos, lim, cap, off);
+ super(bb, mark, pos, lim, cap, addr);
#end[rw]
}
@@ -74,9 +79,8 @@
int lim = this.limit();
assert (pos <= lim);
int rem = (pos <= lim ? lim - pos : 0);
- int off = (pos << $LG_BYTES_PER_VALUE$) + offset;
- assert (off >= 0);
- return new ByteBufferAs$Type$Buffer$RW$$BO$(bb, -1, 0, rem, rem, off);
+ long addr = byteOffset(pos);
+ return new ByteBufferAs$Type$Buffer$RW$$BO$(bb, -1, 0, rem, rem, addr);
}
public $Type$Buffer duplicate() {
@@ -85,7 +89,7 @@
this.position(),
this.limit(),
this.capacity(),
- offset);
+ address);
}
public $Type$Buffer asReadOnlyBuffer() {
@@ -95,7 +99,7 @@
this.position(),
this.limit(),
this.capacity(),
- offset);
+ address);
#else[rw]
return duplicate();
#end[rw]
@@ -103,21 +107,32 @@
#if[rw]
- protected int ix(int i) {
- return (i << $LG_BYTES_PER_VALUE$) + offset;
+ private int ix(int i) {
+ int off = (int) (address - bb.address);
+ return (i << $LG_BYTES_PER_VALUE$) + off;
+ }
+
+ protected long byteOffset(long i) {
+ return (i << $LG_BYTES_PER_VALUE$) + address;
}
public $type$ get() {
- return Bits.get$Type$$BO$(bb, ix(nextGetIndex()));
+ $memtype$ x = unsafe.get$Memtype$Unaligned(bb.hb, byteOffset(nextGetIndex()),
+ {#if[boB]?true:false});
+ return $fromBits$(x);
}
public $type$ get(int i) {
- return Bits.get$Type$$BO$(bb, ix(checkIndex(i)));
+ $memtype$ x = unsafe.get$Memtype$Unaligned(bb.hb, byteOffset(checkIndex(i)),
+ {#if[boB]?true:false});
+ return $fromBits$(x);
}
#if[streamableType]
$type$ getUnchecked(int i) {
- return Bits.get$Type$$BO$(bb, ix(i));
+ $memtype$ x = unsafe.get$Memtype$Unaligned(bb.hb, byteOffset(i),
+ {#if[boB]?true:false});
+ return $fromBits$(x);
}
#end[streamableType]
@@ -125,7 +140,9 @@
public $Type$Buffer put($type$ x) {
#if[rw]
- Bits.put$Type$$BO$(bb, ix(nextPutIndex()), x);
+ $memtype$ y = $toBits$(x);
+ unsafe.put$Memtype$Unaligned(bb.hb, byteOffset(nextPutIndex()), y,
+ {#if[boB]?true:false});
return this;
#else[rw]
throw new ReadOnlyBufferException();
@@ -134,7 +151,9 @@
public $Type$Buffer put(int i, $type$ x) {
#if[rw]
- Bits.put$Type$$BO$(bb, ix(checkIndex(i)), x);
+ $memtype$ y = $toBits$(x);
+ unsafe.put$Memtype$Unaligned(bb.hb, byteOffset(checkIndex(i)), y,
+ {#if[boB]?true:false});
return this;
#else[rw]
throw new ReadOnlyBufferException();
@@ -207,7 +226,7 @@
pos + start,
pos + end,
capacity(),
- offset);
+ address);
}
#end[char]
--- a/jdk/src/java.base/share/classes/java/nio/Direct-X-Buffer-bin.java.template Fri Aug 05 18:16:45 2016 +0530
+++ b/jdk/src/java.base/share/classes/java/nio/Direct-X-Buffer-bin.java.template Fri Aug 05 09:50:29 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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,11 +32,8 @@
#if[rw]
private $type$ get$Type$(long a) {
- if (unaligned) {
- $memtype$ x = unsafe.get$Memtype$(a);
- return $fromBits$(nativeByteOrder ? x : Bits.swap(x));
- }
- return Bits.get$Type$(a, bigEndian);
+ $memtype$ x = unsafe.get$Memtype$Unaligned(null, a, bigEndian);
+ return $fromBits$(x);
}
public $type$ get$Type$() {
@@ -51,12 +48,8 @@
private ByteBuffer put$Type$(long a, $type$ x) {
#if[rw]
- if (unaligned) {
- $memtype$ y = $toBits$(x);
- unsafe.put$Memtype$(a, (nativeByteOrder ? y : Bits.swap(y)));
- } else {
- Bits.put$Type$(a, x, bigEndian);
- }
+ $memtype$ y = $toBits$(x);
+ unsafe.put$Memtype$Unaligned(null, a, y, bigEndian);
return this;
#else[rw]
throw new ReadOnlyBufferException();
@@ -95,13 +88,13 @@
0,
size,
size,
- off))
+ address + off))
: ($Type$Buffer)(new ByteBufferAs$Type$Buffer$RW$L(this,
-1,
0,
size,
size,
- off)));
+ address + off)));
} else {
return (nativeByteOrder
? ($Type$Buffer)(new Direct$Type$Buffer$RW$U(this,
--- a/jdk/src/java.base/share/classes/java/nio/Heap-X-Buffer.java.template Fri Aug 05 18:16:45 2016 +0530
+++ b/jdk/src/java.base/share/classes/java/nio/Heap-X-Buffer.java.template Fri Aug 05 09:50:29 2016 -0700
@@ -325,20 +325,20 @@
public CharBuffer asCharBuffer() {
int size = this.remaining() >> 1;
- int off = offset + position();
+ long addr = address + position();
return (bigEndian
? (CharBuffer)(new ByteBufferAsCharBuffer$RW$B(this,
-1,
0,
size,
size,
- off))
+ addr))
: (CharBuffer)(new ByteBufferAsCharBuffer$RW$L(this,
-1,
0,
size,
size,
- off)));
+ addr)));
}
@@ -376,20 +376,20 @@
public ShortBuffer asShortBuffer() {
int size = this.remaining() >> 1;
- int off = offset + position();
+ long addr = address + position();
return (bigEndian
? (ShortBuffer)(new ByteBufferAsShortBuffer$RW$B(this,
-1,
0,
size,
size,
- off))
+ addr))
: (ShortBuffer)(new ByteBufferAsShortBuffer$RW$L(this,
-1,
0,
size,
size,
- off)));
+ addr)));
}
@@ -427,20 +427,20 @@
public IntBuffer asIntBuffer() {
int size = this.remaining() >> 2;
- int off = offset + position();
+ long addr = address + position();
return (bigEndian
? (IntBuffer)(new ByteBufferAsIntBuffer$RW$B(this,
-1,
0,
size,
size,
- off))
+ addr))
: (IntBuffer)(new ByteBufferAsIntBuffer$RW$L(this,
-1,
0,
size,
size,
- off)));
+ addr)));
}
@@ -478,20 +478,20 @@
public LongBuffer asLongBuffer() {
int size = this.remaining() >> 3;
- int off = offset + position();
+ long addr = address + position();
return (bigEndian
? (LongBuffer)(new ByteBufferAsLongBuffer$RW$B(this,
-1,
0,
size,
size,
- off))
+ addr))
: (LongBuffer)(new ByteBufferAsLongBuffer$RW$L(this,
-1,
0,
size,
size,
- off)));
+ addr)));
}
@@ -533,20 +533,20 @@
public FloatBuffer asFloatBuffer() {
int size = this.remaining() >> 2;
- int off = offset + position();
+ long addr = address + position();
return (bigEndian
? (FloatBuffer)(new ByteBufferAsFloatBuffer$RW$B(this,
-1,
0,
size,
size,
- off))
+ addr))
: (FloatBuffer)(new ByteBufferAsFloatBuffer$RW$L(this,
-1,
0,
size,
size,
- off)));
+ addr)));
}
@@ -588,20 +588,20 @@
public DoubleBuffer asDoubleBuffer() {
int size = this.remaining() >> 3;
- int off = offset + position();
+ long addr = address + position();
return (bigEndian
? (DoubleBuffer)(new ByteBufferAsDoubleBuffer$RW$B(this,
-1,
0,
size,
size,
- off))
+ addr))
: (DoubleBuffer)(new ByteBufferAsDoubleBuffer$RW$L(this,
-1,
0,
size,
size,
- off)));
+ addr)));
}
--- a/jdk/src/java.base/unix/native/libjava/ProcessHandleImpl_unix.c Fri Aug 05 18:16:45 2016 +0530
+++ b/jdk/src/java.base/unix/native/libjava/ProcessHandleImpl_unix.c Fri Aug 05 09:50:29 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
@@ -34,7 +34,6 @@
#include <stdio.h>
#include <errno.h>
#include <fcntl.h>
-#include <pwd.h>
#include <signal.h>
#include <stdlib.h>
#include <unistd.h>
@@ -46,6 +45,12 @@
#include <sys/stat.h>
#include <sys/wait.h>
+/* For POSIX-compliant getpwuid_r on Solaris */
+#if defined(__solaris__)
+#define _POSIX_PTHREAD_SEMANTICS
+#endif
+#include <pwd.h>
+
#ifdef _AIX
#include <sys/procfs.h>
#endif
@@ -468,12 +473,7 @@
} else {
struct passwd pwent;
struct passwd* p = NULL;
-
-#ifdef __solaris__
- RESTARTABLE_RETURN_PTR(getpwuid_r(uid, &pwent, pwbuf, (size_t)getpw_buf_size), p);
-#else
RESTARTABLE(getpwuid_r(uid, &pwent, pwbuf, (size_t)getpw_buf_size, &p), result);
-#endif
// Create the Java String if a name was found
if (result == 0 && p != NULL &&
--- a/jdk/src/java.base/unix/native/libjava/java_props_md.c Fri Aug 05 18:16:45 2016 +0530
+++ b/jdk/src/java.base/unix/native/libjava/java_props_md.c Fri Aug 05 09:50:29 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2013, 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
@@ -68,11 +68,6 @@
#endif
#endif /* !_ALLBSD_SOURCE */
-#ifdef JAVASE_EMBEDDED
-#include <dlfcn.h>
-#include <sys/stat.h>
-#endif
-
/* Take an array of string pairs (map of key->value) and a string (key).
* Examine each pair in the map to see if the first string (key) matches the
* string. If so, store the second string of the pair (value) in the value and
@@ -350,36 +345,6 @@
return 1;
}
-#ifdef JAVASE_EMBEDDED
-/* Determine the default embedded toolkit based on whether libawt_xawt
- * exists in the JRE. This can still be overridden by -Dawt.toolkit=XXX
- */
-static char* getEmbeddedToolkit() {
- Dl_info dlinfo;
- char buf[MAXPATHLEN];
- int32_t len;
- char *p;
- struct stat statbuf;
-
- /* Get address of this library and the directory containing it. */
- dladdr((void *)getEmbeddedToolkit, &dlinfo);
- realpath((char *)dlinfo.dli_fname, buf);
- len = strlen(buf);
- p = strrchr(buf, '/');
- /* Default AWT Toolkit on Linux and Solaris is XAWT (libawt_xawt.so). */
- strncpy(p, "/libawt_xawt.so", MAXPATHLEN-len-1);
- /* Check if it exists */
- if (stat(buf, &statbuf) == -1 && errno == ENOENT) {
- /* No - this is a reduced-headless-jre so use special HToolkit */
- return "sun.awt.HToolkit";
- }
- else {
- /* Yes - this is a headful JRE so fallback to SE defaults */
- return NULL;
- }
-}
-#endif
-
/* This function gets called very early, before VM_CALLS are setup.
* Do not use any of the VM_CALLS entries!!!
*/
@@ -424,10 +389,6 @@
sprops.awt_headless = isInAquaSession() ? NULL : "true";
#else
sprops.graphics_env = "sun.awt.X11GraphicsEnvironment";
-#ifdef JAVASE_EMBEDDED
- sprops.awt_toolkit = getEmbeddedToolkit();
- if (sprops.awt_toolkit == NULL) // default as below
-#endif
sprops.awt_toolkit = "sun.awt.X11.XToolkit";
#endif
--- a/jdk/src/java.base/unix/native/libnio/fs/UnixNativeDispatcher.c Fri Aug 05 18:16:45 2016 +0530
+++ b/jdk/src/java.base/unix/native/libnio/fs/UnixNativeDispatcher.c Fri Aug 05 09:50:29 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 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
@@ -29,8 +29,6 @@
#include <fcntl.h>
#include <dirent.h>
#include <unistd.h>
-#include <pwd.h>
-#include <grp.h>
#include <errno.h>
#include <dlfcn.h>
#include <sys/types.h>
@@ -43,6 +41,13 @@
#endif
#include <sys/time.h>
+/* For POSIX-compliant getpwuid_r, getgrgid_r on Solaris */
+#if defined(__solaris__)
+#define _POSIX_PTHREAD_SEMANTICS
+#endif
+#include <pwd.h>
+#include <grp.h>
+
#ifdef __solaris__
#include <strings.h>
#endif
@@ -1022,11 +1027,7 @@
int res = 0;
errno = 0;
- #ifdef __solaris__
- RESTARTABLE_RETURN_PTR(getpwuid_r((uid_t)uid, &pwent, pwbuf, (size_t)buflen), p);
- #else
- RESTARTABLE(getpwuid_r((uid_t)uid, &pwent, pwbuf, (size_t)buflen, &p), res);
- #endif
+ RESTARTABLE(getpwuid_r((uid_t)uid, &pwent, pwbuf, (size_t)buflen, &p), res);
if (res != 0 || p == NULL || p->pw_name == NULL || *(p->pw_name) == '\0') {
/* not found or error */
@@ -1071,11 +1072,7 @@
}
errno = 0;
- #ifdef __solaris__
- RESTARTABLE_RETURN_PTR(getgrgid_r((gid_t)gid, &grent, grbuf, (size_t)buflen), g);
- #else
- RESTARTABLE(getgrgid_r((gid_t)gid, &grent, grbuf, (size_t)buflen, &g), res);
- #endif
+ RESTARTABLE(getgrgid_r((gid_t)gid, &grent, grbuf, (size_t)buflen, &g), res);
retry = 0;
if (res != 0 || g == NULL || g->gr_name == NULL || *(g->gr_name) == '\0') {
@@ -1126,11 +1123,7 @@
const char* name = (const char*)jlong_to_ptr(nameAddress);
errno = 0;
- #ifdef __solaris__
- RESTARTABLE_RETURN_PTR(getpwnam_r(name, &pwent, pwbuf, (size_t)buflen), p);
- #else
- RESTARTABLE(getpwnam_r(name, &pwent, pwbuf, (size_t)buflen, &p), res);
- #endif
+ RESTARTABLE(getpwnam_r(name, &pwent, pwbuf, (size_t)buflen, &p), res);
if (res != 0 || p == NULL || p->pw_name == NULL || *(p->pw_name) == '\0') {
/* not found or error */
@@ -1171,11 +1164,7 @@
}
errno = 0;
- #ifdef __solaris__
- RESTARTABLE_RETURN_PTR(getgrnam_r(name, &grent, grbuf, (size_t)buflen), g);
- #else
- RESTARTABLE(getgrnam_r(name, &grent, grbuf, (size_t)buflen, &g), res);
- #endif
+ RESTARTABLE(getgrnam_r(name, &grent, grbuf, (size_t)buflen, &g), res);
retry = 0;
if (res != 0 || g == NULL || g->gr_name == NULL || *(g->gr_name) == '\0') {
--- a/jdk/src/java.desktop/unix/native/libawt_xawt/xawt/XToolkit.c Fri Aug 05 18:16:45 2016 +0530
+++ b/jdk/src/java.desktop/unix/native/libawt_xawt/xawt/XToolkit.c Fri Aug 05 09:50:29 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 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
@@ -122,11 +122,7 @@
JNIEXPORT jlong JNICALL Java_sun_awt_X11_XToolkit_getTrayIconDisplayTimeout
(JNIEnv *env, jclass clazz)
{
-#ifndef JAVASE_EMBEDDED
return (jlong) 2000;
-#else
- return (jlong) 10000;
-#endif
}
/*
@@ -369,12 +365,7 @@
#define AWT_READPIPE (awt_pipe_fds[0])
#define AWT_WRITEPIPE (awt_pipe_fds[1])
-#ifdef JAVASE_EMBEDDED
- #define DEF_AWT_MAX_POLL_TIMEOUT ((uint32_t)4000000000) /* milliseconds */
-#else
- #define DEF_AWT_MAX_POLL_TIMEOUT ((uint32_t)500) /* milliseconds */
-#endif
-
+#define DEF_AWT_MAX_POLL_TIMEOUT ((uint32_t)500) /* milliseconds */
#define DEF_AWT_FLUSH_TIMEOUT ((uint32_t)100) /* milliseconds */
#define AWT_MIN_POLL_TIMEOUT ((uint32_t)0) /* milliseconds */
@@ -391,11 +382,7 @@
// Static fields
-#ifdef JAVASE_EMBEDDED
- static int awt_poll_alg = AWT_POLL_AGING_FAST;
-#else
- static int awt_poll_alg = AWT_POLL_AGING_SLOW;
-#endif
+static int awt_poll_alg = AWT_POLL_AGING_SLOW;
static uint32_t AWT_FLUSH_TIMEOUT = DEF_AWT_FLUSH_TIMEOUT; /* milliseconds */
static uint32_t AWT_MAX_POLL_TIMEOUT = DEF_AWT_MAX_POLL_TIMEOUT; /* milliseconds */
--- a/jdk/src/java.desktop/unix/native/libjawt/jawt.c Fri Aug 05 18:16:45 2016 +0530
+++ b/jdk/src/java.desktop/unix/native/libjawt/jawt.c Fri Aug 05 09:50:29 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -39,10 +39,6 @@
*/
JNIEXPORT jboolean JNICALL JAWT_GetAWT(JNIEnv* env, JAWT* awt)
{
-#if defined(JAVASE_EMBEDDED) && defined(HEADLESS)
- /* there are no AWT libs available at all */
- return JNI_FALSE;
-#else
if (awt == NULL) {
return JNI_FALSE;
}
@@ -62,5 +58,4 @@
}
return JNI_TRUE;
-#endif
}
--- a/jdk/src/java.management/share/classes/java/lang/management/ThreadInfo.java Fri Aug 05 18:16:45 2016 +0530
+++ b/jdk/src/java.management/share/classes/java/lang/management/ThreadInfo.java Fri Aug 05 09:50:29 2016 -0700
@@ -771,6 +771,14 @@
* <th align=left>Type</th>
* </tr>
* <tr>
+ * <td>moduleName</td>
+ * <td>{@code java.lang.String}</td>
+ * </tr>
+ * <tr>
+ * <td>moduleVersion</td>
+ * <td>{@code java.lang.String}</td>
+ * </tr>
+ * <tr>
* <td>className</td>
* <td>{@code java.lang.String}</td>
* </tr>
--- a/jdk/src/jdk.management/share/classes/com/sun/management/internal/GcInfoBuilder.java Fri Aug 05 18:16:45 2016 +0530
+++ b/jdk/src/jdk.management/share/classes/com/sun/management/internal/GcInfoBuilder.java Fri Aug 05 09:50:29 2016 -0700
@@ -79,7 +79,7 @@
}
public String[] getPoolNames() {
- return poolNames;
+ return poolNames.clone();
}
int getGcExtItemCount() {
--- a/jdk/src/jdk.management/share/native/libmanagement_ext/Flag.c Fri Aug 05 18:16:45 2016 +0530
+++ b/jdk/src/jdk.management/share/native/libmanagement_ext/Flag.c Fri Aug 05 09:50:29 2016 -0700
@@ -141,6 +141,13 @@
// ignore unsupported type
continue;
}
+
+ if (valueObj == NULL && globals[i].type != JMM_VMGLOBAL_TYPE_JSTRING) {
+ free(globals);
+ JNU_ThrowOutOfMemoryError(env, 0);
+ return 0;
+ }
+
switch (globals[i].origin) {
case JMM_VMGLOBAL_ORIGIN_DEFAULT:
origin = default_origin;
--- a/jdk/src/jdk.security.auth/solaris/native/libjaas/Solaris.c Fri Aug 05 18:16:45 2016 +0530
+++ b/jdk/src/jdk.security.auth/solaris/native/libjaas/Solaris.c Fri Aug 05 09:50:29 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
@@ -26,10 +26,14 @@
#include <jni.h>
#include "com_sun_security_auth_module_SolarisSystem.h"
#include <stdio.h>
-#include <pwd.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
+
+/* For POSIX-compliant getpwuid_r on Solaris */
+#if defined(__solaris__)
+#define _POSIX_PTHREAD_SEMANTICS
+#endif
#include <pwd.h>
static void throwIllegalArgumentException(JNIEnv *env, const char *msg) {
@@ -43,8 +47,10 @@
(JNIEnv *env, jobject obj) {
int i;
- char pwd_buf[1024];
+ long pwd_bufsize;
+ char *pwd_buf = NULL;
struct passwd pwd;
+ struct passwd* p = NULL;
jsize numSuppGroups = getgroups(0, NULL);
jfieldID fid;
jstring jstr;
@@ -53,20 +59,31 @@
gid_t *groups;
jclass cls;
+ pwd_bufsize = sysconf(_SC_GETPW_R_SIZE_MAX);
+ if (pwd_bufsize == -1) {
+ pwd_bufsize = 1024;
+ }
+ pwd_buf = (char *)malloc(pwd_bufsize);
groups = (gid_t *)calloc(numSuppGroups, sizeof(gid_t));
- if (groups == NULL) {
- jclass cls = (*env)->FindClass(env,"java/lang/OutOfMemoryError");
- if (cls != NULL)
+ if (pwd_buf == NULL || groups == NULL) {
+ if (pwd_buf != NULL) {
+ free(pwd_buf);
+ }
+ if (groups != NULL) {
+ free(groups);
+ }
+ cls = (*env)->FindClass(env,"java/lang/OutOfMemoryError");
+ if (cls != NULL) {
(*env)->ThrowNew(env, cls, NULL);
+ }
return;
}
cls = (*env)->GetObjectClass(env, obj);
- memset(pwd_buf, 0, sizeof(pwd_buf));
- if (getpwuid_r(getuid(), &pwd, pwd_buf, sizeof(pwd_buf)) != NULL &&
- getgroups(numSuppGroups, groups) != -1) {
+ if (getpwuid_r(getuid(), &pwd, pwd_buf, sizeof(pwd_buf), &p) != 0 &&
+ p != NULL && getgroups(numSuppGroups, groups) != -1) {
/*
* set username
@@ -129,7 +146,7 @@
(*env)->SetObjectField(env, obj, fid, jgroups);
}
cleanupAndReturn:
+ free(pwd_buf);
free(groups);
-
return;
}
--- a/jdk/src/jdk.security.auth/unix/native/libjaas/Unix.c Fri Aug 05 18:16:45 2016 +0530
+++ b/jdk/src/jdk.security.auth/unix/native/libjaas/Unix.c Fri Aug 05 09:50:29 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
@@ -23,20 +23,21 @@
* questions.
*/
-#ifdef __solaris__
-#define _POSIX_C_SOURCE 199506L
-#endif
-
#include <jni.h>
#include "jni_util.h"
#include "com_sun_security_auth_module_UnixSystem.h"
#include <stdio.h>
-#include <pwd.h>
#include <sys/types.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
+/* For POSIX-compliant getpwuid_r on Solaris */
+#if defined(__solaris__)
+#define _POSIX_PTHREAD_SEMANTICS
+#endif
+#include <pwd.h>
+
/*
* Declare library specific JNI_Onload entry if static build
*/
--- a/jdk/test/ProblemList.txt Fri Aug 05 18:16:45 2016 +0530
+++ b/jdk/test/ProblemList.txt Fri Aug 05 09:50:29 2016 -0700
@@ -344,6 +344,8 @@
com/sun/jdi/GetLocalVariables4Test.sh 8067354 windows-all
+com/sun/jdi/sde/SourceDebugExtensionTest.java 8158066 windows-all
+
############################################################################
# jdk_time
@@ -368,6 +370,10 @@
sun/tools/jcmd/TestJcmdSanity.java 8031482 windows-all
+sun/tools/jhsdb/BasicLauncherTest.java 8160376 macosx-all
+
+sun/tools/jhsdb/heapconfig/JMapHeapConfigTest.java 8160376 macosx-all
+
sun/tools/jstatd/TestJstatdExternalRegistry.java 8046285 generic-all
sun/tools/jps/TestJpsJar.java 8160923 generic-all
--- a/jdk/test/java/lang/invoke/VMAnonymousClass.java Fri Aug 05 18:16:45 2016 +0530
+++ b/jdk/test/java/lang/invoke/VMAnonymousClass.java Fri Aug 05 09:50:29 2016 -0700
@@ -1,5 +1,5 @@
/*
- * 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
@@ -45,6 +45,7 @@
test.testJavaUtil();
test.testJdkInternalMisc();
test.testJavaLangInvoke();
+ test.testProhibitedJavaPkg();
System.out.println("TEST PASSED");
}
@@ -54,13 +55,29 @@
@Test public void testJavaUtil() throws Throwable { test("java/util"); }
@Test public void testJdkInternalMisc() throws Throwable { test("jdk/internal/misc"); }
@Test public void testJavaLangInvoke() throws Throwable { test("java/lang/invoke"); }
+ @Test public void testProhibitedJavaPkg() throws Throwable {
+ try {
+ test("java/prohibited");
+ } catch (SecurityException e) {
+ return;
+ }
+ throw new RuntimeException("Expected SecurityException");
+ }
private static Unsafe unsafe = getUnsafe();
private static void test(String pkg) throws Throwable {
byte[] bytes = dumpClass(pkg);
- // Define VM anonymous class in privileged context (on BCP).
- Class anonClass = unsafe.defineAnonymousClass(Object.class, bytes, null);
+ Class host_class;
+ if (pkg.equals("java/prohibited")) {
+ VMAnonymousClass sampleclass = new VMAnonymousClass();
+ host_class = (Class)sampleclass.getClass();
+ } else {
+ host_class = Object.class;
+ }
+
+ // Define VM anonymous class
+ Class anonClass = unsafe.defineAnonymousClass(host_class, bytes, null);
MethodType t = MethodType.methodType(Object.class, int.class);
MethodHandle target = MethodHandles.lookup().findStatic(anonClass, "get", t);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/nio/Buffer/ByteBufferViews.java Fri Aug 05 09:50:29 2016 -0700
@@ -0,0 +1,746 @@
+/*
+ * 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.
+ */
+
+/* @test
+ * @summary Binary data and view tests for byte buffers
+ * @bug 8159257
+ * @run testng ByteBufferViews
+ */
+
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+import java.nio.Buffer;
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+import java.nio.CharBuffer;
+import java.nio.DoubleBuffer;
+import java.nio.FloatBuffer;
+import java.nio.IntBuffer;
+import java.nio.LongBuffer;
+import java.nio.ShortBuffer;
+import java.util.List;
+import java.util.Map;
+import java.util.function.Function;
+import java.util.function.IntFunction;
+import java.util.function.IntUnaryOperator;
+import java.util.function.UnaryOperator;
+import java.util.stream.Collectors;
+
+import static org.testng.Assert.*;
+
+public class ByteBufferViews {
+ static final int SIZE = 32;
+
+ // List of buffer allocator functions
+ static final List<Map.Entry<String, IntFunction<ByteBuffer>>> BYTE_BUFFER_ALLOCATE_FUNCTIONS = List.of(
+ // Heap
+ Map.entry("ByteBuffer.allocate(ba)",
+ size -> ByteBuffer.allocate(size)),
+ // Aligned
+ Map.entry("ByteBuffer.allocate(size).position(8)",
+ size -> ByteBuffer.allocate(size).position(8)),
+ Map.entry("ByteBuffer.allocate(size).position(8).slice()",
+ size -> ByteBuffer.allocate(size).position(8).slice()),
+ Map.entry("ByteBuffer.allocate(size).position(8).slice().duplicate()",
+ size -> ByteBuffer.allocate(size).position(8).slice().duplicate()),
+ // Unaligned
+ Map.entry("ByteBuffer.allocate(size).position(1)",
+ size -> ByteBuffer.allocate(size).position(1)),
+ Map.entry("ByteBuffer.allocate(size).position(1).slice()",
+ size -> ByteBuffer.allocate(size).position(1).slice()),
+ Map.entry("ByteBuffer.allocate(size).position(1).slice().duplicate()",
+ size -> ByteBuffer.allocate(size).position(1).slice().duplicate()),
+
+ // Off-heap
+ Map.entry("ByteBuffer.allocateDirect(size)",
+ size -> ByteBuffer.allocateDirect(size)),
+ // Aligned
+ Map.entry("ByteBuffer.allocateDirect(size).position(8)",
+ size -> ByteBuffer.allocateDirect(size).position(8)),
+ Map.entry("ByteBuffer.allocateDirect(size).position(8).slice()",
+ size -> ByteBuffer.allocateDirect(size).position(8).slice()),
+ Map.entry("ByteBuffer.allocateDirect(size).position(8).slice().duplicate()",
+ size -> ByteBuffer.allocateDirect(size).position(8).slice().duplicate()),
+ // Unaligned
+ Map.entry("ByteBuffer.allocateDirect(size).position(1)",
+ size -> ByteBuffer.allocateDirect(size).position(1)),
+ Map.entry("ByteBuffer.allocateDirect(size).position(1).slice()",
+ size -> ByteBuffer.allocateDirect(size).position(1).slice()),
+ Map.entry("ByteBuffer.allocateDirect(size).position(1).slice().duplicate()",
+ size -> ByteBuffer.allocateDirect(size).position(1).slice().duplicate())
+ );
+
+ // List of buffer byte order functions
+ static final List<Map.Entry<String, UnaryOperator<ByteBuffer>>> BYTE_BUFFER_ORDER_FUNCTIONS = List.of(
+ Map.entry("order(ByteOrder.BIG_ENDIAN)",
+ (ByteBuffer bb) -> bb.order(ByteOrder.BIG_ENDIAN)),
+ Map.entry("order(ByteOrder.LITTLE_ENDIAN)",
+ (ByteBuffer bb) -> bb.order(ByteOrder.LITTLE_ENDIAN))
+ );
+
+ // Produce a composition of allocation and byte order buffer functions
+ static List<Map.Entry<String, IntFunction<ByteBuffer>>> composeBufferFunctions(
+ List<Map.Entry<String, IntFunction<ByteBuffer>>> af,
+ List<Map.Entry<String, UnaryOperator<ByteBuffer>>> of) {
+ return af.stream().flatMap(afe -> of.stream().
+ map(ofe -> {
+ String s = afe.getKey() + "." + ofe.getKey();
+ IntFunction<ByteBuffer> f = size -> ofe.getValue().
+ apply(afe.getValue().apply(size));
+ return Map.entry(s, f);
+ })
+ ).collect(Collectors.toList());
+ }
+
+ // List of buffer allocator functions to test
+ static final List<Map.Entry<String, IntFunction<ByteBuffer>>> BYTE_BUFFER_FUNCTIONS =
+ composeBufferFunctions(BYTE_BUFFER_ALLOCATE_FUNCTIONS, BYTE_BUFFER_ORDER_FUNCTIONS);
+
+ // Creates a cross product of test arguments for
+ // buffer allocator functions and buffer view functions
+ static Object[][] product(List<? extends Map.Entry<String, ?>> la,
+ List<? extends Map.Entry<String, ?>> lb) {
+ return la.stream().flatMap(lae -> lb.stream().
+ map(lbe -> List.of(
+ lae.getKey() + " -> " + lbe.getKey(),
+ lae.getValue(),
+ lbe.getValue()).toArray()
+ )).toArray(Object[][]::new);
+ }
+
+ static void assertValues(int i, Object bValue, Object bbValue, ByteBuffer bb) {
+ if (!bValue.equals(bbValue)) {
+ fail(String.format("Values %s and %s differ at index %d for %s",
+ bValue, bbValue, i, bb));
+ }
+ }
+
+ static void assertValues(int i, Object bbValue, Object bvValue, ByteBuffer bb, Buffer bv) {
+ if (!bbValue.equals(bvValue)) {
+ fail(String.format("Values %s and %s differ at index %d for %s and %s",
+ bbValue, bvValue, i, bb, bv));
+ }
+ }
+
+ static ByteBuffer allocate(IntFunction<ByteBuffer> f) {
+ return allocate(f, i -> i);
+ }
+
+ static ByteBuffer allocate(IntFunction<ByteBuffer> f, IntUnaryOperator o) {
+ return fill(f.apply(SIZE), o);
+ }
+
+ static ByteBuffer fill(ByteBuffer bb, IntUnaryOperator o) {
+ for (int i = 0; i < bb.limit(); i++) {
+ bb.put(i, (byte) o.applyAsInt(i));
+ }
+ return bb;
+ }
+
+
+ @DataProvider
+ public static Object[][] shortViewProvider() {
+ List<Map.Entry<String, Function<ByteBuffer, ShortBuffer>>> bfs = List.of(
+ Map.entry("bb.asShortBuffer()",
+ bb -> bb.asShortBuffer()),
+ Map.entry("bb.asShortBuffer().slice()",
+ bb -> bb.asShortBuffer().slice()),
+ Map.entry("bb.asShortBuffer().slice().duplicate()",
+ bb -> bb.asShortBuffer().slice().duplicate())
+ );
+
+ return product(BYTE_BUFFER_FUNCTIONS, bfs);
+ }
+
+ @Test(dataProvider = "shortViewProvider")
+ public void testShortGet(String desc, IntFunction<ByteBuffer> fbb,
+ Function<ByteBuffer, ShortBuffer> fbi) {
+ ByteBuffer bb = allocate(fbb);
+ ShortBuffer vb = fbi.apply(bb);
+ int o = bb.position();
+
+ for (int i = 0; i < vb.limit(); i++) {
+ short fromBytes = getShortFromBytes(bb, o + i * 2);
+ short fromMethodView = bb.getShort(o + i * 2);
+ assertValues(i, fromBytes, fromMethodView, bb);
+
+ short fromBufferView = vb.get(i);
+ assertValues(i, fromMethodView, fromBufferView, bb, vb);
+ }
+
+ for (int i = 0; i < vb.limit(); i++) {
+ short v = getShortFromBytes(bb, o + i * 2);
+ short a = bb.getShort();
+ assertValues(i, v, a, bb);
+
+ short b = vb.get();
+ assertValues(i, a, b, bb, vb);
+ }
+
+ }
+
+ @Test(dataProvider = "shortViewProvider")
+ public void testShortPut(String desc, IntFunction<ByteBuffer> fbb,
+ Function<ByteBuffer, ShortBuffer> fbi) {
+ ByteBuffer bbfilled = allocate(fbb);
+ ByteBuffer bb = allocate(fbb, i -> 0);
+ ShortBuffer vb = fbi.apply(bb);
+ int o = bb.position();
+
+ for (int i = 0; i < vb.limit(); i++) {
+ short fromFilled = bbfilled.getShort(o + i * 2);
+
+ vb.put(i, fromFilled);
+ short fromMethodView = bb.getShort(o + i * 2);
+ assertValues(i, fromFilled, fromMethodView, bb, vb);
+ }
+
+ for (int i = 0; i < vb.limit(); i++) {
+ short fromFilled = bbfilled.getShort(o + i * 2);
+
+ vb.put(fromFilled);
+ short fromMethodView = bb.getShort();
+ assertValues(i, fromFilled, fromMethodView, bb, vb);
+ }
+
+
+ fill(bb, i -> 0);
+ bb.clear().position(o);
+ vb.clear();
+
+ for (int i = 0; i < vb.limit(); i++) {
+ short fromFilled = bbfilled.getShort(o + i * 2);
+
+ bb.putShort(o + i * 2, fromFilled);
+ short fromBufferView = vb.get(i);
+ assertValues(i, fromFilled, fromBufferView, bb, vb);
+ }
+
+ for (int i = 0; i < vb.limit(); i++) {
+ short fromFilled = bbfilled.getShort(o + i * 2);
+
+ bb.putShort(fromFilled);
+ short fromBufferView = vb.get();
+ assertValues(i, fromFilled, fromBufferView, bb, vb);
+ }
+ }
+
+ static short getShortFromBytes(ByteBuffer bb, int i) {
+ int a = bb.get(i) & 0xFF;
+ int b = bb.get(i + 1) & 0xFF;
+
+ if (bb.order() == ByteOrder.BIG_ENDIAN) {
+ return (short) ((a << 8) | b);
+ }
+ else {
+ return (short) ((b << 8) | a);
+ }
+ }
+
+ @DataProvider
+ public static Object[][] charViewProvider() {
+ List<Map.Entry<String, Function<ByteBuffer, CharBuffer>>> bfs = List.of(
+ Map.entry("bb.asCharBuffer()",
+ bb -> bb.asCharBuffer()),
+ Map.entry("bb.asCharBuffer().slice()",
+ bb -> bb.asCharBuffer().slice()),
+ Map.entry("bb.asCharBuffer().slice().duplicate()",
+ bb -> bb.asCharBuffer().slice().duplicate())
+ );
+
+ return product(BYTE_BUFFER_FUNCTIONS, bfs);
+ }
+
+ @Test(dataProvider = "charViewProvider")
+ public void testCharGet(String desc, IntFunction<ByteBuffer> fbb,
+ Function<ByteBuffer, CharBuffer> fbi) {
+ ByteBuffer bb = allocate(fbb);
+ CharBuffer vb = fbi.apply(bb);
+ int o = bb.position();
+
+ for (int i = 0; i < vb.limit(); i++) {
+ char fromBytes = getCharFromBytes(bb, o + i * 2);
+ char fromMethodView = bb.getChar(o + i * 2);
+ assertValues(i, fromBytes, fromMethodView, bb);
+
+ char fromBufferView = vb.get(i);
+ assertValues(i, fromMethodView, fromBufferView, bb, vb);
+ }
+
+ for (int i = 0; i < vb.limit(); i++) {
+ char fromBytes = getCharFromBytes(bb, o + i * 2);
+ char fromMethodView = bb.getChar();
+ assertValues(i, fromBytes, fromMethodView, bb);
+
+ char fromBufferView = vb.get();
+ assertValues(i, fromMethodView, fromBufferView, bb, vb);
+ }
+
+ }
+
+ @Test(dataProvider = "charViewProvider")
+ public void testCharPut(String desc, IntFunction<ByteBuffer> fbb,
+ Function<ByteBuffer, CharBuffer> fbi) {
+ ByteBuffer bbfilled = allocate(fbb);
+ ByteBuffer bb = allocate(fbb, i -> 0);
+ CharBuffer vb = fbi.apply(bb);
+ int o = bb.position();
+
+ for (int i = 0; i < vb.limit(); i++) {
+ char fromFilled = bbfilled.getChar(o + i * 2);
+
+ vb.put(i, fromFilled);
+ char fromMethodView = bb.getChar(o + i * 2);
+ assertValues(i, fromFilled, fromMethodView, bb, vb);
+ }
+
+ for (int i = 0; i < vb.limit(); i++) {
+ char fromFilled = bbfilled.getChar(o + i * 2);
+
+ vb.put(fromFilled);
+ char fromMethodView = bb.getChar();
+ assertValues(i, fromFilled, fromMethodView, bb, vb);
+ }
+
+
+ fill(bb, i -> 0);
+ bb.clear().position(o);
+ vb.clear();
+
+ for (int i = 0; i < vb.limit(); i++) {
+ char fromFilled = bbfilled.getChar(o + i * 2);
+
+ bb.putChar(o + i * 2, fromFilled);
+ char fromBufferView = vb.get(i);
+ assertValues(i, fromFilled, fromBufferView, bb, vb);
+ }
+
+ for (int i = 0; i < vb.limit(); i++) {
+ char fromFilled = bbfilled.getChar(o + i * 2);
+
+ bb.putChar(fromFilled);
+ char fromBufferView = vb.get();
+ assertValues(i, fromFilled, fromBufferView, bb, vb);
+ }
+ }
+
+ static char getCharFromBytes(ByteBuffer bb, int i) {
+ return (char) getShortFromBytes(bb, i);
+ }
+
+
+ @DataProvider
+ public static Object[][] intViewProvider() {
+ List<Map.Entry<String, Function<ByteBuffer, IntBuffer>>> bfs = List.of(
+ Map.entry("bb.asIntBuffer()",
+ bb -> bb.asIntBuffer()),
+ Map.entry("bb.asIntBuffer().slice()",
+ bb -> bb.asIntBuffer().slice()),
+ Map.entry("bb.asIntBuffer().slice().duplicate()",
+ bb -> bb.asIntBuffer().slice().duplicate())
+ );
+
+ return product(BYTE_BUFFER_FUNCTIONS, bfs);
+ }
+
+ @Test(dataProvider = "intViewProvider")
+ public void testIntGet(String desc, IntFunction<ByteBuffer> fbb,
+ Function<ByteBuffer, IntBuffer> fbi) {
+ ByteBuffer bb = allocate(fbb);
+ IntBuffer vb = fbi.apply(bb);
+ int o = bb.position();
+
+ for (int i = 0; i < vb.limit(); i++) {
+ int fromBytes = getIntFromBytes(bb, o + i * 4);
+ int fromMethodView = bb.getInt(o + i * 4);
+ assertValues(i, fromBytes, fromMethodView, bb);
+
+ int fromBufferView = vb.get(i);
+ assertValues(i, fromMethodView, fromBufferView, bb, vb);
+ }
+
+ for (int i = 0; i < vb.limit(); i++) {
+ int v = getIntFromBytes(bb, o + i * 4);
+ int a = bb.getInt();
+ assertValues(i, v, a, bb);
+
+ int b = vb.get();
+ assertValues(i, a, b, bb, vb);
+ }
+
+ }
+
+ @Test(dataProvider = "intViewProvider")
+ public void testIntPut(String desc, IntFunction<ByteBuffer> fbb,
+ Function<ByteBuffer, IntBuffer> fbi) {
+ ByteBuffer bbfilled = allocate(fbb);
+ ByteBuffer bb = allocate(fbb, i -> 0);
+ IntBuffer vb = fbi.apply(bb);
+ int o = bb.position();
+
+ for (int i = 0; i < vb.limit(); i++) {
+ int fromFilled = bbfilled.getInt(o + i * 4);
+
+ vb.put(i, fromFilled);
+ int fromMethodView = bb.getInt(o + i * 4);
+ assertValues(i, fromFilled, fromMethodView, bb, vb);
+ }
+
+ for (int i = 0; i < vb.limit(); i++) {
+ int fromFilled = bbfilled.getInt(o + i * 4);
+
+ vb.put(fromFilled);
+ int fromMethodView = bb.getInt();
+ assertValues(i, fromFilled, fromMethodView, bb, vb);
+ }
+
+
+ fill(bb, i -> 0);
+ bb.clear().position(o);
+ vb.clear();
+
+ for (int i = 0; i < vb.limit(); i++) {
+ int fromFilled = bbfilled.getInt(o + i * 4);
+
+ bb.putInt(o + i * 4, fromFilled);
+ int fromBufferView = vb.get(i);
+ assertValues(i, fromFilled, fromBufferView, bb, vb);
+ }
+
+ for (int i = 0; i < vb.limit(); i++) {
+ int fromFilled = bbfilled.getInt(o + i * 4);
+
+ bb.putInt(fromFilled);
+ int fromBufferView = vb.get();
+ assertValues(i, fromFilled, fromBufferView, bb, vb);
+ }
+ }
+
+ static int getIntFromBytes(ByteBuffer bb, int i) {
+ int a = bb.get(i) & 0xFF;
+ int b = bb.get(i + 1) & 0xFF;
+ int c = bb.get(i + 2) & 0xFF;
+ int d = bb.get(i + 3) & 0xFF;
+
+ if (bb.order() == ByteOrder.BIG_ENDIAN) {
+ return ((a << 24) | (b << 16) | (c << 8) | d);
+ }
+ else {
+ return ((d << 24) | (c << 16) | (b << 8) | a);
+ }
+ }
+
+
+ @DataProvider
+ public static Object[][] longViewProvider() {
+ List<Map.Entry<String, Function<ByteBuffer, LongBuffer>>> bfs = List.of(
+ Map.entry("bb.asLongBuffer()",
+ bb -> bb.asLongBuffer()),
+ Map.entry("bb.asLongBuffer().slice()",
+ bb -> bb.asLongBuffer().slice()),
+ Map.entry("bb.asLongBuffer().slice().duplicate()",
+ bb -> bb.asLongBuffer().slice().duplicate())
+ );
+
+ return product(BYTE_BUFFER_FUNCTIONS, bfs);
+ }
+
+ @Test(dataProvider = "longViewProvider")
+ public void testLongGet(String desc, IntFunction<ByteBuffer> fbb,
+ Function<ByteBuffer, LongBuffer> fbi) {
+ ByteBuffer bb = allocate(fbb);
+ LongBuffer vb = fbi.apply(bb);
+ int o = bb.position();
+
+ for (int i = 0; i < vb.limit(); i++) {
+ long fromBytes = getLongFromBytes(bb, o + i * 8);
+ long fromMethodView = bb.getLong(o + i * 8);
+ assertValues(i, fromBytes, fromMethodView, bb);
+
+ long fromBufferView = vb.get(i);
+ assertValues(i, fromMethodView, fromBufferView, bb, vb);
+ }
+
+ for (int i = 0; i < vb.limit(); i++) {
+ long v = getLongFromBytes(bb, o + i * 8);
+ long a = bb.getLong();
+ assertValues(i, v, a, bb);
+
+ long b = vb.get();
+ assertValues(i, a, b, bb, vb);
+ }
+
+ }
+
+ @Test(dataProvider = "longViewProvider")
+ public void testLongPut(String desc, IntFunction<ByteBuffer> fbb,
+ Function<ByteBuffer, LongBuffer> fbi) {
+ ByteBuffer bbfilled = allocate(fbb);
+ ByteBuffer bb = allocate(fbb, i -> 0);
+ LongBuffer vb = fbi.apply(bb);
+ int o = bb.position();
+
+ for (int i = 0; i < vb.limit(); i++) {
+ long fromFilled = bbfilled.getLong(o + i * 8);
+
+ vb.put(i, fromFilled);
+ long fromMethodView = bb.getLong(o + i * 8);
+ assertValues(i, fromFilled, fromMethodView, bb, vb);
+ }
+
+ for (int i = 0; i < vb.limit(); i++) {
+ long fromFilled = bbfilled.getLong(o + i * 8);
+
+ vb.put(fromFilled);
+ long fromMethodView = bb.getLong();
+ assertValues(i, fromFilled, fromMethodView, bb, vb);
+ }
+
+
+ fill(bb, i -> 0);
+ bb.clear().position(o);
+ vb.clear();
+
+ for (int i = 0; i < vb.limit(); i++) {
+ long fromFilled = bbfilled.getLong(o + i * 8);
+
+ bb.putLong(o + i * 8, fromFilled);
+ long fromBufferView = vb.get(i);
+ assertValues(i, fromFilled, fromBufferView, bb, vb);
+ }
+
+ for (int i = 0; i < vb.limit(); i++) {
+ long fromFilled = bbfilled.getLong(o + i * 8);
+
+ bb.putLong(fromFilled);
+ long fromBufferView = vb.get();
+ assertValues(i, fromFilled, fromBufferView, bb, vb);
+ }
+ }
+
+ static long getLongFromBytes(ByteBuffer bb, int i) {
+ long a = bb.get(i) & 0xFF;
+ long b = bb.get(i + 1) & 0xFF;
+ long c = bb.get(i + 2) & 0xFF;
+ long d = bb.get(i + 3) & 0xFF;
+ long e = bb.get(i + 4) & 0xFF;
+ long f = bb.get(i + 5) & 0xFF;
+ long g = bb.get(i + 6) & 0xFF;
+ long h = bb.get(i + 7) & 0xFF;
+
+ if (bb.order() == ByteOrder.BIG_ENDIAN) {
+ return ((a << 56) | (b << 48) | (c << 40) | (d << 32) |
+ (e << 24) | (f << 16) | (g << 8) | h);
+ }
+ else {
+ return ((h << 56) | (g << 48) | (f << 40) | (e << 32) |
+ (d << 24) | (c << 16) | (b << 8) | a);
+ }
+ }
+
+
+ @DataProvider
+ public static Object[][] floatViewProvider() {
+ List<Map.Entry<String, Function<ByteBuffer, FloatBuffer>>> bfs = List.of(
+ Map.entry("bb.asFloatBuffer()",
+ bb -> bb.asFloatBuffer()),
+ Map.entry("bb.asFloatBuffer().slice()",
+ bb -> bb.asFloatBuffer().slice()),
+ Map.entry("bb.asFloatBuffer().slice().duplicate()",
+ bb -> bb.asFloatBuffer().slice().duplicate())
+ );
+
+ return product(BYTE_BUFFER_FUNCTIONS, bfs);
+ }
+
+ @Test(dataProvider = "floatViewProvider")
+ public void testFloatGet(String desc, IntFunction<ByteBuffer> fbb,
+ Function<ByteBuffer, FloatBuffer> fbi) {
+ ByteBuffer bb = allocate(fbb);
+ FloatBuffer vb = fbi.apply(bb);
+ int o = bb.position();
+
+ for (int i = 0; i < vb.limit(); i++) {
+ float fromBytes = getFloatFromBytes(bb, o + i * 4);
+ float fromMethodView = bb.getFloat(o + i * 4);
+ assertValues(i, fromBytes, fromMethodView, bb);
+
+ float fromBufferView = vb.get(i);
+ assertValues(i, fromMethodView, fromBufferView, bb, vb);
+ }
+
+ for (int i = 0; i < vb.limit(); i++) {
+ float v = getFloatFromBytes(bb, o + i * 4);
+ float a = bb.getFloat();
+ assertValues(i, v, a, bb);
+
+ float b = vb.get();
+ assertValues(i, a, b, bb, vb);
+ }
+
+ }
+
+ @Test(dataProvider = "floatViewProvider")
+ public void testFloatPut(String desc, IntFunction<ByteBuffer> fbb,
+ Function<ByteBuffer, FloatBuffer> fbi) {
+ ByteBuffer bbfilled = allocate(fbb);
+ ByteBuffer bb = allocate(fbb, i -> 0);
+ FloatBuffer vb = fbi.apply(bb);
+ int o = bb.position();
+
+ for (int i = 0; i < vb.limit(); i++) {
+ float fromFilled = bbfilled.getFloat(o + i * 4);
+
+ vb.put(i, fromFilled);
+ float fromMethodView = bb.getFloat(o + i * 4);
+ assertValues(i, fromFilled, fromMethodView, bb, vb);
+ }
+
+ for (int i = 0; i < vb.limit(); i++) {
+ float fromFilled = bbfilled.getFloat(o + i * 4);
+
+ vb.put(fromFilled);
+ float fromMethodView = bb.getFloat();
+ assertValues(i, fromFilled, fromMethodView, bb, vb);
+ }
+
+
+ fill(bb, i -> 0);
+ bb.clear().position(o);
+ vb.clear();
+
+ for (int i = 0; i < vb.limit(); i++) {
+ float fromFilled = bbfilled.getFloat(o + i * 4);
+
+ bb.putFloat(o + i * 4, fromFilled);
+ float fromBufferView = vb.get(i);
+ assertValues(i, fromFilled, fromBufferView, bb, vb);
+ }
+
+ for (int i = 0; i < vb.limit(); i++) {
+ float fromFilled = bbfilled.getFloat(o + i * 4);
+
+ bb.putFloat(fromFilled);
+ float fromBufferView = vb.get();
+ assertValues(i, fromFilled, fromBufferView, bb, vb);
+ }
+ }
+
+ static float getFloatFromBytes(ByteBuffer bb, int i) {
+ return Float.intBitsToFloat(getIntFromBytes(bb, i));
+ }
+
+
+
+ @DataProvider
+ public static Object[][] doubleViewProvider() {
+ List<Map.Entry<String, Function<ByteBuffer, DoubleBuffer>>> bfs = List.of(
+ Map.entry("bb.asDoubleBuffer()",
+ bb -> bb.asDoubleBuffer()),
+ Map.entry("bb.asDoubleBuffer().slice()",
+ bb -> bb.asDoubleBuffer().slice()),
+ Map.entry("bb.asDoubleBuffer().slice().duplicate()",
+ bb -> bb.asDoubleBuffer().slice().duplicate())
+ );
+
+ return product(BYTE_BUFFER_FUNCTIONS, bfs);
+ }
+
+ @Test(dataProvider = "doubleViewProvider")
+ public void testDoubleGet(String desc, IntFunction<ByteBuffer> fbb,
+ Function<ByteBuffer, DoubleBuffer> fbi) {
+ ByteBuffer bb = allocate(fbb);
+ DoubleBuffer vb = fbi.apply(bb);
+ int o = bb.position();
+
+ for (int i = 0; i < vb.limit(); i++) {
+ double fromBytes = getDoubleFromBytes(bb, o + i * 8);
+ double fromMethodView = bb.getDouble(o + i * 8);
+ assertValues(i, fromBytes, fromMethodView, bb);
+
+ double fromBufferView = vb.get(i);
+ assertValues(i, fromMethodView, fromBufferView, bb, vb);
+ }
+
+ for (int i = 0; i < vb.limit(); i++) {
+ double v = getDoubleFromBytes(bb, o + i * 8);
+ double a = bb.getDouble();
+ assertValues(i, v, a, bb);
+
+ double b = vb.get();
+ assertValues(i, a, b, bb, vb);
+ }
+
+ }
+
+ @Test(dataProvider = "doubleViewProvider")
+ public void testDoublePut(String desc, IntFunction<ByteBuffer> fbb,
+ Function<ByteBuffer, DoubleBuffer> fbi) {
+ ByteBuffer bbfilled = allocate(fbb);
+ ByteBuffer bb = allocate(fbb, i -> 0);
+ DoubleBuffer vb = fbi.apply(bb);
+ int o = bb.position();
+
+ for (int i = 0; i < vb.limit(); i++) {
+ double fromFilled = bbfilled.getDouble(o + i * 8);
+
+ vb.put(i, fromFilled);
+ double fromMethodView = bb.getDouble(o + i * 8);
+ assertValues(i, fromFilled, fromMethodView, bb, vb);
+ }
+
+ for (int i = 0; i < vb.limit(); i++) {
+ double fromFilled = bbfilled.getDouble(o + i * 8);
+
+ vb.put(fromFilled);
+ double fromMethodView = bb.getDouble();
+ assertValues(i, fromFilled, fromMethodView, bb, vb);
+ }
+
+
+ fill(bb, i -> 0);
+ bb.clear().position(o);
+ vb.clear();
+
+ for (int i = 0; i < vb.limit(); i++) {
+ double fromFilled = bbfilled.getDouble(o + i * 8);
+
+ bb.putDouble(o + i * 8, fromFilled);
+ double fromBufferView = vb.get(i);
+ assertValues(i, fromFilled, fromBufferView, bb, vb);
+ }
+
+ for (int i = 0; i < vb.limit(); i++) {
+ double fromFilled = bbfilled.getDouble(o + i * 8);
+
+ bb.putDouble(fromFilled);
+ double fromBufferView = vb.get();
+ assertValues(i, fromFilled, fromBufferView, bb, vb);
+ }
+ }
+
+ static double getDoubleFromBytes(ByteBuffer bb, int i) {
+ return Double.longBitsToDouble(getLongFromBytes(bb, i));
+ }
+}
--- a/jdk/test/lib/testlibrary/jdk/testlibrary/Platform.java Fri Aug 05 18:16:45 2016 +0530
+++ b/jdk/test/lib/testlibrary/jdk/testlibrary/Platform.java Fri Aug 05 09:50:29 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -58,10 +58,6 @@
return vmName.endsWith(" Minimal VM");
}
- public static boolean isEmbedded() {
- return vmName.contains("Embedded");
- }
-
public static boolean isTieredSupported() {
return compiler.contains("Tiered Compilers");
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/misc/GetSunMiscUnsafe.java Fri Aug 05 09:50:29 2016 -0700
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2001, 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.
+ */
+
+/* @test
+ * @bug 4495577
+ * @summary Ensure that sun.misc.Unsafe cannot (easily)
+ * be accessed from user code
+ * @modules jdk.unsupported
+ */
+
+
+public class GetSunMiscUnsafe {
+
+ public static void main(String[] args) throws Exception {
+ try {
+ sun.misc.Unsafe.getUnsafe();
+ } catch (SecurityException x) {
+ System.err.println("Thrown as expected: " + x);
+ return;
+ }
+ throw new Exception("No exception thrown");
+ }
+
+}
--- a/jdk/test/sun/misc/Safe.java Fri Aug 05 18:16:45 2016 +0530
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 2001, 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
- * @bug 4495577
- * @summary Ensure that sun.misc.Unsafe cannot (easily)
- * be accessed from user code
- * @modules jdk.unsupported
- */
-
-
-public class Safe {
-
- public static void main(String[] args) throws Exception {
- try {
- sun.misc.Unsafe.getUnsafe();
- } catch (Exception x) {
- System.err.println("Thrown as expected: " + x);
- return;
- }
- throw new Exception("No exception thrown");
- }
-
-}
--- a/jdk/test/sun/tools/jhsdb/BasicLauncherTest.java Fri Aug 05 18:16:45 2016 +0530
+++ b/jdk/test/sun/tools/jhsdb/BasicLauncherTest.java Fri Aug 05 09:50:29 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 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
@@ -182,6 +182,7 @@
launchCLHSDB();
+ launch("compiler detected", "jmap", "--clstats");
launchNotOSX("No deadlocks found", "jstack");
launch("compiler detected", "jmap");
launch("Java System Properties", "jinfo");
--- a/jdk/test/tools/launcher/VersionCheck.java Fri Aug 05 18:16:45 2016 +0530
+++ b/jdk/test/tools/launcher/VersionCheck.java Fri Aug 05 09:50:29 2016 -0700
@@ -93,7 +93,6 @@
"jps",
"jrunscript",
"jjs",
- "jsadebugd",
"jstack",
"jstat",
"jstatd",