Skip to content
Permalink
Browse files
Merge
  • Loading branch information
JesperIRL committed Jul 2, 2021
2 parents de61328 + a4d2a9a commit b0e186792e816be30347dacfd88b8e55476584e7
Showing with 907 additions and 128 deletions.
  1. +2 −2 src/hotspot/cpu/x86/x86_32.ad
  2. +2 −2 src/hotspot/cpu/x86/x86_64.ad
  3. +2 −2 src/hotspot/share/opto/callGenerator.cpp
  4. +27 −0 src/hotspot/share/opto/ifnode.cpp
  5. +6 −1 src/hotspot/share/opto/loopopts.cpp
  6. +1 −1 src/java.base/share/classes/java/text/Normalizer.java
  7. +6 −0 src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLLayer.m
  8. +4 −0 src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Flow.java
  9. +11 −6 src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TransPatterns.java
  10. +6 −0 src/jdk.internal.vm.ci/share/classes/module-info.java
  11. +85 −43 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java
  12. +80 −0 test/hotspot/jtreg/compiler/loopopts/TestStoreSunkInInnerLoop.java
  13. +61 −0 test/hotspot/jtreg/compiler/types/TestMethodHandleSpeculation.java
  14. +84 −37 test/hotspot/jtreg/vmTestbase/gc/gctests/PhantomReference/phantom001/phantom001.java
  15. +1 −5 test/jdk/java/foreign/TestResourceScope.java
  16. +96 −16 test/langtools/jdk/javadoc/doclet/testRelativeLinks/TestRelativeLinks.java
  17. +115 −0 test/langtools/jdk/javadoc/doclet/testRelativeLinks/TestRelativeModuleLinks.java
  18. +12 −6 test/langtools/jdk/javadoc/doclet/testRelativeLinks/pkg/C.java
  19. +16 −4 test/langtools/jdk/javadoc/doclet/testRelativeLinks/{pkg2/Foo.java → pkg/D.java}
  20. +5 −2 test/langtools/jdk/javadoc/doclet/testRelativeLinks/pkg/package.html
  21. +43 −0 test/langtools/jdk/javadoc/doclet/testRelativeLinks/pkg/sub/F.java
  22. +43 −0 test/langtools/jdk/javadoc/doclet/testRelativeLinks/pkg2/E.java
  23. +59 −0 test/langtools/tools/javac/T8268592/T8268592.java
  24. +3 −1 test/langtools/tools/javac/patterns/Parenthesized.java
  25. +137 −0 test/micro/org/openjdk/bench/jdk/incubator/foreign/TestLoadBytes.java
