This commit is contained in:
Jesper Wilhelmsson 2020-01-09 20:21:53 +01:00
commit 943b87ddde
32 changed files with 308 additions and 222 deletions
.hgtags
src
hotspot/share
java.base/share/classes/sun/security
jdk.compiler/share/classes/com/sun/tools/javac/comp
jdk.incubator.foreign/share/classes/jdk/incubator/foreign
jdk.jfr/share/classes/jdk/jfr
jdk.jlink/share/classes/jdk/tools/jlink/resources
test

@ -608,4 +608,5 @@ f33197adda9ad82fdef46ac0f7dc0126204f35b2 jdk-15+2
d05fcdf25717d85e80a3a39a6b719458b22be5fe jdk-15+3
d54ce919da90dab361995bb4d87be9851f00537a jdk-14+30
bb0a7975b31ded63d594ee8dbfc4d4ead587f79b jdk-15+4
decd3d2953b640f1043ee76953ff89238bff92e8 jdk-14+31
b97c1773ccafae4a8c16cc6aedb10b2a4f9a07ed jdk-15+5

@ -1,4 +1,4 @@
/*
/*
* Copyright (c) 2001, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@ -2151,6 +2151,13 @@ bool G1CollectedHeap::try_collect_concurrently(GCCause::Cause cause,
return op.gc_succeeded();
}
// If VMOp skipped initiating concurrent marking cycle because
// we're terminating, then we're done.
if (op.terminating()) {
LOG_COLLECT_CONCURRENTLY(cause, "skipped: terminating");
return false;
}
// Lock to get consistent set of values.
uint old_marking_started_after;
uint old_marking_completed_after;

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2020, 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
@ -47,6 +47,7 @@ VM_G1TryInitiateConcMark::VM_G1TryInitiateConcMark(uint gc_count_before,
_target_pause_time_ms(target_pause_time_ms),
_transient_failure(false),
_cycle_already_in_progress(false),
_terminating(false),
_gc_succeeded(false)
{}
@ -66,7 +67,17 @@ void VM_G1TryInitiateConcMark::doit() {
G1CollectedHeap* g1h = G1CollectedHeap::heap();
GCCauseSetter x(g1h, _gc_cause);
if (!g1h->policy()->force_initial_mark_if_outside_cycle(_gc_cause)) {
// Record for handling by caller.
_terminating = g1h->_cm_thread->should_terminate();
if (_terminating && GCCause::is_user_requested_gc(_gc_cause)) {
// When terminating, the request to initiate a concurrent cycle will be
// ignored by do_collection_pause_at_safepoint; instead it will just do
// a young-only or mixed GC (depending on phase). For a user request
// there's no point in even doing that much, so done. For some non-user
// requests the alternative GC might still be needed.
} else if (!g1h->policy()->force_initial_mark_if_outside_cycle(_gc_cause)) {
// Failure to force the next GC pause to be an initial mark indicates
// there is already a concurrent marking cycle in progress. Set flag
// to notify the caller and return immediately.

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2020, 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
@ -52,6 +52,7 @@ class VM_G1TryInitiateConcMark : public VM_GC_Operation {
double _target_pause_time_ms;
bool _transient_failure;
bool _cycle_already_in_progress;
bool _terminating;
bool _gc_succeeded;
public:
@ -63,6 +64,7 @@ public:
virtual void doit();
bool transient_failure() const { return _transient_failure; }
bool cycle_already_in_progress() const { return _cycle_already_in_progress; }
bool terminating() const { return _terminating; }
bool gc_succeeded() const { return _gc_succeeded; }
};

@ -223,7 +223,9 @@ public:
ShenandoahReentrantLocker locker(nm_data->lock());
// Heal oops and disarm
ShenandoahNMethod::heal_nmethod(nm);
if (_heap->is_evacuation_in_progress()) {
ShenandoahNMethod::heal_nmethod(nm);
}
ShenandoahNMethod::disarm_nmethod(nm);
// Clear compiled ICs and exception caches

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2020, 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
@ -671,7 +671,9 @@ void JfrRecorderService::invoke_flush() {
void JfrRecorderService::flushpoint() {
MutexLocker lock(JfrStream_lock, Mutex::_no_safepoint_check_flag);
invoke_flush();
if (_chunkwriter.is_valid()) {
invoke_flush();
}
}
void JfrRecorderService::process_full_buffers() {

@ -4170,7 +4170,7 @@ intptr_t InitializeNode::find_next_fullword_store(uint start, PhaseGVN* phase) {
Node* InitializeNode::complete_stores(Node* rawctl, Node* rawmem, Node* rawptr,
intptr_t header_size,
Node* size_in_bytes,
PhaseGVN* phase) {
PhaseIterGVN* phase) {
assert(!is_complete(), "not already complete");
assert(stores_are_sane(phase), "");
assert(allocation() != NULL, "must be present");
@ -4262,7 +4262,7 @@ Node* InitializeNode::complete_stores(Node* rawctl, Node* rawmem, Node* rawptr,
}
// Collect the store and move on:
st->set_req(MemNode::Memory, inits);
phase->replace_input_of(st, MemNode::Memory, inits);
inits = st; // put it on the linearized chain
set_req(i, zmem); // unhook from previous position

@ -1402,7 +1402,7 @@ public:
// Called when the associated AllocateNode is expanded into CFG.
Node* complete_stores(Node* rawctl, Node* rawmem, Node* rawptr,
intptr_t header_size, Node* size_in_bytes,
PhaseGVN* phase);
PhaseIterGVN* phase);
private:
void remove_extra_zeroes();

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2020, 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
@ -1986,6 +1986,14 @@ WB_ENTRY(jboolean, WB_IsCDSIncludedInVmBuild(JNIEnv* env))
#endif // INCLUDE_CDS
WB_END
WB_ENTRY(jboolean, WB_isC2OrJVMCIIncludedInVmBuild(JNIEnv* env))
#if COMPILER2_OR_JVMCI
return true;
#else
return false;
#endif
WB_END
WB_ENTRY(jboolean, WB_IsJavaHeapArchiveSupported(JNIEnv* env))
return HeapShared::is_heap_object_archiving_allowed();
WB_END
@ -2411,6 +2419,7 @@ static JNINativeMethod methods[] = {
{CC"areOpenArchiveHeapObjectsMapped", CC"()Z", (void*)&WB_AreOpenArchiveHeapObjectsMapped},
{CC"isCDSIncludedInVmBuild", CC"()Z", (void*)&WB_IsCDSIncludedInVmBuild },
{CC"isJFRIncludedInVmBuild", CC"()Z", (void*)&WB_IsJFRIncludedInVmBuild },
{CC"isC2OrJVMCIIncludedInVmBuild", CC"()Z", (void*)&WB_isC2OrJVMCIIncludedInVmBuild },
{CC"isJavaHeapArchiveSupported", CC"()Z", (void*)&WB_IsJavaHeapArchiveSupported },
{CC"cdsMemoryMappingFailed", CC"()Z", (void*)&WB_CDSMemoryMappingFailed },

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2020, 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
@ -28,9 +28,11 @@ package sun.security.ssl;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.security.AlgorithmConstraints;
import java.security.CryptoPrimitive;
import java.security.GeneralSecurityException;
import java.text.MessageFormat;
import java.util.Arrays;
import java.util.EnumSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Locale;
@ -434,7 +436,7 @@ final class ServerHello {
continue;
}
if (!ServerHandshakeContext.legacyAlgorithmConstraints.permits(
null, cs.name, null)) {
EnumSet.of(CryptoPrimitive.KEY_AGREEMENT), cs.name, null)) {
legacySuites.add(cs);
continue;
}
@ -723,7 +725,9 @@ final class ServerHello {
}
if ((legacySuite == null) &&
!legacyConstraints.permits(null, cs.name, null)) {
!legacyConstraints.permits(
EnumSet.of(CryptoPrimitive.KEY_AGREEMENT),
cs.name, null)) {
legacySuite = cs;
continue;
}

@ -1,5 +1,5 @@
/*
* Copyright (c) 2010, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2010, 2020, 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
@ -128,6 +128,11 @@ public class DisabledAlgorithmConstraints extends AbstractAlgorithmConstraints {
@Override
public final boolean permits(Set<CryptoPrimitive> primitives,
String algorithm, AlgorithmParameters parameters) {
if (primitives == null || primitives.isEmpty()) {
throw new IllegalArgumentException("The primitives cannot be null" +
" or empty.");
}
if (!checkAlgorithm(disabledAlgorithms, algorithm, decomposer)) {
return false;
}
@ -216,7 +221,11 @@ public class DisabledAlgorithmConstraints extends AbstractAlgorithmConstraints {
private boolean checkConstraints(Set<CryptoPrimitive> primitives,
String algorithm, Key key, AlgorithmParameters parameters) {
// check the key parameter, it cannot be null.
if (primitives == null || primitives.isEmpty()) {
throw new IllegalArgumentException("The primitives cannot be null" +
" or empty.");
}
if (key == null) {
throw new IllegalArgumentException("The key cannot be null");
}

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2020, 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
@ -51,17 +51,29 @@ public class LegacyAlgorithmConstraints extends AbstractAlgorithmConstraints {
@Override
public final boolean permits(Set<CryptoPrimitive> primitives,
String algorithm, AlgorithmParameters parameters) {
if (primitives == null || primitives.isEmpty()) {
throw new IllegalArgumentException("The primitives cannot be null" +
" or empty.");
}
return checkAlgorithm(legacyAlgorithms, algorithm, decomposer);
}
@Override
public final boolean permits(Set<CryptoPrimitive> primitives, Key key) {
if (primitives == null || primitives.isEmpty()) {
throw new IllegalArgumentException("The primitives cannot be null" +
" or empty.");
}
return true;
}
@Override
public final boolean permits(Set<CryptoPrimitive> primitives,
String algorithm, Key key, AlgorithmParameters parameters) {
if (primitives == null || primitives.isEmpty()) {
throw new IllegalArgumentException("The primitives cannot be null" +
" or empty.");
}
return checkAlgorithm(legacyAlgorithms, algorithm, decomposer);
}

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2020, 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
@ -1855,21 +1855,17 @@ public class Flow {
/** Check that trackable variable is initialized.
*/
boolean checkInit(DiagnosticPosition pos, VarSymbol sym, boolean compactConstructor) {
return checkInit(pos, sym, Errors.VarMightNotHaveBeenInitialized(sym), compactConstructor);
void checkInit(DiagnosticPosition pos, VarSymbol sym) {
checkInit(pos, sym, Errors.VarMightNotHaveBeenInitialized(sym));
}
boolean checkInit(DiagnosticPosition pos, VarSymbol sym, Error errkey, boolean compactConstructor) {
void checkInit(DiagnosticPosition pos, VarSymbol sym, Error errkey) {
if ((sym.adr >= firstadr || sym.owner.kind != TYP) &&
trackable(sym) &&
!inits.isMember(sym.adr)) {
if (sym.owner.kind != TYP || !compactConstructor || !uninits.isMember(sym.adr)) {
log.error(pos, errkey);
}
inits.incl(sym.adr);
return false;
}
return true;
}
/** Utility method to reset several Bits instances.
@ -2099,15 +2095,27 @@ public class Flow {
// the ctor is default(synthesized) or not
if (isSynthesized && !isCompactConstructor) {
checkInit(TreeInfo.diagnosticPositionFor(var, vardecl),
var, Errors.VarNotInitializedInDefaultConstructor(var), isCompactConstructor);
} else {
boolean wasInitialized = checkInit(TreeInfo.diagEndPos(tree.body), var, isCompactConstructor && tree.completesNormally);
if (!wasInitialized && var.owner.kind == TYP && isCompactConstructor && uninits.isMember(var.adr) && tree.completesNormally) {
var, Errors.VarNotInitializedInDefaultConstructor(var));
} else if (isCompactConstructor) {
boolean isInstanceRecordField = var.enclClass().isRecord() &&
(var.flags_field & (Flags.PRIVATE | Flags.FINAL | Flags.GENERATED_MEMBER | Flags.RECORD)) != 0 &&
!var.isStatic() &&
var.owner.kind == TYP;
if (isInstanceRecordField) {
boolean notInitialized = !inits.isMember(var.adr);
if (notInitialized && uninits.isMember(var.adr) && tree.completesNormally) {
/* this way we indicate Lower that it should generate an initialization for this field
* in the compact constructor
*/
var.flags_field |= UNINITIALIZED_FIELD;
var.flags_field |= UNINITIALIZED_FIELD;
} else {
checkInit(TreeInfo.diagEndPos(tree.body), var);
}
} else {
checkInit(TreeInfo.diagnosticPositionFor(var, vardecl), var);
}
} else {
checkInit(TreeInfo.diagEndPos(tree.body), var);
}
}
}
@ -2124,7 +2132,7 @@ public class Flow {
Assert.check(exit instanceof AssignPendingExit);
inits.assign(((AssignPendingExit) exit).exit_inits);
for (int i = firstadr; i < nextadr; i++) {
checkInit(exit.tree.pos(), vardecls[i].sym, isCompactConstructor);
checkInit(exit.tree.pos(), vardecls[i].sym);
}
}
}
@ -2666,7 +2674,7 @@ public class Flow {
super.visitSelect(tree);
if (TreeInfo.isThisQualifier(tree.selected) &&
tree.sym.kind == VAR) {
checkInit(tree.pos(), (VarSymbol)tree.sym, false);
checkInit(tree.pos(), (VarSymbol)tree.sym);
}
}
@ -2727,7 +2735,7 @@ public class Flow {
public void visitIdent(JCIdent tree) {
if (tree.sym.kind == VAR) {
checkInit(tree.pos(), (VarSymbol)tree.sym, false);
checkInit(tree.pos(), (VarSymbol)tree.sym);
referenced(tree.sym);
}
}

@ -140,7 +140,7 @@ abstract class AbstractLayout implements MemoryLayout {
/*** Helper constants for implementing Layout::describeConstable ***/
public static final DirectMethodHandleDesc BSM_GET_STATIC_FINAL
static final DirectMethodHandleDesc BSM_GET_STATIC_FINAL
= ConstantDescs.ofConstantBootstrap(ConstantDescs.CD_ConstantBootstraps, "getStaticFinal",
ConstantDescs.CD_Object, ConstantDescs.CD_Class);

@ -74,7 +74,13 @@ public interface MemoryAddress {
/**
* Compares the specified object with this address for equality. Returns {@code true} if and only if the specified
* object is also a address, and it is equal to this address.
* object is also an address, and it refers to the same memory location as this address.
*
* @apiNote two addresses might be considered equal despite their associated segments differ. This
* can happen, for instance, if the segment associated with one address is a <em>slice</em>
* (see {@link MemorySegment#asSlice(long, long)}) of the segment associated with the other address. Moreover,
* two addresses might be considered equals despite differences in the temporal bounds associated with their
* corresponding segments (this is possible, for example, as a result of calls to {@link MemorySegment#acquire()}).
*
* @param that the object to be compared for equality with this address.
* @return {@code true} if the specified object is equal to this address.

@ -55,14 +55,14 @@ import java.util.OptionalLong;
* <p>
* Non-platform classes should not implement {@linkplain MemoryLayout} directly.
*
* <h2>Size, alignment and byte order</h2>
* <h2><a id = "layout-align">Size, alignment and byte order</a></h2>
*
* All layouts have a size; layout size for value and padding layouts is always explicitly denoted; this means that a layout description
* always has the same size in bits, regardless of the platform in which it is used. For derived layouts, the size is computed
* as follows:
* <ul>
* <li>for a <em>finite</em> sequence layout <em>S</em> whose element layout is <em>E</em> and size is L,
* the size of <em>S</em> is that of <em>E, multiplied by L</em></li>
* the size of <em>S</em> is that of <em>E</em>, multiplied by <em>L</em></li>
* <li>the size of an <em>unbounded</em> sequence layout is <em>unknown</em></li>
* <li>for a group layout <em>G</em> with member layouts <em>M1</em>, <em>M2</em>, ... <em>Mn</em> whose sizes are
* <em>S1</em>, <em>S2</em>, ... <em>Sn</em>, respectively, the size of <em>G</em> is either <em>S1 + S2 + ... + Sn</em> or
@ -180,6 +180,9 @@ public interface MemoryLayout extends Constable {
* <li>{@code A=512} is the most strict alignment required by the x86/SV ABI (for AVX-512 data).</li>
* </ul>
*
* If no explicit alignment constraint was set on this layout (see {@link #withBitAlignment(long)}),
* then this method returns the <a href="#layout-align">natural alignment</a> constraint (in bits) associated with this layout.
*
* @return the layout alignment constraint, in bits.
*/
long bitAlignment();
@ -195,6 +198,9 @@ public interface MemoryLayout extends Constable {
* <li>{@code A=64} is the most strict alignment required by the x86/SV ABI (for AVX-512 data).</li>
* </ul>
*
* If no explicit alignment constraint was set on this layout (see {@link #withBitAlignment(long)}),
* then this method returns the <a href="#layout-align">natural alignment</a> constraint (in bytes) associated with this layout.
*
* @return the layout alignment constraint, in bytes.
* @throws UnsupportedOperationException if {@code bitAlignment()} is not a multiple of 8.
*/
@ -352,7 +358,16 @@ E * (S + I * F)
/**
* Compares the specified object with this layout for equality. Returns {@code true} if and only if the specified
* object is also a layout, and it is equal to this layout.
* object is also a layout, and it is equal to this layout. Two layouts are considered equal if they are of
* the same kind, have the same size, name and alignment constraints. Furthermore, depending on the layout kind, additional
* conditions must be satisfied:
* <ul>
* <li>two value layouts are considered equal if they have the same endianness (see {@link ValueLayout#order()})</li>
* <li>two sequence layouts are considered equal if they have the same element count (see {@link SequenceLayout#elementCount()}), and
* if their element layouts (see {@link SequenceLayout#elementLayout()}) are also equal</li>
* <li>two group layouts are considered equal if they are of the same kind (see {@link GroupLayout#isStruct()},
* {@link GroupLayout#isUnion()}) and if their member layouts (see {@link GroupLayout#memberLayouts()}) are also equal</li>
* </ul>
*
* @param that the object to be compared for equality with this layout.
* @return {@code true} if the specified object is equal to this layout.

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2020, 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
@ -424,7 +424,7 @@ public final class Recording implements Closeable {
*
* @since 14
*/
public void setFlushInterval(Duration interval) {
/*package private*/ void setFlushInterval(Duration interval) {
Objects.nonNull(interval);
if (interval.isNegative()) {
throw new IllegalArgumentException("Stream interval can't be negative");
@ -439,7 +439,7 @@ public final class Recording implements Closeable {
*
* @since 14
*/
public Duration getFlushInterval() {
/*package private*/ Duration getFlushInterval() {
return internal.getFlushInterval();
}

@ -1,5 +1,5 @@
/*
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2019, 2020, 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
@ -86,7 +86,6 @@ public final class RecordingStream implements AutoCloseable, EventStream {
Utils.checkAccessFlightRecorder();
AccessControlContext acc = AccessController.getContext();
this.recording = new Recording();
this.recording.setFlushInterval(Duration.ofMillis(1000));
try {
PlatformRecording pr = PrivateAccess.getInstance().getPlatformRecording(recording);
this.directoryStream = new EventDirectoryStream(acc, null, SecuritySupport.PRIVILIGED, pr);
@ -267,20 +266,6 @@ public final class RecordingStream implements AutoCloseable, EventStream {
recording.setMaxSize(maxSize);
}
/**
* Determines how often events are made available for streaming.
*
* @param interval the interval at which events are made available to the
* stream, no {@code null}
*
* @throws IllegalArgumentException if {@code interval} is negative
*
* @throws IllegalStateException if the stream is closed
*/
public void setFlushInterval(Duration interval) {
recording.setFlushInterval(interval);
}
@Override
public void setReuse(boolean reuse) {
directoryStream.setReuse(reuse);

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2020, 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
@ -43,6 +43,7 @@ import jdk.jfr.internal.LogLevel;
import jdk.jfr.internal.LogTag;
import jdk.jfr.internal.Logger;
import jdk.jfr.internal.OldObjectSample;
import jdk.jfr.internal.PlatformRecording;
import jdk.jfr.internal.PrivateAccess;
import jdk.jfr.internal.SecuritySupport.SafePath;
import jdk.jfr.internal.Type;
@ -186,7 +187,8 @@ final class DCmdStart extends AbstractDCmd {
}
if (flush != null) {
recording.setFlushInterval(Duration.ofNanos(flush));
PlatformRecording p = PrivateAccess.getInstance().getPlatformRecording(recording);
p.setFlushInterval(Duration.ofNanos(flush));
}
if (maxSize != null) {

@ -46,7 +46,8 @@ main.opt.module-path=\
\ if it exists.
main.opt.add-modules=\
\ --add-modules <mod>[,<mod>...] Root modules to resolve
\ --add-modules <mod>[,<mod>...] Root modules to resolve in addition to the\n\
\ initial modules. <mod> can also be ALL-MODULE-PATH.
main.opt.limit-modules=\
\ --limit-modules <mod>[,<mod>...] Limit the universe of observable\n\

@ -0,0 +1,79 @@
/*
* Copyright (c) 2020, 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 8236140
* @requires vm.gc.Serial
* @summary Tests proper rehashing of a captured volatile field StoreL node when completing it.
* @run main/othervm -Xbatch -XX:+UseSerialGC -XX:CompileCommand=compileonly,compiler.macronodes.TestCompleteVolatileStore::test
* compiler.macronodes.TestCompleteVolatileStore
*/
package compiler.macronodes;
public class TestCompleteVolatileStore {
int i1 = 4;
public void test() {
/*
* The store to the volatile field 'l1' (StoreL) of 'a' is captured in the Initialize node of 'a'
* (i.e. additional input to it) and completed in InitializeNode::complete_stores.
* Since 'l1' is volatile, the hash of the StoreL is non-zero triggering the hash assertion failure.
*/
A a = new A();
// Make sure that the CheckCastPP node of 'a' is used in the input chain of the Intialize node of 'b'
B b = new B(a);
// Make sure 'b' is non-scalar-replacable to avoid eliminating all allocations
B[] arr = new B[i1];
arr[i1-3] = b;
}
public static void main(String[] strArr) {
TestCompleteVolatileStore _instance = new TestCompleteVolatileStore();
for (int i = 0; i < 10_000; i++ ) {
_instance.test();
}
}
}
class A {
// Needs to be volatile to have a non-zero hash for the StoreL node.
volatile long l1;
A() {
// StoreL gets captured and is later processed in InitializeNode::complete_stores while expanding the allocation node.
this.l1 = 256;
}
}
class B {
A a;
B(A a) {
this.a = a;
}
}

@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2020, 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
@ -87,7 +87,7 @@ public class TestGCLogMessages {
}
public boolean isAvailable() {
return Compiler.isC2Enabled() || Compiler.isGraalEnabled();
return Compiler.isC2OrJVMCIIncludedInVmBuild();
}
}

@ -0,0 +1,54 @@
/*
* 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
* @run testng TestTypeAccess
*/
import jdk.incubator.foreign.MemorySegment;
import jdk.incubator.foreign.MemoryLayouts;
import org.testng.annotations.*;
import java.lang.invoke.VarHandle;
import java.lang.invoke.WrongMethodTypeException;
public class TestTypeAccess {
static final VarHandle INT_HANDLE = MemoryLayouts.JAVA_INT.varHandle(int.class);
@Test(expectedExceptions=ClassCastException.class)
public void testMemoryAddressCoordinateAsString() {
try (MemorySegment s = MemorySegment.allocateNative(8)) {
int v = (int)INT_HANDLE.get("string");
}
}
@Test(expectedExceptions=WrongMethodTypeException.class)
public void testMemoryCoordinatePrimitive() {
try (MemorySegment s = MemorySegment.allocateNative(8)) {
int v = (int)INT_HANDLE.get(1);
}
}
}

@ -1,5 +1,5 @@
/*
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2019, 2020, 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
@ -78,7 +78,6 @@ public final class TestSetEndTime {
CountDownLatch closed = new CountDownLatch(1);
AtomicInteger count = new AtomicInteger();
try (RecordingStream rs = new RecordingStream()) {
rs.setFlushInterval(Duration.ofSeconds(1));
rs.onEvent(e -> {
count.incrementAndGet();
});

@ -1,62 +0,0 @@
/*
* 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. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package jdk.jfr.api.consumer.recordingstream;
import java.time.Duration;
import jdk.jfr.consumer.RecordingStream;
import jdk.test.lib.jfr.EventNames;
/**
* @test
* @summary Tests RecordingStream::setFlushInterval
* @key jfr
* @requires vm.hasJFR
* @library /test/lib
* @run main/othervm jdk.jfr.api.consumer.recordingstream.TestSetFlushInterval
*/
public class TestSetFlushInterval {
public static void main(String... args) throws Exception {
Duration expectedDuration = Duration.ofMillis(1001);
try (RecordingStream r = new RecordingStream()) {
r.setFlushInterval(expectedDuration);
r.enable(EventNames.ActiveRecording);
r.onEvent(e -> {
System.out.println(e);
Duration duration = e.getDuration("flushInterval");
if (expectedDuration.equals(duration)) {
System.out.println("Closing recording");
r.close();
return;
}
System.out.println("Flush interval not set, was " + duration +
", but expected " + expectedDuration);
});
r.start();
}
}
}

@ -1,5 +1,5 @@
/*
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2019, 2020, 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
@ -74,7 +74,6 @@ public class TestStreamingRemote {
public static void main(String... args) throws Exception {
try (Recording r = new Recording()) {
r.setFlushInterval(Duration.ofSeconds(1));
r.start();
String repository = System.getProperty("jdk.jfr.repository");
Path policy = createPolicyFile(repository);

@ -1,5 +1,5 @@
/*
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2019, 2020, 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
@ -71,7 +71,6 @@ public class TestInProcessMigration {
System.out.println("Started es.startAsync()");
try (Recording r = new Recording()) {
r.setFlushInterval(Duration.ofSeconds(1));
r.start();
// Chunk in default repository
MigrationEvent e1 = new MigrationEvent();

@ -1,86 +0,0 @@
/*
* 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. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package jdk.jfr.api.recording.time;
import java.time.Duration;
import java.util.concurrent.CountDownLatch;
import jdk.jfr.Recording;
import jdk.jfr.consumer.EventStream;
import jdk.test.lib.Asserts;
/**
* @test
* @key jfr
* @summary Test Recording::SetFlushInterval(...) and
* Recording::getFlushInterval()
* @requires vm.hasJFR
* @library /test/lib
* @run main/othervm jdk.jfr.api.recording.time.TestSetFlushInterval
*/
public class TestSetFlushInterval {
public static void main(String[] args) throws Throwable {
testSetGet();
testSetNull();
testFlush();
}
static void testFlush() throws Exception {
CountDownLatch flush = new CountDownLatch(1);
try (EventStream es = EventStream.openRepository()) {
es.onFlush(() -> {
flush.countDown();
});
es.startAsync();
try (Recording r = new Recording()) {
r.setFlushInterval(Duration.ofSeconds(1));
r.start();
flush.await();
}
}
}
static void testSetNull() {
try (Recording r = new Recording()) {
r.setFlushInterval(null);
Asserts.fail("Expected NullPointerException");
} catch (NullPointerException npe) {
// as expected
}
}
static void testSetGet() {
try (Recording r = new Recording()) {
Duration a = Duration.ofNanos(21378461289374646L);
r.setFlushInterval(a);
Duration b = r.getFlushInterval();
Asserts.assertEQ(a, b);
}
}
}

@ -1,5 +1,5 @@
/*
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -29,6 +29,8 @@ import java.time.Duration;
import jdk.jfr.FlightRecorder;
import jdk.jfr.Recording;
import jdk.jfr.internal.PlatformRecording;
import jdk.jfr.internal.PrivateAccess;
/**
* @test
@ -36,14 +38,17 @@ import jdk.jfr.Recording;
* @key jfr
* @requires vm.hasJFR
* @library /test/lib /test/jdk
* @run main/othervm -XX:StartFlightRecording=flush-interval=1s jdk.jfr.startupargs.TestFlushInterval
* @modules jdk.jfr/jdk.jfr.internal
* @run main/othervm -XX:StartFlightRecording=flush-interval=2s jdk.jfr.startupargs.TestFlushInterval
*/
public class TestFlushInterval {
public static void main(String[] args) throws Exception {
for (Recording r : FlightRecorder.getFlightRecorder().getRecordings()) {
Duration d = r.getFlushInterval();
if (d.equals(Duration.ofSeconds(1))) {
PrivateAccess p = PrivateAccess.getInstance();
PlatformRecording pr = p.getPlatformRecording(r);
Duration d = pr.getFlushInterval();
if (d.equals(Duration.ofSeconds(2))) {
return; //OK
} else {
throw new Exception("Unexpected flush-interval " + d);

@ -414,6 +414,18 @@ public class RecordCompilationTests extends CompilationTestCase {
// x is not DA nor DU in the body of the constructor hence error
assertFail("compiler.err.var.might.not.have.been.initialized", "record R(int x) { # }",
"public R { if (x < 0) { this.x = -x; } }");
// if static fields are not DA then error
assertFail("compiler.err.var.might.not.have.been.initialized",
"record R() { # }", "static final String x;");
// ditto
assertFail("compiler.err.var.might.not.have.been.initialized",
"record R() { # }", "static final String x; public R {}");
// ditto
assertFail("compiler.err.var.might.not.have.been.initialized",
"record R(int i) { # }", "static final String x; public R {}");
}
public void testReturnInCanonical_Compact() {

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2020, 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
@ -227,6 +227,8 @@ public class WhiteBox {
public native void NMTArenaMalloc(long arena, long size);
// Compiler
public native boolean isC2OrJVMCIIncludedInVmBuild();
public native int matchesMethod(Executable method, String pattern);
public native int matchesInline(Executable method, String pattern);
public native boolean shouldPrintAssembly(Executable method, int comp_level);

@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -34,6 +34,15 @@ public class Compiler {
private static final WhiteBox WB = WhiteBox.getWhiteBox();
/**
* Check if C2 or JVMCI were included in the VM build
*
* @return true if either C2 or JVMCI were included in the VM build.
*/
public static boolean isC2OrJVMCIIncludedInVmBuild() {
return WB.isC2OrJVMCIIncludedInVmBuild();
}
/**
* Check if Graal is used as JIT compiler.
*