This commit is contained in:
Mikael Vidstedt 2019-07-12 02:50:43 -07:00
commit cfcd0223a9
28 changed files with 1882 additions and 849 deletions

View File

@ -571,4 +571,5 @@ b7f68ddec66f996ae3aad03291d129ca9f02482d jdk-13+27
e64383344f144217c36196c3c8a2df8f588a2af3 jdk-14+3
1e95931e7d8fa7e3899340a9c7cb28dbea50c10c jdk-13+28
19d0b382f0869f72d4381b54fa129f1c74b6e766 jdk-14+4
3081f39a3d30d63b112098386ac2bb027c2b7223 jdk-13+29
0f1e29c77e50c7da11d83df410026392c4d1a28c jdk-14+5

View File

@ -138,7 +138,7 @@ ifeq ($(BUILD_CDS_ARCHIVE), true)
-Xmx128M -Xms128M $(LOG_INFO), \
))
JDK_TARGETS += $(gen_cds_archive_jdk)
JRE_TARGETS += $(gen_cds_archive_jre)
endif
################################################################################

View File

@ -85,6 +85,8 @@ h1.title + .subtitle {
margin-top: -1em;
}
a { text-decoration: none }
a:link {
color: #4A6782;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -761,78 +761,87 @@ public abstract class CipherSpi {
+ " bytes of space in output buffer");
}
// detecting input and output buffer overlap may be tricky
// we can only write directly into output buffer when we
// are 100% sure it's safe to do so
boolean a1 = input.hasArray();
boolean a2 = output.hasArray();
int total = 0;
byte[] inArray, outArray;
if (a2) { // output has an accessible byte[]
outArray = output.array();
int outPos = output.position();
int outOfs = output.arrayOffset() + outPos;
if (a1) { // input also has an accessible byte[]
inArray = input.array();
int inOfs = input.arrayOffset() + inPos;
if (a1) { // input has an accessible byte[]
byte[] inArray = input.array();
int inOfs = input.arrayOffset() + inPos;
if (a2) { // output has an accessible byte[]
byte[] outArray = output.array();
int outPos = output.position();
int outOfs = output.arrayOffset() + outPos;
// check array address and offsets and use temp output buffer
// if output offset is larger than input offset and
// falls within the range of input data
boolean useTempOut = false;
if (inArray == outArray &&
((inOfs < outOfs) && (outOfs < inOfs + inLen))) {
useTempOut = true;
outArray = new byte[outLenNeeded];
outOfs = 0;
}
if (isUpdate) {
total = engineUpdate(inArray, inOfs, inLen, outArray, outOfs);
} else {
total = engineDoFinal(inArray, inOfs, inLen, outArray, outOfs);
}
if (useTempOut) {
output.put(outArray, outOfs, total);
} else {
// adjust output position manually
output.position(outPos + total);
}
// adjust input position manually
input.position(inLimit);
} else { // input does not have accessible byte[]
inArray = new byte[getTempArraySize(inLen)];
do {
int chunk = Math.min(inLen, inArray.length);
if (chunk > 0) {
input.get(inArray, 0, chunk);
}
int n;
if (isUpdate || (inLen > chunk)) {
n = engineUpdate(inArray, 0, chunk, outArray, outOfs);
} else {
n = engineDoFinal(inArray, 0, chunk, outArray, outOfs);
}
total += n;
outOfs += n;
inLen -= chunk;
} while (inLen > 0);
}
output.position(outPos + total);
} else { // output does not have an accessible byte[]
if (a1) { // but input has an accessible byte[]
inArray = input.array();
int inOfs = input.arrayOffset() + inPos;
} else { // output does not have an accessible byte[]
byte[] outArray = null;
if (isUpdate) {
outArray = engineUpdate(inArray, inOfs, inLen);
} else {
outArray = engineDoFinal(inArray, inOfs, inLen);
}
input.position(inLimit);
if (outArray != null && outArray.length != 0) {
output.put(outArray);
total = outArray.length;
}
} else { // input also does not have an accessible byte[]
inArray = new byte[getTempArraySize(inLen)];
do {
int chunk = Math.min(inLen, inArray.length);
if (chunk > 0) {
input.get(inArray, 0, chunk);
}
int n;
if (isUpdate || (inLen > chunk)) {
outArray = engineUpdate(inArray, 0, chunk);
} else {
outArray = engineDoFinal(inArray, 0, chunk);
}
if (outArray != null && outArray.length != 0) {
output.put(outArray);
total += outArray.length;
}
inLen -= chunk;
} while (inLen > 0);
// adjust input position manually
input.position(inLimit);
}
} else { // input does not have an accessible byte[]
// have to assume the worst, since we have no way of determine
// if input and output overlaps or not
byte[] tempOut = new byte[outLenNeeded];
int outOfs = 0;
byte[] tempIn = new byte[getTempArraySize(inLen)];
do {
int chunk = Math.min(inLen, tempIn.length);
if (chunk > 0) {
input.get(tempIn, 0, chunk);
}
int n;
if (isUpdate || (inLen > chunk)) {
n = engineUpdate(tempIn, 0, chunk, tempOut, outOfs);
} else {
n = engineDoFinal(tempIn, 0, chunk, tempOut, outOfs);
}
outOfs += n;
total += n;
inLen -= chunk;
} while (inLen > 0);
if (total > 0) {
output.put(tempOut, 0, total);
}
}
return total;
}

View File

@ -104,21 +104,10 @@ public class CurveDB {
if (namedCurve.getCurve().getField().getFieldSize() != fieldSize) {
continue;
}
if (namedCurve.getCurve().equals(params.getCurve()) == false) {
continue;
if (ECUtil.equals(namedCurve, params)) {
// everything matches our named curve, return it
return namedCurve;
}
if (namedCurve.getGenerator().equals(params.getGenerator()) ==
false) {
continue;
}
if (namedCurve.getOrder().equals(params.getOrder()) == false) {
continue;
}
if (namedCurve.getCofactor() != params.getCofactor()) {
continue;
}
// everything matches our named curve, return it
return namedCurve;
}
// no match found
return null;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2006, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2006, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -32,7 +32,7 @@ import java.security.interfaces.*;
import java.security.spec.*;
import java.util.Arrays;
public class ECUtil {
public final class ECUtil {
// Used by SunPKCS11 and SunJSSE.
public static ECPoint decodePoint(byte[] data, EllipticCurve curve)
@ -220,6 +220,21 @@ public class ECUtil {
return nameSpec.getName();
}
public static boolean equals(ECParameterSpec spec1, ECParameterSpec spec2) {
if (spec1 == spec2) {
return true;
}
if (spec1 == null || spec2 == null) {
return false;
}
return (spec1.getCofactor() == spec2.getCofactor() &&
spec1.getOrder().equals(spec2.getOrder()) &&
spec1.getCurve().equals(spec2.getCurve()) &&
spec1.getGenerator().equals(spec2.getGenerator()));
}
// Convert the concatenation R and S in into their DER encoding
public static byte[] encodeSignature(byte[] signature) throws SignatureException {

View File

@ -28,6 +28,7 @@ package sun.security.util;
import java.io.IOException;
import java.security.*;
import java.security.spec.*;
import java.util.Locale;
import sun.security.rsa.RSAUtil;
import jdk.internal.access.SharedSecrets;
@ -74,14 +75,9 @@ public class SignatureUtil {
AlgorithmParameters params)
throws ProviderException {
sigName = checkName(sigName);
sigName = checkName(sigName).toUpperCase(Locale.ENGLISH);
AlgorithmParameterSpec paramSpec = null;
if (params != null) {
if (sigName.toUpperCase().indexOf("RSA") == -1) {
throw new ProviderException
("Unrecognized algorithm for signature parameters " +
sigName);
}
// AlgorithmParameters.getAlgorithm() may returns oid if it's
// created during DER decoding. Convert to use the standard name
// before passing it to RSAUtil
@ -93,7 +89,20 @@ public class SignatureUtil {
throw new ProviderException(e);
}
}
paramSpec = RSAUtil.getParamSpec(params);
if (sigName.indexOf("RSA") != -1) {
paramSpec = RSAUtil.getParamSpec(params);
} else if (sigName.indexOf("ECDSA") != -1) {
try {
paramSpec = params.getParameterSpec(ECParameterSpec.class);
} catch (Exception e) {
throw new ProviderException("Error handling EC parameters", e);
}
} else {
throw new ProviderException
("Unrecognized algorithm for signature parameters " +
sigName);
}
}
return paramSpec;
}
@ -103,17 +112,31 @@ public class SignatureUtil {
public static AlgorithmParameterSpec getParamSpec(String sigName,
byte[] paramBytes)
throws ProviderException {
sigName = checkName(sigName);
sigName = checkName(sigName).toUpperCase(Locale.ENGLISH);
AlgorithmParameterSpec paramSpec = null;
if (paramBytes != null) {
if (sigName.toUpperCase().indexOf("RSA") == -1) {
if (sigName.indexOf("RSA") != -1) {
AlgorithmParameters params =
createAlgorithmParameters(sigName, paramBytes);
paramSpec = RSAUtil.getParamSpec(params);
} else if (sigName.indexOf("ECDSA") != -1) {
try {
Provider p = Signature.getInstance(sigName).getProvider();
paramSpec = ECUtil.getECParameterSpec(p, paramBytes);
} catch (Exception e) {
throw new ProviderException("Error handling EC parameters", e);
}
// ECUtil discards exception and returns null, so we need to check
// the returned value
if (paramSpec == null) {
throw new ProviderException("Error handling EC parameters");
}
} else {
throw new ProviderException
("Unrecognized algorithm for signature parameters " +
sigName);
}
AlgorithmParameters params =
createAlgorithmParameters(sigName, paramBytes);
paramSpec = RSAUtil.getParamSpec(params);
}
return paramSpec;
}

View File

@ -109,7 +109,7 @@ the main class.
.SH DESCRIPTION
.PP
The \f[CB]java\f[R] command starts a Java application.
It does this by starting the Java Runtime Environment (JRE), loading the
It does this by starting the Java Virtual Machine (JVM), loading the
specified class, and calling that class\[aq]s \f[CB]main()\f[R] method.
The method must be declared \f[CB]public\f[R] and \f[CB]static\f[R], it must
not return any value, and it must accept a \f[CB]String\f[R] array as a
@ -566,7 +566,7 @@ marks (for example \f[CB]\-Dfoo="foo\ bar"\f[R]).
.RS
.RE
.TP
.B \f[CB]\-disableassertions\f[R][\f[CB]:\f[R][\f[I]packagename\f[R]]...|\f[CB]:\f[R]\f[I]classname\f[R]] or \f[CB]\-da\\[\f[R]:\f[CB]\\[*packagename*\\]...|\f[R]:`\f[I]classname\f[R]]
.B \f[CB]\-disableassertions\f[R][\f[CB]:\f[R][\f[I]packagename\f[R]]...|\f[CB]:\f[R]\f[I]classname\f[R]] or \f[CB]\-da\f[R][\f[CB]:\f[R][\f[I]packagename\f[R]]...|\f[CB]:\f[R]\f[I]classname\f[R]]
Disables assertions.
By default, assertions are disabled in all packages and classes.
With no arguments, \f[CB]\-disableassertions\f[R] (\f[CB]\-da\f[R]) disables
@ -606,7 +606,7 @@ Disables assertions in all system classes.
.RS
.RE
.TP
.B \f[CB]\-enableassertions\f[R][\f[CB]:\f[R][\f[I]packagename\f[R]]...|\f[CB]:\f[R]\f[I]classname\f[R]] or \f[CB]\-ea\\[\f[R]:\f[CB]\\[*packagename*\\]...|\f[R]:`\f[I]classname\f[R]]
.B \f[CB]\-enableassertions\f[R][\f[CB]:\f[R][\f[I]packagename\f[R]]...|\f[CB]:\f[R]\f[I]classname\f[R]] or \f[CB]\-ea\f[R][\f[CB]:\f[R][\f[I]packagename\f[R]]...|\f[CB]:\f[R]\f[I]classname\f[R]]
Enables assertions.
By default, assertions are disabled in all packages and classes.
With no arguments, \f[CB]\-enableassertions\f[R] (\f[CB]\-ea\f[R]) enables
@ -659,6 +659,7 @@ Prints the help message to the output stream.
.TP
.B \f[CB]\-javaagent:\f[R]\f[I]jarpath\f[R][\f[CB]=\f[R]\f[I]options\f[R]]
Loads the specified Java programming language agent.
See \f[CB]java.lang.instrument\f[R].
.RS
.RE
.TP
@ -718,12 +719,12 @@ Displays information about the modules in use.
.RE
.TP
.B \f[CB]\-\-version\f[R]
Prints product version to the error stream and exits.
Prints product version to the output stream and exits.
.RS
.RE
.TP
.B \f[CB]\-version\f[R]
Prints product version to the output stream and exits.
Prints product version to the error stream and exits.
.RS
.RE
.TP
@ -747,7 +748,7 @@ limitations by enabling the launcher to expand the contents of argument
files after shell expansion, but before argument processing.
Contents in the argument files are expanded because otherwise, they
would be specified on the command line until the
\f[CB]\-Xdisable\-\@files\f[R] option was encountered.
\f[CB]\-\-disable\-\@files\f[R] option was encountered.
.RS
.PP
The argument files can also contain the main class name and all options.
@ -856,7 +857,7 @@ are compiled to native code.
.TP
.B \f[CB]\-Xmn\f[R] \f[I]size\f[R]
Sets the initial and maximum size (in bytes) of the heap for the young
generation (nursery).
generation (nursery) in the generational collectors.
Append the letter \f[CB]k\f[R] or \f[CB]K\f[R] to indicate kilobytes,
\f[CB]m\f[R] or \f[CB]M\f[R] to indicate megabytes, or \f[CB]g\f[R] or
\f[CB]G\f[R] to indicate gigabytes.
@ -866,8 +867,10 @@ If the size for the young generation is too small, then a lot of minor
garbage collections are performed.
If the size is too large, then only full garbage collections are
performed, which can take a long time to complete.
It is recommended that you keep the size for the young generation
greater than 25% and less than 50% of the overall heap size.
It is recommended that you do not set the size for the young generation
for the G1 collector, and keep the size for the young generation greater
than 25% and less than 50% of the overall heap size for other
collectors.
The following examples show how to set the initial and maximum size of
young generation to 256 MB using various units:
.RS
@ -887,7 +890,7 @@ size of the heap for the young generation, you can use
.RE
.TP
.B \f[CB]\-Xms\f[R] \f[I]size\f[R]
Sets the initial size (in bytes) of the heap.
Sets the minimum and initial size (in bytes) of the heap.
This value must be a multiple of 1024 and greater than 1 MB.
Append the letter \f[CB]k\f[R] or \f[CB]K\f[R] to indicate kilobytes,
\f[CB]m\f[R] or \f[CB]M\f[R] to indicate megabytes, \f[CB]g\f[R] or \f[CB]G\f[R]
@ -904,16 +907,18 @@ MB using various units:
\f[R]
.fi
.PP
If you don\[aq]t set this option, then the initial size is set as the
sum of the sizes allocated for the old generation and the young
generation.
Instead of the \f[CB]\-Xms\f[R] option to set both the minimum and initial
size of the heap, you can use \f[CB]\-XX:MinHeapSize\f[R] to set the
minimum size and \f[CB]\-XX:InitialHeapSize\f[R] to set the initial size.
.PP
If you don\[aq]t set this option, the initial size is set as the sum of
the sizes allocated for the old generation and the young generation.
The initial size of the heap for the young generation can be set using
the \f[CB]\-Xmn\f[R] option or the \f[CB]\-XX:NewSize\f[R] option.
.RE
.TP
.B \f[CB]\-Xmx\f[R] \f[I]size\f[R]
Specifies the maximum size (in bytes) of the memory allocation pool in
bytes.
Specifies the maximum size (in bytes) of the heap.
This value must be a multiple of 1024 and greater than 2 MB.
Append the letter \f[CB]k\f[R] or \f[CB]K\f[R] to indicate kilobytes,
\f[CB]m\f[R] or \f[CB]M\f[R] to indicate megabytes, or \f[CB]g\f[R] or
@ -1205,13 +1210,6 @@ or directories.
.RS
.RE
.TP
.B \f[CB]\-\-disable\-\@files\f[R]
Can be used anywhere on the command line, including in an argument file,
to prevent further \f[CB]\@\f[R]\f[I]filename\f[R] expansion.
This option stops expanding \f[CB]\@\f[R]\-argfiles after the option.
.RS
.RE
.TP
.B \f[CB]\-\-source\f[R] \f[I]version\f[R]
Sets the version of the source in source\-file mode.
.RS
@ -1392,32 +1390,13 @@ By default this option is disabled.
.RS
.RE
.TP
.B \f[CB]\-XX:+FlightRecorder\f[R]
Enables the use of Java Flight Recorder (JFR) during the runtime of the
application.
.RS
.RS
.PP
\f[B]Note:\f[R] The \f[CB]\-XX:+FlightRecorder\f[R] option is no longer
required to use JFR.
This was a change made in JDK 8u40.
.RE
.RE
.TP
.B \f[CB]\-XX:FlightRecorderOptions=\f[R]\f[I]parameter\f[R]\f[CB]=\f[R]\f[I]value\f[R]
.B \f[CB]\-XX:FlightRecorderOptions=\f[R]\f[I]parameter\f[R]\f[CB]=\f[R]\f[I]value\f[R] (or)\f[CB]\-XX:FlightRecorderOptions:\f[R]\f[I]parameter\f[R]\f[CB]=\f[R]\f[I]value\f[R]
Sets the parameters that control the behavior of JFR.
.RS
.PP
The following list contains the available JFR
\f[I]parameter\f[R]\f[CB]=\f[R]\f[I]value\f[R] entries:
.TP
.B \f[CB]allow_threadbuffers_to_disk=\f[R]{\f[CB]true\f[R]|\f[CB]false\f[R]}
Specifies whether thread buffers are written directly to disk if the
buffer thread is blocked.
By default, this parameter is disabled.
.RS
.RE
.TP
.B \f[CB]globalbuffersize=\f[R]\f[I]size\f[R]
Specifies the total amount of primary memory used for data retention.
The default value is based on the value specified for
@ -1492,7 +1471,8 @@ performance.
.TP
.B \f[CB]threadbuffersize=\f[R]\f[I]size\f[R]
Specifies the per\-thread local buffer size (in bytes).
By default, the local buffer size is set to 8 kilobytes.
By default, the local buffer size is set to 8 kilobytes, with a minimum
value of 4 kilobytes.
Overriding this parameter could reduce performance and is not
recommended.
.RS
@ -2978,19 +2958,17 @@ Enables Java heap optimization.
This sets various parameters to be optimal for long\-running jobs with
intensive memory allocation, based on the configuration of the computer
(RAM and CPU).
By default, the option is disabled and the heap isn't optimized.
By default, the option is disabled and the heap sizes are configured
less aggressively.
.RS
.RE
.TP
.B \f[CB]\-XX:+AlwaysPreTouch\f[R]
Enables touching of every page on the Java heap during JVM
initialization.
This gets all pages into memory before entering the \f[CB]main()\f[R]
method.
The option can be used in testing to simulate a long\-running system
with all virtual memory mapped to physical memory.
By default, this option is disabled and all pages are committed as JVM
heap space fills.
Requests the VM to touch every page on the Java heap after requesting it
from the operating system and before handing memory out to the
application.
By default, this option is disabled and all pages are committed as the
application uses the heap space.
.RS
.RE
.TP
@ -3026,12 +3004,10 @@ initiating occupancy fraction.
.RS
.PP
The following example shows how to set the factor to 20%:
.IP
.nf
\f[CB]
>\ \ \ `\-XX:CMSInitiatingOccupancyFraction=20`
\f[R]
.fi
.RS
.PP
\f[CB]\-XX:CMSInitiatingOccupancyFraction=20\f[R]
.RE
.RE
.TP
.B \f[CB]\-XX:CMSIncrementalDutySafetyFactor=\f[R]\f[I]percent\f[R]
@ -3095,11 +3071,14 @@ deprecated \f[CB]\-XX:+UseConcMarkSweepGC\f[R] option and the
.RS
.RE
.TP
.B \f[CB]\-XX:+ExplicitGCInvokesConcurrentAndUnloadsClasses\f[R]
Enables invoking of concurrent GC by using the \f[CB]System.gc()\f[R]
request and unloading of classes during the concurrent GC cycle.
This option is disabled by default and can be enabled only with the
deprecated \f[CB]\-XX:+UseConcMarkSweepGC\f[R] option.
.B \f[CB]\-XX:G1AdaptiveIHOPNumInitialSamples=\f[R]\f[I]number\f[R]
When \f[CB]\-XX:UseAdaptiveIHOP\f[R] is enabled, this option sets the
number of completed marking cycles used to gather samples until G1
adaptively determines the optimum value of
\f[CB]\-XX:InitiatingHeapOccupancyPercent\f[R].
Before, G1 uses the value of
\f[CB]\-XX:InitiatingHeapOccupancyPercent\f[R] directly for this purpose.
The default value is 3.
.RS
.RE
.TP
@ -3107,10 +3086,8 @@ deprecated \f[CB]\-XX:+UseConcMarkSweepGC\f[R] option.
Sets the size of the regions into which the Java heap is subdivided when
using the garbage\-first (G1) collector.
The value is a power of 2 and can range from 1 MB to 32 MB.
The goal is to have around 2048 regions based on the minimum Java heap
size.
The default region size is determined ergonomically based on the heap
size.
size with a goal of approximately 2048 regions.
.RS
.PP
The following example sets the size of the subdivisions to 16 MB:
@ -3137,8 +3114,6 @@ The default value is 60 percent of your Java heap.
.PP
This is an experimental flag.
This setting replaces the \f[CB]\-XX:DefaultMaxNewGenPercent\f[R] setting.
.PP
This setting isn\[aq]t available in Java HotSpot VM build 23 or earlier.
.RE
.TP
.B \f[CB]\-XX:G1MixedGCCountTarget=\f[R]\f[I]number\f[R]
@ -3148,8 +3123,6 @@ cycle to collect old regions with at most
The default is 8 mixed garbage collections.
The goal for mixed collections is to be within this target number.
.RS
.PP
This setting isn\[aq]t available in Java HotSpot VM build 23 or earlier.
.RE
.TP
.B \f[CB]\-XX:G1MixedGCLiveThresholdPercent=\f[R]\f[I]percent\f[R]
@ -3161,8 +3134,6 @@ The default occupancy is 85 percent.
This is an experimental flag.
This setting replaces the
\f[CB]\-XX:G1OldCSetRegionLiveThresholdPercent\f[R] setting.
.PP
This setting isn\[aq]t available in Java HotSpot VM build 23 or earlier.
.RE
.TP
.B \f[CB]\-XX:G1NewSizePercent=\f[R]\f[I]percent\f[R]
@ -3173,8 +3144,6 @@ The default value is 5 percent of your Java heap.
.PP
This is an experimental flag.
This setting replaces the \f[CB]\-XX:DefaultMinNewGenPercent\f[R] setting.
.PP
This setting isn\[aq]t available in Java HotSpot VM build 23 or earlier.
.RE
.TP
.B \f[CB]\-XX:G1OldCSetRegionThresholdPercent=\f[R]\f[I]percent\f[R]
@ -3182,8 +3151,6 @@ Sets an upper limit on the number of old regions to be collected during
a mixed garbage collection cycle.
The default is 10 percent of the Java heap.
.RS
.PP
This setting isn\[aq]t available in Java HotSpot VM build 23 or earlier.
.RE
.TP
.B \f[CB]\-XX:G1ReservePercent=\f[R]\f[I]percent\f[R]
@ -3202,10 +3169,20 @@ The following example sets the reserved heap to 20%:
.RE
.RE
.TP
.B \f[CB]\-XX:InitialHeapOccupancyPercent=\f[R]\f[I]percent\f[R]
Sets the Java heap occupancy threshold that triggers a marking cycle.
The default occupancy is 45 percent of the entire Java heap.
.B \f[CB]\-XX:+G1UseAdaptiveIHOP\f[R]
Controls adaptive calculation of the old generation occupancy to start
background work preparing for an old generation collection.
If enabled, G1 uses \f[CB]\-XX:InitiatingHeapOccupancyPercent\f[R] for the
first few times as specified by the value of
\f[CB]\-XX:G1AdaptiveIHOPNumInitialSamples\f[R], and after that adaptively
calculates a new optimum value for the initiating occupancy
automatically.
Otherwise, the old generation collection process always starts at the
old generation occupancy determined by
\f[CB]\-XX:InitiatingHeapOccupancyPercent\f[R].
.RS
.PP
The default is enabled.
.RE
.TP
.B \f[CB]\-XX:InitialHeapSize=\f[R]\f[I]size\f[R]
@ -3276,15 +3253,18 @@ to 4:
.RE
.TP
.B \f[CB]\-XX:InitiatingHeapOccupancyPercent=\f[R]\f[I]percent\f[R]
Sets the percentage of the heap occupancy (0 to 100) at which to start a
concurrent GC cycle.
It\[aq]s used by garbage collectors that trigger a concurrent GC cycle
based on the occupancy of the entire heap, not just one of the
generations (for example, the G1 garbage collector).
Sets the percentage of the old generation occupancy (0 to 100) at which
to start the first few concurrent marking cycles for the G1 garbage
collector.
.RS
.PP
By default, the initiating value is set to 45%.
A value of 0 implies nonstop GC cycles.
A value of 0 implies nonstop concurrent GC cycles from the beginning
until G1 adaptively sets this value.
.PP
See also the \f[CB]\-XX:G1UseAdaptiveIHOP\f[R] and
\f[CB]\-XX:G1AdaptiveIHOPNumInitialSamples\f[R] options.
.PP
The following example shows how to set the initiating heap occupancy to
75%:
.RS
@ -3298,7 +3278,9 @@ Sets a target for the maximum GC pause time (in milliseconds).
This is a soft goal, and the JVM will make its best effort to achieve
it.
The specified value doesn\[aq]t adapt to your heap size.
By default, there\[aq]s no maximum pause time value.
By default, for G1 the maximum pause time target is 200 milliseconds.
The other generational collectors do not use a pause time goal by
default.
.RS
.PP
The following example shows how to set the maximum target pause time to
@ -3332,13 +3314,6 @@ allocated memory to 80 MB using various units:
\f[R]
.fi
.PP
On Oracle Solaris 7 and Oracle Solaris 8 SPARC platforms, the upper
limit for this value is approximately 4,000 MB minus overhead amounts.
On Oracle Solaris 2.6 and x86 platforms, the upper limit is
approximately 2,000 MB minus overhead amounts.
On Linux platforms, the upper limit is approximately 2,000 MB minus
overhead amounts.
.PP
The \f[CB]\-XX:MaxHeapSize\f[R] option is equivalent to \f[CB]\-Xmx\f[R].
.RE
.TP
@ -3450,6 +3425,32 @@ option to keep the Java heap small by reducing the dynamic footprint for
embedded applications.
.RE
.TP
.B \f[CB]\-XX:MinHeapSize=\f[R]\f[I]size\f[R]
Sets the minimum size (in bytes) of the memory allocation pool.
This value must be either 0, or a multiple of 1024 and greater than 1
MB.
Append the letter \f[CB]k\f[R] or \f[CB]K\f[R] to indicate kilobytes,
\f[CB]m\f[R] or \f[CB]M\f[R] to indicate megabytes, or \f[CB]g\f[R] or
\f[CB]G\f[R] to indicate gigabytes.
The default value is selected at run time based on the system
configuration.
.RS
.PP
The following examples show how to set the mimimum size of allocated
memory to 6 MB using various units:
.IP
.nf
\f[CB]
\-XX:MinHeapSize=6291456
\-XX:MinHeapSize=6144k
\-XX:MinHeapSize=6m
\f[R]
.fi
.PP
If you set this option to 0, then the minimum size is set to the same
value as the initial size.
.RE
.TP
.B \f[CB]\-XX:NewRatio=\f[R]\f[I]ratio\f[R]
Sets the ratio between young and old generation sizes.
By default, this option is set to 2.
@ -3493,23 +3494,13 @@ The \f[CB]\-XX:NewSize\f[R] option is equivalent to \f[CB]\-Xmn\f[R].
.RE
.TP
.B \f[CB]\-XX:ParallelGCThreads=\f[R]\f[I]threads\f[R]
Sets the value of the stop\-the\-world (STW) worker threads.
This option sets the value of \f[I]threads\f[R] to the number of logical
processors.
The value of \f[I]threads\f[R] is the same as the number of logical
processors up to a value of 8.
Sets the number of the stop\-the\-world (STW) worker threads.
The default value depends on the number of CPUs available to the JVM and
the garbage collector selected.
.RS
.PP
If there are more than 8 logical processors, then this option sets the
value of \f[I]threads\f[R] to approximately 5/8 of the logical
processors.
This works in most cases except for larger SPARC systems where the value
of \f[I]threads\f[R] can be approximately 5/16 of the logical processors.
.PP
The default value depends on the number of CPUs available to the JVM.
.PP
For example, to set the number of threads for parallel GC to 2, specify
the following option:
For example, to set the number of threads for G1 GC to 2, specify the
following option:
.RS
.PP
\f[CB]\-XX:ParallelGCThreads=2\f[R]
@ -3749,6 +3740,22 @@ This option is enabled by default.
To disable the use of TLABs, specify the option \f[CB]\-XX:\-UseTLAB\f[R].
.RS
.RE
.TP
.B \f[CB]\-XX:+UseZGC\f[R]
Enables the use of the Z garbage collector.
This garbage collector is best for providing lowest latency with large
Java heaps at some throughput cost.
This is an experimental garbage collector, you need to specify
\f[CB]\-XX:+UnlockExperimentalVMOptions\f[R] before \f[CB]\-XX:+UseZGC\f[R]
on the command line.
.RS
.PP
Example:
.RS
.PP
\f[CB]\-XX:+UnlockExperimentalVMOptions\ \-XX:+UseZGC\f[R]
.RE
.RE
.SH DEPRECATED JAVA OPTIONS
.PP
These \f[CB]java\f[R] options are deprecated and might be removed in a
@ -3788,6 +3795,13 @@ You can enable it only for classes with older versions of the bytecode.
.RS
.RE
.TP
.B \f[CB]\-XX:+FlightRecorder\f[R]
Enables the use of Java Flight Recorder (JFR) during the runtime of the
application.
Since JDK 8u40 this option has not been required to use JFR.
.RS
.RE
.TP
.B \f[CB]\-XX:+TraceClassLoading\f[R]
Enables tracing of classes as they are loaded.
By default, this option is disabled and classes aren\[aq]t traced.
@ -3926,8 +3940,8 @@ sign (\f[CB]\@\f[R]), it expands the contents of that file into an
argument list just as they would be specified on the command line.
.PP
The \f[CB]java\f[R] launcher expands the argument file contents until it
encounters the \f[CB]\-Xdisable\-\@files\f[R] option.
You can use the \f[CB]\-Xdisable\-\@files\f[R] option anywhere on the
encounters the \f[CB]\-\-disable\-\@files\f[R] option.
You can use the \f[CB]\-\-disable\-\@files\f[R] option anywhere on the
command line, including in an argument file, to stop \f[CB]\@\f[R]
argument files expansion.
.PP
@ -5603,7 +5617,7 @@ Use the following commands and advanced options to achieve lower
response times for your application:
.RS
.PP
\f[CB]java\ \-XX:+UseG1GC\ \-Xms26g\ Xmx26g\ \-XX:MaxGCPauseMillis=500\f[R]
\f[CB]java\ \-XX:+UseG1GC\ \-XX:MaxGCPauseMillis=100\f[R]
.RE
.SS Keeping the Java Heap Small and Reducing the Dynamic Footprint of
Embedded Applications

View File

@ -479,8 +479,7 @@ GtkApi* gtk3_load(JNIEnv *env, const char* lib_name)
fp_gtk_fixed_new = dl_symbol("gtk_fixed_new");
fp_gtk_handle_box_new = dl_symbol("gtk_handle_box_new");
fp_gtk_image_new = dl_symbol("gtk_image_new");
fp_gtk_hpaned_new = dl_symbol("gtk_hpaned_new");
fp_gtk_vpaned_new = dl_symbol("gtk_vpaned_new");
fp_gtk_paned_new = dl_symbol("gtk_paned_new");
fp_gtk_scale_new = dl_symbol("gtk_scale_new");
fp_gtk_hscrollbar_new = dl_symbol("gtk_hscrollbar_new");
fp_gtk_vscrollbar_new = dl_symbol("gtk_vscrollbar_new");
@ -1083,7 +1082,7 @@ static GtkWidget *gtk3_get_widget(WidgetType widget_type)
case SPLIT_PANE:
if (init_result = (NULL == gtk3_widgets[_GTK_HPANED_TYPE]))
{
gtk3_widgets[_GTK_HPANED_TYPE] = (*fp_gtk_hpaned_new)();
gtk3_widgets[_GTK_HPANED_TYPE] = (*fp_gtk_paned_new)(GTK_ORIENTATION_HORIZONTAL);
}
result = gtk3_widgets[_GTK_HPANED_TYPE];
break;
@ -1316,7 +1315,7 @@ static GtkWidget *gtk3_get_widget(WidgetType widget_type)
case VSPLIT_PANE_DIVIDER:
if (init_result = (NULL == gtk3_widgets[_GTK_VPANED_TYPE]))
{
gtk3_widgets[_GTK_VPANED_TYPE] = (*fp_gtk_vpaned_new)();
gtk3_widgets[_GTK_VPANED_TYPE] = (*fp_gtk_paned_new)(GTK_ORIENTATION_VERTICAL);
}
result = gtk3_widgets[_GTK_VPANED_TYPE];
break;
@ -1436,6 +1435,10 @@ static GtkStyleContext* get_style(WidgetType widget_type, const gchar *detail)
} else if (strcmp(detail, "option") == 0) {
path = createWidgetPath (NULL);
append_element(path, "radio");
} else if (strcmp(detail, "paned") == 0) {
path = createWidgetPath (fp_gtk_style_context_get_path (widget_context));
append_element(path, "paned");
append_element(path, "separator");
} else {
path = createWidgetPath (fp_gtk_style_context_get_path (widget_context));
append_element(path, detail);
@ -1834,22 +1837,30 @@ static void gtk3_paint_handle(WidgetType widget_type, GtkStateType state_type,
{
gtk3_widget = gtk3_get_widget(widget_type);
GtkStyleContext* context = fp_gtk_widget_get_style_context (gtk3_widget);
fp_gtk_style_context_save (context);
GtkStyleContext* context = get_style(widget_type, detail);
GtkStateFlags flags = get_gtk_flags(state_type);
fp_gtk_style_context_set_state(context, GTK_STATE_FLAG_PRELIGHT);
if (detail != 0) {
if (detail != 0 && !(strcmp(detail, "paned") == 0)) {
transform_detail_string(detail, context);
fp_gtk_style_context_add_class (context, "handlebox_bin");
}
fp_gtk_render_handle(context, cr, x, y, width, height);
fp_gtk_render_background(context, cr, x, y, width, height);
if (!(strcmp(detail, "paned") == 0)) {
fp_gtk_render_handle(context, cr, x, y, width, height);
fp_gtk_render_background(context, cr, x, y, width, height);
} else {
if (orientation == GTK_ORIENTATION_VERTICAL) {
fp_gtk_render_handle(context, cr, x+width/2, y, 2, height);
fp_gtk_render_background(context, cr, x+width/2, y, 2, height);
} else {
fp_gtk_render_handle(context, cr, x, y+height/2, width, 2);
fp_gtk_render_background(context, cr, x, y+height/2, width, 2);
}
}
fp_gtk_style_context_restore (context);
disposeOrRestoreContext(context);
}
static void gtk3_paint_hline(WidgetType widget_type, GtkStateType state_type,

View File

@ -163,6 +163,7 @@ typedef void GtkRange;
typedef void GtkProgressBar;
typedef void GtkProgress;
typedef void GtkWidgetPath;
typedef void GtkPaned;
/* Some real structures */
typedef struct
@ -503,8 +504,7 @@ static GtkWidget* (*fp_gtk_combo_box_entry_new)();
static GtkWidget* (*fp_gtk_entry_new)();
static GtkWidget* (*fp_gtk_fixed_new)();
static GtkWidget* (*fp_gtk_handle_box_new)();
static GtkWidget* (*fp_gtk_hpaned_new)();
static GtkWidget* (*fp_gtk_vpaned_new)();
static GtkWidget* (*fp_gtk_paned_new)(GtkOrientation orientation);
static GtkWidget* (*fp_gtk_scale_new)(GtkOrientation orientation,
GtkAdjustment* adjustment);
static GtkWidget* (*fp_gtk_hscrollbar_new)(GtkAdjustment* adjustment);

File diff suppressed because it is too large Load Diff

View File

@ -72,6 +72,9 @@ abstract class ECDSASignature extends SignatureSpi {
// public key, if initialized for verifying
private ECPublicKey publicKey;
// signature parameters
private ECParameterSpec sigParams = null;
// The format. true for the IEEE P1363 format. false (default) for ASN.1
private final boolean p1363Format;
@ -279,10 +282,14 @@ abstract class ECDSASignature extends SignatureSpi {
@Override
protected void engineInitVerify(PublicKey publicKey)
throws InvalidKeyException {
this.publicKey = (ECPublicKey) ECKeyFactory.toECKey(publicKey);
ECPublicKey key = (ECPublicKey) ECKeyFactory.toECKey(publicKey);
if (!isCompatible(this.sigParams, key.getParams())) {
throw new InvalidKeyException("Key params does not match signature params");
}
// Should check that the supplied key is appropriate for signature
// algorithm (e.g. P-256 for SHA256withECDSA)
this.publicKey = key;
this.privateKey = null;
resetDigest();
}
@ -298,10 +305,14 @@ abstract class ECDSASignature extends SignatureSpi {
@Override
protected void engineInitSign(PrivateKey privateKey, SecureRandom random)
throws InvalidKeyException {
this.privateKey = (ECPrivateKey) ECKeyFactory.toECKey(privateKey);
ECPrivateKey key = (ECPrivateKey) ECKeyFactory.toECKey(privateKey);
if (!isCompatible(this.sigParams, key.getParams())) {
throw new InvalidKeyException("Key params does not match signature params");
}
// Should check that the supplied key is appropriate for signature
// algorithm (e.g. P-256 for SHA256withECDSA)
this.privateKey = key;
this.publicKey = null;
this.random = random;
resetDigest();
@ -354,6 +365,16 @@ abstract class ECDSASignature extends SignatureSpi {
needsReset = true;
}
private static boolean isCompatible(ECParameterSpec sigParams,
ECParameterSpec keyParams) {
if (sigParams == null) {
// no restriction on key param
return true;
}
return ECUtil.equals(sigParams, keyParams);
}
private byte[] signDigestImpl(ECDSAOperations ops, int seedBits,
byte[] digest, ECPrivateKeyImpl privImpl, SecureRandom random)
throws SignatureException {
@ -495,9 +516,16 @@ abstract class ECDSASignature extends SignatureSpi {
@Override
protected void engineSetParameter(AlgorithmParameterSpec params)
throws InvalidAlgorithmParameterException {
if (params != null) {
if (params != null && !(params instanceof ECParameterSpec)) {
throw new InvalidAlgorithmParameterException("No parameter accepted");
}
ECKey key = (this.privateKey == null? this.publicKey : this.privateKey);
if ((key != null) && !isCompatible((ECParameterSpec)params, key.getParams())) {
throw new InvalidAlgorithmParameterException
("Signature params does not match key params");
}
sigParams = (ECParameterSpec) params;
}
// get parameter, not supported. See JCA doc
@ -510,7 +538,17 @@ abstract class ECDSASignature extends SignatureSpi {
@Override
protected AlgorithmParameters engineGetParameters() {
return null;
if (sigParams == null) {
return null;
}
try {
AlgorithmParameters ap = AlgorithmParameters.getInstance("EC");
ap.init(sigParams);
return ap;
} catch (Exception e) {
// should never happen
throw new ProviderException("Error retrieving EC parameters", e);
}
}
/**

View File

@ -447,13 +447,13 @@ corresponding \f[CB]javac\f[R] options.
See \f[I]Extra Options\f[R] in \f[B]javac\f[R] for the detailed
descriptions of using these options:
.IP \[bu] 2
\f[CB]\-add\-exports\f[R]
\f[CB]\-\-add\-exports\f[R]
.IP \[bu] 2
\f[CB]\-\-add\-reads\f[R]
.IP \[bu] 2
\f[CB]\-\-patch\-module\f[R]
.IP \[bu] 2
\f[CB]\-\-Xmaxerrs\f[R]
\f[CB]\-Xmaxerrs\f[R]
.IP \[bu] 2
\f[CB]\-Xmaxwarns\f[R]
.PP

View File

@ -131,8 +131,8 @@ Prints internal type signatures.
.RE
.TP
.B \f[CB]\-sysinfo\f[R]
Shows system information (path, size, date, MD5 hash) of the class being
processed.
Shows system information (path, size, date, SHA\-256 hash) of the class
being processed.
.RS
.RE
.TP
@ -169,6 +169,11 @@ Overrides the location of bootstrap class files.
.RS
.RE
.TP
.B \f[CB]\-\-multi\-release\f[R] \f[I]version\f[R]
Specifies the version to select in multi\-release JAR files.
.RS
.RE
.TP
.B \f[CB]\-J\f[R]\f[I]option\f[R]
Passes the specified option to the JVM.
For example:

View File

@ -63,6 +63,11 @@ The command can generate the dependencies in DOT language (see the
\f[CB]\-dotoutput\f[R] option).
.SH POSSIBLE OPTIONS
.TP
.B \f[CB]\-?\f[R] or \f[CB]\-h\f[R] or \f[CB]\-\-help\f[R]
Prints the help message.
.RS
.RE
.TP
.B \f[CB]\-dotoutput\f[R] \f[I]dir\f[R] or \f[CB]\-\-dot\-output\f[R] \f[I]dir\f[R]
Specifies the destination directory for DOT file output.
If this option is specified, then the \f[CB]jdeps\f[R]command generates
@ -296,7 +301,7 @@ Shows the profile containing a package.
.RS
.RE
.TP
.B \f[CB]\-R\f[R] or \f[CB]\-recursive\f[R]
.B \f[CB]\-R\f[R] or \f[CB]\-\-recursive\f[R]
Recursively traverses all run\-time dependences.
The \f[CB]\-R\f[R] option implies \f[CB]\-filter:none\f[R].
If \f[CB]\-p\f[R], \f[CB]\-e\f[R], or \f[CB]\-f\f[R] options are specified,
@ -309,7 +314,7 @@ Do not recursively traverse dependences.
.RS
.RE
.TP
.B \f[CB]\-I\f[R] or \f[CB]\-inverse\f[R]
.B \f[CB]\-I\f[R] or \f[CB]\-\-inverse\f[R]
Analyzes the dependences per other given options and then finds all
artifacts that directly and indirectly depend on the matching nodes.
This is equivalent to the inverse of the compile\-time view analysis and

View File

@ -379,9 +379,7 @@ jlink\ \-\-add\-modules\ java.naming,jdk.crypto.cryptoki\ \-\-output\ mybuild
The following command is similar to the one that creates a runtime image
named \f[CB]greetingsapp\f[R], except that it will link the modules
resolved from root modules with service binding; see the
\f[B]\f[BC]Configuration.resolveAndBind\f[B]\f[R]
[https://docs.oracle.com/javase/10/docs/api/java/lang/module/Configuration.html#resolveAndBind\-java.lang.module.ModuleFinder\-java.util.List\-java.lang.module.ModuleFinder\-java.util.Collection\-]
method.
\f[B]\f[BC]Configuration.resolveAndBind\f[B]\f[R] method.
.IP
.nf
\f[CB]

View File

@ -148,13 +148,10 @@ element using one the following forms:
.IP \[bu] 2
\f[CB]regex:\f[R]\f[I]regex\-pattern\f[R]
.PP
See the \f[B]\f[BC]FileSystem.getPathMatcher\f[B]\f[R]
[https://docs.oracle.com/javase/10/docs/api/java/nio/file/FileSystem.html#getPathMatcher\-java.lang.String\-]
method for the syntax of \f[I]glob\-pattern\f[R].
See the \f[B]\f[BC]Pattern\f[B]\f[R]
[https://docs.oracle.com/javase/10/docs/api/java/util/regex/Pattern.html]
class for the syntax of \f[I]regex\-pattern\f[R], which represents a
regular expression.
See the \f[B]\f[BC]FileSystem.getPathMatcher\f[B]\f[R] method for the
syntax of \f[I]glob\-pattern\f[R].
See the \f[B]\f[BC]Pattern\f[B]\f[R] class for the syntax of
\f[I]regex\-pattern\f[R], which represents a regular expression.
.RE
.TP
.B \f[CB]\-\-hash\-modules\f[R] \f[I]regex\-pattern\f[R]

View File

@ -46,12 +46,12 @@ Class names that include their packages, for example,
.RE
.SH DESCRIPTION
.PP
\f[B]Deprecation Note:\f[R] The \f[CB]rmic\f[R] tool has been deprecated and
is subject to removal in a future release. Support for static
generation of Java Remote Method Protocol (JRMP) stubs and skeletons
has been deprecated. Applications should use dynamically generated
JRMP stubs, eliminating the need to use the \f[CB]rmic\f[R] tool for
JRMP-based applications.
\f[B]Deprecation Note:\f[R] The rmic tool has been deprecated and is
subject to removal in a future release.
Support for static generation of Java Remote Method Protocol (JRMP)
stubs and skeletons has been deprecated.
Applications should use dynamically generated JRMP stubs, eliminating
the need to use the rmic tool for JRMP\-based applications.
.PP
The \f[CB]rmic\f[R] compiler generates stub and skeleton class files using
the JRMP.

View File

@ -76,13 +76,10 @@ class Bignum {
// grow. There are no checks if the stack-allocated space is sufficient.
static final int kBigitCapacity = kMaxSignificantBits / kBigitSize;
private final int[] bigits_ = new int[kBigitCapacity];
// A vector backed by bigits_buffer_. This way accesses to the array are
// checked for out-of-bounds errors.
// Vector<int> bigits_;
private int used_digits_;
// The Bignum's value equals value(bigits_) * 2^(exponent_ * kBigitSize).
private int exponent_;
private final int[] bigits_ = new int[kBigitCapacity];
Bignum() {}
@ -124,7 +121,9 @@ class Bignum {
void assignUInt16(final char value) {
assert (kBigitSize >= 16);
zero();
if (value == 0) return;
if (value == 0) {
return;
}
ensureCapacity(1);
bigits_[0] = value;
@ -136,7 +135,9 @@ class Bignum {
final int kUInt64Size = 64;
zero();
if (value == 0) return;
if (value == 0) {
return;
}
final int needed_bigits = kUInt64Size / kBigitSize + 1;
ensureCapacity(needed_bigits);
@ -521,26 +522,27 @@ class Bignum {
mask >>>= 2;
long this_value = base;
boolean delayed_multipliciation = false;
boolean delayed_multiplication = false;
final long max_32bits = 0xFFFFFFFFL;
while (mask != 0 && this_value <= max_32bits) {
this_value = this_value * this_value;
// Verify that there is enough space in this_value to perform the
// multiplication. The first bit_size bits must be 0.
if ((power_exponent & mask) != 0) {
assert bit_size > 0;
final long base_bits_mask =
~((1L << (64 - bit_size)) - 1);
final boolean high_bits_zero = (this_value & base_bits_mask) == 0;
if (high_bits_zero) {
this_value *= base;
} else {
delayed_multipliciation = true;
delayed_multiplication = true;
}
}
mask >>>= 1;
}
assignUInt64(this_value);
if (delayed_multipliciation) {
if (delayed_multiplication) {
multiplyByUInt32(base);
}
@ -681,7 +683,7 @@ class Bignum {
}
int bigitAt(final int index) {
int bigitOrZero(final int index) {
if (index >= bigitLength()) return 0;
if (index < exponent_) return 0;
return bigits_[index - exponent_];
@ -696,8 +698,8 @@ class Bignum {
if (bigit_length_a < bigit_length_b) return -1;
if (bigit_length_a > bigit_length_b) return +1;
for (int i = bigit_length_a - 1; i >= Math.min(a.exponent_, b.exponent_); --i) {
final int bigit_a = a.bigitAt(i);
final int bigit_b = b.bigitAt(i);
final int bigit_a = a.bigitOrZero(i);
final int bigit_b = b.bigitOrZero(i);
if (bigit_a < bigit_b) return -1;
if (bigit_a > bigit_b) return +1;
// Otherwise they are equal up to this digit. Try the next digit.
@ -726,9 +728,9 @@ class Bignum {
// Starting at min_exponent all digits are == 0. So no need to compare them.
final int min_exponent = Math.min(Math.min(a.exponent_, b.exponent_), c.exponent_);
for (int i = c.bigitLength() - 1; i >= min_exponent; --i) {
final int int_a = a.bigitAt(i);
final int int_b = b.bigitAt(i);
final int int_c = c.bigitAt(i);
final int int_a = a.bigitOrZero(i);
final int int_b = b.bigitOrZero(i);
final int int_c = c.bigitOrZero(i);
final int sum = int_a + int_b;
if (sum > int_c + borrow) {
return +1;

View File

@ -286,7 +286,8 @@ class FixedDtoa {
fractionals -= (long) (digit) << point;
}
// If the first bit after the point is set we have to round up.
if (((fractionals >>> (point - 1)) & 1) == 1) {
assert (fractionals == 0 || point - 1 >= 0);
if ((fractionals != 0) && ((fractionals >>> (point - 1)) & 1) == 1) {
roundUp(buffer);
}
} else { // We need 128 bits.

View File

@ -115,7 +115,7 @@ class IeeeDouble {
}
static double previousDouble(final long d64) {
if (d64 == (kInfinity | kSignMask)) return -longToDouble(kInfinity);
if (d64 == (kInfinity | kSignMask)) return -Infinity();
if (sign(d64) < 0) {
return longToDouble(d64 + 1);
} else {

View File

@ -26,6 +26,7 @@ package nsk.share.gc.gp;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.lang.invoke.*;
import java.util.*;
import nsk.share.gc.gp.array.*;
import nsk.share.gc.gp.string.*;
@ -194,6 +195,36 @@ public final class GarbageUtils {
return eatMemory(stresser, gp, initialFactor, minMemoryChunk, factor, OOM_TYPE.ANY);
}
static int numberOfOOMEs = 0;
/**
* Minimal wrapper of the main implementation. Catches any OOM
* that might be thrown when rematerializing Objects when deoptimizing.
*
* It is Important that the impl is not inlined.
*/
public static int eatMemory(ExecutionController stresser, GarbageProducer gp, long initialFactor, long minMemoryChunk, long factor, OOM_TYPE type) {
try {
// Using a methodhandle invoke of eatMemoryImpl to prevent inlining of it
MethodHandles.Lookup lookup = MethodHandles.lookup();
MethodType mt = MethodType.methodType(
int.class,
ExecutionController.class,
GarbageProducer.class,
long.class,
long.class,
long.class,
OOM_TYPE.class);
MethodHandle eat = lookup.findStatic(GarbageUtils.class, "eatMemoryImpl", mt);
return (int) eat.invoke(stresser, gp, initialFactor, minMemoryChunk, factor, type);
} catch (OutOfMemoryError e) {
return numberOfOOMEs++;
} catch (Throwable t) {
throw new RuntimeException(t);
}
}
/**
* Eat memory using given garbage producer.
*
@ -211,8 +242,9 @@ public final class GarbageUtils {
* @param type of OutOfMemory Exception: Java heap space or Metadata space
* @return number of OOME occured
*/
public static int eatMemory(ExecutionController stresser, GarbageProducer gp, long initialFactor, long minMemoryChunk, long factor, OOM_TYPE type) {
int numberOfOOMEs = 0;
public static int eatMemoryImpl(ExecutionController stresser, GarbageProducer gp, long initialFactor, long minMemoryChunk, long factor, OOM_TYPE type) {
numberOfOOMEs = 0;
try {
byte[] someMemory = new byte[200000]; //200 Kb
try {

View File

@ -0,0 +1,191 @@
/*
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* 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 8181386
* @summary CipherSpi ByteBuffer to byte array conversion fails for
* certain data overlap conditions
* @run main CipherByteBufferOverwriteTest 0 false
* @run main CipherByteBufferOverwriteTest 0 true
* @run main CipherByteBufferOverwriteTest 4 false
* @run main CipherByteBufferOverwriteTest 4 true
*/
import java.security.spec.AlgorithmParameterSpec;
import javax.crypto.Cipher;
import javax.crypto.SecretKey;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
import java.nio.ByteBuffer;
import java.util.Arrays;
public class CipherByteBufferOverwriteTest {
private static final boolean DEBUG = false;
private static final String TRANSFORMATION = "AES/CBC/PKCS5Padding";
// must be larger than the temp array size, i.e. 4096, hardcoded in
// javax.crypto.CipherSpi class
private static final int PLAINTEXT_SIZE = 8192;
// leave room for padding
private static final int CIPHERTEXT_BUFFER_SIZE = PLAINTEXT_SIZE + 32;
private static final SecretKey KEY = new SecretKeySpec(new byte[16], "AES");
private static final AlgorithmParameterSpec PARAMS =
new IvParameterSpec(new byte[16]);
private static ByteBuffer inBuf;
private static ByteBuffer outBuf;
private enum BufferType {
ALLOCATE, DIRECT, WRAP;
}
public static void main(String[] args) throws Exception {
int offset = Integer.parseInt(args[0]);
boolean useRO = Boolean.parseBoolean(args[1]);
// an all-zeros plaintext is the easiest way to demonstrate the issue,
// but it fails with any plaintext, of course
byte[] expectedPT = new byte[PLAINTEXT_SIZE];
byte[] buf = new byte[offset + CIPHERTEXT_BUFFER_SIZE];
System.arraycopy(expectedPT, 0, buf, 0, PLAINTEXT_SIZE);
// generate expected cipher text using byte[] methods
Cipher c = Cipher.getInstance(TRANSFORMATION);
c.init(Cipher.ENCRYPT_MODE, KEY, PARAMS);
byte[] expectedCT = c.doFinal(expectedPT);
// Test#1: against ByteBuffer generated with allocate(int) call
prepareBuffers(BufferType.ALLOCATE, useRO, buf.length,
buf, 0, PLAINTEXT_SIZE, offset);
runTest(offset, expectedPT, expectedCT);
System.out.println("\tALLOCATE: passed");
// Test#2: against direct ByteBuffer
prepareBuffers(BufferType.DIRECT, useRO, buf.length,
buf, 0, PLAINTEXT_SIZE, offset);
System.out.println("\tDIRECT: passed");
runTest(offset, expectedPT, expectedCT);
// Test#3: against ByteBuffer wrapping existing array
prepareBuffers(BufferType.WRAP, useRO, buf.length,
buf, 0, PLAINTEXT_SIZE, offset);
runTest(offset, expectedPT, expectedCT);
System.out.println("\tWRAP: passed");
System.out.println("All Tests Passed");
}
private static void prepareBuffers(BufferType type,
boolean useRO, int bufSz, byte[] in, int inOfs, int inLen,
int outOfs) {
switch (type) {
case ALLOCATE:
outBuf = ByteBuffer.allocate(bufSz);
inBuf = outBuf.slice();
inBuf.put(in, inOfs, inLen);
inBuf.rewind();
inBuf.limit(inLen);
outBuf.position(outOfs);
break;
case DIRECT:
outBuf = ByteBuffer.allocateDirect(bufSz);
inBuf = outBuf.slice();
inBuf.put(in, inOfs, inLen);
inBuf.rewind();
inBuf.limit(inLen);
outBuf.position(outOfs);
break;
case WRAP:
if (in.length < bufSz) {
throw new RuntimeException("ERROR: Input buffer too small");
}
outBuf = ByteBuffer.wrap(in);
inBuf = ByteBuffer.wrap(in, inOfs, inLen);
outBuf.position(outOfs);
break;
}
if (useRO) {
inBuf = inBuf.asReadOnlyBuffer();
}
if (DEBUG) {
System.out.println("inBuf, pos = " + inBuf.position() +
", capacity = " + inBuf.capacity() +
", limit = " + inBuf.limit() +
", remaining = " + inBuf.remaining());
System.out.println("outBuf, pos = " + outBuf.position() +
", capacity = " + outBuf.capacity() +
", limit = " + outBuf.limit() +
", remaining = " + outBuf.remaining());
}
}
private static void runTest(int ofs, byte[] expectedPT, byte[] expectedCT)
throws Exception {
Cipher c = Cipher.getInstance(TRANSFORMATION);
c.init(Cipher.ENCRYPT_MODE, KEY, PARAMS);
int ciphertextSize = c.doFinal(inBuf, outBuf);
// read out the encrypted result
outBuf.position(ofs);
byte[] finalCT = new byte[ciphertextSize];
if (DEBUG) {
System.out.println("runTest, ciphertextSize = " + ciphertextSize);
System.out.println("runTest, ofs = " + ofs +
", remaining = " + finalCT.length +
", limit = " + outBuf.limit());
}
outBuf.get(finalCT);
if (!Arrays.equals(finalCT, expectedCT)) {
throw new Exception("ERROR: Ciphertext does not match");
}
// now do decryption
outBuf.position(ofs);
outBuf.limit(ofs + ciphertextSize);
c.init(Cipher.DECRYPT_MODE, KEY, PARAMS);
ByteBuffer finalPTBuf = ByteBuffer.allocate(
c.getOutputSize(outBuf.remaining()));
c.doFinal(outBuf, finalPTBuf);
// read out the decrypted result
finalPTBuf.flip();
byte[] finalPT = new byte[finalPTBuf.remaining()];
finalPTBuf.get(finalPT);
if (!Arrays.equals(finalPT, expectedPT)) {
throw new Exception("ERROR: Plaintext does not match");
}
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2010, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2010, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -90,8 +90,12 @@ public class DirPermissionDenied {
}
@AfterTest
public void tearDown() throws IOException {
public void tearDown() throws Throwable {
// add read permission to ensure the dir removable
ProcessTools.executeCommand("chmod", "733", TEST_DIR.toString())
.outputTo(System.out)
.errorTo(System.out)
.shouldHaveExitValue(0);
FileUtils.deleteFileIfExistsWithRetry(TEST_DIR);
}
}

View File

@ -0,0 +1,91 @@
/*
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* 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 8225745
* @summary Ensure ECDSA certificates with signature algorithm parameters
* can be verified successfully
* @run main ECSigParamsVerifyWithCert
*/
import java.io.*;
import java.security.cert.CertificateFactory;
import java.security.cert.X509Certificate;
public class ECSigParamsVerifyWithCert {
// ECDSA certificate with non-null signature parameters, i.e.
// Signature Algorithm: SHA256withECDSA, params unparsed,
// OID = 1.2.840.10045.4.3.2
private static String ecEntityWithSigParamsStr =
"-----BEGIN CERTIFICATE-----\n" +
"MIICXjCCAfmgAwIBAgIIHzREzASpiTowFAYIKoZIzj0EAwIGCCqGSM49AwEHMGAx\n" +
"IzAhBgNVBAMMGkNvcmRhIE5vZGUgSW50ZXJtZWRpYXRlIENBMQswCQYDVQQKDAJS\n" +
"MzEOMAwGA1UECwwFY29yZGExDzANBgNVBAcMBkxvbmRvbjELMAkGA1UEBhMCVUsw\n" +
"HhcNMTgwNjI1MDAwMDAwWhcNMjcwNTIwMDAwMDAwWjAxMQswCQYDVQQGEwJHQjEP\n" +
"MA0GA1UEBwwGTG9uZG9uMREwDwYDVQQKDAhNZWdhQ29ycDBZMBMGByqGSM49AgEG\n" +
"CCqGSM49AwEHA0IABG2VjWPPFnGVka3G9++Sz/GPRkAkht4BDoYTlkRz8hpwr4iu\n" +
"fU6NlReirLOB4LBLZcmp16xm4RYsN5ouTS7Z3wKjgcEwgb4wHQYDVR0OBBYEFBnY\n" +
"sikYpaSL9U8FUygbqN3sIvMOMA8GA1UdEwEB/wQFMAMBAf8wCwYDVR0PBAQDAgGG\n" +
"MCMGA1UdJQQcMBoGCCsGAQUFBwMBBggrBgEFBQcDAgYEVR0lADARBgorBgEEAYOK\n" +
"YgEBBAMCAQQwRwYDVR0eAQH/BD0wO6A3MDWkMzAxMQswCQYDVQQGEwJHQjEPMA0G\n" +
"A1UEBwwGTG9uZG9uMREwDwYDVQQKDAhNZWdhQ29ycKEAMBQGCCqGSM49BAMCBggq\n" +
"hkjOPQMBBwNJADBGAiEAos+QzgwwH2hfOtrlLncHnoT2YXXHP4q5h01T2DRmjcMC\n" +
"IQDa3xZz7CkyyNO1+paAthiNVIlGwwnl4UxuYMwkAiWACw==\n" +
"-----END CERTIFICATE-----\n";
// ECDSA certificate with only signature algorithm oid, no parameters, i.e.
// Signature Algorithm: SHA256withECDSA, OID = 1.2.840.10045.4.3.2
private static String ecSigner =
"-----BEGIN CERTIFICATE-----\n" +
"MIICETCCAbigAwIBAgIIaHr3YTnjT8YwCgYIKoZIzj0EAwIwWDEbMBkGA1UEAwwS\n" +
"Q29yZGEgTm9kZSBSb290IENBMQswCQYDVQQKDAJSMzEOMAwGA1UECwwFY29yZGEx\n" +
"DzANBgNVBAcMBkxvbmRvbjELMAkGA1UEBhMCVUswHhcNMTcwNTIyMDAwMDAwWhcN\n" +
"MjcwNTIwMDAwMDAwWjBgMSMwIQYDVQQDDBpDb3JkYSBOb2RlIEludGVybWVkaWF0\n" +
"ZSBDQTELMAkGA1UECgwCUjMxDjAMBgNVBAsMBWNvcmRhMQ8wDQYDVQQHDAZMb25k\n" +
"b24xCzAJBgNVBAYTAlVLMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEA8veoCbh\n" +
"ZmazlyIFWjExBd8ru5OYdFW9Z9ZD5BVg/dswdKC4dlHMHe/sQ4TxFmkYNqf7DTTt\n" +
"ePtdHT7Eb1LGYKNkMGIwHQYDVR0OBBYEFOvuLjAVKUCuGZge2G/jfX8HosITMAsG\n" +
"A1UdDwQEAwIBhjAjBgNVHSUEHDAaBggrBgEFBQcDAQYIKwYBBQUHAwIGBFUdJQAw\n" +
"DwYDVR0TAQH/BAUwAwEB/zAKBggqhkjOPQQDAgNHADBEAiB6wr47tuC71qi6+FbY\n" +
"XYDTvK+QmAi5ywkFc95I9fPLaQIgIM+nNNQ50NwK610h3bG37XC2tGu+A7Dhtt2Q\n" +
"4nDqu30=\n" +
"-----END CERTIFICATE-----\n";
public static void main(String[] args) throws Exception {
CertificateFactory certFactory = CertificateFactory.getInstance("X.509");
ByteArrayInputStream is
= new ByteArrayInputStream(ecEntityWithSigParamsStr.getBytes());
X509Certificate ecEntityWithSigParams = (X509Certificate)certFactory.generateCertificate(is);
is = new ByteArrayInputStream(ecSigner.getBytes());
X509Certificate ecSigner = (X509Certificate)certFactory.generateCertificate(is);
try {
ecEntityWithSigParams.verify(ecSigner.getPublicKey());
System.out.println("Test Passed: EC Cert verified");
} catch (Exception e) {
System.out.println("Failed, cannot verify EC certificate with sig params");
throw e;
}
}
}

View File

@ -69,7 +69,7 @@ import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertTrue;
/**
* FastDtoa tests
* BignumDtoa tests
*/
@SuppressWarnings("javadoc")
public class BignumDtoaTest {
@ -220,6 +220,11 @@ public class BignumDtoaTest {
assertEquals(299, buffer.getDecimalPoint());
buffer.reset();
DoubleConversion.bignumDtoa(1e-23, DtoaMode.SHORTEST, 0, buffer);
assertEquals("1", buffer.getRawDigits());
assertEquals(-22, buffer.getDecimalPoint());
buffer.reset();
final long smallest_normal64 = 0x0010000000000000L;
double v = Double.longBitsToDouble(smallest_normal64);
DoubleConversion.bignumDtoa(v, DtoaMode.SHORTEST, 0, buffer);

View File

@ -624,6 +624,11 @@ public class FixedDtoaTest {
assertEquals("1000000000000000128", buffer.getRawDigits());
assertEquals(19, buffer.getDecimalPoint());
buffer.reset();
assertTrue(DoubleConversion.fixedDtoa(2.10861548515811875e+15, 17, buffer));
assertEquals("210861548515811875", buffer.getRawDigits());
assertEquals(16, buffer.getDecimalPoint());
buffer.reset();
}

View File

@ -41,7 +41,11 @@ import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertTrue;
/**
* Ieee class tests
* IeeeDouble tests
*
* @test
* @modules jdk.scripting.nashorn/jdk.nashorn.internal.runtime.doubleconv:open
* @run testng jdk.nashorn.internal.runtime.doubleconv.test.IeeeDoubleTest
*/
@SuppressWarnings({"unchecked", "javadoc"})
public class IeeeDoubleTest {