@@ -11481,7 +11481,7 @@ instruct MoveL2D_reg_reg_sse(regD dst, eRegL src, regD tmp) %{
// Small ClearArray non-AVX512.
instruct rep_stos(eCXRegI cnt, eDIRegP base, regD tmp, eAXRegI zero, Universe dummy, eFlagsReg cr) %{
predicate(!((ClearArrayNode*)n)->is_large() &&
(UseAVX <= 2 || !VM_Version::supports_avx512vlbw()));
(UseAVX <= 2));
match(Set dummy (ClearArray cnt base));
effect(USE_KILL cnt, USE_KILL base, TEMP tmp, KILL zero, KILL cr);

@@ -11542,7 +11542,7 @@ instruct rep_stos(eCXRegI cnt, eDIRegP base, regD tmp, eAXRegI zero, Universe du
// Small ClearArray AVX512 non-constant length.
instruct rep_stos_evex(eCXRegI cnt, eDIRegP base, regD tmp, kReg ktmp, eAXRegI zero, Universe dummy, eFlagsReg cr) %{
predicate(!((ClearArrayNode*)n)->is_large() &&
UseAVX > 2 && VM_Version::supports_avx512vlbw() &&
UseAVX > 2 &&
!n->in(2)->bottom_type()->is_int()->is_con());
match(Set dummy (ClearArray cnt base));
effect(USE_KILL cnt, USE_KILL base, TEMP tmp, TEMP ktmp, KILL zero, KILL cr);
@@ -11044,7 +11044,7 @@ instruct rep_stos(rcx_RegL cnt, rdi_RegP base, regD tmp, rax_RegI zero,
Universe dummy, rFlagsReg cr)
%{
predicate(!((ClearArrayNode*)n)->is_large() &&
(UseAVX <= 2 || !VM_Version::supports_avx512vlbw()));
(UseAVX <= 2));
match(Set dummy (ClearArray cnt base));
effect(USE_KILL cnt, USE_KILL base, TEMP tmp, KILL zero, KILL cr);

@@ -11105,7 +11105,7 @@ instruct rep_stos_evex(rcx_RegL cnt, rdi_RegP base, regD tmp, kReg ktmp, rax_Reg
Universe dummy, rFlagsReg cr)
%{
predicate(!((ClearArrayNode*)n)->is_large() &&
UseAVX > 2 && VM_Version::supports_avx512vlbw() &&
UseAVX > 2 &&
!n->in(2)->bottom_type()->is_long()->is_con());
match(Set dummy (ClearArray cnt base));
effect(USE_KILL cnt, USE_KILL base, TEMP tmp, TEMP ktmp, KILL zero, KILL cr);
@@ -1151,7 +1151,7 @@ CallGenerator* CallGenerator::for_method_handle_inline(JVMState* jvms, ciMethod*
const TypeOopPtr* arg_type = arg->bottom_type()->isa_oopptr();
const Type* sig_type = TypeOopPtr::make_from_klass(signature->accessing_klass());
if (arg_type != NULL && !arg_type->higher_equal(sig_type)) {
const Type* recv_type = arg_type->join_speculative(sig_type); // keep speculative part
const Type* recv_type = arg_type->filter_speculative(sig_type); // keep speculative part
Node* cast_obj = gvn.transform(new CheckCastPPNode(kit.control(), arg, recv_type));
kit.set_argument(0, cast_obj);
}
@@ -1164,7 +1164,7 @@ CallGenerator* CallGenerator::for_method_handle_inline(JVMState* jvms, ciMethod*
const TypeOopPtr* arg_type = arg->bottom_type()->isa_oopptr();
const Type* sig_type = TypeOopPtr::make_from_klass(t->as_klass());
if (arg_type != NULL && !arg_type->higher_equal(sig_type)) {
const Type* narrowed_arg_type = arg_type->join_speculative(sig_type); // keep speculative part
const Type* narrowed_arg_type = arg_type->filter_speculative(sig_type); // keep speculative part
Node* cast_obj = gvn.transform(new CheckCastPPNode(kit.control(), arg, narrowed_arg_type));
kit.set_argument(receiver_skip + j, cast_obj);
}
@@ -1011,6 +1011,33 @@ bool IfNode::fold_compares_helper(ProjNode* proj, ProjNode* success, ProjNode* f
adjusted_lim = igvn->transform(new SubINode(hi, lo));
}
hook->destruct(igvn);

int lo = igvn->type(adjusted_lim)->is_int()->_lo;
if (lo < 0) {
// If range check elimination applies to this comparison, it includes code to protect from overflows that may
// cause the main loop to be skipped entirely. Delay this transformation.
// Example:
// for (int i = 0; i < limit; i++) {
// if (i < max_jint && i > min_jint) {...
// }
// Comparisons folded as:
// i - min_jint - 1 <u -2
// when RC applies, main loop limit becomes:
// min(limit, max(-2 + min_jint + 1, min_jint))
// = min(limit, min_jint)
// = min_jint
if (!igvn->C->post_loop_opts_phase()) {
if (adjusted_val->outcnt() == 0) {
igvn->remove_dead_node(adjusted_val);
}
if (adjusted_lim->outcnt() == 0) {
igvn->remove_dead_node(adjusted_lim);
}
igvn->C->record_for_post_loop_opts_igvn(this);
return false;
}
}

Node* newcmp = igvn->transform(new CmpUNode(adjusted_val, adjusted_lim));
Node* newbool = igvn->transform(new BoolNode(newcmp, cond));

@@ -949,6 +949,9 @@ void PhaseIdealLoop::try_move_store_after_loop(Node* n) {
assert(get_loop(lca) == outer_loop, "safepoint in outer loop consume all memory state");
}
#endif
lca = place_outside_loop(lca, n_loop);
assert(!n_loop->is_member(get_loop(lca)), "control must not be back in the loop");
assert(get_loop(lca)->_nest < n_loop->_nest || lca->in(0)->Opcode() == Op_NeverBranch, "must not be moved into inner loop");

// Move store out of the loop
_igvn.replace_node(hook, n->in(MemNode::Memory));
@@ -1147,7 +1150,9 @@ Node* PhaseIdealLoop::place_outside_loop(Node* useblock, IdealLoopTree* loop) co
// Pick control right outside the loop
for (;;) {
Node* dom = idom(useblock);
if (loop->is_member(get_loop(dom))) {
if (loop->is_member(get_loop(dom)) ||
// NeverBranch nodes are not assigned to the loop when constructed
(dom->Opcode() == Op_NeverBranch && loop->is_member(get_loop(dom->in(0))))) {
break;
}
useblock = dom;
@@ -144,7 +144,7 @@
/**
* Normalize a sequence of char values.
* The sequence will be normalized according to the specified normalization
* from.
* form.
* @param src The sequence of char values to normalize.
* @param form The normalization form; one of
* {@link java.text.Normalizer.Form#NFC},
@@ -80,6 +80,7 @@ - (id) initWithJavaLayer:(jobject)layer
- (void) blitTexture {
if (self.ctx == NULL || self.javaLayer == NULL || self.buffer == nil || self.ctx.device == nil) {
J2dTraceLn4(J2D_TRACE_VERBOSE, "MTLLayer.blitTexture: uninitialized (mtlc=%p, javaLayer=%p, buffer=%p, devide=%p)", self.ctx, self.javaLayer, self.buffer, ctx.device);
[self stopDisplayLink];
return;
}

@@ -89,6 +90,7 @@ - (void) blitTexture {
@autoreleasepool {
if ((self.buffer.width == 0) || (self.buffer.height == 0)) {
J2dTraceLn(J2D_TRACE_VERBOSE, "MTLLayer.blitTexture: cannot create drawable of size 0");
[self stopDisplayLink];
return;
}

@@ -99,17 +101,20 @@ - (void) blitTexture {

if (src_h <= 0 || src_w <= 0) {
J2dTraceLn(J2D_TRACE_VERBOSE, "MTLLayer.blitTexture: Invalid src width or height.");
[self stopDisplayLink];
return;
}

id<MTLCommandBuffer> commandBuf = [self.ctx createBlitCommandBuffer];
if (commandBuf == nil) {
J2dTraceLn(J2D_TRACE_VERBOSE, "MTLLayer.blitTexture: commandBuf is null");
[self stopDisplayLink];
return;
}
id<CAMetalDrawable> mtlDrawable = [self nextDrawable];
if (mtlDrawable == nil) {
J2dTraceLn(J2D_TRACE_VERBOSE, "MTLLayer.blitTexture: nextDrawable is null)");
[self stopDisplayLink];
return;
}
self.nextDrawableCount++;
@@ -277,6 +282,7 @@ CVReturn displayLinkCallback(CVDisplayLinkRef displayLink, const CVTimeStamp* no
MTLContext * ctx = layer.ctx;
if (layer == NULL || ctx == NULL) {
J2dTraceLn(J2D_TRACE_VERBOSE, "MTLLayer_blit : Layer or Context is null");
[layer stopDisplayLink];
return;
}

@@ -1577,6 +1577,10 @@ public void visitClassDef(JCClassDecl tree) {
public void visitClassDef(JCClassDecl tree) {
//skip
}
@Override
public void visitLambda(JCLambda tree) {
//skip
}
public boolean isAlive() {
return super.alive != Liveness.DEAD;
}
@@ -190,6 +190,7 @@ public void visitTypeTest(JCInstanceOf tree) {
syms.objectType
: tree.expr.type;
VarSymbol prevCurrentValue = currentValue;
bindingContext = new BasicBindingContext();
try {
JCExpression translatedExpr = translate(tree.expr);
Symbol exprSym = TreeInfo.symbol(translatedExpr);
@@ -206,16 +207,20 @@ public void visitTypeTest(JCInstanceOf tree) {
}

Type principalType = principalType((JCPattern) tree.pattern);
result = makeBinary(Tag.AND,
makeTypeTest(make.Ident(currentValue), make.Type(principalType)),
(JCExpression) this.<JCTree>translate(tree.pattern));
JCExpression resultExpression=
makeBinary(Tag.AND,
makeTypeTest(make.Ident(currentValue), make.Type(principalType)),
(JCExpression) this.<JCTree>translate(tree.pattern));
if (currentValue != exprSym) {
result = make.at(tree.pos).LetExpr(make.VarDef(currentValue, translatedExpr),
(JCExpression)result).setType(syms.booleanType);
((LetExpr) result).needsCond = true;
resultExpression =
make.at(tree.pos).LetExpr(make.VarDef(currentValue, translatedExpr),
resultExpression).setType(syms.booleanType);
((LetExpr) resultExpression).needsCond = true;
}
result = bindingContext.decorateExpression(resultExpression);
} finally {
currentValue = prevCurrentValue;
bindingContext.pop();
}
} else {
super.visitTypeTest(tree);
@@ -27,6 +27,12 @@
exports jdk.vm.ci.services to
jdk.internal.vm.compiler,
jdk.internal.vm.compiler.management;
exports jdk.vm.ci.runtime to
jdk.internal.vm.compiler,
jdk.internal.vm.compiler.management;
exports jdk.vm.ci.meta to jdk.internal.vm.compiler;
exports jdk.vm.ci.code to jdk.internal.vm.compiler;
exports jdk.vm.ci.hotspot to jdk.internal.vm.compiler;

uses jdk.vm.ci.services.JVMCIServiceLocator;
uses jdk.vm.ci.hotspot.HotSpotJVMCIBackendFactory;
@@ -183,11 +183,6 @@
*/
protected boolean printedAnnotationHeading = false;

/**
* To check whether annotation field heading is printed or not.
*/
protected boolean printedAnnotationFieldHeading = false;

/**
* To check whether the repeated annotations is documented or not.
*/
@@ -1647,13 +1642,41 @@ protected Boolean defaultAction(DocTree node, Content c) {
}

/**
* Return true if relative links should not be redirected.
* Returns true if relative links should be redirected.
*
* @return Return true if a relative link should not be redirected.
* @return true if a relative link should be redirected.
*/
private boolean shouldRedirectRelativeLinks(Element element) {
if (element == null || utils.isOverviewElement(element)) {
// Can't redirect unless there is a valid source element.
return false;
}
// Retrieve the element of this writer if it is a "primary" writer for an element.
// Note: It would be nice to have getCurrentPageElement() return package and module elements
// in their respective writers, but other uses of the method are only interested in TypeElements.
Element currentPageElement = getCurrentPageElement();
if (currentPageElement == null) {
if (this instanceof PackageWriterImpl packageWriter) {
currentPageElement = packageWriter.packageElement;
} else if (this instanceof ModuleWriterImpl moduleWriter) {
currentPageElement = moduleWriter.mdle;
}
}
// Redirect link if the current writer is not the primary writer for the source element.
return currentPageElement == null
|| (currentPageElement != element
&& currentPageElement != utils.getEnclosingTypeElement(element));
}

/**
* Returns true if element lives in the same package as the type or package
* element of this writer.
*/
private boolean shouldNotRedirectRelativeLinks() {
return this instanceof ClassWriter ||
this instanceof PackageSummaryWriter;
private boolean inSamePackage(Element element) {
Element currentPageElement = (this instanceof PackageWriterImpl packageWriter)
? packageWriter.packageElement : getCurrentPageElement();
return currentPageElement != null && !utils.isModule(element)
&& utils.containingPackage(currentPageElement) == utils.containingPackage(element);
}

/**
@@ -1681,47 +1704,66 @@ private boolean shouldNotRedirectRelativeLinks() {
*/
private String redirectRelativeLinks(Element element, TextTree tt) {
String text = tt.getBody();
if (element == null || utils.isOverviewElement(element) || shouldNotRedirectRelativeLinks()) {
if (!shouldRedirectRelativeLinks(element)) {
return text;
}

DocPath redirectPathFromRoot = new SimpleElementVisitor14<DocPath, Void>() {
@Override
public DocPath visitType(TypeElement e, Void p) {
return docPaths.forPackage(utils.containingPackage(e));
String lower = Utils.toLowerCase(text);
if (lower.startsWith("mailto:")
|| lower.startsWith("http:")
|| lower.startsWith("https:")
|| lower.startsWith("file:")) {
return text;
}
if (text.startsWith("#")) {
// Redirected fragment link: prepend HTML file name to make it work
if (utils.isModule(element)) {
text = "module-summary.html" + text;
} else if (utils.isPackage(element)) {
text = DocPaths.PACKAGE_SUMMARY.getPath() + text;
} else {
TypeElement typeElement = element instanceof TypeElement
? (TypeElement) element : utils.getEnclosingTypeElement(element);
text = docPaths.forName(typeElement).getPath() + text;
}
}

@Override
public DocPath visitPackage(PackageElement e, Void p) {
return docPaths.forPackage(e);
}
if (!inSamePackage(element)) {
DocPath redirectPathFromRoot = new SimpleElementVisitor14<DocPath, Void>() {
@Override
public DocPath visitType(TypeElement e, Void p) {
return docPaths.forPackage(utils.containingPackage(e));
}

@Override
public DocPath visitVariable(VariableElement e, Void p) {
return docPaths.forPackage(utils.containingPackage(e));
}
@Override
public DocPath visitPackage(PackageElement e, Void p) {
return docPaths.forPackage(e);
}

@Override
public DocPath visitExecutable(ExecutableElement e, Void p) {
return docPaths.forPackage(utils.containingPackage(e));
}
@Override
public DocPath visitVariable(VariableElement e, Void p) {
return docPaths.forPackage(utils.containingPackage(e));
}

@Override
protected DocPath defaultAction(Element e, Void p) {
return null;
@Override
public DocPath visitExecutable(ExecutableElement e, Void p) {
return docPaths.forPackage(utils.containingPackage(e));
}

@Override
public DocPath visitModule(ModuleElement e, Void p) {
return DocPaths.forModule(e);
}

@Override
protected DocPath defaultAction(Element e, Void p) {
return null;
}
}.visit(element);
if (redirectPathFromRoot != null) {
text = "{@" + (new DocRootTaglet()).getName() + "}/"
+ redirectPathFromRoot.resolve(text).getPath();
return replaceDocRootDir(text);
}
}.visit(element);
if (redirectPathFromRoot == null) {
return text;
}
String lower = Utils.toLowerCase(text);
if (!(lower.startsWith("mailto:")
|| lower.startsWith("http:")
|| lower.startsWith("https:")
|| lower.startsWith("file:"))) {
text = "{@" + (new DocRootTaglet()).getName() + "}/"
+ redirectPathFromRoot.resolve(text).getPath();
text = replaceDocRootDir(text);
}
return text;
}

1 comment on commit b0e1867

@openjdk-notifier

This comment has been minimized.

Copy link

@openjdk-notifier openjdk-notifier bot commented on b0e1867 Jul 2, 2021

Please sign in to comment.