This commit is contained in:
Jesper Wilhelmsson 2020-12-24 08:28:24 +00:00
commit 57217b58bf
6 changed files with 74 additions and 6 deletions

View file

@ -112,7 +112,8 @@ size_t MonitorList::unlink_deflated(Thread* self, LogStream* ls,
ObjectMonitor* prev = NULL; ObjectMonitor* prev = NULL;
ObjectMonitor* head = Atomic::load_acquire(&_head); ObjectMonitor* head = Atomic::load_acquire(&_head);
ObjectMonitor* m = head; ObjectMonitor* m = head;
do { // The in-use list head can be NULL during the final audit.
while (m != NULL) {
if (m->is_being_async_deflated()) { if (m->is_being_async_deflated()) {
// Find next live ObjectMonitor. // Find next live ObjectMonitor.
ObjectMonitor* next = m; ObjectMonitor* next = m;
@ -154,7 +155,7 @@ size_t MonitorList::unlink_deflated(Thread* self, LogStream* ls,
"unlinked_count", unlinked_count, "unlinked_count", unlinked_count,
ls, timer_p); ls, timer_p);
} }
} while (m != NULL); }
Atomic::sub(&_count, unlinked_count); Atomic::sub(&_count, unlinked_count);
return unlinked_count; return unlinked_count;
} }

View file

@ -379,6 +379,7 @@ implements CRTFlags {
public void visitYield(JCYield tree) { public void visitYield(JCYield tree) {
SourceRange sr = new SourceRange(startPos(tree), endPos(tree)); SourceRange sr = new SourceRange(startPos(tree), endPos(tree));
sr.mergeWith(csp(tree.value));
result = sr; result = sr;
} }

View file

@ -917,6 +917,7 @@ public class DocCommentParser {
nextChar(); nextChar();
skipWhitespace(); skipWhitespace();
if (ch == '\'' || ch == '"') { if (ch == '\'' || ch == '"') {
newline = false;
vkind = (ch == '\'') ? ValueKind.SINGLE : ValueKind.DOUBLE; vkind = (ch == '\'') ? ValueKind.SINGLE : ValueKind.DOUBLE;
char quote = ch; char quote = ch;
nextChar(); nextChar();

View file

@ -40,6 +40,8 @@ import jdk.test.lib.process.OutputAnalyzer;
import sun.hotspot.WhiteBox; import sun.hotspot.WhiteBox;
public class TestWBDeflateIdleMonitors { public class TestWBDeflateIdleMonitors {
static final int N_DELAY = 1000; // delay between tries
static final int N_TRIES = 5; // number of times to try deflation
public static void main(String args[]) throws Exception { public static void main(String args[]) throws Exception {
ProcessBuilder pb = ProcessTools.createTestJvm( ProcessBuilder pb = ProcessTools.createTestJvm(
@ -68,9 +70,22 @@ public class TestWBDeflateIdleMonitors {
Asserts.assertEQ(wb.isMonitorInflated(obj), true, Asserts.assertEQ(wb.isMonitorInflated(obj), true,
"Monitor should be inflated."); "Monitor should be inflated.");
} }
for (int cnt = 1; cnt <= N_TRIES; cnt++) {
System.out.println("Deflation try #" + cnt);
boolean did_deflation = wb.deflateIdleMonitors(); boolean did_deflation = wb.deflateIdleMonitors();
Asserts.assertEQ(did_deflation, true, Asserts.assertEQ(did_deflation, true,
"deflateIdleMonitors() should have worked."); "deflateIdleMonitors() should have worked.");
if (!wb.isMonitorInflated(obj)) {
// Deflation worked so no more retries needed.
break;
}
try {
System.out.println("Deflation try #" + cnt + " failed. "
+ "Delaying before retry.");
Thread.sleep(N_DELAY);
} catch (InterruptedException ie) {
}
}
Asserts.assertEQ(wb.isMonitorInflated(obj), false, Asserts.assertEQ(wb.isMonitorInflated(obj), false,
"Monitor should be deflated."); "Monitor should be deflated.");
} }

View file

@ -1,6 +1,6 @@
/* /*
* @test /nodynamiccopyright/ * @test /nodynamiccopyright/
* @bug 8004832 * @bug 8004832 8258916
* @summary Add new doclint package * @summary Add new doclint package
* @modules jdk.javadoc/jdk.javadoc.internal.doclint * @modules jdk.javadoc/jdk.javadoc.internal.doclint
* @build DocLintTester * @build DocLintTester
@ -24,5 +24,11 @@ public class HtmlAttrsTest {
* <font size="3"> text </font> * <font size="3"> text </font>
*/ */
public void obsolete_use_css() { } public void obsolete_use_css() { }
/**
* multi-line mailto <a
* href="mailto:nobody@example.com">nobody</a>
*/
public void multiline_mailto() { }
} }

View file

@ -143,6 +143,50 @@ public class CRT {
" 35, 63, 180d, 240a, 10 // 35, 63, 6:13, 9:10, flow-target\n" + " 35, 63, 180d, 240a, 10 // 35, 63, 6:13, 9:10, flow-target\n" +
" 0, 64, c09, 240b, 1 // 0, 64, 3:09, 9:11, statement\n" + " 0, 64, c09, 240b, 1 // 0, 64, 3:09, 9:11, statement\n" +
" 0, 64, 824, 2806, 2 // 0, 64, 2:36, 10:06, block\n"); " 0, 64, 824, 2806, 2 // 0, 64, 2:36, 10:06, block\n");
doTest(
"""
private boolean convert(int i) {
return switch (i) {
default -> (i < 256) ? true : false;
};
}
""",
"""
CharacterRangeTable:
0, 0, c14, c15, 8 // 0, 0, 3:20, 3:21, flow-controller
12, 15, 1014, 101d, 8 // 12, 15, 4:20, 4:29, flow-controller
16, 18, 1014, 101d, 100 // 16, 18, 4:20, 4:29, branch-false
19, 19, 1020, 1024, 10 // 19, 19, 4:32, 4:36, flow-target
23, 23, 1027, 102c, 10 // 23, 23, 4:39, 4:44, flow-target
12, 26, 1014, 102d, 11 // 12, 26, 4:20, 4:45, statement, flow-target
0, 27, c05, 1407, 1 // 0, 27, 3:05, 5:07, statement
0, 27, 820, 1802, 2 // 0, 27, 2:32, 6:02, block
"""
);
doTest(
"""
private boolean convert(int i) {
return switch (i) {
case 1 -> switch (Integer.toString(i)) {
case "1" -> true;
default -> throw new IllegalStateException("failure");
};
default -> throw new IllegalStateException("failure");
};
}
""",
"""
CharacterRangeTable:
0, 0, c14, c15, 8 // 0, 0, 3:20, 3:21, flow-controller
20, 24, 1013, 102f, 1 // 20, 24, 4:19, 4:47, statement
80, 83, 1419, 141e, 11 // 80, 83, 5:25, 5:30, statement, flow-target
84, 93, 1818, 1843, 11 // 84, 93, 6:24, 6:67, statement, flow-target
20, 96, 1013, 1c0b, 11 // 20, 96, 4:19, 7:11, statement, flow-target
97, 106, 2014, 203f, 11 // 97, 106, 8:20, 8:63, statement, flow-target
0, 107, c05, 2407, 1 // 0, 107, 3:05, 9:07, statement
0, 107, 820, 2802, 2 // 0, 107, 2:32, 10:02, block
"""
);
} }
private void doTest(String code, String expected) throws Exception { private void doTest(String code, String expected) throws Exception {