Merge
This commit is contained in:
commit
9b7a8f1982
@ -4699,19 +4699,46 @@ int os::active_processor_count() {
|
||||
return active_cpus;
|
||||
}
|
||||
|
||||
static bool should_warn_invalid_processor_id() {
|
||||
if (os::processor_count() == 1) {
|
||||
// Don't warn if we only have one processor
|
||||
return false;
|
||||
}
|
||||
|
||||
static volatile int warn_once = 1;
|
||||
|
||||
if (Atomic::load(&warn_once) == 0 ||
|
||||
Atomic::xchg(&warn_once, 0) == 0) {
|
||||
// Don't warn more than once
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
uint os::processor_id() {
|
||||
const int id = Linux::sched_getcpu();
|
||||
|
||||
#ifndef PRODUCT
|
||||
if (UseDebuggerErgo1 && id >= _processor_count) {
|
||||
// Some debuggers limit the processor count without limiting
|
||||
// the returned processor ids. Fake the processor id.
|
||||
return 0;
|
||||
if (id < processor_count()) {
|
||||
return (uint)id;
|
||||
}
|
||||
#endif
|
||||
|
||||
assert(id >= 0 && id < _processor_count, "Invalid processor id [%d]", id);
|
||||
return (uint)id;
|
||||
// Some environments (e.g. openvz containers and the rr debugger) incorrectly
|
||||
// report a processor id that is higher than the number of processors available.
|
||||
// This is problematic, for example, when implementing CPU-local data structures,
|
||||
// where the processor id is used to index into an array of length processor_count().
|
||||
// If this happens we return 0 here. This is is safe since we always have at least
|
||||
// one processor, but it's not optimal for performance if we're actually executing
|
||||
// in an environment with more than one processor.
|
||||
if (should_warn_invalid_processor_id()) {
|
||||
log_warning(os)("Invalid processor id reported by the operating system "
|
||||
"(got processor id %d, valid processor id range is 0-%d)",
|
||||
id, processor_count() - 1);
|
||||
log_warning(os)("Falling back to assuming processor id is 0. "
|
||||
"This could have a negative impact on performance.");
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void os::set_native_thread_name(const char *name) {
|
||||
|
@ -133,7 +133,11 @@ void MutableSpace::initialize(MemRegion mr,
|
||||
}
|
||||
|
||||
set_bottom(mr.start());
|
||||
set_end(mr.end());
|
||||
// When expanding concurrently with callers of cas_allocate, setting end
|
||||
// makes the new space available for allocation by other threads. So this
|
||||
// assignment must follow all other configuration and initialization that
|
||||
// might be done for expansion.
|
||||
Atomic::release_store(end_addr(), mr.end());
|
||||
|
||||
if (clear_space) {
|
||||
clear(mangle_space);
|
||||
|
@ -35,7 +35,6 @@
|
||||
#include "logging/log.hpp"
|
||||
#include "oops/oop.inline.hpp"
|
||||
#include "runtime/java.hpp"
|
||||
#include "runtime/orderAccess.hpp"
|
||||
#include "utilities/align.hpp"
|
||||
|
||||
PSOldGen::PSOldGen(ReservedSpace rs, size_t initial_size, size_t min_size,
|
||||
@ -354,9 +353,9 @@ void PSOldGen::post_resize() {
|
||||
WorkGang* workers = Thread::current()->is_VM_thread() ?
|
||||
&ParallelScavengeHeap::heap()->workers() : NULL;
|
||||
|
||||
// Ensure the space bounds are updated and made visible to other
|
||||
// threads after the other data structures have been resized.
|
||||
OrderAccess::storestore();
|
||||
// The update of the space's end is done by this call. As that
|
||||
// makes the new space available for concurrent allocation, this
|
||||
// must be the last step when expanding.
|
||||
object_space()->initialize(new_memregion,
|
||||
SpaceDecorator::DontClear,
|
||||
SpaceDecorator::DontMangle,
|
||||
|
@ -2285,7 +2285,7 @@ void MemoryGraphFixer::collect_memory_nodes() {
|
||||
uint last = _phase->C->unique();
|
||||
|
||||
#ifdef ASSERT
|
||||
uint8_t max_depth = 0;
|
||||
uint16_t max_depth = 0;
|
||||
for (LoopTreeIterator iter(_phase->ltree_root()); !iter.done(); iter.next()) {
|
||||
IdealLoopTree* lpt = iter.current();
|
||||
max_depth = MAX2(max_depth, lpt->_nest);
|
||||
|
@ -291,6 +291,7 @@ IdealLoopTree* PhaseIdealLoop::insert_outer_loop(IdealLoopTree* loop, LoopNode*
|
||||
loop->_parent = outer_ilt;
|
||||
loop->_next = NULL;
|
||||
loop->_nest++;
|
||||
assert(loop->_nest <= SHRT_MAX, "sanity");
|
||||
return outer_ilt;
|
||||
}
|
||||
|
||||
@ -2614,6 +2615,7 @@ bool IdealLoopTree::is_member(const IdealLoopTree *l) const {
|
||||
//------------------------------set_nest---------------------------------------
|
||||
// Set loop tree nesting depth. Accumulate _has_call bits.
|
||||
int IdealLoopTree::set_nest( uint depth ) {
|
||||
assert(depth <= SHRT_MAX, "sanity");
|
||||
_nest = depth;
|
||||
int bits = _has_call;
|
||||
if( _child ) bits |= _child->set_nest(depth+1);
|
||||
|
@ -611,7 +611,7 @@ public:
|
||||
|
||||
Node_List _body; // Loop body for inner loops
|
||||
|
||||
uint8_t _nest; // Nesting depth
|
||||
uint16_t _nest; // Nesting depth
|
||||
uint8_t _irreducible:1, // True if irreducible
|
||||
_has_call:1, // True if has call safepoint
|
||||
_has_sfpt:1, // True if has non-call safepoint
|
||||
|
@ -24,6 +24,7 @@
|
||||
|
||||
#include "precompiled.hpp"
|
||||
#include "ci/ciSymbols.hpp"
|
||||
#include "gc/shared/barrierSet.hpp"
|
||||
#include "opto/castnode.hpp"
|
||||
#include "opto/graphKit.hpp"
|
||||
#include "opto/phaseX.hpp"
|
||||
@ -413,15 +414,17 @@ void PhaseVector::expand_vunbox_node(VectorUnboxNode* vec_unbox) {
|
||||
|
||||
Node* mem = vec_unbox->mem();
|
||||
Node* ctrl = vec_unbox->in(0);
|
||||
Node* vec_field_ld = LoadNode::make(gvn,
|
||||
ctrl,
|
||||
mem,
|
||||
vec_adr,
|
||||
vec_adr->bottom_type()->is_ptr(),
|
||||
TypeOopPtr::make_from_klass(field->type()->as_klass()),
|
||||
T_OBJECT,
|
||||
MemNode::unordered);
|
||||
vec_field_ld = gvn.transform(vec_field_ld);
|
||||
Node* vec_field_ld;
|
||||
{
|
||||
DecoratorSet decorators = MO_UNORDERED | IN_HEAP;
|
||||
C2AccessValuePtr addr(vec_adr, vec_adr->bottom_type()->is_ptr());
|
||||
MergeMemNode* local_mem = MergeMemNode::make(mem);
|
||||
gvn.record_for_igvn(local_mem);
|
||||
BarrierSetC2* bs = BarrierSet::barrier_set()->barrier_set_c2();
|
||||
C2OptAccess access(gvn, ctrl, local_mem, decorators, T_OBJECT, obj, addr);
|
||||
const Type* type = TypeOopPtr::make_from_klass(field->type()->as_klass());
|
||||
vec_field_ld = bs->load_at(access, type);
|
||||
}
|
||||
|
||||
// For proper aliasing, attach concrete payload type.
|
||||
ciKlass* payload_klass = ciTypeArrayKlass::make(bt);
|
||||
|
@ -483,6 +483,7 @@ address StubRoutines::select_fill_function(BasicType t, bool aligned, const char
|
||||
case T_NARROWOOP:
|
||||
case T_NARROWKLASS:
|
||||
case T_ADDRESS:
|
||||
case T_VOID:
|
||||
// Currently unsupported
|
||||
return NULL;
|
||||
|
||||
|
@ -4397,7 +4397,7 @@ public final class String
|
||||
*/
|
||||
void getBytes(byte[] dst, int srcPos, int dstBegin, byte coder, int length) {
|
||||
if (coder() == coder) {
|
||||
System.arraycopy(value, srcPos, dst, dstBegin << coder, length << coder());
|
||||
System.arraycopy(value, srcPos << coder, dst, dstBegin << coder, length << coder);
|
||||
} else { // this.coder == LATIN && coder == UTF16
|
||||
StringLatin1.inflate(value, srcPos, dst, dstBegin, length);
|
||||
}
|
||||
|
@ -22,7 +22,7 @@
|
||||
.\"t
|
||||
.\" Automatically generated by Pandoc 2.3.1
|
||||
.\"
|
||||
.TH "JAVA" "1" "2020" "JDK 17" "JDK Commands"
|
||||
.TH "JAVA" "1" "2021" "JDK 17" "JDK Commands"
|
||||
.hy
|
||||
.SH NAME
|
||||
.PP
|
||||
@ -4095,6 +4095,22 @@ The replacement Unified Logging syntax is
|
||||
\f[CB]\-Xlog:class+loader+constraints=info\f[R].
|
||||
See \f[B]Enable Logging with the JVM Unified Logging Framework\f[R].
|
||||
.RE
|
||||
.SH REMOVED JAVA OPTIONS
|
||||
.PP
|
||||
These \f[CB]java\f[R] options have been removed in JDK 16 and using them
|
||||
results in an error of:
|
||||
.RS
|
||||
.PP
|
||||
\f[CB]Unrecognized\ VM\ option\f[R] \f[I]option\-name\f[R]
|
||||
.RE
|
||||
.TP
|
||||
.B \f[CB]\-XX:+UseParallelOldGC\f[R]
|
||||
Enables the use of the parallel garbage collector for full GCs.
|
||||
By default, this option is disabled.
|
||||
Enabling it automatically enables the \f[CB]\-XX:+UseParallelGC\f[R]
|
||||
option.
|
||||
.RS
|
||||
.RE
|
||||
.PP
|
||||
For the lists and descriptions of options removed in previous releases
|
||||
see the \f[I]Removed Java Options\f[R] section in:
|
||||
|
@ -22,7 +22,7 @@
|
||||
.\"t
|
||||
.\" Automatically generated by Pandoc 2.3.1
|
||||
.\"
|
||||
.TH "KEYTOOL" "1" "2020" "JDK 16" "JDK Commands"
|
||||
.TH "KEYTOOL" "1" "2021" "JDK 16" "JDK Commands"
|
||||
.hy
|
||||
.SH NAME
|
||||
.PP
|
||||
|
@ -21,7 +21,7 @@
|
||||
.\"
|
||||
.\" Automatically generated by Pandoc 2.3.1
|
||||
.\"
|
||||
.TH "RMID" "1" "2020" "JDK 16" "JDK Commands"
|
||||
.TH "RMID" "1" "2021" "JDK 16" "JDK Commands"
|
||||
.hy
|
||||
.SH NAME
|
||||
.PP
|
||||
|
@ -21,7 +21,7 @@
|
||||
.\"
|
||||
.\" Automatically generated by Pandoc 2.3.1
|
||||
.\"
|
||||
.TH "RMIREGISTRY" "1" "2020" "JDK 16" "JDK Commands"
|
||||
.TH "RMIREGISTRY" "1" "2021" "JDK 16" "JDK Commands"
|
||||
.hy
|
||||
.SH NAME
|
||||
.PP
|
||||
|
@ -21,7 +21,7 @@
|
||||
.\"
|
||||
.\" Automatically generated by Pandoc 2.3.1
|
||||
.\"
|
||||
.TH "JRUNSCRIPT" "1" "2020" "JDK 16" "JDK Commands"
|
||||
.TH "JRUNSCRIPT" "1" "2021" "JDK 16" "JDK Commands"
|
||||
.hy
|
||||
.SH NAME
|
||||
.PP
|
||||
|
@ -21,7 +21,7 @@
|
||||
.\"
|
||||
.\" Automatically generated by Pandoc 2.3.1
|
||||
.\"
|
||||
.TH "JAVAC" "1" "2020" "JDK 16" "JDK Commands"
|
||||
.TH "JAVAC" "1" "2021" "JDK 16" "JDK Commands"
|
||||
.hy
|
||||
.SH NAME
|
||||
.PP
|
||||
|
@ -21,7 +21,7 @@
|
||||
.\"
|
||||
.\" Automatically generated by Pandoc 2.3.1
|
||||
.\"
|
||||
.TH "SERIALVER" "1" "2020" "JDK 16" "JDK Commands"
|
||||
.TH "SERIALVER" "1" "2021" "JDK 16" "JDK Commands"
|
||||
.hy
|
||||
.SH NAME
|
||||
.PP
|
||||
|
@ -21,7 +21,7 @@
|
||||
.\"
|
||||
.\" Automatically generated by Pandoc 2.3.1
|
||||
.\"
|
||||
.TH "JHSDB" "1" "2020" "JDK 16" "JDK Commands"
|
||||
.TH "JHSDB" "1" "2021" "JDK 16" "JDK Commands"
|
||||
.hy
|
||||
.SH NAME
|
||||
.PP
|
||||
|
@ -21,7 +21,7 @@
|
||||
.\"
|
||||
.\" Automatically generated by Pandoc 2.3.1
|
||||
.\"
|
||||
.TH "JAR" "1" "2020" "JDK 16" "JDK Commands"
|
||||
.TH "JAR" "1" "2021" "JDK 16" "JDK Commands"
|
||||
.hy
|
||||
.SH NAME
|
||||
.PP
|
||||
|
@ -22,7 +22,7 @@
|
||||
.\"t
|
||||
.\" Automatically generated by Pandoc 2.3.1
|
||||
.\"
|
||||
.TH "JARSIGNER" "1" "2020" "JDK 16" "JDK Commands"
|
||||
.TH "JARSIGNER" "1" "2021" "JDK 16" "JDK Commands"
|
||||
.hy
|
||||
.SH NAME
|
||||
.PP
|
||||
@ -960,15 +960,6 @@ incurs higher overhead.
|
||||
.RS
|
||||
.RE
|
||||
.TP
|
||||
.B \f[CB]\-directsign\f[R]
|
||||
By default, jarsigner stores the hash of the \f[CB]\&.SF\f[R] file and
|
||||
possibly other information in a SignerInfo signedAttributes field, and
|
||||
then calculates the signature on this field.
|
||||
If this option is set, no SignerInfo signedAttributes field is generated
|
||||
and the signature is calculated on the \f[CB]\&.SF\f[R] file directly.
|
||||
.RS
|
||||
.RE
|
||||
.TP
|
||||
.B \f[CB]\-sectionsonly\f[R]
|
||||
If the \f[CB]\-sectionsonly\f[R] option appears on the command line, then
|
||||
the \f[CB]\&.SF\f[R] file (signature file) generated when a JAR file is
|
||||
|
@ -21,7 +21,7 @@
|
||||
.\"
|
||||
.\" Automatically generated by Pandoc 2.3.1
|
||||
.\"
|
||||
.TH "JAVADOC" "1" "2020" "JDK 16" "JDK Commands"
|
||||
.TH "JAVADOC" "1" "2021" "JDK 16" "JDK Commands"
|
||||
.hy
|
||||
.SH NAME
|
||||
.PP
|
||||
@ -596,7 +596,7 @@ it does, you must enclose the title in quotation marks.
|
||||
Additional quotation marks within the \f[CB]title\f[R] tag must be
|
||||
escaped.
|
||||
For example,
|
||||
\f[CB]javadoc\ \-header\ "<b>My\ Library</b><br>v1.0"\ com.mypackage.\f[R]
|
||||
\f[CB]javadoc\ \-doctitle\ "<b>My\ Library</b><br>v1.0"\ com.mypackage.\f[R]
|
||||
.RS
|
||||
.RE
|
||||
.TP
|
||||
|
@ -21,7 +21,7 @@
|
||||
.\"
|
||||
.\" Automatically generated by Pandoc 2.3.1
|
||||
.\"
|
||||
.TH "JCMD" "1" "2020" "JDK 16" "JDK Commands"
|
||||
.TH "JCMD" "1" "2021" "JDK 16" "JDK Commands"
|
||||
.hy
|
||||
.SH NAME
|
||||
.PP
|
||||
|
@ -21,7 +21,7 @@
|
||||
.\"
|
||||
.\" Automatically generated by Pandoc 2.3.1
|
||||
.\"
|
||||
.TH "JINFO" "1" "2020" "JDK 16" "JDK Commands"
|
||||
.TH "JINFO" "1" "2021" "JDK 16" "JDK Commands"
|
||||
.hy
|
||||
.SH NAME
|
||||
.PP
|
||||
|
@ -21,7 +21,7 @@
|
||||
.\"
|
||||
.\" Automatically generated by Pandoc 2.3.1
|
||||
.\"
|
||||
.TH "JMAP" "1" "2020" "JDK 16" "JDK Commands"
|
||||
.TH "JMAP" "1" "2021" "JDK 16" "JDK Commands"
|
||||
.hy
|
||||
.SH NAME
|
||||
.PP
|
||||
|
@ -21,7 +21,7 @@
|
||||
.\"
|
||||
.\" Automatically generated by Pandoc 2.3.1
|
||||
.\"
|
||||
.TH "JPS" "1" "2020" "JDK 16" "JDK Commands"
|
||||
.TH "JPS" "1" "2021" "JDK 16" "JDK Commands"
|
||||
.hy
|
||||
.SH NAME
|
||||
.PP
|
||||
|
@ -21,7 +21,7 @@
|
||||
.\"
|
||||
.\" Automatically generated by Pandoc 2.3.1
|
||||
.\"
|
||||
.TH "JSTACK" "1" "2020" "JDK 16" "JDK Commands"
|
||||
.TH "JSTACK" "1" "2021" "JDK 16" "JDK Commands"
|
||||
.hy
|
||||
.SH NAME
|
||||
.PP
|
||||
|
@ -21,7 +21,7 @@
|
||||
.\"
|
||||
.\" Automatically generated by Pandoc 2.3.1
|
||||
.\"
|
||||
.TH "JSTAT" "1" "2020" "JDK 16" "JDK Commands"
|
||||
.TH "JSTAT" "1" "2021" "JDK 16" "JDK Commands"
|
||||
.hy
|
||||
.SH NAME
|
||||
.PP
|
||||
|
@ -21,7 +21,7 @@
|
||||
.\"
|
||||
.\" Automatically generated by Pandoc 2.3.1
|
||||
.\"
|
||||
.TH "JCONSOLE" "1" "2020" "JDK 16" "JDK Commands"
|
||||
.TH "JCONSOLE" "1" "2021" "JDK 16" "JDK Commands"
|
||||
.hy
|
||||
.SH NAME
|
||||
.PP
|
||||
|
@ -21,7 +21,7 @@
|
||||
.\"
|
||||
.\" Automatically generated by Pandoc 2.3.1
|
||||
.\"
|
||||
.TH "JAVAP" "1" "2020" "JDK 16" "JDK Commands"
|
||||
.TH "JAVAP" "1" "2021" "JDK 16" "JDK Commands"
|
||||
.hy
|
||||
.SH NAME
|
||||
.PP
|
||||
|
@ -21,7 +21,7 @@
|
||||
.\"
|
||||
.\" Automatically generated by Pandoc 2.3.1
|
||||
.\"
|
||||
.TH "JDEPRSCAN" "1" "2020" "JDK 16" "JDK Commands"
|
||||
.TH "JDEPRSCAN" "1" "2021" "JDK 16" "JDK Commands"
|
||||
.hy
|
||||
.SH NAME
|
||||
.PP
|
||||
|
@ -21,7 +21,7 @@
|
||||
.\"
|
||||
.\" Automatically generated by Pandoc 2.3.1
|
||||
.\"
|
||||
.TH "JDEPS" "1" "2020" "JDK 16" "JDK Commands"
|
||||
.TH "JDEPS" "1" "2021" "JDK 16" "JDK Commands"
|
||||
.hy
|
||||
.SH NAME
|
||||
.PP
|
||||
|
@ -21,7 +21,7 @@
|
||||
.\"
|
||||
.\" Automatically generated by Pandoc 2.3.1
|
||||
.\"
|
||||
.TH "JDB" "1" "2020" "JDK 16" "JDK Commands"
|
||||
.TH "JDB" "1" "2021" "JDK 16" "JDK Commands"
|
||||
.hy
|
||||
.SH NAME
|
||||
.PP
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 2021, 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
|
||||
@ -41,6 +41,7 @@ import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
@ -851,4 +852,18 @@ public final class PlatformRecording implements AutoCloseable {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void removePath(SafePath path) {
|
||||
synchronized (recorder) {
|
||||
Iterator<RepositoryChunk> it = chunks.iterator();
|
||||
while (it.hasNext()) {
|
||||
RepositoryChunk c = it.next();
|
||||
if (c.getFile().equals(path)) {
|
||||
it.remove();
|
||||
removed(c);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2012, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2012, 2021, 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
|
||||
@ -33,6 +33,7 @@ import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import jdk.jfr.internal.SecuritySupport.SafePath;
|
||||
import jdk.jfr.internal.management.ChunkFilename;
|
||||
|
||||
public final class Repository {
|
||||
|
||||
@ -45,6 +46,7 @@ public final class Repository {
|
||||
private final Set<SafePath> cleanupDirectories = new HashSet<>();
|
||||
private SafePath baseLocation;
|
||||
private SafePath repository;
|
||||
private ChunkFilename chunkFilename;
|
||||
|
||||
private Repository() {
|
||||
}
|
||||
@ -61,6 +63,7 @@ public final class Repository {
|
||||
// Probe to see if repository can be created, needed for fail fast
|
||||
// during JVM startup or JFR.configure
|
||||
this.repository = createRepository(baseLocation);
|
||||
this.chunkFilename = null;
|
||||
try {
|
||||
// Remove so we don't "leak" repositories, if JFR is never started
|
||||
// and shutdown hook not added.
|
||||
@ -84,8 +87,13 @@ public final class Repository {
|
||||
jvm.setRepositoryLocation(repository.toString());
|
||||
SecuritySupport.setProperty(JFR_REPOSITORY_LOCATION_PROPERTY, repository.toString());
|
||||
cleanupDirectories.add(repository);
|
||||
chunkFilename = null;
|
||||
}
|
||||
return new RepositoryChunk(repository, timestamp);
|
||||
if (chunkFilename == null) {
|
||||
chunkFilename = ChunkFilename.newPriviliged(repository.toPath());
|
||||
}
|
||||
String filename = chunkFilename.next(timestamp.toLocalDateTime());
|
||||
return new RepositoryChunk(new SafePath(filename), timestamp.toInstant());
|
||||
} catch (Exception e) {
|
||||
String errorMsg = String.format("Could not create chunk in repository %s, %s: %s", repository, e.getClass(), e.getMessage());
|
||||
Logger.log(LogTag.JFR, LogLevel.ERROR, errorMsg);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2012, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2012, 2021, 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,7 +47,6 @@ final class RepositoryChunk {
|
||||
}
|
||||
};
|
||||
|
||||
private final SafePath repositoryPath;
|
||||
private final SafePath chunkFile;
|
||||
private final Instant startTime;
|
||||
private final RandomAccessFile unFinishedRAF;
|
||||
@ -56,28 +55,12 @@ final class RepositoryChunk {
|
||||
private int refCount = 0;
|
||||
private long size;
|
||||
|
||||
RepositoryChunk(SafePath path, ZonedDateTime timestamp) throws Exception {
|
||||
this.startTime = timestamp.toInstant();
|
||||
this.repositoryPath = path;
|
||||
this.chunkFile = findFileName(repositoryPath, timestamp.toLocalDateTime());
|
||||
RepositoryChunk(SafePath path, Instant startTime) throws Exception {
|
||||
this.startTime = startTime;
|
||||
this.chunkFile = path;
|
||||
this.unFinishedRAF = SecuritySupport.createRandomAccessFile(chunkFile);
|
||||
}
|
||||
|
||||
private static SafePath findFileName(SafePath directory, LocalDateTime time) throws Exception {
|
||||
String filename = Utils.formatDateTime(time);
|
||||
Path p = directory.toPath().resolve(filename + FILE_EXTENSION);
|
||||
for (int i = 1; i < MAX_CHUNK_NAMES; i++) {
|
||||
SafePath s = new SafePath(p);
|
||||
if (!SecuritySupport.exists(s)) {
|
||||
return s;
|
||||
}
|
||||
String extendedName = String.format("%s_%02d%s", filename, i, FILE_EXTENSION);
|
||||
p = directory.toPath().resolve(extendedName);
|
||||
}
|
||||
p = directory.toPath().resolve(filename + "_" + System.currentTimeMillis() + FILE_EXTENSION);
|
||||
return new SafePath(p);
|
||||
}
|
||||
|
||||
void finish(Instant endTime) {
|
||||
try {
|
||||
finishWithException(endTime);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 2021, 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
|
||||
@ -500,6 +500,11 @@ public final class SecuritySupport {
|
||||
public long fileSize(Path p) throws IOException {
|
||||
return doPrivilegedIOWithReturn( () -> Files.size(p));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean exists(Path p) throws IOException {
|
||||
return doPrivilegedIOWithReturn( () -> Files.exists(p));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 2021, 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
|
||||
@ -184,7 +184,7 @@ public final class Utils {
|
||||
|
||||
// This method reduces the number of loaded classes
|
||||
// compared to DateTimeFormatter
|
||||
static String formatDateTime(LocalDateTime time) {
|
||||
public static String formatDateTime(LocalDateTime time) {
|
||||
StringBuilder sb = new StringBuilder(19);
|
||||
sb.append(time.getYear() / 100);
|
||||
appendPadded(sb, time.getYear() % 100, true);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2019, 2021, 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
|
||||
@ -46,6 +46,8 @@ public abstract class FileAccess {
|
||||
|
||||
public abstract long fileSize(Path p) throws IOException;
|
||||
|
||||
public abstract boolean exists(Path s) throws IOException;
|
||||
|
||||
private static class UnPrivileged extends FileAccess {
|
||||
@Override
|
||||
public RandomAccessFile openRAF(File f, String mode) throws IOException {
|
||||
@ -71,5 +73,10 @@ public abstract class FileAccess {
|
||||
public long fileSize(Path p) throws IOException {
|
||||
return Files.size(p);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean exists(Path p) {
|
||||
return Files.exists(p);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2020, 2021, 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
|
||||
@ -119,8 +119,7 @@ public final class OngoingStream extends EventByteStream {
|
||||
throw new IOException("No progress");
|
||||
}
|
||||
startTimeNanos += header.getDurationNanos();
|
||||
Instant timestamp = Utils.epochNanosToInstant(startTimeNanos);
|
||||
ManagementSupport.removeBefore(recording, timestamp);
|
||||
ManagementSupport.removePath(recording, path);
|
||||
closeInput();
|
||||
} else {
|
||||
header.refresh();
|
||||
|
@ -0,0 +1,90 @@
|
||||
/*
|
||||
* Copyright (c) 2021, 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.internal.management;
|
||||
|
||||
import java.nio.file.Paths;
|
||||
import java.nio.file.Path;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.io.IOException;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import jdk.jfr.internal.SecuritySupport;
|
||||
import jdk.jfr.internal.SecuritySupport.SafePath;
|
||||
import jdk.jfr.internal.Utils;
|
||||
import jdk.jfr.internal.consumer.FileAccess;
|
||||
|
||||
// Allows a remote streaming client to create chunk files
|
||||
// with same naming scheme as the JVM.
|
||||
public final class ChunkFilename {
|
||||
private static final int MAX_CHUNK_NAMES = 100_000;
|
||||
private static final String FILE_EXTENSION = ".jfr";
|
||||
|
||||
private final Path directory;
|
||||
private final FileAccess fileAcess;
|
||||
|
||||
private Path lastPath;
|
||||
private int counter;
|
||||
|
||||
public static ChunkFilename newUnpriviliged(Path directory) {
|
||||
return new ChunkFilename(directory, FileAccess.UNPRIVILEGED);
|
||||
}
|
||||
|
||||
public static ChunkFilename newPriviliged(Path directory) {
|
||||
return new ChunkFilename(directory, SecuritySupport.PRIVILEGED);
|
||||
}
|
||||
|
||||
private ChunkFilename(Path directory, FileAccess fileAccess) {
|
||||
// Avoid malicious implementations of Path interface
|
||||
this.directory = Paths.get(directory.toString());
|
||||
this.fileAcess = fileAccess;
|
||||
}
|
||||
|
||||
public String next(LocalDateTime time) throws IOException {
|
||||
String filename = Utils.formatDateTime(time);
|
||||
Path p = directory.resolve(filename + FILE_EXTENSION);
|
||||
|
||||
// If less than one file per second (typically case)
|
||||
if (lastPath == null || !p.equals(lastPath)) {
|
||||
if (!fileAcess.exists(p)) {
|
||||
counter = 1; // reset counter
|
||||
lastPath = p;
|
||||
return p.toString();
|
||||
}
|
||||
}
|
||||
|
||||
// If more than one file per second
|
||||
while (counter < MAX_CHUNK_NAMES) {
|
||||
String extendedName = String.format("%s_%02d%s", filename, counter, FILE_EXTENSION);
|
||||
p = directory.resolve(extendedName);
|
||||
counter++;
|
||||
if (!fileAcess.exists(p)) {
|
||||
return p.toString();
|
||||
}
|
||||
}
|
||||
throw new IOException("Unable to find unused filename after " + counter + " attempts");
|
||||
}
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -49,6 +49,7 @@ import jdk.jfr.internal.Logger;
|
||||
import jdk.jfr.internal.MetadataRepository;
|
||||
import jdk.jfr.internal.PlatformRecording;
|
||||
import jdk.jfr.internal.PrivateAccess;
|
||||
import jdk.jfr.internal.SecuritySupport.SafePath;
|
||||
import jdk.jfr.internal.Utils;
|
||||
import jdk.jfr.internal.WriteableUserPath;
|
||||
import jdk.jfr.internal.consumer.EventDirectoryStream;
|
||||
@ -141,7 +142,12 @@ public final class ManagementSupport {
|
||||
public static void removeBefore(Recording recording, Instant timestamp) {
|
||||
PlatformRecording pr = PrivateAccess.getInstance().getPlatformRecording(recording);
|
||||
pr.removeBefore(timestamp);
|
||||
}
|
||||
|
||||
// Needed callback to detect when a chunk has been parsed.
|
||||
public static void removePath(Recording recording, Path path) {
|
||||
PlatformRecording pr = PrivateAccess.getInstance().getPlatformRecording(recording);
|
||||
pr.removePath(new SafePath(path));
|
||||
}
|
||||
|
||||
// Needed callback to detect when a chunk has been parsed.
|
||||
|
@ -21,7 +21,7 @@
|
||||
.\"
|
||||
.\" Automatically generated by Pandoc 2.3.1
|
||||
.\"
|
||||
.TH "JFR" "1" "2020" "JDK 16" "JDK Commands"
|
||||
.TH "JFR" "1" "2021" "JDK 16" "JDK Commands"
|
||||
.hy
|
||||
.SH NAME
|
||||
.PP
|
||||
|
@ -21,7 +21,7 @@
|
||||
.\"
|
||||
.\" Automatically generated by Pandoc 2.3.1
|
||||
.\"
|
||||
.TH "JLINK" "1" "2020" "JDK 16" "JDK Commands"
|
||||
.TH "JLINK" "1" "2021" "JDK 16" "JDK Commands"
|
||||
.hy
|
||||
.SH NAME
|
||||
.PP
|
||||
|
@ -21,7 +21,7 @@
|
||||
.\"
|
||||
.\" Automatically generated by Pandoc 2.3.1
|
||||
.\"
|
||||
.TH "JMOD" "1" "2020" "JDK 16" "JDK Commands"
|
||||
.TH "JMOD" "1" "2021" "JDK 16" "JDK Commands"
|
||||
.hy
|
||||
.SH NAME
|
||||
.PP
|
||||
|
@ -22,7 +22,7 @@
|
||||
.\"t
|
||||
.\" Automatically generated by Pandoc 2.3.1
|
||||
.\"
|
||||
.TH "JSHELL" "1" "2020" "JDK 16" "JDK Commands"
|
||||
.TH "JSHELL" "1" "2021" "JDK 16" "JDK Commands"
|
||||
.hy
|
||||
.SH NAME
|
||||
.PP
|
||||
|
@ -21,7 +21,7 @@
|
||||
.\"
|
||||
.\" Automatically generated by Pandoc 2.3.1
|
||||
.\"
|
||||
.TH "JSTATD" "1" "2020" "JDK 16" "JDK Commands"
|
||||
.TH "JSTATD" "1" "2021" "JDK 16" "JDK Commands"
|
||||
.hy
|
||||
.SH NAME
|
||||
.PP
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2020, 2021, 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
|
||||
@ -30,6 +30,7 @@ import java.io.RandomAccessFile;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.time.Duration;
|
||||
import java.time.Instant;
|
||||
import java.time.LocalDateTime;
|
||||
@ -40,19 +41,20 @@ import java.util.Deque;
|
||||
import java.util.Iterator;
|
||||
import java.util.Objects;
|
||||
|
||||
import jdk.jfr.internal.management.ChunkFilename;
|
||||
import jdk.jfr.internal.management.ManagementSupport;
|
||||
|
||||
final class DiskRepository implements Closeable {
|
||||
|
||||
final static class DiskChunk {
|
||||
final Path path;
|
||||
final Instant startTime;
|
||||
final long startTimeNanos;
|
||||
Instant endTime;
|
||||
long size;
|
||||
|
||||
DiskChunk(Path path, long startNanos) {
|
||||
this.path = path;
|
||||
this.startTime = ManagementSupport.epochNanosToInstant(startNanos);
|
||||
this.startTimeNanos = startNanos;
|
||||
}
|
||||
}
|
||||
|
||||
@ -80,6 +82,7 @@ final class DiskRepository implements Closeable {
|
||||
private final boolean deleteDirectory;
|
||||
private final ByteBuffer buffer = ByteBuffer.allocate(256);
|
||||
private final Path directory;
|
||||
private final ChunkFilename chunkFilename;
|
||||
|
||||
private RandomAccessFile raf;
|
||||
private RandomAccessFile previousRAF;
|
||||
@ -103,6 +106,7 @@ final class DiskRepository implements Closeable {
|
||||
public DiskRepository(Path path, boolean deleteDirectory) throws IOException {
|
||||
this.directory = path;
|
||||
this.deleteDirectory = deleteDirectory;
|
||||
this.chunkFilename = ChunkFilename.newUnpriviliged(path);
|
||||
}
|
||||
|
||||
public synchronized void write(byte[] bytes) throws IOException {
|
||||
@ -295,8 +299,8 @@ final class DiskRepository implements Closeable {
|
||||
previousRAFstate = state;
|
||||
currentChunk.size = Files.size(currentChunk.path);
|
||||
long durationNanos = buffer.getLong(HEADER_FILE_DURATION);
|
||||
Duration d = Duration.ofNanos(durationNanos);
|
||||
currentChunk.endTime = currentChunk.startTime.plus(d);
|
||||
long endTimeNanos = currentChunk.startTimeNanos + durationNanos;
|
||||
currentChunk.endTime = ManagementSupport.epochNanosToInstant(endTimeNanos);
|
||||
}
|
||||
raf.seek(position);
|
||||
}
|
||||
@ -325,44 +329,8 @@ final class DiskRepository implements Closeable {
|
||||
int nanoOfSecond = (int) (nanos % 1_000_000_000);
|
||||
ZoneOffset z = OffsetDateTime.now().getOffset();
|
||||
LocalDateTime d = LocalDateTime.ofEpochSecond(epochSecond, nanoOfSecond, z);
|
||||
String filename = formatDateTime(d);
|
||||
Path p1 = directory.resolve(filename + ".jfr");
|
||||
if (!Files.exists(p1)) {
|
||||
return new DiskChunk(p1, nanos);
|
||||
}
|
||||
for (int i = 1; i < 100; i++) {
|
||||
String s = Integer.toString(i);
|
||||
if (i < 10) {
|
||||
s = "0" + s;
|
||||
}
|
||||
Path p2 = directory.resolve(filename + "_" + s + ".jfr");
|
||||
if (!Files.exists(p2)) {
|
||||
return new DiskChunk(p2, nanos);
|
||||
}
|
||||
}
|
||||
throw new IOException("Could not create chunk for path " + p1);
|
||||
}
|
||||
|
||||
static String formatDateTime(LocalDateTime time) {
|
||||
StringBuilder sb = new StringBuilder(19);
|
||||
sb.append(time.getYear() / 100);
|
||||
appendPadded(sb, time.getYear() % 100, true);
|
||||
appendPadded(sb, time.getMonth().getValue(), true);
|
||||
appendPadded(sb, time.getDayOfMonth(), true);
|
||||
appendPadded(sb, time.getHour(), true);
|
||||
appendPadded(sb, time.getMinute(), true);
|
||||
appendPadded(sb, time.getSecond(), false);
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
private static void appendPadded(StringBuilder text, int number, boolean separator) {
|
||||
if (number < 10) {
|
||||
text.append('0');
|
||||
}
|
||||
text.append(number);
|
||||
if (separator) {
|
||||
text.append('_');
|
||||
}
|
||||
String filename = chunkFilename.next(d);
|
||||
return new DiskChunk(Paths.get(filename), nanos);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -423,11 +391,11 @@ final class DiskRepository implements Closeable {
|
||||
cleanUpDeadChunk(count + 10);
|
||||
}
|
||||
|
||||
public synchronized void onChunkComplete(Instant timestamp) {
|
||||
public synchronized void onChunkComplete(long endTimeNanos) {
|
||||
int count = 0;
|
||||
while (!activeChunks.isEmpty()) {
|
||||
DiskChunk oldestChunk = activeChunks.peek();
|
||||
if (oldestChunk.startTime.isBefore(timestamp)) {
|
||||
if (oldestChunk.startTimeNanos < endTimeNanos) {
|
||||
removeOldestChunk();
|
||||
count++;
|
||||
} else {
|
||||
|
@ -29,13 +29,16 @@ import java.time.Instant;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import jdk.jfr.internal.management.ManagementSupport;
|
||||
|
||||
final class DownLoadThread extends Thread {
|
||||
private final RemoteRecordingStream stream;
|
||||
private final Instant startTime;
|
||||
private final Instant endTime;
|
||||
private final DiskRepository diskRepository;
|
||||
|
||||
DownLoadThread(RemoteRecordingStream stream) {
|
||||
DownLoadThread(RemoteRecordingStream stream, String name) {
|
||||
super(name);
|
||||
this.stream = stream;
|
||||
this.startTime = stream.startTime;
|
||||
this.endTime = stream.endTime;
|
||||
@ -65,7 +68,7 @@ final class DownLoadThread extends Thread {
|
||||
}
|
||||
}
|
||||
} catch (IOException ioe) {
|
||||
// ignore
|
||||
ManagementSupport.logDebug(ioe.getMessage());
|
||||
} finally {
|
||||
diskRepository.complete();
|
||||
}
|
||||
|
@ -133,8 +133,7 @@ public final class RemoteRecordingStream implements EventStream {
|
||||
|
||||
@Override
|
||||
public void accept(Long endNanos) {
|
||||
Instant t = ManagementSupport.epochNanosToInstant(endNanos);
|
||||
repository.onChunkComplete(t);
|
||||
repository.onChunkComplete(endNanos);
|
||||
}
|
||||
}
|
||||
|
||||
@ -552,8 +551,8 @@ public final class RemoteRecordingStream implements EventStream {
|
||||
}
|
||||
|
||||
private void startDownload() {
|
||||
Thread downLoadThread = new DownLoadThread(this);
|
||||
downLoadThread.setName("JFR: Download Thread " + creationTime);
|
||||
String name = "JFR: Download Thread " + creationTime;
|
||||
Thread downLoadThread = new DownLoadThread(this, name);
|
||||
downLoadThread.start();
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,75 @@
|
||||
/*
|
||||
* Copyright (c) 2021, 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 8260370
|
||||
* @summary C2: LoopLimit node is not eliminated
|
||||
*
|
||||
* @run main/othervm
|
||||
* -Xcomp
|
||||
* -XX:CompileOnly=compiler/loopopts/TestLoopLimitNodeElimination
|
||||
* compiler.loopopts.TestLoopLimitNodeElimination
|
||||
*/
|
||||
|
||||
package compiler.loopopts;
|
||||
|
||||
// the test code is derived from a randomly generated test
|
||||
public class TestLoopLimitNodeElimination {
|
||||
private static class MyException extends RuntimeException { }
|
||||
private static final int ITERATIONS = 100000;
|
||||
private static final int SIZE = 400;
|
||||
|
||||
private static int counter = 0;
|
||||
|
||||
int[] array1 = new int[SIZE];
|
||||
|
||||
void test() {
|
||||
int[] array2 = new int[SIZE];
|
||||
array1[2] = 0;
|
||||
array1 = array1;
|
||||
for (long i = 301; i > 2; i -= 2) {
|
||||
int j = 1;
|
||||
do {
|
||||
for (int k = (int) i; k < 1; k++) { }
|
||||
} while (++j < 4);
|
||||
}
|
||||
|
||||
counter++;
|
||||
if (counter == ITERATIONS) {
|
||||
throw new MyException();
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
try {
|
||||
var test = new TestLoopLimitNodeElimination();
|
||||
while (true) {
|
||||
test.test();
|
||||
}
|
||||
} catch (MyException e) {
|
||||
// expected
|
||||
}
|
||||
}
|
||||
}
|
||||
|
1939
test/hotspot/jtreg/compiler/loopopts/TestNestedIrreducibleLoops.jasm
Normal file
1939
test/hotspot/jtreg/compiler/loopopts/TestNestedIrreducibleLoops.jasm
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,45 @@
|
||||
/*
|
||||
* Copyright (c) 2021, 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 8253353
|
||||
* @summary Tests custom bytecode with deep nested irreducible loops.
|
||||
*
|
||||
* @compile TestNestedIrreducibleLoops.jasm
|
||||
* @run main/othervm -Xbatch -XX:CompileCommand=dontinline,TestNestedIrreducibleLoops::*
|
||||
* -XX:CompileCommand=exclude,TestNestedIrreducibleLoopsMain::main
|
||||
* TestNestedIrreducibleLoopsMain
|
||||
*/
|
||||
|
||||
public class TestNestedIrreducibleLoopsMain {
|
||||
public static void main(String[] args) {
|
||||
TestNestedIrreducibleLoops t = new TestNestedIrreducibleLoops();
|
||||
t.loopCounter = 3;
|
||||
int j;
|
||||
for (int i = 0; i < 11000; i++) {
|
||||
t.start = i & 0x3ff;
|
||||
j = t.test(); // Produces deep nested irreducible loops
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,81 @@
|
||||
/*
|
||||
* Copyright (c) 2021, Huawei Technologies Co. Ltd. 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.
|
||||
*/
|
||||
|
||||
package compiler.vectorapi;
|
||||
|
||||
import jdk.incubator.vector.IntVector;
|
||||
import jdk.incubator.vector.LongVector;
|
||||
import jdk.incubator.vector.VectorSpecies;
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8260339
|
||||
* @summary StoreVectorNode is not considered with -XX:+OptimizeFill
|
||||
* @modules jdk.incubator.vector
|
||||
*
|
||||
* @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+OptimizeFill compiler.vectorapi.TestLoopStoreVector
|
||||
*/
|
||||
|
||||
public class TestLoopStoreVector {
|
||||
static final VectorSpecies<Integer> SPECIESi = IntVector.SPECIES_PREFERRED;
|
||||
static final VectorSpecies<Long> SPECIESl = LongVector.SPECIES_PREFERRED;
|
||||
|
||||
static final int INVOC_COUNT = 5000;
|
||||
static final int size = 64;
|
||||
|
||||
static int[] ai = {20, 21, 02, 14, 83, 119, 101, 101, 116, 121, 44, 32,
|
||||
73, 32, 76, 79, 86, 69, 32, 89, 79, 85, 32, 102, 111,
|
||||
114, 101, 118, 101, 114, 33, 32, 32, 32, 45, 45, 32,
|
||||
32, 32, 66, 121, 32, 87, 97, 110, 103, 72, 117, 97,
|
||||
110, 103,46, 76, 105, 102, 101, 32, 105, 115, 32, 116,
|
||||
104, 101, 32};
|
||||
static long[] al = {102, 108, 111, 119, 101, 114, 32, 102, 111, 114, 32,
|
||||
119, 104, 105, 99, 104, 32, 108, 111, 118, 101, 32,
|
||||
105, 115, 32, 116, 104, 101, 32, 104, 111, 110, 101,
|
||||
121, 46, 32, 87, 101, 32, 119, 105, 108, 108, 32, 115,
|
||||
116, 105, 99, 107, 32, 116, 111, 103, 101, 116, 104,
|
||||
101, 114, 32, 33, 33, 33, 33, 32};
|
||||
|
||||
public static void testVectorCastL2I(long[] input, int[] output, VectorSpecies<Long> speciesl, VectorSpecies<Integer> speciesi) {
|
||||
LongVector av = LongVector.fromArray(speciesl, input, 0);
|
||||
IntVector bv = (IntVector) av.castShape(speciesi, 0);
|
||||
bv.intoArray(output, 0);
|
||||
}
|
||||
|
||||
public static int test0() {
|
||||
for (int i = 0; i < 1000; i++) {
|
||||
testVectorCastL2I(al, ai, SPECIESl, SPECIESi);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
for (int i = 0; i < INVOC_COUNT; i++) {
|
||||
test0();
|
||||
}
|
||||
for (int i = 0; i < 64; i++) {
|
||||
System.out.print(ai[i] + " ");
|
||||
}
|
||||
System.out.println("");
|
||||
}
|
||||
}
|
@ -0,0 +1,162 @@
|
||||
/*
|
||||
* Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
import jdk.incubator.vector.*;
|
||||
import jdk.internal.vm.annotation.ForceInline;
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.Test;
|
||||
import org.testng.annotations.DataProvider;
|
||||
|
||||
import java.lang.invoke.MethodHandles;
|
||||
import java.lang.invoke.VarHandle;
|
||||
import java.nio.ByteOrder;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.function.IntFunction;
|
||||
import java.util.function.IntUnaryOperator;
|
||||
import jdk.incubator.vector.VectorShape;
|
||||
import jdk.incubator.vector.VectorSpecies;
|
||||
import jdk.internal.vm.annotation.ForceInline;
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8260473
|
||||
* @requires vm.gc.Z
|
||||
* @modules jdk.incubator.vector
|
||||
* @modules java.base/jdk.internal.vm.annotation
|
||||
* @run testng/othervm -XX:CompileCommand=compileonly,jdk/incubator/vector/ByteVector.fromByteBuffer
|
||||
* -XX:-TieredCompilation -XX:CICompilerCount=1 -XX:+UseZGC -Xbatch -Xmx256m VectorRebracket128Test
|
||||
*/
|
||||
|
||||
@Test
|
||||
public class VectorRebracket128Test {
|
||||
static final int INVOC_COUNT = Integer.getInteger("jtreg.compiler.vectorapi.vectorrebracket128test.loop-iterations", 1000);
|
||||
static final int NUM_ITER = 200 * INVOC_COUNT;
|
||||
|
||||
static final VectorSpecies<Integer> ispec128 = IntVector.SPECIES_128;
|
||||
static final VectorSpecies<Float> fspec128 = FloatVector.SPECIES_128;
|
||||
static final VectorSpecies<Long> lspec128 = LongVector.SPECIES_128;
|
||||
static final VectorSpecies<Double> dspec128 = DoubleVector.SPECIES_128;
|
||||
static final VectorSpecies<Byte> bspec128 = ByteVector.SPECIES_128;
|
||||
static final VectorSpecies<Short> sspec128 = ShortVector.SPECIES_128;
|
||||
|
||||
static <T> IntFunction<T> withToString(String s, IntFunction<T> f) {
|
||||
return new IntFunction<T>() {
|
||||
@Override
|
||||
public T apply(int v) {
|
||||
return f.apply(v);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return s;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
interface ToByteF {
|
||||
byte apply(int i);
|
||||
}
|
||||
|
||||
static byte[] fill_byte(int s , ToByteF f) {
|
||||
return fill_byte(new byte[s], f);
|
||||
}
|
||||
|
||||
static byte[] fill_byte(byte[] a, ToByteF f) {
|
||||
for (int i = 0; i < a.length; i++) {
|
||||
a[i] = f.apply(i);
|
||||
}
|
||||
return a;
|
||||
}
|
||||
|
||||
static final List<IntFunction<byte[]>> BYTE_GENERATORS = List.of(
|
||||
withToString("byte(i)", (int s) -> {
|
||||
return fill_byte(s, i -> (byte)(i+1));
|
||||
})
|
||||
);
|
||||
|
||||
@DataProvider
|
||||
public Object[][] byteUnaryOpProvider() {
|
||||
return BYTE_GENERATORS.stream().
|
||||
map(f -> new Object[]{f}).
|
||||
toArray(Object[][]::new);
|
||||
}
|
||||
|
||||
static
|
||||
void checkPartialResult(VectorSpecies<?> a, VectorSpecies<?> b,
|
||||
byte[] input, byte[] output, byte[] expected,
|
||||
int part, int origin) {
|
||||
if (Arrays.equals(expected, output)) {
|
||||
return;
|
||||
}
|
||||
int block;
|
||||
block = Math.min(a.vectorByteSize(), b.vectorByteSize());
|
||||
|
||||
System.out.println("input: "+Arrays.toString(input));
|
||||
System.out.println("Failing with "+a+"->"+b+
|
||||
" (reinterpret)"+
|
||||
", block=" + block +
|
||||
", part=" + part +
|
||||
", origin=" + origin);
|
||||
System.out.println("expect: "+Arrays.toString(expected));
|
||||
System.out.println("output: "+Arrays.toString(output));
|
||||
Assert.assertEquals(expected, output);
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
static <E,F>
|
||||
void testVectorRebracket(VectorSpecies<E> a, VectorSpecies<F> b, byte[] input, byte[] output) {
|
||||
Vector<E> av = a.fromByteArray(input, 0, ByteOrder.nativeOrder());
|
||||
int block;
|
||||
assert(input.length == output.length);
|
||||
|
||||
block = Math.min(a.vectorByteSize(), b.vectorByteSize());
|
||||
if (false)
|
||||
System.out.println("testing "+a+"->"+b+
|
||||
(false?" (lanewise)":" (reinterpret)")+
|
||||
", block=" + block);
|
||||
byte[] expected;
|
||||
int origin;
|
||||
|
||||
int part = 0;
|
||||
Vector<F> bv = av.reinterpretShape(b, part);
|
||||
bv.intoByteArray(output, 0, ByteOrder.nativeOrder());
|
||||
// in-place copy, no resize
|
||||
expected = input;
|
||||
origin = 0;
|
||||
checkPartialResult(a, b, input, output, expected,
|
||||
part, origin);
|
||||
|
||||
}
|
||||
|
||||
@Test(dataProvider = "byteUnaryOpProvider")
|
||||
static void testRebracket128(IntFunction<byte[]> fa) {
|
||||
byte[] barr = fa.apply(128/Byte.SIZE);
|
||||
byte[] bout = new byte[barr.length];
|
||||
for (int i = 0; i < NUM_ITER; i++) {
|
||||
testVectorRebracket(bspec128, bspec128, barr, bout);
|
||||
testVectorRebracket(bspec128, sspec128, barr, bout);
|
||||
testVectorRebracket(bspec128, ispec128, barr, bout);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -828,7 +828,6 @@ javax/script/Test7.java 8239361 generic-
|
||||
jdk/jfr/event/runtime/TestNetworkUtilizationEvent.java 8228990,8229370 generic-all
|
||||
jdk/jfr/event/compiler/TestCodeSweeper.java 8225209 generic-all
|
||||
jdk/jfr/event/os/TestThreadContextSwitches.java 8247776 windows-all
|
||||
jdk/jfr/jmx/streaming/TestRotate.java 8257215 generic-all
|
||||
jdk/jfr/startupargs/TestStartName.java 8214685 windows-x64
|
||||
jdk/jfr/startupargs/TestStartDuration.java 8214685 windows-x64
|
||||
|
||||
|
@ -27,9 +27,10 @@ import static org.testng.Assert.assertEquals;
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @run testng Insert
|
||||
* @bug 4914802 8257511
|
||||
* @summary Test StringBuilder.insert sanity tests
|
||||
* @run testng/othervm -XX:-CompactStrings Insert
|
||||
* @run testng/othervm -XX:+CompactStrings Insert
|
||||
*/
|
||||
@Test
|
||||
public class Insert {
|
||||
|
@ -44,7 +44,7 @@ import jdk.management.jfr.RemoteRecordingStream;
|
||||
* @summary Tests that streaming can work over chunk rotations
|
||||
* @requires vm.hasJFR
|
||||
* @library /test/lib /test/jdk
|
||||
* @run main/othervm jdk.jfr.jmx.streaming.TestRotate
|
||||
* @run main/othervm -Xlog:jfr=debug jdk.jfr.jmx.streaming.TestRotate
|
||||
*/
|
||||
public class TestRotate {
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user