This commit is contained in:
Jesper Wilhelmsson 2020-12-17 03:04:19 +00:00
commit 11bd7a814f
41 changed files with 852 additions and 223 deletions

View File

@ -467,6 +467,10 @@ void ClassListParser::resolve_indy(Symbol* class_name_symbol, TRAPS) {
Klass* klass = SystemDictionary::resolve_or_fail(class_name_symbol, class_loader, protection_domain, true, THREAD); // FIXME should really be just a lookup
if (klass != NULL && klass->is_instance_klass()) {
InstanceKlass* ik = InstanceKlass::cast(klass);
if (SystemDictionaryShared::has_class_failed_verification(ik)) {
// don't attempt to resolve indy on classes that has previously failed verification
return;
}
MetaspaceShared::try_link_class(ik, THREAD);
assert(!HAS_PENDING_EXCEPTION, "unexpected exception");

View File

@ -353,6 +353,7 @@
/* Panama Support */ \
template(jdk_internal_invoke_NativeEntryPoint, "jdk/internal/invoke/NativeEntryPoint") \
template(jdk_internal_invoke_NativeEntryPoint_signature, "Ljdk/internal/invoke/NativeEntryPoint;") \
template(jdk_incubator_foreign_MemoryAccess, "jdk/incubator/foreign/MemoryAccess") \
\
/* Support for JVMCI */ \
JVMCI_VM_SYMBOLS_DO(template, do_alias) \

View File

@ -1270,7 +1270,6 @@ void nmethod::make_unloaded() {
JVMCINMethodData* nmethod_data = jvmci_nmethod_data();
if (nmethod_data != NULL) {
nmethod_data->invalidate_nmethod_mirror(this);
nmethod_data->clear_nmethod_mirror(this);
}
#endif
}

View File

@ -30,11 +30,12 @@
#include "runtime/thread.hpp"
JfrAllocationTracer::JfrAllocationTracer(const Klass* klass, HeapWord* obj, size_t alloc_size, bool outside_tlab, Thread* thread) : _tl(NULL) {
JfrObjectAllocationSample::send_event(klass, alloc_size, outside_tlab, thread);
if (LeakProfiler::is_running()) {
_tl = thread->jfr_thread_local();
LeakProfiler::sample(obj, alloc_size, thread->as_Java_thread());
}
// Let this happen after LeakProfiler::sample, to possibly reuse a cached stacktrace.
JfrObjectAllocationSample::send_event(klass, alloc_size, outside_tlab, thread);
}
JfrAllocationTracer::~JfrAllocationTracer() {

View File

@ -714,6 +714,12 @@ void JVMCINMethodData::invalidate_nmethod_mirror(nmethod* nm) {
HotSpotJVMCI::InstalledCode::set_entryPoint(jvmciEnv, nmethod_mirror, 0);
}
}
if (_nmethod_mirror_index != -1 && nm->is_unloaded()) {
// Drop the reference to the nmethod mirror object but don't clear the actual oop reference. Otherwise
// it would appear that the nmethod didn't need to be unloaded in the first place.
_nmethod_mirror_index = -1;
}
}
JVMCIRuntime::JVMCIRuntime(int id) {

View File

@ -1601,6 +1601,18 @@ bool MethodData::profile_unsafe(const methodHandle& m, int bci) {
return false;
}
bool MethodData::profile_memory_access(const methodHandle& m, int bci) {
Bytecode_invoke inv(m , bci);
if (inv.is_invokestatic()) {
if (inv.klass() == vmSymbols::jdk_incubator_foreign_MemoryAccess()) {
if (inv.name()->starts_with("get") || inv.name()->starts_with("set")) {
return true;
}
}
}
return false;
}
int MethodData::profile_arguments_flag() {
return TypeProfileLevel % 10;
}
@ -1630,6 +1642,10 @@ bool MethodData::profile_arguments_for_invoke(const methodHandle& m, int bci) {
return true;
}
if (profile_memory_access(m, bci)) {
return true;
}
assert(profile_arguments_jsr292_only(), "inconsistent");
return profile_jsr292(m, bci);
}

View File

@ -2148,6 +2148,7 @@ private:
static bool profile_jsr292(const methodHandle& m, int bci);
static bool profile_unsafe(const methodHandle& m, int bci);
static bool profile_memory_access(const methodHandle& m, int bci);
static int profile_arguments_flag();
static bool profile_all_arguments();
static bool profile_arguments_for_invoke(const methodHandle& m, int bci);

View File

@ -1451,6 +1451,7 @@ public:
// Mark an IfNode as being dominated by a prior test,
// without actually altering the CFG (and hence IDOM info).
void dominated_by( Node *prevdom, Node *iff, bool flip = false, bool exclude_loop_predicate = false );
bool no_dependent_zero_check(Node* n) const;
// Split Node 'n' through merge point
Node *split_thru_region( Node *n, Node *region );

View File

@ -278,18 +278,23 @@ void PhaseIdealLoop::dominated_by( Node *prevdom, Node *iff, bool flip, bool exc
return; // Let IGVN transformation change control dependence.
}
IdealLoopTree *old_loop = get_loop(dp);
IdealLoopTree* old_loop = get_loop(dp);
for (DUIterator_Fast imax, i = dp->fast_outs(imax); i < imax; i++) {
Node* cd = dp->fast_out(i); // Control-dependent node
if (cd->depends_only_on_test()) {
// Do not rewire Div and Mod nodes which could have a zero divisor to avoid skipping their zero check.
if (cd->depends_only_on_test() && no_dependent_zero_check(cd)) {
assert(cd->in(0) == dp, "");
_igvn.replace_input_of(cd, 0, prevdom);
set_early_ctrl(cd, false);
IdealLoopTree *new_loop = get_loop(get_ctrl(cd));
IdealLoopTree* new_loop = get_loop(get_ctrl(cd));
if (old_loop != new_loop) {
if (!old_loop->_child) old_loop->_body.yank(cd);
if (!new_loop->_child) new_loop->_body.push(cd);
if (!old_loop->_child) {
old_loop->_body.yank(cd);
}
if (!new_loop->_child) {
new_loop->_body.push(cd);
}
}
--i;
--imax;
@ -297,6 +302,25 @@ void PhaseIdealLoop::dominated_by( Node *prevdom, Node *iff, bool flip, bool exc
}
}
// Check if the type of a divisor of a Div or Mod node includes zero.
bool PhaseIdealLoop::no_dependent_zero_check(Node* n) const {
switch (n->Opcode()) {
case Op_DivI:
case Op_ModI: {
// Type of divisor includes 0?
const TypeInt* type_divisor = _igvn.type(n->in(2))->is_int();
return (type_divisor->_hi < 0 || type_divisor->_lo > 0);
}
case Op_DivL:
case Op_ModL: {
// Type of divisor includes 0?
const TypeLong* type_divisor = _igvn.type(n->in(2))->is_long();
return (type_divisor->_hi < 0 || type_divisor->_lo > 0);
}
}
return true;
}
//------------------------------has_local_phi_input----------------------------
// Return TRUE if 'n' has Phi inputs from its local block and no other
// block-local inputs (all non-local-phi inputs come from earlier blocks)

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 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
@ -25,6 +25,7 @@
package com.sun.crypto.provider;
import java.util.Arrays;
import java.util.Locale;
import java.security.*;
@ -347,28 +348,40 @@ public final class RSACipher extends CipherSpi {
throw new IllegalBlockSizeException("Data must not be longer "
+ "than " + buffer.length + " bytes");
}
byte[] paddingCopy = null;
byte[] result = null;
try {
byte[] data;
switch (mode) {
case MODE_SIGN:
data = padding.pad(buffer, 0, bufOfs);
return RSACore.rsa(data, privateKey, true);
paddingCopy = padding.pad(buffer, 0, bufOfs);
result = RSACore.rsa(paddingCopy, privateKey, true);
break;
case MODE_VERIFY:
byte[] verifyBuffer = RSACore.convert(buffer, 0, bufOfs);
data = RSACore.rsa(verifyBuffer, publicKey);
return padding.unpad(data);
paddingCopy = RSACore.rsa(verifyBuffer, publicKey);
result = padding.unpad(paddingCopy);
break;
case MODE_ENCRYPT:
data = padding.pad(buffer, 0, bufOfs);
return RSACore.rsa(data, publicKey);
paddingCopy = padding.pad(buffer, 0, bufOfs);
result = RSACore.rsa(paddingCopy, publicKey);
break;
case MODE_DECRYPT:
byte[] decryptBuffer = RSACore.convert(buffer, 0, bufOfs);
data = RSACore.rsa(decryptBuffer, privateKey, false);
return padding.unpad(data);
paddingCopy = RSACore.rsa(decryptBuffer, privateKey, false);
result = padding.unpad(paddingCopy);
break;
default:
throw new AssertionError("Internal error");
}
return result;
} finally {
Arrays.fill(buffer, 0, bufOfs, (byte)0);
bufOfs = 0;
if (paddingCopy != null // will not happen
&& paddingCopy != buffer // already cleaned
&& paddingCopy != result) { // DO NOT CLEAN, THIS IS RESULT!
Arrays.fill(paddingCopy, (byte)0);
}
}
}
@ -404,6 +417,7 @@ public final class RSACipher extends CipherSpi {
byte[] result = doFinal();
int n = result.length;
System.arraycopy(result, 0, out, outOfs, n);
Arrays.fill(result, (byte)0);
return n;
}
@ -414,15 +428,19 @@ public final class RSACipher extends CipherSpi {
if ((encoded == null) || (encoded.length == 0)) {
throw new InvalidKeyException("Could not obtain encoded key");
}
if (encoded.length > buffer.length) {
throw new InvalidKeyException("Key is too long for wrapping");
}
update(encoded, 0, encoded.length);
try {
return doFinal();
} catch (BadPaddingException e) {
// should not occur
throw new InvalidKeyException("Wrapping failed", e);
if (encoded.length > buffer.length) {
throw new InvalidKeyException("Key is too long for wrapping");
}
update(encoded, 0, encoded.length);
try {
return doFinal();
} catch (BadPaddingException e) {
// should not occur
throw new InvalidKeyException("Wrapping failed", e);
}
} finally {
Arrays.fill(encoded, (byte)0);
}
}
@ -453,20 +471,26 @@ public final class RSACipher extends CipherSpi {
throw new InvalidKeyException("Unwrapping failed", e);
}
if (isTlsRsaPremasterSecret) {
if (!(spec instanceof TlsRsaPremasterSecretParameterSpec)) {
throw new IllegalStateException(
"No TlsRsaPremasterSecretParameterSpec specified");
try {
if (isTlsRsaPremasterSecret) {
if (!(spec instanceof TlsRsaPremasterSecretParameterSpec)) {
throw new IllegalStateException(
"No TlsRsaPremasterSecretParameterSpec specified");
}
// polish the TLS premaster secret
encoded = KeyUtil.checkTlsPreMasterSecretKey(
((TlsRsaPremasterSecretParameterSpec) spec).getClientVersion(),
((TlsRsaPremasterSecretParameterSpec) spec).getServerVersion(),
random, encoded, (failover != null));
}
// polish the TLS premaster secret
encoded = KeyUtil.checkTlsPreMasterSecretKey(
((TlsRsaPremasterSecretParameterSpec)spec).getClientVersion(),
((TlsRsaPremasterSecretParameterSpec)spec).getServerVersion(),
random, encoded, (failover != null));
return ConstructKeys.constructKey(encoded, algorithm, type);
} finally {
if (encoded != null) {
Arrays.fill(encoded, (byte) 0);
}
}
return ConstructKeys.constructKey(encoded, algorithm, type);
}
// see JCE spec

View File

@ -66,7 +66,7 @@ import static java.util.Objects.requireNonNull;
* @see Class#getEnumConstants()
* @see java.util.EnumSet
* @see java.util.EnumMap
* @jls 8.9 Enum Types
* @jls 8.9 Enum Classes
* @jls 8.9.3 Enum Members
* @since 1.5
*/

View File

@ -26,16 +26,16 @@
package java.lang.annotation;
/**
* The common interface extended by all annotation types. Note that an
* The common interface extended by all annotation interfaces. Note that an
* interface that manually extends this one does <i>not</i> define
* an annotation type. Also note that this interface does not itself
* define an annotation type.
* an annotation interface. Also note that this interface does not itself
* define an annotation interface.
*
* More information about annotation types can be found in section {@jls 9.6} of
* <cite>The Java Language Specification</cite>.
* More information about annotation interfaces can be found in section
* {@jls 9.6} of <cite>The Java Language Specification</cite>.
*
* The {@link java.lang.reflect.AnnotatedElement} interface discusses
* compatibility concerns when evolving an annotation type from being
* compatibility concerns when evolving an annotation interface from being
* non-repeatable to being repeatable.
*
* @author Josh Bloch
@ -46,7 +46,7 @@ public interface Annotation {
* Returns true if the specified object represents an annotation
* that is logically equivalent to this one. In other words,
* returns true if the specified object is an instance of the same
* annotation type as this instance, all of whose members are equal
* annotation interface as this instance, all of whose members are equal
* to the corresponding member of this annotation, as defined below:
* <ul>
* <li>Two corresponding primitive typed members whose values are
@ -127,15 +127,15 @@ public interface Annotation {
String toString();
/**
* Returns the annotation type of this annotation.
* Returns the annotation interface of this annotation.
*
* @apiNote Implementation-dependent classes are used to provide
* the implementations of annotations. Therefore, calling {@link
* Object#getClass getClass} on an annotation will return an
* implementation-dependent class. In contrast, this method will
* reliably return the annotation type of the annotation.
* reliably return the annotation interface of the annotation.
*
* @return the annotation type of this annotation
* @return the annotation interface of this annotation
* @see Enum#getDeclaringClass
*/
Class<? extends Annotation> annotationType();

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 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
@ -27,23 +27,23 @@ package java.lang.annotation;
/**
* If the annotation {@code @Documented} is present on the declaration
* of an annotation type <i>A</i>, then any {@code @A} annotation on
* of an annotation interface <i>A</i>, then any {@code @A} annotation on
* an element is considered part of the element's public contract.
*
* In more detail, when an annotation type <i>A</i> is annotated with
* {@code Documented}, the presence and value of annotations of type
* <i>A</i> are a part of the public contract of the elements <i>A</i>
* In more detail, when an annotation interface <i>A</i> is annotated with
* {@code Documented}, the presence and value of <i>A</i> annotations
* are a part of the public contract of the elements <i>A</i>
* annotates.
*
* Conversely, if an annotation type <i>B</i> is <em>not</em>
* Conversely, if an annotation interface <i>B</i> is <em>not</em>
* annotated with {@code Documented}, the presence and value of
* <i>B</i> annotations are <em>not</em> part of the public contract
* of the elements <i>B</i> annotates.
*
* Concretely, if an annotation type is annotated with {@code
* Documented}, by default a tool like javadoc will display
* annotations of that type in its output while annotations of
* annotation types without {@code Documented} will not be displayed.
* Concretely, if an annotation interface is annotated with {@code Documented},
* by default a tool like javadoc will display annotations of that interface
* in its output while annotations of annotation interfaces without
* {@code Documented} will not be displayed.
*
* @author Joshua Bloch
* @since 1.5

View File

@ -26,7 +26,7 @@
package java.lang.annotation;
/**
* The constants of this enumerated type provide a simple classification of the
* The constants of this enumerated class provide a simple classification of the
* syntactic locations where annotations may appear in a Java program. These
* constants are used in {@link java.lang.annotation.Target Target}
* meta-annotations to specify where it is legal to write annotations of a
@ -42,23 +42,25 @@ package java.lang.annotation;
* #MODULE}, {@link #PARAMETER}, {@link #TYPE}, and {@link #TYPE_PARAMETER}
* correspond to the declaration contexts in JLS 9.6.4.1.
*
* <p>For example, an annotation whose type is meta-annotated with
* <p>For example, an annotation whose interface is meta-annotated with
* {@code @Target(ElementType.FIELD)} may only be written as a modifier for a
* field declaration.
*
* <p>The constant {@link #TYPE_USE} corresponds to the type contexts in JLS
* 4.11, as well as to two declaration contexts: type declarations (including
* annotation type declarations) and type parameter declarations.
* 4.11, as well as to two declaration contexts: class and interface
* declarations (including annotation declarations) and type parameter
* declarations.
*
* <p>For example, an annotation whose type is meta-annotated with
* {@code @Target(ElementType.TYPE_USE)} may be written on the type of a field
* (or within the type of the field, if it is a nested, parameterized, or array
* type), and may also appear as a modifier for, say, a class declaration.
* <p>For example, an annotation whose interface is meta-annotated with
* {@code @Target(ElementType.TYPE_USE)} may be written on the class or
* interface of a field (or within the class or interface of the field, if it
* is a nested or parameterized class or interface, or array class), and may
* also appear as a modifier for, say, a class declaration.
*
* <p>The {@code TYPE_USE} constant includes type declarations and type
* parameter declarations as a convenience for designers of type checkers which
* give semantics to annotation types. For example, if the annotation type
* {@code NonNull} is meta-annotated with
* <p>The {@code TYPE_USE} constant includes class and interface declarations
* and type parameter declarations as a convenience for designers of
* type checkers which give semantics to annotation interfaces. For example,
* if the annotation interface {@code NonNull} is meta-annotated with
* {@code @Target(ElementType.TYPE_USE)}, then {@code @NonNull}
* {@code class C {...}} could be treated by a type checker as indicating that
* all variables of class {@code C} are non-null, while still allowing
@ -71,7 +73,7 @@ package java.lang.annotation;
* @jls 4.1 The Kinds of Types and Values
*/
public enum ElementType {
/** Class, interface (including annotation type), enum, or record
/** Class, interface (including annotation interface), enum, or record
* declaration */
TYPE,
@ -90,7 +92,7 @@ public enum ElementType {
/** Local variable declaration */
LOCAL_VARIABLE,
/** Annotation type declaration */
/** Annotation interface declaration (Formerly known as an annotation type.) */
ANNOTATION_TYPE,
/** Package declaration */

View File

@ -27,8 +27,8 @@ package java.lang.annotation;
/**
* Thrown to indicate that a program has attempted to access an element of
* an annotation type that was added to the annotation type definition after
* the annotation was compiled (or serialized). This exception will not be
* an annotation interface that was added to the annotation interface definition
* after the annotation was compiled (or serialized). This exception will not be
* thrown if the new element has a default value.
* This exception can be thrown by the {@linkplain
* java.lang.reflect.AnnotatedElement API used to read annotations
@ -43,7 +43,7 @@ public class IncompleteAnnotationException extends RuntimeException {
private static final long serialVersionUID = 8445097402741811912L;
/**
* The annotation type.
* The annotation interface.
*/
private Class<? extends Annotation> annotationType;
/**
@ -53,9 +53,9 @@ public class IncompleteAnnotationException extends RuntimeException {
/**
* Constructs an IncompleteAnnotationException to indicate that
* the named element was missing from the specified annotation type.
* the named element was missing from the specified annotation interface.
*
* @param annotationType the Class object for the annotation type
* @param annotationType the Class object for the annotation interface
* @param elementName the name of the missing element
* @throws NullPointerException if either parameter is {@code null}
*/
@ -70,10 +70,10 @@ public class IncompleteAnnotationException extends RuntimeException {
}
/**
* Returns the Class object for the annotation type with the
* Returns the Class object for the annotation interface with the
* missing element.
*
* @return the Class object for the annotation type with the
* @return the Class object for the annotation interface with the
* missing element
*/
public Class<? extends Annotation> annotationType() {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 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
@ -26,18 +26,18 @@
package java.lang.annotation;
/**
* Indicates that an annotation type is automatically inherited. If
* an Inherited meta-annotation is present on an annotation type
* declaration, and the user queries the annotation type on a class
* declaration, and the class declaration has no annotation for this type,
* Indicates that an annotation interface is automatically inherited. If
* an Inherited meta-annotation is present on an annotation interface
* declaration, and the user queries the annotation interface on a class
* declaration, and the class declaration has no annotation for this interface,
* then the class's superclass will automatically be queried for the
* annotation type. This process will be repeated until an annotation for this
* type is found, or the top of the class hierarchy (Object)
* is reached. If no superclass has an annotation for this type, then
* annotation interface. This process will be repeated until an annotation for
* this interface is found, or the top of the class hierarchy (Object)
* is reached. If no superclass has an annotation for this interface, then
* the query will indicate that the class in question has no such annotation.
*
* <p>Note that this meta-annotation type has no effect if the annotated
* type is used to annotate anything other than a class. Note also
* <p>Note that this meta-annotation interface has no effect if the annotated
* interface is used to annotate anything other than a class. Note also
* that this meta-annotation only causes annotations to be inherited
* from superclasses; annotations on implemented interfaces have no
* effect.

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2015, 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
@ -26,24 +26,24 @@
package java.lang.annotation;
/**
* The annotation type {@code java.lang.annotation.Repeatable} is
* used to indicate that the annotation type whose declaration it
* The annotation interface {@code java.lang.annotation.Repeatable} is
* used to indicate that the annotation interface whose declaration it
* (meta-)annotates is <em>repeatable</em>. The value of
* {@code @Repeatable} indicates the <em>containing annotation
* type</em> for the repeatable annotation type.
* interface</em> for the repeatable annotation interface.
*
* @since 1.8
* @jls 9.6.3 Repeatable Annotation Types
* @jls 9.7.5 Multiple Annotations of the Same Type
* @jls 9.6.3 Repeatable Annotation Interfaces
* @jls 9.7.5 Multiple Annotations of the Same Interface
*/
@Documented
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.ANNOTATION_TYPE)
public @interface Repeatable {
/**
* Indicates the <em>containing annotation type</em> for the
* repeatable annotation type.
* @return the containing annotation type
* Indicates the <em>containing annotation interface</em> for the
* repeatable annotation interface.
* @return the containing annotation interface
*/
Class<? extends Annotation> value();
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 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
@ -26,15 +26,15 @@
package java.lang.annotation;
/**
* Indicates how long annotations with the annotated type are to
* Indicates how long annotations with the annotated interface are to
* be retained. If no Retention annotation is present on
* an annotation type declaration, the retention policy defaults to
* an annotation interface declaration, the retention policy defaults to
* {@code RetentionPolicy.CLASS}.
*
* <p>A Retention meta-annotation has effect only if the
* meta-annotated type is used directly for annotation. It has no
* effect if the meta-annotated type is used as a member type in
* another annotation type.
* meta-annotated interface is used directly for annotation. It has no
* effect if the meta-annotated interface is used as a member interface in
* another annotation interface.
*
* @author Joshua Bloch
* @since 1.5

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 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
@ -26,10 +26,10 @@
package java.lang.annotation;
/**
* Annotation retention policy. The constants of this enumerated type
* Annotation retention policy. The constants of this enumerated class
* describe the various policies for retaining annotations. They are used
* in conjunction with the {@link Retention} meta-annotation type to specify
* how long annotations are to be retained.
* in conjunction with the {@link Retention} meta-annotation interface to
* specify how long annotations are to be retained.
*
* @author Joshua Bloch
* @since 1.5

View File

@ -26,22 +26,22 @@
package java.lang.annotation;
/**
* Indicates the contexts in which an annotation type is applicable. The
* declaration contexts and type contexts in which an annotation type may be
* applicable are specified in JLS 9.6.4.1, and denoted in source code by enum
* constants of {@link ElementType java.lang.annotation.ElementType}.
* Indicates the contexts in which an annotation interface is applicable. The
* declaration contexts and type contexts in which an annotation interface may
* be applicable are specified in JLS 9.6.4.1, and denoted in source code by
* enum constants of {@link ElementType java.lang.annotation.ElementType}.
*
* <p>If an {@code @Target} meta-annotation is not present on an annotation type
* {@code T}, then an annotation of type {@code T} may be written as a
* modifier for any declaration except a type parameter declaration.
* <p>If an {@code @Target} meta-annotation is not present on an annotation
* interface {@code T}, then an annotation of type {@code T} may be written as
* a modifier for any declaration except a type parameter declaration.
*
* <p>If an {@code @Target} meta-annotation is present, the compiler will enforce
* the usage restrictions indicated by {@code ElementType}
* enum constants, in line with JLS 9.7.4.
*
* <p>For example, this {@code @Target} meta-annotation indicates that the
* declared type is itself a meta-annotation type. It can only be used on
* annotation type declarations:
* declared interface is itself a meta-annotation interface. It can only be
* used on annotation interface declarations:
* <pre>
* &#064;Target(ElementType.ANNOTATION_TYPE)
* public &#064;interface MetaAnnotationType {
@ -49,12 +49,13 @@ package java.lang.annotation;
* }
* </pre>
*
* <p>This {@code @Target} meta-annotation indicates that the declared type is
* intended solely for use as a member type in complex annotation type
* declarations. It cannot be used to annotate anything directly:
* <p>This {@code @Target} meta-annotation indicates that the declared class or
* interface is intended solely for use as a member class or interface in
* complex annotation interface declarations. It cannot be used to annotate
* anything directly:
* <pre>
* &#064;Target({})
* public &#064;interface MemberType {
* public &#064;interface MemberInterface {
* ...
* }
* </pre>
@ -72,16 +73,16 @@ package java.lang.annotation;
* @since 1.5
* @jls 9.6.4.1 @Target
* @jls 9.7.4 Where Annotations May Appear
* @jls 9.7.5 Multiple Annotations of the Same Type
* @jls 9.7.5 Multiple Annotations of the Same Interface
*/
@Documented
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.ANNOTATION_TYPE)
public @interface Target {
/**
* Returns an array of the kinds of elements an annotation type
* Returns an array of the kinds of elements an annotation interface
* can be applied to.
* @return an array of the kinds of elements an annotation type
* @return an array of the kinds of elements an annotation interface
* can be applied to
*/
ElementType[] value();

View File

@ -405,7 +405,7 @@ public final class Method extends Executable {
*
* @jls 8.4.3 Method Modifiers
* @jls 9.4 Method Declarations
* @jls 9.6.1 Annotation Type Elements
* @jls 9.6.1 Annotation Interface Elements
*/
public String toString() {
return sharedToString(Modifier.methodModifiers(),
@ -475,7 +475,7 @@ public final class Method extends Executable {
*
* @jls 8.4.3 Method Modifiers
* @jls 9.4 Method Declarations
* @jls 9.6.1 Annotation Type Elements
* @jls 9.6.1 Annotation Interface Elements
*/
@Override
public String toGenericString() {

View File

@ -29,21 +29,21 @@ package jdk.internal.access.foreign;
import jdk.internal.misc.ScopedMemoryAccess;
/**
* This proxy interface is required to allow instances of the {@code MemorySegment} interface (which is defined inside
* This abstract class is required to allow implementations of the {@code MemorySegment} interface (which is defined inside
* an incubating module) to be accessed from the memory access var handles.
*/
public interface MemorySegmentProxy {
public abstract class MemorySegmentProxy {
/**
* Check that memory access is within spatial bounds and that access is compatible with segment access modes.
* @throws UnsupportedOperationException if underlying segment has incompatible access modes (e.g. attempting to write
* a read-only segment).
* @throws IndexOutOfBoundsException if access is out-of-bounds.
*/
void checkAccess(long offset, long length, boolean readOnly);
long unsafeGetOffset();
Object unsafeGetBase();
boolean isSmall();
ScopedMemoryAccess.Scope scope();
public abstract void checkAccess(long offset, long length, boolean readOnly);
public abstract long unsafeGetOffset();
public abstract Object unsafeGetBase();
public abstract boolean isSmall();
public abstract ScopedMemoryAccess.Scope scope();
/* Helper functions for offset computations. These are required so that we can avoid issuing long opcodes
* (e.g. LMUL, LADD) when we're operating on 'small' segments (segments whose length can be expressed with an int).
@ -51,7 +51,7 @@ public interface MemorySegmentProxy {
* BCE when working with small segments. This workaround should be dropped when JDK-8223051 is resolved.
*/
static long addOffsets(long op1, long op2, MemorySegmentProxy segmentProxy) {
public static long addOffsets(long op1, long op2, MemorySegmentProxy segmentProxy) {
if (segmentProxy.isSmall()) {
// force ints for BCE
if (op1 > Integer.MAX_VALUE || op2 > Integer.MAX_VALUE
@ -74,7 +74,7 @@ public interface MemorySegmentProxy {
}
}
static long multiplyOffsets(long op1, long op2, MemorySegmentProxy segmentProxy) {
public static long multiplyOffsets(long op1, long op2, MemorySegmentProxy segmentProxy) {
if (segmentProxy.isSmall()) {
if (op1 > Integer.MAX_VALUE || op2 > Integer.MAX_VALUE
|| op1 < Integer.MIN_VALUE || op2 < Integer.MIN_VALUE) {

View File

@ -325,3 +325,6 @@ public class ScopedMemoryAccess {
}
// typed-ops here
// Note: all the accessor methods defined below take advantage of argument type profiling
// (see src/hotspot/share/oops/methodData.cpp) which greatly enhances performance when the same accessor
// method is used repeatedly with different 'base' objects.

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 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
@ -231,12 +231,14 @@ public final class RSACore {
if ((n == len + 1) && (b[0] == 0)) {
byte[] t = new byte[len];
System.arraycopy(b, 1, t, 0, len);
Arrays.fill(b, (byte)0);
return t;
}
// must be smaller
assert (n < len);
byte[] t = new byte[len];
System.arraycopy(b, 0, t, (len - n), n);
Arrays.fill(b, (byte)0);
return t;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 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
@ -238,41 +238,33 @@ public final class RSAPadding {
/**
* Pad the data and return the padded block.
*/
public byte[] pad(byte[] data, int ofs, int len)
throws BadPaddingException {
return pad(RSACore.convert(data, ofs, len));
public byte[] pad(byte[] data) throws BadPaddingException {
return pad(data, 0, data.length);
}
/**
* Pad the data and return the padded block.
*/
public byte[] pad(byte[] data) throws BadPaddingException {
if (data.length > maxDataSize) {
public byte[] pad(byte[] data, int ofs, int len)
throws BadPaddingException {
if (len > maxDataSize) {
throw new BadPaddingException("Data must be shorter than "
+ (maxDataSize + 1) + " bytes but received "
+ data.length + " bytes.");
+ len + " bytes.");
}
switch (type) {
case PAD_NONE:
return data;
return RSACore.convert(data, ofs, len);
case PAD_BLOCKTYPE_1:
case PAD_BLOCKTYPE_2:
return padV15(data);
return padV15(data, ofs, len);
case PAD_OAEP_MGF1:
return padOAEP(data);
return padOAEP(data, ofs, len);
default:
throw new AssertionError();
}
}
/**
* Unpad the padded block and return the data.
*/
public byte[] unpad(byte[] padded, int ofs, int len)
throws BadPaddingException {
return unpad(RSACore.convert(padded, ofs, len));
}
/**
* Unpad the padded block and return the data.
*/
@ -298,11 +290,10 @@ public final class RSAPadding {
/**
* PKCS#1 v1.5 padding (blocktype 1 and 2).
*/
private byte[] padV15(byte[] data) throws BadPaddingException {
private byte[] padV15(byte[] data, int ofs, int len) throws BadPaddingException {
byte[] padded = new byte[paddedSize];
System.arraycopy(data, 0, padded, paddedSize - data.length,
data.length);
int psSize = paddedSize - 3 - data.length;
System.arraycopy(data, ofs, padded, paddedSize - len, len);
int psSize = paddedSize - 3 - len;
int k = 0;
padded[k++] = 0;
padded[k++] = (byte)type;
@ -388,7 +379,7 @@ public final class RSAPadding {
* PKCS#1 v2.0 OAEP padding (MGF1).
* Paragraph references refer to PKCS#1 v2.1 (June 14, 2002)
*/
private byte[] padOAEP(byte[] M) throws BadPaddingException {
private byte[] padOAEP(byte[] M, int ofs, int len) throws BadPaddingException {
if (random == null) {
random = JCAUtil.getSecureRandom();
}
@ -415,7 +406,7 @@ public final class RSAPadding {
int dbLen = EM.length - dbStart;
// start of message M in EM
int mStart = paddedSize - M.length;
int mStart = paddedSize - len;
// build DB
// 2.b: Concatenate lHash, PS, a single octet with hexadecimal value
@ -424,7 +415,7 @@ public final class RSAPadding {
// (note that PS is all zeros)
System.arraycopy(lHash, 0, EM, dbStart, hLen);
EM[mStart - 1] = 1;
System.arraycopy(M, 0, EM, mStart, M.length);
System.arraycopy(M, ofs, EM, mStart, len);
// produce maskedDB
mgf.generateAndXor(EM, seedStart, seedLen, dbLen, EM, dbStart);

View File

@ -27,7 +27,7 @@ package javax.tools;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.Iterator;
import java.util.Objects;
import java.util.ServiceConfigurationError;
import java.util.ServiceLoader;
@ -118,8 +118,7 @@ public class ToolProvider {
try {
ServiceLoader<T> sl = ServiceLoader.load(clazz, ClassLoader.getSystemClassLoader());
for (Iterator<T> iter = sl.iterator(); iter.hasNext(); ) {
T tool = iter.next();
for (T tool : sl) {
if (matches(tool, moduleName))
return tool;
}
@ -140,7 +139,7 @@ public class ToolProvider {
PrivilegedAction<Boolean> pa = () -> {
Module toolModule = tool.getClass().getModule();
String toolModuleName = toolModule.getName();
return toolModuleName.equals(moduleName);
return Objects.equals(toolModuleName, moduleName);
};
return AccessController.doPrivileged(pa);
}

View File

@ -88,6 +88,10 @@ public final class MemoryAccess {
return MemoryHandles.varHandle(carrier, 1, elementLayout.order());
}
// Note: all the accessor methods defined below take advantage of argument type profiling
// (see src/hotspot/share/oops/methodData.cpp) which greatly enhances performance when the same accessor
// method is used repeatedly with different segment kinds (e.g. on-heap vs. off-heap).
/**
* Reads a byte from given segment and offset.
*

View File

@ -53,7 +53,7 @@ import java.util.function.IntFunction;
* are defined for each memory segment kind, see {@link NativeMemorySegmentImpl}, {@link HeapMemorySegmentImpl} and
* {@link MappedMemorySegmentImpl}.
*/
public abstract class AbstractMemorySegmentImpl implements MemorySegment, MemorySegmentProxy {
public abstract class AbstractMemorySegmentImpl extends MemorySegmentProxy implements MemorySegment {
private static final ScopedMemoryAccess SCOPED_MEMORY_ACCESS = ScopedMemoryAccess.getScopedMemoryAccess();

View File

@ -95,6 +95,8 @@ public class DeprecatedListWriter extends SubWriterHolderWriter {
return "enum.constant";
case ANNOTATION_TYPE_MEMBER:
return "annotation.type.member";
case RECORD_CLASS:
return "record.class";
default:
throw new AssertionError("unknown kind: " + kind);
}
@ -120,6 +122,8 @@ public class DeprecatedListWriter extends SubWriterHolderWriter {
return "doclet.Errors";
case ANNOTATION_TYPE:
return "doclet.Annotation_Types";
case RECORD_CLASS:
return "doclet.RecordClasses";
case FIELD:
return "doclet.Fields";
case METHOD:
@ -155,6 +159,8 @@ public class DeprecatedListWriter extends SubWriterHolderWriter {
return "doclet.errors";
case ANNOTATION_TYPE:
return "doclet.annotation_types";
case RECORD_CLASS:
return "doclet.record_classes";
case FIELD:
return "doclet.fields";
case METHOD:
@ -190,6 +196,8 @@ public class DeprecatedListWriter extends SubWriterHolderWriter {
return "doclet.Errors";
case ANNOTATION_TYPE:
return "doclet.AnnotationType";
case RECORD_CLASS:
return "doclet.Record";
case FIELD:
return "doclet.Field";
case METHOD:
@ -229,6 +237,7 @@ public class DeprecatedListWriter extends SubWriterHolderWriter {
case EXCEPTION:
case ERROR:
case ANNOTATION_TYPE:
case RECORD_CLASS:
writerMap.put(kind, classW);
break;
case FIELD:
@ -407,6 +416,7 @@ public class DeprecatedListWriter extends SubWriterHolderWriter {
case CLASS:
case ENUM:
case ANNOTATION_TYPE:
case RECORD:
writer = new NestedClassWriterImpl(this);
break;
case FIELD:

View File

@ -99,6 +99,7 @@ doclet.Annotation_Type_Members=Annotation Type Elements
doclet.for_removal=for removal
doclet.annotation_types=annotation types
doclet.annotation_type_members=annotation type elements
doclet.record_classes=record classes
doclet.Generated_Docs_Untitled=Generated Documentation (Untitled)
doclet.Other_Packages=Other Packages
doclet.Description=Description

View File

@ -142,6 +142,7 @@ doclet.Method_Summary=Method Summary
doclet.Record_Summary=Record Summary
doclet.Interfaces=Interfaces
doclet.Enums=Enums
doclet.RecordClasses=Record Classes
doclet.AnnotationTypes=Annotation Types
doclet.Exceptions=Exceptions
doclet.Errors=Errors

View File

@ -59,6 +59,7 @@ public class DeprecatedAPIListBuilder {
ENUM,
EXCEPTION, // no ElementKind mapping
ERROR, // no ElementKind mapping
RECORD_CLASS,
ANNOTATION_TYPE,
FIELD,
METHOD,
@ -144,6 +145,10 @@ public class DeprecatedAPIListBuilder {
eset = deprecatedMap.get(DeprElementKind.ENUM);
eset.add(e);
break;
case RECORD:
eset = deprecatedMap.get(DeprElementKind.RECORD_CLASS);
eset.add(e);
break;
}
}
composeDeprecatedList(rset, deprecatedMap.get(DeprElementKind.FIELD),

View File

@ -335,6 +335,7 @@ hotspot_appcds_dynamic = \
-runtime/cds/appcds/ExtraSymbols.java \
-runtime/cds/appcds/LambdaEagerInit.java \
-runtime/cds/appcds/LambdaProxyClasslist.java \
-runtime/cds/appcds/LambdaVerificationFailedDuringDump.java \
-runtime/cds/appcds/LongClassListPath.java \
-runtime/cds/appcds/LotsOfClasses.java \
-runtime/cds/appcds/MismatchedPathTriggerMemoryRelease.java \

View File

@ -0,0 +1,66 @@
/*
* 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 8257822
* @summary Verify that zero check is executed before division/modulo operation.
* @requires vm.compiler2.enabled
* @run main/othervm -Xcomp -XX:-TieredCompilation -XX:CompileOnly=compiler/loopopts/TestDivZeroWithSplitIf::test
* -XX:+StressGCM -XX:StressSeed=873732072 compiler.loopopts.TestDivZeroWithSplitIf
*/
package compiler.loopopts;
public class TestDivZeroWithSplitIf {
public static int iArrFld[] = new int[10];
public static void test() {
int x = 20;
int y = 0;
int z = 10;
for (int i = 9; i < 99; i += 2) {
for (int j = 3; j < 100; j++) {
for (int k = 1; k < 2; k++) {
try {
x = (-65229 / y); // Division by zero
z = (iArrFld[5] / 8); // RangeCheckNode
} catch (ArithmeticException a_e) {}
try {
y = (-38077 / y);
z = (y / 9);
} catch (ArithmeticException a_e) {}
y = 8;
z += k;
}
}
}
}
public static void main(String[] strArr) {
for (int i = 0; i < 10; i++) {
test();
}
}
}

View File

@ -0,0 +1,50 @@
/*
* 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
* @summary Dumping of lambda proxy classes should not crash VM in case the caller class has failed verification.
* @requires vm.cds
* @library /test/lib
* @compile test-classes/BadInvokeDynamic.jcod
* @run driver LambdaVerificationFailedDuringDump
*/
import jdk.test.lib.process.OutputAnalyzer;
public class LambdaVerificationFailedDuringDump {
public static void main(String[] args) throws Exception {
JarBuilder.build("badinvokedynamic", "BadInvokeDynamic");
String appJar = TestCommon.getTestJar("badinvokedynamic.jar");
OutputAnalyzer out = TestCommon.dump(appJar,
TestCommon.list("BadInvokeDynamic",
"@lambda-proxy BadInvokeDynamic run ()Ljava/lang/Runnable; ()V REF_invokeStatic BadInvokeDynamic lambda$doTest$0 ()V ()V"));
out.shouldContain("Preload Warning: Verification failed for BadInvokeDynamic")
.shouldContain("Skipping BadInvokeDynamic: Failed verification")
.shouldHaveExitValue(0);
}
}

View File

@ -0,0 +1,136 @@
/*
* 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.
*
*/
// Should get a verifier error at bytecode 15 for JVM_CONSTANT_NameAndType
class BadInvokeDynamic {
0xCAFEBABE;
0; // minor version
51; // version
[] { // Constant Pool
; // first element is empty
Method #6 #15; // #1
Field #16 #17; // #2
String #18; // #3
Method #19 #20; // #4
class #21; // #5
class #22; // #6
Utf8 "hello"; // #7
Utf8 "()V"; // #8
Utf8 "Code"; // #9
Utf8 "LineNumberTable"; // #10
Utf8 "main"; // #11
Utf8 "([Ljava/lang/String;)V"; // #12
Utf8 "SourceFile"; // #13
Utf8 "BadInvokeDynamic.java"; // #14
NameAndType #7 #8; // #15
class #23; // #16
NameAndType #24 #25; // #17
Utf8 "Hello World"; // #18
class #26; // #19
NameAndType #27 #28; // #20
Utf8 "BadInvokeDynamic"; // #21
Utf8 "java/lang/Object"; // #22
Utf8 "java/lang/System"; // #23
Utf8 "out"; // #24
Utf8 "Ljava/io/PrintStream;"; // #25
Utf8 "java/io/PrintStream"; // #26
Utf8 "println"; // #27
Utf8 "(Ljava/lang/String;)V"; // #28
} // Constant Pool
0x0021; // access
#5;// this_cpx
#6;// super_cpx
[] { // Interfaces
} // Interfaces
[] { // fields
} // fields
[] { // methods
{ // Member
0x0001; // access
#7; // name_cpx
#8; // sig_cpx
[] { // Attributes
Attr(#9) { // Code
1; // max_stack
1; // max_locals
Bytes[]{
0x2AB70001B1;
};
[] { // Traps
} // end Traps
[] { // Attributes
Attr(#10) { // LineNumberTable
[] { // LineNumberTable
0 1;
}
} // end LineNumberTable
} // Attributes
} // end Code
} // Attributes
} // Member
;
{ // Member
0x0009; // access
#11; // name_cpx
#12; // sig_cpx
[] { // Attributes
Attr(#9) { // Code
2; // max_stack
2; // max_locals
Bytes[]{
0xB200021203B60004;
0x033CBA000F840102;
0x840103840104B1;
};
[] { // Traps
} // end Traps
[] { // Attributes
Attr(#10) { // LineNumberTable
[] { // LineNumberTable
0 3;
8 4;
10 5;
13 6;
16 7;
19 8;
22 9;
}
} // end LineNumberTable
} // Attributes
} // end Code
} // Attributes
} // Member
} // methods
[] { // Attributes
Attr(#13) { // SourceFile
#14;
} // end SourceFile
} // Attributes
} // end class BadInvokeDynamic

View File

@ -496,7 +496,7 @@ java/awt/Robot/RobotWheelTest/RobotWheelTest.java 8129827 generic-all
java/awt/Focus/WindowUpdateFocusabilityTest/WindowUpdateFocusabilityTest.java 8202926 linux-all
java/awt/datatransfer/ConstructFlavoredObjectTest/ConstructFlavoredObjectTest.java 8202860 linux-all
java/awt/dnd/DisposeFrameOnDragCrash/DisposeFrameOnDragTest.java 8202790 macosx-all,linux-all
java/awt/FileDialog/FilenameFilterTest/FilenameFilterTest.java 8202882 linux-all
java/awt/FileDialog/FilenameFilterTest/FilenameFilterTest.java 8202882,8255898 linux-all,macosx-all
java/awt/dnd/MissingDragExitEventTest/MissingDragExitEventTest.java 8030121 macosx-all,linux-all
java/awt/Choice/ChoicePopupLocation/ChoicePopupLocation.java 8202931 macosx-all,linux-all
java/awt/Focus/NonFocusableBlockedOwnerTest/NonFocusableBlockedOwnerTest.java 7124275 macosx-all

View File

@ -448,15 +448,25 @@ abstract class EATestCaseBaseDebugger extends EATestCaseBaseShared {
}
}
/**
* Set a breakpoint in the given method and resume all threads. The
* breakpoint is configured to suspend just the thread that reaches it
* instead of all threads. This is important when running with graal.
*/
public BreakpointEvent resumeTo(String clsName, String methodName, String signature) {
boolean suspendThreadOnly = true;
return env.resumeTo(clsName, methodName, signature, suspendThreadOnly);
}
public void resumeToWarmupDone() throws Exception {
msg("resuming to " + TARGET_TESTCASE_BASE_NAME + ".warmupDone()V");
env.resumeTo(TARGET_TESTCASE_BASE_NAME, "warmupDone", "()V");
resumeTo(TARGET_TESTCASE_BASE_NAME, "warmupDone", "()V");
testCase = env.targetMainThread.frame(0).thisObject();
}
public void resumeToTestCaseDone() {
msg("resuming to " + TARGET_TESTCASE_BASE_NAME + ".testCaseDone()V");
env.resumeTo(TARGET_TESTCASE_BASE_NAME, "testCaseDone", "()V");
resumeTo(TARGET_TESTCASE_BASE_NAME, "testCaseDone", "()V");
}
public void checkPostConditions() throws Exception {
@ -798,11 +808,6 @@ abstract class EATestCaseBaseTarget extends EATestCaseBaseShared implements Runn
public boolean warmupDone;
// With UseJVMCICompiler it is possible that a compilation is made a
// background compilation even though -Xbatch is given (e.g. if JVMCI is not
// yet fully initialized). Therefore it is possible that the test method has
// not reached the highest compilation level after warm-up.
public boolean testMethodReachedHighestCompLevel;
public volatile Object biasToBeRevoked;
@ -915,7 +920,7 @@ abstract class EATestCaseBaseTarget extends EATestCaseBaseShared implements Runn
testCaseName + ": test method not found at depth " + testMethodDepth);
// check if the frame is (not) deoptimized as expected
if (!DeoptimizeObjectsALot) {
if (testFrameShouldBeDeoptimized() && testMethodReachedHighestCompLevel) {
if (testFrameShouldBeDeoptimized()) {
Asserts.assertTrue(WB.isFrameDeoptimized(testMethodDepth+1),
testCaseName + ": expected test method frame at depth " + testMethodDepth + " to be deoptimized");
} else {
@ -969,16 +974,24 @@ abstract class EATestCaseBaseTarget extends EATestCaseBaseShared implements Runn
} catch (NoSuchMethodException | SecurityException e) {
Asserts.fail("could not check compilation level of", e);
}
// Background compilation (-Xbatch) cannot always be disabled with JVMCI
// compiler (e.g. if JVMCI is not yet fully initialized), therefore it
// is possible that due to background compilation we reach here before
// the test method is compiled on the highest level.
int highestLevel = CompilerUtils.getMaxCompilationLevel();
int compLevel = WB.getMethodCompilationLevel(m);
testMethodReachedHighestCompLevel = highestLevel == compLevel;
if (!UseJVMCICompiler) {
Asserts.assertEQ(highestLevel, compLevel,
m + " not on expected compilation level");
} else {
// Background compilation (-Xbatch) will block a thread with timeout
// (see CompileBroker::wait_for_jvmci_completion()). Therefore it is
// possible to reach here before the main test method is compiled.
// In that case we wait for it to be compiled.
while (compLevel != highestLevel) {
msg(TESTMETHOD_DEFAULT_NAME + " is compiled on level " + compLevel +
". Wait until highes level (" + highestLevel + ") is reached.");
try {
Thread.sleep(200);
} catch (InterruptedException e) { /* ignored */ }
compLevel = WB.getMethodCompilationLevel(m);
}
}
}
@ -1140,7 +1153,7 @@ class EAGetWithoutMaterializeTarget extends EATestCaseBaseTarget {
class EAGetWithoutMaterialize extends EATestCaseBaseDebugger {
public void runTestCase() throws Exception {
BreakpointEvent bpe = env.resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V");
BreakpointEvent bpe = resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V");
printStack(bpe.thread());
ObjectReference o = getLocalRef(bpe.thread().frame(1), XYVAL_NAME, "xy");
checkPrimitiveField(o, FD.I, "x", 4);
@ -1164,7 +1177,7 @@ class EAMaterializeLocalVariableUponGet extends EATestCaseBaseDebugger {
private ObjectReference o;
public void runTestCase() throws Exception {
BreakpointEvent bpe = env.resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V");
BreakpointEvent bpe = resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V");
printStack(bpe.thread());
// check 1.
o = getLocalRef(bpe.thread().frame(1), XYVAL_NAME, "xy");
@ -1203,7 +1216,7 @@ class EAMaterializeLocalVariableUponGetTarget extends EATestCaseBaseTarget {
// call that will return another object
class EAMaterializeLocalAtObjectReturn extends EATestCaseBaseDebugger {
public void runTestCase() throws Exception {
BreakpointEvent bpe = env.resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V");
BreakpointEvent bpe = resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V");
printStack(bpe.thread());
ObjectReference o = getLocalRef(bpe.thread().frame(2), XYVAL_NAME, "xy");
checkPrimitiveField(o, FD.I, "x", 4);
@ -1248,17 +1261,22 @@ class EAMaterializeLocalAtObjectReturnTarget extends EATestCaseBaseTarget {
class EAMaterializeLocalAtObjectPollReturnReturn extends EATestCaseBaseDebugger {
public void runTestCase() throws Exception {
msg("Resume " + env.targetMainThread);
env.targetMainThread.resume();
env.vm().resume();
waitUntilTargetHasEnteredEndlessLoop();
ObjectReference o = null;
int retryCount = 0;
do {
env.targetMainThread.suspend();
printStack(env.targetMainThread);
try {
o = getLocalRef(env.targetMainThread.frame(0), XYVAL_NAME, "xy");
} catch (Exception e) {
msg("The local variable xy is out of scope because we suspended at the wrong bci. Resume and try again!");
++retryCount;
msg("The local variable xy is out of scope because we suspended at the wrong bci. Resume and try again! (" + retryCount + ")");
env.targetMainThread.resume();
if ((retryCount % 10) == 0) {
Thread.sleep(200);
}
}
} while (o == null);
checkPrimitiveField(o, FD.I, "x", 4);
@ -1327,7 +1345,7 @@ class EAMaterializeIntArrayTarget extends EATestCaseBaseTarget {
class EAMaterializeIntArray extends EATestCaseBaseDebugger {
public void runTestCase() throws Exception {
BreakpointEvent bpe = env.resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V");
BreakpointEvent bpe = resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V");
printStack(bpe.thread());
int[] expectedVals = {1, 2, 3};
checkLocalPrimitiveArray(bpe.thread().frame(1), "nums", FD.I, expectedVals);
@ -1352,7 +1370,7 @@ class EAMaterializeLongArrayTarget extends EATestCaseBaseTarget {
class EAMaterializeLongArray extends EATestCaseBaseDebugger {
public void runTestCase() throws Exception {
BreakpointEvent bpe = env.resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V");
BreakpointEvent bpe = resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V");
printStack(bpe.thread());
long[] expectedVals = {1, 2, 3};
checkLocalPrimitiveArray(bpe.thread().frame(1), "nums", FD.J, expectedVals);
@ -1377,7 +1395,7 @@ class EAMaterializeFloatArrayTarget extends EATestCaseBaseTarget {
class EAMaterializeFloatArray extends EATestCaseBaseDebugger {
public void runTestCase() throws Exception {
BreakpointEvent bpe = env.resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V");
BreakpointEvent bpe = resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V");
printStack(bpe.thread());
float[] expectedVals = {1.1f, 2.2f, 3.3f};
checkLocalPrimitiveArray(bpe.thread().frame(1), "nums", FD.F, expectedVals);
@ -1402,7 +1420,7 @@ class EAMaterializeDoubleArrayTarget extends EATestCaseBaseTarget {
class EAMaterializeDoubleArray extends EATestCaseBaseDebugger {
public void runTestCase() throws Exception {
BreakpointEvent bpe = env.resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V");
BreakpointEvent bpe = resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V");
printStack(bpe.thread());
double[] expectedVals = {1.1d, 2.2d, 3.3d};
checkLocalPrimitiveArray(bpe.thread().frame(1), "nums", FD.D, expectedVals);
@ -1427,7 +1445,7 @@ class EAMaterializeObjectArrayTarget extends EATestCaseBaseTarget {
class EAMaterializeObjectArray extends EATestCaseBaseDebugger {
public void runTestCase() throws Exception {
BreakpointEvent bpe = env.resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V");
BreakpointEvent bpe = resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V");
printStack(bpe.thread());
ReferenceType clazz = bpe.thread().frame(0).location().declaringType();
ObjectReference[] expectedVals = {
@ -1465,7 +1483,7 @@ class EAMaterializeObjectWithConstantAndNotConstantValuesTarget extends EATestCa
class EAMaterializeObjectWithConstantAndNotConstantValues extends EATestCaseBaseDebugger {
public void runTestCase() throws Exception {
BreakpointEvent bpe = env.resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V");
BreakpointEvent bpe = resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V");
printStack(bpe.thread());
ObjectReference o = getLocalRef(bpe.thread().frame(1), "ILFDO", "o");
checkPrimitiveField(o, FD.I, "i", 1);
@ -1508,7 +1526,7 @@ class EAMaterializeObjReferencedBy2LocalsTarget extends EATestCaseBaseTarget {
class EAMaterializeObjReferencedBy2Locals extends EATestCaseBaseDebugger {
public void runTestCase() throws Exception {
BreakpointEvent bpe = env.resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V");
BreakpointEvent bpe = resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V");
printStack(bpe.thread());
ObjectReference xy = getLocalRef(bpe.thread().frame(1), XYVAL_NAME, "xy");
ObjectReference alias = getLocalRef(bpe.thread().frame(1), XYVAL_NAME, "alias");
@ -1539,7 +1557,7 @@ class EAMaterializeObjReferencedBy2LocalsAndModifyTarget extends EATestCaseBaseT
class EAMaterializeObjReferencedBy2LocalsAndModify extends EATestCaseBaseDebugger {
public void runTestCase() throws Exception {
BreakpointEvent bpe = env.resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V");
BreakpointEvent bpe = resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V");
printStack(bpe.thread());
ObjectReference alias = getLocalRef(bpe.thread().frame(1), XYVAL_NAME, "alias");
setField(alias, "x", env.vm().mirrorOf(42));
@ -1580,7 +1598,7 @@ class EAMaterializeObjReferencedBy2LocalsInDifferentVirtFramesTarget extends EAT
class EAMaterializeObjReferencedBy2LocalsInDifferentVirtFrames extends EATestCaseBaseDebugger {
public void runTestCase() throws Exception {
BreakpointEvent bpe = env.resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V");
BreakpointEvent bpe = resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V");
printStack(bpe.thread());
ObjectReference xy = getLocalRef(bpe.thread().frame(2), XYVAL_NAME, "xy");
ObjectReference alias = getLocalRef(bpe.thread().frame(1), "testMethod_inlined", "alias", XYVAL_NAME);
@ -1623,7 +1641,7 @@ class EAMaterializeObjReferencedBy2LocalsInDifferentVirtFramesAndModifyTarget ex
class EAMaterializeObjReferencedBy2LocalsInDifferentVirtFramesAndModify extends EATestCaseBaseDebugger {
public void runTestCase() throws Exception {
BreakpointEvent bpe = env.resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V");
BreakpointEvent bpe = resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V");
printStack(bpe.thread());
ObjectReference alias = getLocalRef(bpe.thread().frame(1), "testMethod_inlined", "alias", XYVAL_NAME);
setField(alias, "x", env.vm().mirrorOf(42));
@ -1669,7 +1687,7 @@ class EAMaterializeObjReferencedFromOperandStackTarget extends EATestCaseBaseTar
class EAMaterializeObjReferencedFromOperandStack extends EATestCaseBaseDebugger {
public void runTestCase() throws Exception {
BreakpointEvent bpe = env.resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V");
BreakpointEvent bpe = resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V");
printStack(bpe.thread());
ObjectReference xy1 = getLocalRef(bpe.thread().frame(2), XYVAL_NAME, "xy1");
checkPrimitiveField(xy1, FD.I, "x", 2);
@ -1689,7 +1707,7 @@ class EAMaterializeObjReferencedFromOperandStack extends EATestCaseBaseDebugger
class EAMaterializeLocalVariableUponGetAfterSetInteger extends EATestCaseBaseDebugger {
public void runTestCase() throws Exception {
BreakpointEvent bpe = env.resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V");
BreakpointEvent bpe = resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V");
printStack(bpe.thread());
setLocal(bpe.thread().frame(1), "i", env.vm().mirrorOf(43));
ObjectReference o = getLocalRef(bpe.thread().frame(1), XYVAL_NAME, "xy");
@ -1727,7 +1745,7 @@ class EAMaterializeLocalVariableUponGetAfterSetIntegerTarget extends EATestCaseB
class EARelockingSimple extends EATestCaseBaseDebugger {
public void runTestCase() throws Exception {
BreakpointEvent bpe = env.resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V");
BreakpointEvent bpe = resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V");
printStack(bpe.thread());
@SuppressWarnings("unused")
ObjectReference o = getLocalRef(bpe.thread().frame(1), XYVAL_NAME, "l1");
@ -1754,7 +1772,7 @@ class EARelockingSimpleTarget extends EATestCaseBaseTarget {
class EARelockingSimple_2 extends EATestCaseBaseDebugger {
public void runTestCase() throws Exception {
BreakpointEvent bpe = env.resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V");
BreakpointEvent bpe = resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V");
printStack(bpe.thread());
@SuppressWarnings("unused")
ObjectReference o = getLocalRef(bpe.thread().frame(1), XYVAL_NAME, "l1");
@ -1804,7 +1822,7 @@ class EARelockingRecursiveTarget extends EATestCaseBaseTarget {
class EARelockingRecursive extends EATestCaseBaseDebugger {
public void runTestCase() throws Exception {
BreakpointEvent bpe = env.resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V");
BreakpointEvent bpe = resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V");
printStack(bpe.thread());
@SuppressWarnings("unused")
ObjectReference o = getLocalRef(bpe.thread().frame(2), XYVAL_NAME, "l1");
@ -1846,7 +1864,7 @@ class EARelockingNestedInflatedTarget extends EATestCaseBaseTarget {
class EARelockingNestedInflated extends EATestCaseBaseDebugger {
public void runTestCase() throws Exception {
BreakpointEvent bpe = env.resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V");
BreakpointEvent bpe = resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V");
printStack(bpe.thread());
@SuppressWarnings("unused")
ObjectReference o = getLocalRef(bpe.thread().frame(2), XYVAL_NAME, "l1");
@ -1863,7 +1881,7 @@ class EARelockingNestedInflated extends EATestCaseBaseDebugger {
class EARelockingNestedInflated_02 extends EATestCaseBaseDebugger {
public void runTestCase() throws Exception {
BreakpointEvent bpe = env.resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V");
BreakpointEvent bpe = resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V");
printStack(bpe.thread());
@SuppressWarnings("unused")
ObjectReference o = getLocalRef(bpe.thread().frame(2), XYVAL_NAME, "l1");
@ -1903,7 +1921,7 @@ class EARelockingNestedInflated_02Target extends EATestCaseBaseTarget {
class EARelockingArgEscapeLWLockedInCalleeFrame extends EATestCaseBaseDebugger {
public void runTestCase() throws Exception {
BreakpointEvent bpe = env.resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V");
BreakpointEvent bpe = resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V");
printStack(bpe.thread());
@SuppressWarnings("unused")
ObjectReference o = getLocalRef(bpe.thread().frame(2), XYVAL_NAME, "l1");
@ -1942,7 +1960,7 @@ class EARelockingArgEscapeLWLockedInCalleeFrameTarget extends EATestCaseBaseTarg
class EARelockingArgEscapeLWLockedInCalleeFrame_2 extends EATestCaseBaseDebugger {
public void runTestCase() throws Exception {
BreakpointEvent bpe = env.resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V");
BreakpointEvent bpe = resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V");
printStack(bpe.thread());
@SuppressWarnings("unused")
ObjectReference o = getLocalRef(bpe.thread().frame(2), XYVAL_NAME, "l1");
@ -1988,7 +2006,7 @@ class EARelockingArgEscapeLWLockedInCalleeFrame_3 extends EATestCaseBaseDebugger
public static final String XYVAL_LOCAL_NAME = EARelockingArgEscapeLWLockedInCalleeFrame_3Target.XYValLocal.class.getName();
public void runTestCase() throws Exception {
BreakpointEvent bpe = env.resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V");
BreakpointEvent bpe = resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V");
printStack(bpe.thread());
@SuppressWarnings("unused")
ObjectReference o = getLocalRef(bpe.thread().frame(1), XYVAL_LOCAL_NAME, "l1");
@ -2037,7 +2055,7 @@ class EARelockingArgEscapeLWLockedInCalleeFrame_4 extends EATestCaseBaseDebugger
public static final String XYVAL_LOCAL_NAME = EARelockingArgEscapeLWLockedInCalleeFrame_4Target.XYValLocal.class.getName();
public void runTestCase() throws Exception {
BreakpointEvent bpe = env.resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V");
BreakpointEvent bpe = resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V");
printStack(bpe.thread());
@SuppressWarnings("unused")
ObjectReference o = getLocalRef(bpe.thread().frame(1), XYVAL_LOCAL_NAME, "l1");
@ -2082,7 +2100,7 @@ class EARelockingArgEscapeLWLockedInCalleeFrame_4Target extends EATestCaseBaseTa
class EARelockingObjectCurrentlyWaitingOn extends EATestCaseBaseDebugger {
public void runTestCase() throws Exception {
env.targetMainThread.resume();
env.vm().resume();
boolean inWait = false;
do {
Thread.sleep(100);
@ -2184,7 +2202,7 @@ class EARelockingObjectCurrentlyWaitingOnTarget extends EATestCaseBaseTarget {
class EADeoptFrameAfterReadLocalObject_01 extends EATestCaseBaseDebugger {
public void runTestCase() throws Exception {
BreakpointEvent bpe = env.resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V");
BreakpointEvent bpe = resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V");
printStack(bpe.thread());
@SuppressWarnings("unused")
ObjectReference xy = getLocalRef(bpe.thread().frame(1), XYVAL_NAME, "xy");
@ -2239,7 +2257,7 @@ class EADeoptFrameAfterReadLocalObject_01BTarget extends EATestCaseBaseTarget {
class EADeoptFrameAfterReadLocalObject_01B extends EATestCaseBaseDebugger {
public void runTestCase() throws Exception {
BreakpointEvent bpe = env.resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V");
BreakpointEvent bpe = resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V");
printStack(bpe.thread());
@SuppressWarnings("unused")
ObjectReference xy = getLocalRef(bpe.thread().frame(1), "callee", "xy", XYVAL_NAME);
@ -2256,7 +2274,7 @@ class EADeoptFrameAfterReadLocalObject_01B extends EATestCaseBaseDebugger {
class EADeoptFrameAfterReadLocalObject_02 extends EATestCaseBaseDebugger {
public void runTestCase() throws Exception {
BreakpointEvent bpe = env.resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V");
BreakpointEvent bpe = resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V");
printStack(bpe.thread());
@SuppressWarnings("unused")
ObjectReference xy = getLocalRef(bpe.thread().frame(1), "dontinline_callee", "xy", XYVAL_NAME);
@ -2302,7 +2320,7 @@ class EADeoptFrameAfterReadLocalObject_02Target extends EATestCaseBaseTarget {
class EADeoptFrameAfterReadLocalObject_02B extends EATestCaseBaseDebugger {
public void runTestCase() throws Exception {
BreakpointEvent bpe = env.resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V");
BreakpointEvent bpe = resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V");
printStack(bpe.thread());
@SuppressWarnings("unused")
ObjectReference xy = getLocalRef(bpe.thread().frame(1), "dontinline_callee", "xy", XYVAL_NAME);
@ -2351,7 +2369,7 @@ class EADeoptFrameAfterReadLocalObject_02BTarget extends EATestCaseBaseTarget {
class EADeoptFrameAfterReadLocalObject_02C extends EATestCaseBaseDebugger {
public void runTestCase() throws Exception {
BreakpointEvent bpe = env.resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V");
BreakpointEvent bpe = resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V");
printStack(bpe.thread());
@SuppressWarnings("unused")
ObjectReference xy = getLocalRef(bpe.thread().frame(1), "dontinline_callee_accessed_by_debugger", "xy", XYVAL_NAME);
@ -2405,7 +2423,7 @@ class EADeoptFrameAfterReadLocalObject_02CTarget extends EATestCaseBaseTarget {
class EADeoptFrameAfterReadLocalObject_03 extends EATestCaseBaseDebugger {
public void runTestCase() throws Exception {
BreakpointEvent bpe = env.resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V");
BreakpointEvent bpe = resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V");
printStack(bpe.thread());
ObjectReference xy = getLocalRef(bpe.thread().frame(1), XYVAL_NAME, "xy");
setField(xy, "x", env.vm().mirrorOf(1));
@ -2462,7 +2480,7 @@ class EAGetOwnedMonitors extends EATestCaseBaseDebugger {
public void runTestCase() throws Exception {
msg("resume");
env.targetMainThread.resume();
env.vm().resume();
waitUntilTargetHasEnteredEndlessLoop();
// In contrast to JVMTI, JDWP requires a target thread to be suspended, before the owned monitors can be queried
msg("suspend target");
@ -2511,7 +2529,7 @@ class EAEntryCount extends EATestCaseBaseDebugger {
public void runTestCase() throws Exception {
msg("resume");
env.targetMainThread.resume();
env.vm().resume();
waitUntilTargetHasEnteredEndlessLoop();
// In contrast to JVMTI, JDWP requires a target thread to be suspended, before the owned monitors can be queried
msg("suspend target");
@ -2538,7 +2556,7 @@ class EAEntryCount extends EATestCaseBaseDebugger {
class EAPopFrameNotInlined extends EATestCaseBaseDebugger {
public void runTestCase() throws Exception {
BreakpointEvent bpe = env.resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V");
BreakpointEvent bpe = resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V");
printStack(bpe.thread());
msg("PopFrame");
bpe.thread().popFrames(bpe.thread().frame(0));
@ -2590,7 +2608,7 @@ class EAPopFrameNotInlinedTarget extends EATestCaseBaseTarget {
class EAPopFrameNotInlinedReallocFailure extends EATestCaseBaseDebugger {
public void runTestCase() throws Exception {
BreakpointEvent bpe = env.resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V");
BreakpointEvent bpe = resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V");
ThreadReference thread = bpe.thread();
printStack(thread);
// frame[0]: EATestCaseBaseTarget.dontinline_brkpt()
@ -2683,7 +2701,7 @@ class EAPopInlinedMethodWithScalarReplacedObjectsReallocFailure extends EATestCa
public void runTestCase() throws Exception {
ThreadReference thread = env.targetMainThread;
thread.resume();
env.vm().resume();
waitUntilTargetHasEnteredEndlessLoop();
thread.suspend();
@ -2800,7 +2818,7 @@ class EAPopInlinedMethodWithScalarReplacedObjectsReallocFailureTarget extends EA
class EAForceEarlyReturnNotInlined extends EATestCaseBaseDebugger {
public void runTestCase() throws Exception {
BreakpointEvent bpe = env.resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V");
BreakpointEvent bpe = resumeTo(TARGET_TESTCASE_BASE_NAME, "dontinline_brkpt", "()V");
ThreadReference thread = bpe.thread();
printStack(thread);
// frame[0]: EATestCaseBaseTarget.dontinline_brkpt()
@ -2867,7 +2885,7 @@ class EAForceEarlyReturnOfInlinedMethodWithScalarReplacedObjects extends EATestC
public void runTestCase() throws Exception {
ThreadReference thread = env.targetMainThread;
thread.resume();
env.vm().resume();
waitUntilTargetHasEnteredEndlessLoop();
thread.suspend();
@ -2951,7 +2969,7 @@ class EAForceEarlyReturnOfInlinedMethodWithScalarReplacedObjectsReallocFailure e
public void runTestCase() throws Exception {
ThreadReference thread = env.targetMainThread;
thread.resume();
env.vm().resume();
waitUntilTargetHasEnteredEndlessLoop();
thread.suspend();
@ -3073,7 +3091,7 @@ class EAGetInstancesOfReferenceType extends EATestCaseBaseDebugger {
ReferenceType cls = ((ClassObjectReference)getField(testCase, "cls")).reflectedType();
msg("reflected type is " + cls);
msg("resume");
env.targetMainThread.resume();
env.vm().resume();
waitUntilTargetHasEnteredEndlessLoop();
// do this while thread is running!
msg("Retrieve instances of " + cls.name());

View File

@ -839,6 +839,12 @@ abstract public class TestScaffold extends TargetAdapter {
public BreakpointEvent resumeTo(String clsName, String methodName,
String methodSignature) {
return resumeTo(clsName, methodName, methodSignature, false /* suspendThread */);
}
public BreakpointEvent resumeTo(String clsName, String methodName,
String methodSignature,
boolean suspendThread) {
ReferenceType rt = findReferenceType(clsName);
if (rt == null) {
rt = resumeToPrepareOf(clsName).referenceType();
@ -850,7 +856,7 @@ abstract public class TestScaffold extends TargetAdapter {
+ clsName + "." + methodName + ":" + methodSignature);
}
return resumeTo(method.location());
return resumeTo(method.location(), suspendThread);
}
public BreakpointEvent resumeTo(String clsName, int lineNumber) throws AbsentInformationException {

View File

@ -23,7 +23,7 @@
/*
* @test
* @bug 8225055 8239804 8246774
* @bug 8225055 8239804 8246774 8258338
* @summary Record types
* @library /tools/lib ../../lib
* @modules jdk.javadoc/jdk.javadoc.internal.tool
@ -494,4 +494,70 @@ public class TestRecordTypes extends JavadocTester {
nbsp;<span class="element-name">i</span>()</div>""");
}
@Test
public void testDeprecatedRecord(Path base) throws IOException {
Path src = base.resolve("src");
tb.writeJavaFiles(src,
"""
package p; /** This is record R.
* @deprecated Do not use.
*/
@Deprecated
public record R(int r1) { }""");
javadoc("-d", base.resolve("out").toString(),
"-quiet", "-noindex",
"-sourcepath", src.toString(),
"p");
checkExit(Exit.OK);
checkOutput("deprecated-list.html", true,
"""
<h2 title="Contents">Contents</h2>
<ul>
<li><a href="#record.class">Record Classes</a></li>
</ul>""",
"""
<div id="record.class">
<div class="caption"><span>Record Classes</span></div>
<div class="summary-table two-column-summary">
<div class="table-header col-first">Record</div>
<div class="table-header col-last">Description</div>
<div class="col-deprecated-item-name even-row-color"><a href="p/R.html" title="class in p">p.R</a></div>
<div class="col-last even-row-color">
<div class="deprecation-comment">Do not use.</div>
</div>""");
}
@Test
public void testDeprecatedRecordComponent(Path base) throws IOException {
Path src = base.resolve("src");
tb.writeJavaFiles(src,
"""
package p; /** This is record R. */
public record R(@Deprecated int r1) { }""");
javadoc("-d", base.resolve("out").toString(),
"-quiet", "-noindex",
"-sourcepath", src.toString(),
"p");
checkExit(Exit.OK);
checkOutput("deprecated-list.html", true,
"""
<h2 title="Contents">Contents</h2>
<ul>
<li><a href="#method">Methods</a></li>
</ul>""",
"""
<div id="method">
<div class="caption"><span>Methods</span></div>
<div class="summary-table two-column-summary">
<div class="table-header col-first">Method</div>
<div class="table-header col-last">Description</div>
<div class="col-deprecated-item-name even-row-color"><a href="p/R.html#r1()">p.R.r1()</a></div>
<div class="col-last even-row-color"></div>
</div>""");
}
}

View File

@ -0,0 +1,190 @@
/*
* 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.
*/
package org.openjdk.bench.jdk.incubator.foreign;
import jdk.incubator.foreign.MemoryAccess;
import jdk.incubator.foreign.MemoryLayout;
import jdk.incubator.foreign.MemorySegment;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.BenchmarkMode;
import org.openjdk.jmh.annotations.Fork;
import org.openjdk.jmh.annotations.Measurement;
import org.openjdk.jmh.annotations.Mode;
import org.openjdk.jmh.annotations.OutputTimeUnit;
import org.openjdk.jmh.annotations.Setup;
import org.openjdk.jmh.annotations.State;
import org.openjdk.jmh.annotations.TearDown;
import org.openjdk.jmh.annotations.Warmup;
import sun.misc.Unsafe;
import java.lang.invoke.VarHandle;
import java.util.concurrent.TimeUnit;
import static jdk.incubator.foreign.MemoryLayout.PathElement.sequenceElement;
import static jdk.incubator.foreign.MemoryLayouts.JAVA_INT;
@BenchmarkMode(Mode.AverageTime)
@Warmup(iterations = 5, time = 500, timeUnit = TimeUnit.MILLISECONDS)
@Measurement(iterations = 10, time = 500, timeUnit = TimeUnit.MILLISECONDS)
@State(org.openjdk.jmh.annotations.Scope.Thread)
@OutputTimeUnit(TimeUnit.MILLISECONDS)
@Fork(value = 3, jvmArgsAppend = { "--add-modules=jdk.incubator.foreign" })
public class LoopOverPollutedSegments {
static final int ELEM_SIZE = 1_000_000;
static final int CARRIER_SIZE = (int) JAVA_INT.byteSize();
static final int ALLOC_SIZE = ELEM_SIZE * CARRIER_SIZE;
static final Unsafe unsafe = Utils.unsafe;
MemorySegment nativeSegment, heapSegmentBytes, heapSegmentFloats;
byte[] arr;
long addr;
static final VarHandle intHandle = MemoryLayout.ofSequence(JAVA_INT).varHandle(int.class, MemoryLayout.PathElement.sequenceElement());
@Setup
public void setup() {
addr = unsafe.allocateMemory(ALLOC_SIZE);
for (int i = 0; i < ELEM_SIZE; i++) {
unsafe.putInt(addr + (i * 4), i);
}
arr = new byte[ALLOC_SIZE];
nativeSegment = MemorySegment.allocateNative(ALLOC_SIZE, 4);
heapSegmentBytes = MemorySegment.ofArray(new byte[ALLOC_SIZE]);
heapSegmentFloats = MemorySegment.ofArray(new float[ELEM_SIZE]);
for (int rep = 0 ; rep < 5 ; rep++) {
for (int i = 0; i < ELEM_SIZE; i++) {
unsafe.putInt(arr, Unsafe.ARRAY_BYTE_BASE_OFFSET + (i * 4), i);
MemoryAccess.setIntAtIndex(nativeSegment, i, i);
MemoryAccess.setFloatAtIndex(nativeSegment, i, i);
intHandle.set(nativeSegment, (long)i, i);
MemoryAccess.setIntAtIndex(heapSegmentBytes, i, i);
MemoryAccess.setFloatAtIndex(heapSegmentBytes, i, i);
intHandle.set(heapSegmentBytes, (long)i, i);
MemoryAccess.setIntAtIndex(heapSegmentFloats, i, i);
MemoryAccess.setFloatAtIndex(heapSegmentFloats, i, i);
intHandle.set(heapSegmentFloats, (long)i, i);
}
}
}
@TearDown
public void tearDown() {
nativeSegment.close();
heapSegmentBytes = null;
heapSegmentFloats = null;
arr = null;
unsafe.freeMemory(addr);
}
@Benchmark
public int native_segment_VH() {
int sum = 0;
for (int k = 0; k < ELEM_SIZE; k++) {
intHandle.set(nativeSegment, (long)k, k + 1);
int v = (int) intHandle.get(nativeSegment, (long)k);
sum += v;
}
return sum;
}
@Benchmark
public int native_segment_static() {
int sum = 0;
for (int k = 0; k < ELEM_SIZE; k++) {
MemoryAccess.setIntAtOffset(nativeSegment, k, k + 1);
int v = MemoryAccess.getIntAtOffset(nativeSegment, k);
sum += v;
}
return sum;
}
@Benchmark
public int heap_segment_ints_VH() {
int sum = 0;
for (int k = 0; k < ELEM_SIZE; k++) {
intHandle.set(heapSegmentBytes, (long)k, k + 1);
int v = (int) intHandle.get(heapSegmentBytes, (long)k);
sum += v;
}
return sum;
}
@Benchmark
public int heap_segment_ints_static() {
int sum = 0;
for (int k = 0; k < ELEM_SIZE; k++) {
MemoryAccess.setIntAtOffset(heapSegmentBytes, k, k + 1);
int v = MemoryAccess.getIntAtOffset(heapSegmentBytes, k);
sum += v;
}
return sum;
}
@Benchmark
public int heap_segment_floats_VH() {
int sum = 0;
for (int k = 0; k < ELEM_SIZE; k++) {
intHandle.set(heapSegmentFloats, (long)k, k + 1);
int v = (int)intHandle.get(heapSegmentFloats, (long)k);
sum += v;
}
return sum;
}
@Benchmark
public int heap_segment_floats_static() {
int sum = 0;
for (int k = 0; k < ELEM_SIZE; k++) {
MemoryAccess.setIntAtOffset(heapSegmentFloats, k, k + 1);
int v = MemoryAccess.getIntAtOffset(heapSegmentFloats, k);
sum += v;
}
return sum;
}
@Benchmark
public int heap_unsafe() {
int sum = 0;
for (int k = 0; k < ALLOC_SIZE; k += 4) {
unsafe.putInt(arr, k + Unsafe.ARRAY_BYTE_BASE_OFFSET, k + 1);
int v = unsafe.getInt(arr, k + Unsafe.ARRAY_BYTE_BASE_OFFSET);
sum += v;
}
return sum;
}
@Benchmark
public int native_unsafe() {
int sum = 0;
for (int k = 0; k < ALLOC_SIZE; k += 4) {
unsafe.putInt(addr + k, k + 1);
int v = unsafe.getInt(addr + k);
sum += v;
}
return sum;
}
}