mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 14:54:52 +02:00
Merge
This commit is contained in:
commit
f52ea8839e
19 changed files with 223 additions and 107 deletions
1
.hgtags
1
.hgtags
|
@ -474,3 +474,4 @@ dfa46cfe56346884a61efdc30dc50f7505d66761 jdk-11+1
|
||||||
663f20fc51091bd7f95d18448850ba091207b7bd jdk-10+44
|
663f20fc51091bd7f95d18448850ba091207b7bd jdk-10+44
|
||||||
4f96cf952e71cb8a127334494faf28880c26181b jdk-10+45
|
4f96cf952e71cb8a127334494faf28880c26181b jdk-10+45
|
||||||
1fd4d6068f54561cfc67d54fc9ca84af7212c4f8 jdk-11+3
|
1fd4d6068f54561cfc67d54fc9ca84af7212c4f8 jdk-11+3
|
||||||
|
e59941f7247d451fa7df9eaef3fce0f492f8420c jdk-11+4
|
||||||
|
|
|
@ -48,6 +48,7 @@ $(INTERIM_IMAGE_DIR)/$(JIMAGE_TARGET_FILE): $(JMODS) \
|
||||||
$(RM) -r $(INTERIM_IMAGE_DIR)
|
$(RM) -r $(INTERIM_IMAGE_DIR)
|
||||||
$(JLINK_TOOL) \
|
$(JLINK_TOOL) \
|
||||||
--output $(INTERIM_IMAGE_DIR) \
|
--output $(INTERIM_IMAGE_DIR) \
|
||||||
|
--disable-plugin generate-jli-classes \
|
||||||
--add-modules $(INTERIM_MODULES_LIST)
|
--add-modules $(INTERIM_MODULES_LIST)
|
||||||
$(TOUCH) $@
|
$(TOUCH) $@
|
||||||
|
|
||||||
|
|
|
@ -77,7 +77,7 @@ VS_MSVCR_2017=vcruntime140.dll
|
||||||
VS_MSVCP_2017=msvcp140.dll
|
VS_MSVCP_2017=msvcp140.dll
|
||||||
VS_ENVVAR_2017="VS150COMNTOOLS"
|
VS_ENVVAR_2017="VS150COMNTOOLS"
|
||||||
VS_VS_INSTALLDIR_2017="Microsoft Visual Studio/2017"
|
VS_VS_INSTALLDIR_2017="Microsoft Visual Studio/2017"
|
||||||
VS_EDITIONS_2017="Community Professional Enterprise"
|
VS_EDITIONS_2017="BuildTools Community Professional Enterprise"
|
||||||
VS_SDK_INSTALLDIR_2017=
|
VS_SDK_INSTALLDIR_2017=
|
||||||
VS_VS_PLATFORM_NAME_2017="v141"
|
VS_VS_PLATFORM_NAME_2017="v141"
|
||||||
VS_SDK_PLATFORM_NAME_2017=
|
VS_SDK_PLATFORM_NAME_2017=
|
||||||
|
|
|
@ -77,7 +77,6 @@ public class ResultSet {
|
||||||
"line.separator",
|
"line.separator",
|
||||||
"file.separator",
|
"file.separator",
|
||||||
"file.encoding",
|
"file.encoding",
|
||||||
"file.encoding.pkg",
|
|
||||||
"java.class.path",
|
"java.class.path",
|
||||||
"java.library.path",
|
"java.library.path",
|
||||||
"java.io.tmpdir",
|
"java.io.tmpdir",
|
||||||
|
|
|
@ -3590,7 +3590,8 @@ class Character implements java.io.Serializable, Comparable<Character> {
|
||||||
*/
|
*/
|
||||||
public static UnicodeBlock of(int codePoint) {
|
public static UnicodeBlock of(int codePoint) {
|
||||||
if (!isValidCodePoint(codePoint)) {
|
if (!isValidCodePoint(codePoint)) {
|
||||||
throw new IllegalArgumentException();
|
throw new IllegalArgumentException(
|
||||||
|
String.format("Not a valid Unicode code point: 0x%X", codePoint));
|
||||||
}
|
}
|
||||||
|
|
||||||
int top, bottom, current;
|
int top, bottom, current;
|
||||||
|
@ -3649,7 +3650,8 @@ class Character implements java.io.Serializable, Comparable<Character> {
|
||||||
public static final UnicodeBlock forName(String blockName) {
|
public static final UnicodeBlock forName(String blockName) {
|
||||||
UnicodeBlock block = map.get(blockName.toUpperCase(Locale.US));
|
UnicodeBlock block = map.get(blockName.toUpperCase(Locale.US));
|
||||||
if (block == null) {
|
if (block == null) {
|
||||||
throw new IllegalArgumentException();
|
throw new IllegalArgumentException("Not a valid block name: "
|
||||||
|
+ blockName);
|
||||||
}
|
}
|
||||||
return block;
|
return block;
|
||||||
}
|
}
|
||||||
|
@ -7394,7 +7396,8 @@ class Character implements java.io.Serializable, Comparable<Character> {
|
||||||
*/
|
*/
|
||||||
public static UnicodeScript of(int codePoint) {
|
public static UnicodeScript of(int codePoint) {
|
||||||
if (!isValidCodePoint(codePoint))
|
if (!isValidCodePoint(codePoint))
|
||||||
throw new IllegalArgumentException();
|
throw new IllegalArgumentException(
|
||||||
|
String.format("Not a valid Unicode code point: 0x%X", codePoint));
|
||||||
int type = getType(codePoint);
|
int type = getType(codePoint);
|
||||||
// leave SURROGATE and PRIVATE_USE for table lookup
|
// leave SURROGATE and PRIVATE_USE for table lookup
|
||||||
if (type == UNASSIGNED)
|
if (type == UNASSIGNED)
|
||||||
|
@ -8088,7 +8091,8 @@ class Character implements java.io.Serializable, Comparable<Character> {
|
||||||
toSurrogates(codePoint, dst, dstIndex);
|
toSurrogates(codePoint, dst, dstIndex);
|
||||||
return 2;
|
return 2;
|
||||||
} else {
|
} else {
|
||||||
throw new IllegalArgumentException();
|
throw new IllegalArgumentException(
|
||||||
|
String.format("Not a valid Unicode code point: 0x%X", codePoint));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8116,7 +8120,8 @@ class Character implements java.io.Serializable, Comparable<Character> {
|
||||||
toSurrogates(codePoint, result, 0);
|
toSurrogates(codePoint, result, 0);
|
||||||
return result;
|
return result;
|
||||||
} else {
|
} else {
|
||||||
throw new IllegalArgumentException();
|
throw new IllegalArgumentException(
|
||||||
|
String.format("Not a valid Unicode code point: 0x%X", codePoint));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10178,7 +10183,8 @@ class Character implements java.io.Serializable, Comparable<Character> {
|
||||||
*/
|
*/
|
||||||
public static String getName(int codePoint) {
|
public static String getName(int codePoint) {
|
||||||
if (!isValidCodePoint(codePoint)) {
|
if (!isValidCodePoint(codePoint)) {
|
||||||
throw new IllegalArgumentException();
|
throw new IllegalArgumentException(
|
||||||
|
String.format("Not a valid Unicode code point: 0x%X", codePoint));
|
||||||
}
|
}
|
||||||
String name = CharacterName.getInstance().getName(codePoint);
|
String name = CharacterName.getInstance().getName(codePoint);
|
||||||
if (name != null)
|
if (name != null)
|
||||||
|
|
|
@ -3178,6 +3178,7 @@ public final class String
|
||||||
return new String(StringUTF16.toBytesSupplementary(codePoint), UTF16);
|
return new String(StringUTF16.toBytesSupplementary(codePoint), UTF16);
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new IllegalArgumentException("Not a valid Unicode code point");
|
throw new IllegalArgumentException(
|
||||||
|
format("Not a valid Unicode code point: 0x%X", codePoint));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
|
|
||||||
package java.lang.ref;
|
package java.lang.ref;
|
||||||
|
|
||||||
import jdk.internal.vm.annotation.DontInline;
|
import jdk.internal.vm.annotation.ForceInline;
|
||||||
import jdk.internal.HotSpotIntrinsicCandidate;
|
import jdk.internal.HotSpotIntrinsicCandidate;
|
||||||
import jdk.internal.misc.JavaLangRefAccess;
|
import jdk.internal.misc.JavaLangRefAccess;
|
||||||
import jdk.internal.misc.SharedSecrets;
|
import jdk.internal.misc.SharedSecrets;
|
||||||
|
@ -420,10 +420,12 @@ public abstract class Reference<T> {
|
||||||
* @param ref the reference. If {@code null}, this method has no effect.
|
* @param ref the reference. If {@code null}, this method has no effect.
|
||||||
* @since 9
|
* @since 9
|
||||||
*/
|
*/
|
||||||
@DontInline
|
@ForceInline
|
||||||
public static void reachabilityFence(Object ref) {
|
public static void reachabilityFence(Object ref) {
|
||||||
// Does nothing, because this method is annotated with @DontInline
|
// Does nothing. This method is annotated with @ForceInline to eliminate
|
||||||
// HotSpot needs to retain the ref and not GC it before a call to this
|
// most of the overhead that using @DontInline would cause with the
|
||||||
// method
|
// HotSpot JVM, when this fence is used in a wide variety of situations.
|
||||||
|
// HotSpot JVM retains the ref and does not GC it before a call to
|
||||||
|
// this method, because the JIT-compilers do not have GC-only safepoints.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -32,24 +32,40 @@ class XXX {
|
||||||
#if[rw]
|
#if[rw]
|
||||||
|
|
||||||
private $type$ get$Type$(long a) {
|
private $type$ get$Type$(long a) {
|
||||||
$memtype$ x = UNSAFE.get$Memtype$Unaligned(null, a, bigEndian);
|
try {
|
||||||
return $fromBits$(x);
|
$memtype$ x = UNSAFE.get$Memtype$Unaligned(null, a, bigEndian);
|
||||||
|
return $fromBits$(x);
|
||||||
|
} finally {
|
||||||
|
Reference.reachabilityFence(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public $type$ get$Type$() {
|
public $type$ get$Type$() {
|
||||||
return get$Type$(ix(nextGetIndex($BYTES_PER_VALUE$)));
|
try {
|
||||||
|
return get$Type$(ix(nextGetIndex($BYTES_PER_VALUE$)));
|
||||||
|
} finally {
|
||||||
|
Reference.reachabilityFence(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public $type$ get$Type$(int i) {
|
public $type$ get$Type$(int i) {
|
||||||
return get$Type$(ix(checkIndex(i, $BYTES_PER_VALUE$)));
|
try {
|
||||||
|
return get$Type$(ix(checkIndex(i, $BYTES_PER_VALUE$)));
|
||||||
|
} finally {
|
||||||
|
Reference.reachabilityFence(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#end[rw]
|
#end[rw]
|
||||||
|
|
||||||
private ByteBuffer put$Type$(long a, $type$ x) {
|
private ByteBuffer put$Type$(long a, $type$ x) {
|
||||||
#if[rw]
|
#if[rw]
|
||||||
$memtype$ y = $toBits$(x);
|
try {
|
||||||
UNSAFE.put$Memtype$Unaligned(null, a, y, bigEndian);
|
$memtype$ y = $toBits$(x);
|
||||||
|
UNSAFE.put$Memtype$Unaligned(null, a, y, bigEndian);
|
||||||
|
} finally {
|
||||||
|
Reference.reachabilityFence(this);
|
||||||
|
}
|
||||||
return this;
|
return this;
|
||||||
#else[rw]
|
#else[rw]
|
||||||
throw new ReadOnlyBufferException();
|
throw new ReadOnlyBufferException();
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -28,6 +28,7 @@
|
||||||
package java.nio;
|
package java.nio;
|
||||||
|
|
||||||
import java.io.FileDescriptor;
|
import java.io.FileDescriptor;
|
||||||
|
import java.lang.ref.Reference;
|
||||||
import jdk.internal.misc.VM;
|
import jdk.internal.misc.VM;
|
||||||
import jdk.internal.ref.Cleaner;
|
import jdk.internal.ref.Cleaner;
|
||||||
import sun.nio.ch.DirectBuffer;
|
import sun.nio.ch.DirectBuffer;
|
||||||
|
@ -257,16 +258,28 @@ class Direct$Type$Buffer$RW$$BO$
|
||||||
}
|
}
|
||||||
|
|
||||||
public $type$ get() {
|
public $type$ get() {
|
||||||
return $fromBits$($swap$(UNSAFE.get$Swaptype$(ix(nextGetIndex()))));
|
try {
|
||||||
|
return $fromBits$($swap$(UNSAFE.get$Swaptype$(ix(nextGetIndex()))));
|
||||||
|
} finally {
|
||||||
|
Reference.reachabilityFence(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public $type$ get(int i) {
|
public $type$ get(int i) {
|
||||||
return $fromBits$($swap$(UNSAFE.get$Swaptype$(ix(checkIndex(i)))));
|
try {
|
||||||
|
return $fromBits$($swap$(UNSAFE.get$Swaptype$(ix(checkIndex(i)))));
|
||||||
|
} finally {
|
||||||
|
Reference.reachabilityFence(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if[streamableType]
|
#if[streamableType]
|
||||||
$type$ getUnchecked(int i) {
|
$type$ getUnchecked(int i) {
|
||||||
return $fromBits$($swap$(UNSAFE.get$Swaptype$(ix(i))));
|
try {
|
||||||
|
return $fromBits$($swap$(UNSAFE.get$Swaptype$(ix(i))));
|
||||||
|
} finally {
|
||||||
|
Reference.reachabilityFence(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#end[streamableType]
|
#end[streamableType]
|
||||||
|
|
||||||
|
@ -282,21 +295,25 @@ class Direct$Type$Buffer$RW$$BO$
|
||||||
throw new BufferUnderflowException();
|
throw new BufferUnderflowException();
|
||||||
|
|
||||||
long dstOffset = ARRAY_BASE_OFFSET + ((long)offset << $LG_BYTES_PER_VALUE$);
|
long dstOffset = ARRAY_BASE_OFFSET + ((long)offset << $LG_BYTES_PER_VALUE$);
|
||||||
|
try {
|
||||||
#if[!byte]
|
#if[!byte]
|
||||||
if (order() != ByteOrder.nativeOrder())
|
if (order() != ByteOrder.nativeOrder())
|
||||||
UNSAFE.copySwapMemory(null,
|
UNSAFE.copySwapMemory(null,
|
||||||
|
ix(pos),
|
||||||
|
dst,
|
||||||
|
dstOffset,
|
||||||
|
(long)length << $LG_BYTES_PER_VALUE$,
|
||||||
|
(long)1 << $LG_BYTES_PER_VALUE$);
|
||||||
|
else
|
||||||
|
#end[!byte]
|
||||||
|
UNSAFE.copyMemory(null,
|
||||||
ix(pos),
|
ix(pos),
|
||||||
dst,
|
dst,
|
||||||
dstOffset,
|
dstOffset,
|
||||||
(long)length << $LG_BYTES_PER_VALUE$,
|
(long)length << $LG_BYTES_PER_VALUE$);
|
||||||
(long)1 << $LG_BYTES_PER_VALUE$);
|
} finally {
|
||||||
else
|
Reference.reachabilityFence(this);
|
||||||
#end[!byte]
|
}
|
||||||
UNSAFE.copyMemory(null,
|
|
||||||
ix(pos),
|
|
||||||
dst,
|
|
||||||
dstOffset,
|
|
||||||
(long)length << $LG_BYTES_PER_VALUE$);
|
|
||||||
position(pos + length);
|
position(pos + length);
|
||||||
} else {
|
} else {
|
||||||
super.get(dst, offset, length);
|
super.get(dst, offset, length);
|
||||||
|
@ -311,7 +328,11 @@ class Direct$Type$Buffer$RW$$BO$
|
||||||
|
|
||||||
public $Type$Buffer put($type$ x) {
|
public $Type$Buffer put($type$ x) {
|
||||||
#if[rw]
|
#if[rw]
|
||||||
UNSAFE.put$Swaptype$(ix(nextPutIndex()), $swap$($toBits$(x)));
|
try {
|
||||||
|
UNSAFE.put$Swaptype$(ix(nextPutIndex()), $swap$($toBits$(x)));
|
||||||
|
} finally {
|
||||||
|
Reference.reachabilityFence(this);
|
||||||
|
}
|
||||||
return this;
|
return this;
|
||||||
#else[rw]
|
#else[rw]
|
||||||
throw new ReadOnlyBufferException();
|
throw new ReadOnlyBufferException();
|
||||||
|
@ -320,7 +341,11 @@ class Direct$Type$Buffer$RW$$BO$
|
||||||
|
|
||||||
public $Type$Buffer put(int i, $type$ x) {
|
public $Type$Buffer put(int i, $type$ x) {
|
||||||
#if[rw]
|
#if[rw]
|
||||||
UNSAFE.put$Swaptype$(ix(checkIndex(i)), $swap$($toBits$(x)));
|
try {
|
||||||
|
UNSAFE.put$Swaptype$(ix(checkIndex(i)), $swap$($toBits$(x)));
|
||||||
|
} finally {
|
||||||
|
Reference.reachabilityFence(this);
|
||||||
|
}
|
||||||
return this;
|
return this;
|
||||||
#else[rw]
|
#else[rw]
|
||||||
throw new ReadOnlyBufferException();
|
throw new ReadOnlyBufferException();
|
||||||
|
@ -346,7 +371,12 @@ class Direct$Type$Buffer$RW$$BO$
|
||||||
|
|
||||||
if (srem > rem)
|
if (srem > rem)
|
||||||
throw new BufferOverflowException();
|
throw new BufferOverflowException();
|
||||||
UNSAFE.copyMemory(sb.ix(spos), ix(pos), (long)srem << $LG_BYTES_PER_VALUE$);
|
try {
|
||||||
|
UNSAFE.copyMemory(sb.ix(spos), ix(pos), (long)srem << $LG_BYTES_PER_VALUE$);
|
||||||
|
} finally {
|
||||||
|
Reference.reachabilityFence(sb);
|
||||||
|
Reference.reachabilityFence(this);
|
||||||
|
}
|
||||||
sb.position(spos + srem);
|
sb.position(spos + srem);
|
||||||
position(pos + srem);
|
position(pos + srem);
|
||||||
} else if (src.hb != null) {
|
} else if (src.hb != null) {
|
||||||
|
@ -380,21 +410,25 @@ class Direct$Type$Buffer$RW$$BO$
|
||||||
throw new BufferOverflowException();
|
throw new BufferOverflowException();
|
||||||
|
|
||||||
long srcOffset = ARRAY_BASE_OFFSET + ((long)offset << $LG_BYTES_PER_VALUE$);
|
long srcOffset = ARRAY_BASE_OFFSET + ((long)offset << $LG_BYTES_PER_VALUE$);
|
||||||
|
try {
|
||||||
#if[!byte]
|
#if[!byte]
|
||||||
if (order() != ByteOrder.nativeOrder())
|
if (order() != ByteOrder.nativeOrder())
|
||||||
UNSAFE.copySwapMemory(src,
|
UNSAFE.copySwapMemory(src,
|
||||||
|
srcOffset,
|
||||||
|
null,
|
||||||
|
ix(pos),
|
||||||
|
(long)length << $LG_BYTES_PER_VALUE$,
|
||||||
|
(long)1 << $LG_BYTES_PER_VALUE$);
|
||||||
|
else
|
||||||
|
#end[!byte]
|
||||||
|
UNSAFE.copyMemory(src,
|
||||||
srcOffset,
|
srcOffset,
|
||||||
null,
|
null,
|
||||||
ix(pos),
|
ix(pos),
|
||||||
(long)length << $LG_BYTES_PER_VALUE$,
|
(long)length << $LG_BYTES_PER_VALUE$);
|
||||||
(long)1 << $LG_BYTES_PER_VALUE$);
|
} finally {
|
||||||
else
|
Reference.reachabilityFence(this);
|
||||||
#end[!byte]
|
}
|
||||||
UNSAFE.copyMemory(src,
|
|
||||||
srcOffset,
|
|
||||||
null,
|
|
||||||
ix(pos),
|
|
||||||
(long)length << $LG_BYTES_PER_VALUE$);
|
|
||||||
position(pos + length);
|
position(pos + length);
|
||||||
} else {
|
} else {
|
||||||
super.put(src, offset, length);
|
super.put(src, offset, length);
|
||||||
|
@ -411,8 +445,11 @@ class Direct$Type$Buffer$RW$$BO$
|
||||||
int lim = limit();
|
int lim = limit();
|
||||||
assert (pos <= lim);
|
assert (pos <= lim);
|
||||||
int rem = (pos <= lim ? lim - pos : 0);
|
int rem = (pos <= lim ? lim - pos : 0);
|
||||||
|
try {
|
||||||
UNSAFE.copyMemory(ix(pos), ix(0), (long)rem << $LG_BYTES_PER_VALUE$);
|
UNSAFE.copyMemory(ix(pos), ix(0), (long)rem << $LG_BYTES_PER_VALUE$);
|
||||||
|
} finally {
|
||||||
|
Reference.reachabilityFence(this);
|
||||||
|
}
|
||||||
position(rem);
|
position(rem);
|
||||||
limit(capacity());
|
limit(capacity());
|
||||||
discardMark();
|
discardMark();
|
||||||
|
@ -497,19 +534,6 @@ class Direct$Type$Buffer$RW$$BO$
|
||||||
|
|
||||||
|
|
||||||
#if[byte]
|
#if[byte]
|
||||||
|
|
||||||
byte _get(int i) { // package-private
|
|
||||||
return UNSAFE.getByte(address + i);
|
|
||||||
}
|
|
||||||
|
|
||||||
void _put(int i, byte b) { // package-private
|
|
||||||
#if[rw]
|
|
||||||
UNSAFE.putByte(address + i, b);
|
|
||||||
#else[rw]
|
|
||||||
throw new ReadOnlyBufferException();
|
|
||||||
#end[rw]
|
|
||||||
}
|
|
||||||
|
|
||||||
// #BIN
|
// #BIN
|
||||||
//
|
//
|
||||||
// Binary-data access methods for short, char, int, long, float,
|
// Binary-data access methods for short, char, int, long, float,
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
package java.nio;
|
package java.nio;
|
||||||
|
|
||||||
import java.io.FileDescriptor;
|
import java.io.FileDescriptor;
|
||||||
|
import java.lang.ref.Reference;
|
||||||
import jdk.internal.misc.Unsafe;
|
import jdk.internal.misc.Unsafe;
|
||||||
|
|
||||||
|
|
||||||
|
@ -166,9 +167,15 @@ public abstract class MappedByteBuffer
|
||||||
int count = Bits.pageCount(length);
|
int count = Bits.pageCount(length);
|
||||||
long a = mappingAddress(offset);
|
long a = mappingAddress(offset);
|
||||||
byte x = 0;
|
byte x = 0;
|
||||||
for (int i=0; i<count; i++) {
|
try {
|
||||||
x ^= unsafe.getByte(a);
|
for (int i=0; i<count; i++) {
|
||||||
a += ps;
|
// TODO consider changing to getByteOpaque thus avoiding
|
||||||
|
// dead code elimination and the need to calculate a checksum
|
||||||
|
x ^= unsafe.getByte(a);
|
||||||
|
a += ps;
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
Reference.reachabilityFence(this);
|
||||||
}
|
}
|
||||||
if (unused != 0)
|
if (unused != 0)
|
||||||
unused = x;
|
unused = x;
|
||||||
|
|
|
@ -1749,11 +1749,6 @@ public abstract class $Type$Buffer
|
||||||
|
|
||||||
abstract ByteBuffer slice(int pos, int lim);
|
abstract ByteBuffer slice(int pos, int lim);
|
||||||
|
|
||||||
// Unchecked accessors, for use by ByteBufferAs-X-Buffer classes
|
|
||||||
//
|
|
||||||
abstract byte _get(int i); // package-private
|
|
||||||
abstract void _put(int i, byte b); // package-private
|
|
||||||
|
|
||||||
// #BIN
|
// #BIN
|
||||||
//
|
//
|
||||||
// Binary-data access methods for short, char, int, long, float,
|
// Binary-data access methods for short, char, int, long, float,
|
||||||
|
|
|
@ -247,7 +247,6 @@ Java_java_lang_System_initProperties(JNIEnv *env, jclass cla, jobject props)
|
||||||
* user.language
|
* user.language
|
||||||
* user.script, user.country, user.variant (if user's environment specifies them)
|
* user.script, user.country, user.variant (if user's environment specifies them)
|
||||||
* file.encoding
|
* file.encoding
|
||||||
* file.encoding.pkg
|
|
||||||
*/
|
*/
|
||||||
PUTPROP(props, "user.language", sprops->language);
|
PUTPROP(props, "user.language", sprops->language);
|
||||||
if (sprops->script) {
|
if (sprops->script) {
|
||||||
|
@ -266,7 +265,6 @@ Java_java_lang_System_initProperties(JNIEnv *env, jclass cla, jobject props)
|
||||||
if (sprops->sun_stderr_encoding != NULL) {
|
if (sprops->sun_stderr_encoding != NULL) {
|
||||||
PUTPROP(props, "sun.stderr.encoding", sprops->sun_stderr_encoding);
|
PUTPROP(props, "sun.stderr.encoding", sprops->sun_stderr_encoding);
|
||||||
}
|
}
|
||||||
PUTPROP(props, "file.encoding.pkg", "sun.io");
|
|
||||||
|
|
||||||
/* unicode_encoding specifies the default endianness */
|
/* unicode_encoding specifies the default endianness */
|
||||||
PUTPROP(props, "sun.io.unicode.encoding", sprops->unicode_encoding);
|
PUTPROP(props, "sun.io.unicode.encoding", sprops->unicode_encoding);
|
||||||
|
|
|
@ -629,7 +629,6 @@ GetJavaProperties(JNIEnv* env)
|
||||||
* user.language
|
* user.language
|
||||||
* user.script, user.country, user.variant (if user's environment specifies them)
|
* user.script, user.country, user.variant (if user's environment specifies them)
|
||||||
* file.encoding
|
* file.encoding
|
||||||
* file.encoding.pkg
|
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -122,9 +122,11 @@ public class ReachabilityFenceTest {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Reference.reachabilityFence(o);
|
try {
|
||||||
|
return finalized.get();
|
||||||
return finalized.get();
|
} finally {
|
||||||
|
Reference.reachabilityFence(o);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class MyFinalizeable {
|
private static class MyFinalizeable {
|
||||||
|
|
|
@ -30,23 +30,28 @@ import java.io.IOException;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
import jdk.testlibrary.OutputAnalyzer;
|
import jdk.test.lib.JDKToolFinder;
|
||||||
import jdk.testlibrary.ProcessTools;
|
import jdk.test.lib.Utils;
|
||||||
|
import jdk.test.lib.process.OutputAnalyzer;
|
||||||
|
import jdk.test.lib.process.ProcessTools;
|
||||||
|
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @test
|
* @test
|
||||||
* @bug 8058520
|
* @bug 8058520 8196748
|
||||||
* @summary jar tf and jar xf should work on zip files with leading garbage
|
* @summary jar tf and jar xf should work on zip files with leading garbage
|
||||||
* @library /lib/testlibrary
|
* @library /test/lib
|
||||||
* @run testng LeadingGarbage
|
* @run testng LeadingGarbage
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public class LeadingGarbage {
|
public class LeadingGarbage {
|
||||||
final String jar =
|
|
||||||
Paths.get(System.getProperty("java.home"), "bin", "jar").toString();
|
|
||||||
final File[] files = { new File("a"), new File("b") };
|
final File[] files = { new File("a"), new File("b") };
|
||||||
final File normalZip = new File("normal.zip");
|
final File normalZip = new File("normal.zip");
|
||||||
final File leadingGarbageZip = new File("leadingGarbage.zip");
|
final File leadingGarbageZip = new File("leadingGarbage.zip");
|
||||||
|
@ -74,12 +79,10 @@ public class LeadingGarbage {
|
||||||
|
|
||||||
void createNormalZip() throws Throwable {
|
void createNormalZip() throws Throwable {
|
||||||
createFiles();
|
createFiles();
|
||||||
String[] cmd = { jar, "c0Mf", "normal.zip", "a", "b" };
|
OutputAnalyzer a = jar("c0Mf", "normal.zip", "a", "b");
|
||||||
ProcessBuilder pb = new ProcessBuilder(cmd);
|
|
||||||
OutputAnalyzer a = ProcessTools.executeProcess(pb);
|
|
||||||
a.shouldHaveExitValue(0);
|
a.shouldHaveExitValue(0);
|
||||||
a.stdoutShouldMatch("\\A\\Z");
|
a.stdoutShouldMatch("\\A\\Z");
|
||||||
a.stderrShouldMatch("\\A\\Z");
|
a.stderrShouldMatchIgnoreVMWarnings("\\A\\Z");
|
||||||
deleteFiles();
|
deleteFiles();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -104,15 +107,13 @@ public class LeadingGarbage {
|
||||||
}
|
}
|
||||||
|
|
||||||
void assertCanList(String zipFileName) throws Throwable {
|
void assertCanList(String zipFileName) throws Throwable {
|
||||||
String[] cmd = { jar, "tf", zipFileName };
|
OutputAnalyzer a = jar("tf", zipFileName);
|
||||||
ProcessBuilder pb = new ProcessBuilder(cmd);
|
|
||||||
OutputAnalyzer a = ProcessTools.executeProcess(pb);
|
|
||||||
a.shouldHaveExitValue(0);
|
a.shouldHaveExitValue(0);
|
||||||
StringBuilder expected = new StringBuilder();
|
StringBuilder expected = new StringBuilder();
|
||||||
for (File file : files)
|
for (File file : files)
|
||||||
expected.append(file.getName()).append(System.lineSeparator());
|
expected.append(file.getName()).append(System.lineSeparator());
|
||||||
a.stdoutShouldMatch(expected.toString());
|
a.stdoutShouldMatch(expected.toString());
|
||||||
a.stderrShouldMatch("\\A\\Z");
|
a.stderrShouldMatchIgnoreVMWarnings("\\A\\Z");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void test_canExtract() throws Throwable {
|
public void test_canExtract() throws Throwable {
|
||||||
|
@ -126,13 +127,20 @@ public class LeadingGarbage {
|
||||||
}
|
}
|
||||||
|
|
||||||
void assertCanExtract(String zipFileName) throws Throwable {
|
void assertCanExtract(String zipFileName) throws Throwable {
|
||||||
String[] cmd = { jar, "xf", zipFileName };
|
OutputAnalyzer a = jar("xf", zipFileName);
|
||||||
ProcessBuilder pb = new ProcessBuilder(cmd);
|
|
||||||
OutputAnalyzer a = ProcessTools.executeProcess(pb);
|
|
||||||
a.shouldHaveExitValue(0);
|
a.shouldHaveExitValue(0);
|
||||||
a.stdoutShouldMatch("\\A\\Z");
|
a.stdoutShouldMatch("\\A\\Z");
|
||||||
a.stderrShouldMatch("\\A\\Z");
|
a.stderrShouldMatchIgnoreVMWarnings("\\A\\Z");
|
||||||
assertFilesExist();
|
assertFilesExist();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
OutputAnalyzer jar(String... args) throws Throwable {
|
||||||
|
String jar = JDKToolFinder.getJDKTool("jar");
|
||||||
|
List<String> cmds = new ArrayList<>();
|
||||||
|
cmds.add(jar);
|
||||||
|
cmds.addAll(Utils.getForwardVmOptions());
|
||||||
|
Stream.of(args).forEach(x -> cmds.add(x));
|
||||||
|
ProcessBuilder p = new ProcessBuilder(cmds);
|
||||||
|
return ProcessTools.executeCommand(p);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,7 +46,7 @@ import static java.lang.System.out;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @test
|
* @test
|
||||||
* @bug 8167328 8171830 8165640 8174248 8176772
|
* @bug 8167328 8171830 8165640 8174248 8176772 8196748
|
||||||
* @library /lib/testlibrary /test/lib
|
* @library /lib/testlibrary /test/lib
|
||||||
* @modules jdk.compiler
|
* @modules jdk.compiler
|
||||||
* jdk.jartool
|
* jdk.jartool
|
||||||
|
@ -155,6 +155,8 @@ public class Basic {
|
||||||
} else if (line.startsWith("contains:")) {
|
} else if (line.startsWith("contains:")) {
|
||||||
line = line.substring("contains:".length());
|
line = line.substring("contains:".length());
|
||||||
conceals = stringToSet(line);
|
conceals = stringToSet(line);
|
||||||
|
} else if (line.contains("VM warning:")) {
|
||||||
|
continue; // ignore server vm warning see#8196748
|
||||||
} else {
|
} else {
|
||||||
throw new AssertionError("Unknown value " + line);
|
throw new AssertionError("Unknown value " + line);
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @test
|
* @test
|
||||||
|
# @bug 8196748
|
||||||
* @summary Tests for API validator.
|
* @summary Tests for API validator.
|
||||||
* @library /test/lib
|
* @library /test/lib
|
||||||
* @modules java.base/jdk.internal.misc
|
* @modules java.base/jdk.internal.misc
|
||||||
|
@ -86,7 +87,7 @@ public class ApiValidatorTest extends MRTestBase {
|
||||||
".");
|
".");
|
||||||
if (isAcceptable) {
|
if (isAcceptable) {
|
||||||
result.shouldHaveExitValue(SUCCESS)
|
result.shouldHaveExitValue(SUCCESS)
|
||||||
.shouldBeEmpty();
|
.shouldBeEmptyIgnoreVMWarnings();
|
||||||
} else {
|
} else {
|
||||||
result.shouldNotHaveExitValue(SUCCESS)
|
result.shouldNotHaveExitValue(SUCCESS)
|
||||||
.shouldContain("contains a class with different api from earlier version");
|
.shouldContain("contains a class with different api from earlier version");
|
||||||
|
@ -417,4 +418,3 @@ public class ApiValidatorTest extends MRTestBase {
|
||||||
javac(classes, sourceFiles);
|
javac(classes, sourceFiles);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @test
|
* @test
|
||||||
# @bug 8186087
|
# @bug 8186087 8196748
|
||||||
* @library /test/lib
|
* @library /test/lib
|
||||||
* @modules java.base/jdk.internal.misc
|
* @modules java.base/jdk.internal.misc
|
||||||
* jdk.compiler
|
* jdk.compiler
|
||||||
|
@ -127,7 +127,7 @@ public class Basic extends MRTestBase {
|
||||||
jar("cf", jarfile, "-C", classes.resolve("base").toString(), ".",
|
jar("cf", jarfile, "-C", classes.resolve("base").toString(), ".",
|
||||||
"--release", release, "-C", classes.resolve("v10").toString(), ".")
|
"--release", release, "-C", classes.resolve("v10").toString(), ".")
|
||||||
.shouldHaveExitValue(SUCCESS)
|
.shouldHaveExitValue(SUCCESS)
|
||||||
.shouldBeEmpty();
|
.shouldBeEmptyIgnoreVMWarnings();
|
||||||
}
|
}
|
||||||
// invalid
|
// invalid
|
||||||
for (String release : List.of("9.0", "8", "v9",
|
for (String release : List.of("9.0", "8", "v9",
|
||||||
|
@ -335,7 +335,7 @@ public class Basic extends MRTestBase {
|
||||||
jar("cf", jarfile, "-C", classes.resolve("base").toString(), ".",
|
jar("cf", jarfile, "-C", classes.resolve("base").toString(), ".",
|
||||||
"--release", "9", "-C", classes.resolve("v9").toString(), ".")
|
"--release", "9", "-C", classes.resolve("v9").toString(), ".")
|
||||||
.shouldHaveExitValue(SUCCESS)
|
.shouldHaveExitValue(SUCCESS)
|
||||||
.shouldBeEmpty();
|
.shouldBeEmptyIgnoreVMWarnings();
|
||||||
jar("uf", jarfile,
|
jar("uf", jarfile,
|
||||||
"--release", "10", "-C", classes.resolve("v9").toString(), ".")
|
"--release", "10", "-C", classes.resolve("v9").toString(), ".")
|
||||||
.shouldHaveExitValue(SUCCESS)
|
.shouldHaveExitValue(SUCCESS)
|
||||||
|
@ -417,7 +417,7 @@ public class Basic extends MRTestBase {
|
||||||
"-C", classes.resolve("base").toString(), ".",
|
"-C", classes.resolve("base").toString(), ".",
|
||||||
"--release", "9", "-C", classes.resolve("v9").toString(), ".")
|
"--release", "9", "-C", classes.resolve("v9").toString(), ".")
|
||||||
.shouldNotHaveExitValue(SUCCESS)
|
.shouldNotHaveExitValue(SUCCESS)
|
||||||
.asLines();
|
.asLinesWithoutVMWarnings();
|
||||||
|
|
||||||
/* "META-INF/versions/9/version/Nested$nested.class" is really NOT isolated
|
/* "META-INF/versions/9/version/Nested$nested.class" is really NOT isolated
|
||||||
assertTrue(output.size() == 4);
|
assertTrue(output.size() == 4);
|
||||||
|
@ -516,7 +516,7 @@ public class Basic extends MRTestBase {
|
||||||
"-C", classes.resolve("base").toString(), ".",
|
"-C", classes.resolve("base").toString(), ".",
|
||||||
"--release", "10", "-C", classes.resolve("v10").toString(), ".")
|
"--release", "10", "-C", classes.resolve("v10").toString(), ".")
|
||||||
.shouldHaveExitValue(SUCCESS)
|
.shouldHaveExitValue(SUCCESS)
|
||||||
.shouldBeEmpty();
|
.shouldBeEmptyIgnoreVMWarnings();
|
||||||
|
|
||||||
try (JarFile jf = new JarFile(new File(jarfile), true,
|
try (JarFile jf = new JarFile(new File(jarfile), true,
|
||||||
ZipFile.OPEN_READ, JarFile.runtimeVersion())) {
|
ZipFile.OPEN_READ, JarFile.runtimeVersion())) {
|
||||||
|
|
|
@ -27,6 +27,7 @@ import java.io.IOException;
|
||||||
import java.io.PrintStream;
|
import java.io.PrintStream;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
@ -184,9 +185,9 @@ public final class OutputAnalyzer {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Verify that the stdout and stderr contents of output buffer does not contain the string
|
* Verify that the stdout and stderr contents of output buffer are empty
|
||||||
*
|
*
|
||||||
* @throws RuntimeException If the string was found
|
* @throws RuntimeException If the stdout and stderr are not empty
|
||||||
*/
|
*/
|
||||||
public OutputAnalyzer shouldBeEmpty() {
|
public OutputAnalyzer shouldBeEmpty() {
|
||||||
if (!stdout.isEmpty()) {
|
if (!stdout.isEmpty()) {
|
||||||
|
@ -271,6 +272,7 @@ public final class OutputAnalyzer {
|
||||||
* @throws RuntimeException If the pattern was not found
|
* @throws RuntimeException If the pattern was not found
|
||||||
*/
|
*/
|
||||||
public OutputAnalyzer stderrShouldMatch(String pattern) {
|
public OutputAnalyzer stderrShouldMatch(String pattern) {
|
||||||
|
|
||||||
Matcher matcher = Pattern.compile(pattern, Pattern.MULTILINE).matcher(stderr);
|
Matcher matcher = Pattern.compile(pattern, Pattern.MULTILINE).matcher(stderr);
|
||||||
if (!matcher.find()) {
|
if (!matcher.find()) {
|
||||||
reportDiagnosticSummary();
|
reportDiagnosticSummary();
|
||||||
|
@ -485,4 +487,57 @@ public final class OutputAnalyzer {
|
||||||
private List<String> asLines(String buffer) {
|
private List<String> asLines(String buffer) {
|
||||||
return Arrays.asList(buffer.split("(\\r\\n|\\n|\\r)"));
|
return Arrays.asList(buffer.split("(\\r\\n|\\n|\\r)"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private static final String jvmwarningmsg = ".* VM warning:.*";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Verifies that the stdout and stderr contents of output buffer are empty, after
|
||||||
|
* filtering out the HotSpot warning messages.
|
||||||
|
*
|
||||||
|
* @throws RuntimeException If the stdout and stderr are not empty
|
||||||
|
*/
|
||||||
|
public OutputAnalyzer shouldBeEmptyIgnoreVMWarnings() {
|
||||||
|
if (!stdout.isEmpty()) {
|
||||||
|
reportDiagnosticSummary();
|
||||||
|
throw new RuntimeException("stdout was not empty");
|
||||||
|
}
|
||||||
|
if (!stderr.replaceAll(jvmwarningmsg + "\\R", "").isEmpty()) {
|
||||||
|
reportDiagnosticSummary();
|
||||||
|
throw new RuntimeException("stderr was not empty");
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Verify that the stderr contents of output buffer matches the pattern,
|
||||||
|
* after filtering out the Hotespot warning messages
|
||||||
|
*
|
||||||
|
* @param pattern
|
||||||
|
* @throws RuntimeException If the pattern was not found
|
||||||
|
*/
|
||||||
|
public OutputAnalyzer stderrShouldMatchIgnoreVMWarnings(String pattern) {
|
||||||
|
String stderr = this.stderr.replaceAll(jvmwarningmsg + "\\R", "");
|
||||||
|
Matcher matcher = Pattern.compile(pattern, Pattern.MULTILINE).matcher(stderr);
|
||||||
|
if (!matcher.find()) {
|
||||||
|
reportDiagnosticSummary();
|
||||||
|
throw new RuntimeException("'" + pattern
|
||||||
|
+ "' missing from stderr \n");
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the contents of the output buffer (stdout and stderr), without those
|
||||||
|
* JVM warning msgs, as list of strings. Output is split by newlines.
|
||||||
|
*
|
||||||
|
* @return Contents of the output buffer as list of strings
|
||||||
|
*/
|
||||||
|
public List<String> asLinesWithoutVMWarnings() {
|
||||||
|
return Arrays.asList(getOutput().split("\\R"))
|
||||||
|
.stream()
|
||||||
|
.filter(Pattern.compile(jvmwarningmsg).asPredicate().negate())
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue