This commit is contained in:
Jesper Wilhelmsson 2019-01-10 21:52:33 +01:00
commit e13cc6d3a6
10 changed files with 48 additions and 39 deletions
.hgtags
src
hotspot/share/classfile
java.base/share/classes/java/lang
test
hotspot/jtreg
jdk
java/lang/String
jdk/jfr/event/gc/detailed

@ -533,3 +533,4 @@ cc4098b3bc10d1c390384289025fea7b0d4b9e93 jdk-13+0
50677f43ac3df9a8684222b8893543c60f3aa0bd jdk-13+2
de9fd809bb475401aad188eab2264226788aad81 jdk-12+26
642346a11059b9f283110dc301a24ed43b76a94e jdk-13+3
f15d443f97318e9b40e6f451e327ff69ed4ec361 jdk-12+27

@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -503,26 +503,33 @@ Handle SystemDictionaryShared::get_shared_protection_domain(Handle class_loader,
Handle SystemDictionaryShared::get_shared_protection_domain(Handle class_loader,
ModuleEntry* mod, TRAPS) {
ClassLoaderData *loader_data = mod->loader_data();
Handle protection_domain;
if (mod->shared_protection_domain() == NULL) {
Symbol* location = mod->location();
if (location != NULL) {
Handle url_string = java_lang_String::create_from_symbol(
location, CHECK_(protection_domain));
Handle location_string = java_lang_String::create_from_symbol(
location, CHECK_NH);
Handle url;
JavaValue result(T_OBJECT);
Klass* classLoaders_klass =
SystemDictionary::jdk_internal_loader_ClassLoaders_klass();
JavaCalls::call_static(&result, classLoaders_klass, vmSymbols::toFileURL_name(),
if (location->starts_with("jrt:/")) {
url = JavaCalls::construct_new_instance(SystemDictionary::URL_klass(),
vmSymbols::string_void_signature(),
location_string, CHECK_NH);
} else {
Klass* classLoaders_klass =
SystemDictionary::jdk_internal_loader_ClassLoaders_klass();
JavaCalls::call_static(&result, classLoaders_klass, vmSymbols::toFileURL_name(),
vmSymbols::toFileURL_signature(),
url_string, CHECK_(protection_domain));
Handle url = Handle(THREAD, (oop)result.get_jobject());
location_string, CHECK_NH);
url = Handle(THREAD, (oop)result.get_jobject());
}
Handle pd = get_protection_domain_from_classloader(class_loader, url, THREAD);
Handle pd = get_protection_domain_from_classloader(class_loader, url,
CHECK_NH);
mod->set_shared_protection_domain(loader_data, pd);
}
}
protection_domain = Handle(THREAD, mod->shared_protection_domain());
Handle protection_domain(THREAD, mod->shared_protection_domain());
assert(protection_domain.not_null(), "sanity");
return protection_domain;
}

@ -2813,8 +2813,7 @@ public final class String
* lines are then concatenated and returned.
* <p>
* If {@code n > 0} then {@code n} spaces (U+0020) are inserted at the
* beginning of each line. {@link String#isBlank() Blank lines} are
* unaffected.
* beginning of each line.
* <p>
* If {@code n < 0} then up to {@code n}
* {@link Character#isWhitespace(int) white space characters} are removed
@ -2849,7 +2848,7 @@ public final class String
: lines();
if (n > 0) {
final String spaces = " ".repeat(n);
stream = stream.map(s -> s.isBlank() ? s : spaces + s);
stream = stream.map(s -> spaces + s);
} else if (n == Integer.MIN_VALUE) {
stream = stream.map(s -> s.stripLeading());
} else if (n < 0) {

@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -28,6 +28,7 @@
* @bug 8209825
* @summary Checks VerifyStack after deoptimization of array allocation slow call
* @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:TieredStopAtLevel=1
* -XX:AllocatePrefetchLines=1 -XX:AllocateInstancePrefetchLines=1 -XX:AllocatePrefetchStepSize=16 -XX:AllocatePrefetchDistance=1
* -XX:MinTLABSize=1k -XX:TLABSize=1k
* -XX:+DeoptimizeALot -XX:+VerifyStack
* compiler.interpreter.TestVerifyStackAfterDeopt

@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -48,25 +48,24 @@ public class ProtectionDomain {
TestCommon.list("ProtDomain",
"ProtDomainBOther",
"java/util/Dictionary",
"sun/tools/javac/Main",
"com/sun/tools/javac/Main",
"jdk/nio/zipfs/ZipInfo",
"java/net/URL",
"sun/rmi/rmic/Main",
"com/sun/jndi/dns/DnsName"));
OutputAnalyzer output;
// First class is loaded from CDS, second class is loaded from JAR
output = TestCommon.exec(appJar, "ProtDomain");
TestCommon.checkExec(output, "Protection Domains match");
TestCommon.run("-cp", appJar, "ProtDomain")
.assertNormalExit("Protection Domains match");
// First class is loaded from JAR, second class is loaded from CDS
output = TestCommon.exec(appJar, "ProtDomainB");
TestCommon.checkExec(output, "Protection Domains match");
TestCommon.run("-cp", appJar, "ProtDomainB")
.assertNormalExit("Protection Domains match");
// Test ProtectionDomain for application and extension module classes from the
// "modules" jimage
output = TestCommon.exec(appJar, "JimageClassProtDomain");
output.shouldNotContain("Failed: Protection Domains do not match");
TestCommon.run("-cp", appJar, "JimageClassProtDomain")
.assertNormalExit(output -> output.shouldNotContain(
"Failed: Protection Domains do not match"));
}
}

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2018, 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
@ -37,7 +37,7 @@ public class JimageClassProtDomain {
"java.util.Dictionary", "java.util.ServiceConfigurationError"},
{"Loading shared app module class first",
"sun.tools.javac.Main", "sun.tools.javac.BatchParser"},
"com.sun.tools.javac.Main", "com.sun.tools.javac.code.Symbol"},
{"Loading shared ext module class first",
"jdk.nio.zipfs.ZipInfo", "jdk.nio.zipfs.ZipPath"},
@ -46,7 +46,7 @@ public class JimageClassProtDomain {
"java.net.HttpCookie", "java.net.URL"},
{"Loading non-shared app module class first",
"sun.rmi.rmic.RMIGenerator", "sun.rmi.rmic.Main"},
"com.sun.tools.sjavac.Util", "com.sun.tools.sjavac.Main"},
{"Loading non-shared ext module class first",
"com.sun.jndi.dns.Resolver", "com.sun.jndi.dns.DnsName"}};
@ -61,13 +61,16 @@ public class JimageClassProtDomain {
Class c1 = Class.forName(shared);
Class c2 = Class.forName(nonShared);
if (c1.getProtectionDomain() != c2.getProtectionDomain()) {
System.out.println("Failed: Protection Domains do not match!");
System.out.println(c1.getProtectionDomain());
System.out.println(c1.getProtectionDomain().getCodeSource());
System.out.println(c2.getProtectionDomain());
System.out.println(c2.getProtectionDomain().getCodeSource());
System.exit(1);
throw new RuntimeException("Failed: Protection Domains do not match!");
} else {
System.out.println(c1.getProtectionDomain());
System.out.println(c1.getProtectionDomain().getCodeSource());
System.out.println(c2.getProtectionDomain());
System.out.println(c2.getProtectionDomain().getCodeSource());
System.out.println("Passed: Protection Domains match.");
}
}

@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2018, 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
@ -42,8 +42,7 @@ public class ProtDomain {
if (mine == his) {
System.out.println("Protection Domains match");
} else {
System.out.println("Protection Domains do not match!");
System.exit(1);
throw new RuntimeException("Protection Domains do not match!");
}
}
}

@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2018, 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
@ -42,8 +42,7 @@ public class ProtDomainB {
if (mine == his) {
System.out.println("Protection Domains match");
} else {
System.out.println("Protection Domains do not match!");
System.exit(1);
throw new RuntimeException("Protection Domains do not match!");
}
}
}

@ -67,7 +67,7 @@ public class Indent {
Stream<String> stream = input.lines();
if (adjust > 0) {
final String spaces = " ".repeat(adjust);
stream = stream.map(s -> s.isBlank() ? s : spaces + s);
stream = stream.map(s -> spaces + s);
} else if (adjust < 0) {
stream = stream.map(s -> s.substring(Math.min(-adjust, indexOfNonWhitespace(s))));
}

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -35,7 +35,8 @@ package jdk.jfr.event.gc.detailed;
* & vm.opt.ExplicitGCInvokesConcurrent != true
* @library /test/lib /test/jdk
* @run main/othervm -Xmx32m -Xms32m -Xmn12m -XX:+UseG1GC -XX:-UseStringDeduplication -XX:MaxTenuringThreshold=5 -XX:InitialTenuringThreshold=5 jdk.jfr.event.gc.detailed.TestPromotionEventWithG1
* @run main/othervm -Xmx32m -Xms32m -Xmn12m -XX:+UseG1GC -XX:-UseStringDeduplication -XX:MaxTenuringThreshold=5 -XX:InitialTenuringThreshold=5 -XX:MinTLABSize=576 -XX:TLABSize=576 jdk.jfr.event.gc.detailed.TestPromotionEventWithG1
* @run main/othervm -Xmx32m -Xms32m -Xmn12m -XX:AllocatePrefetchLines=1 -XX:AllocateInstancePrefetchLines=1 -XX:AllocatePrefetchStepSize=16 -XX:AllocatePrefetchDistance=1 -XX:+UseG1GC
* -XX:-UseStringDeduplication -Xlog:os+cpu=info -XX:MaxTenuringThreshold=5 -XX:InitialTenuringThreshold=5 -XX:MinTLABSize=768 -XX:TLABSize=768 jdk.jfr.event.gc.detailed.TestPromotionEventWithG1
*/
public class TestPromotionEventWithG1 {