Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge jdk20 #11744

Closed
wants to merge 5 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/hotspot/share/classfile/placeholders.hpp
Original file line number Diff line number Diff line change
@@ -105,9 +105,11 @@ class PlaceholderEntry {

Symbol* supername() const { return _supername; }
void set_supername(Symbol* supername) {
Symbol::maybe_decrement_refcount(_supername);
_supername = supername;
Symbol::maybe_increment_refcount(_supername);
if (supername != _supername) {
Symbol::maybe_decrement_refcount(_supername);
_supername = supername;
Symbol::maybe_increment_refcount(_supername);
}
}
void clear_supername() {
Symbol::maybe_decrement_refcount(_supername);
40 changes: 19 additions & 21 deletions src/hotspot/share/gc/g1/g1RemSet.cpp
Original file line number Diff line number Diff line change
@@ -1031,7 +1031,7 @@ class G1MergeHeapRootsTask : public WorkerTask {
G1MergeHeapRootsPrefetchCache<G1CardTable::CardValue>(G1CardTable::dirty_card_val()),
_merge_card_cl(merge_card_cl) { }

~G1MergeCardSetCache() {
void flush() {
for (uint i = 0; i < CacheSize; i++) {
_merge_card_cl->mark_card(push(&_dummy_card));
}
@@ -1120,7 +1120,10 @@ class G1MergeHeapRootsTask : public WorkerTask {
return false;
}

G1MergeCardSetStats stats() const { return _stats; }
G1MergeCardSetStats stats() {
_merge_card_set_cache.flush();
return _stats;
}
};

// Closure to make sure that the marking bitmap is clear for any old region in
@@ -1187,11 +1190,10 @@ class G1MergeHeapRootsTask : public WorkerTask {
// Visitor for the remembered sets of humongous candidate regions to merge their
// remembered set into the card table.
class G1FlushHumongousCandidateRemSets : public HeapRegionIndexClosure {
G1RemSetScanState* _scan_state;
G1MergeCardSetStats _merge_stats;
G1MergeCardSetClosure _cl;

public:
G1FlushHumongousCandidateRemSets(G1RemSetScanState* scan_state) : _scan_state(scan_state), _merge_stats() { }
G1FlushHumongousCandidateRemSets(G1RemSetScanState* scan_state) : _cl(scan_state) { }

bool do_heap_region_index(uint region_index) override {
G1CollectedHeap* g1h = G1CollectedHeap::heap();
@@ -1208,12 +1210,8 @@ class G1MergeHeapRootsTask : public WorkerTask {
guarantee(r->rem_set()->occupancy_less_or_equal_than(G1EagerReclaimRemSetThreshold),
"Found a not-small remembered set here. This is inconsistent with previous assumptions.");

G1MergeCardSetStats stats;
{
G1MergeCardSetClosure cl(_scan_state);
cl.merge_card_set_for_region(r);
stats = cl.stats();
}

_cl.merge_card_set_for_region(r);

// We should only clear the card based remembered set here as we will not
// implicitly rebuild anything else during eager reclaim. Note that at the moment
@@ -1233,7 +1231,9 @@ class G1MergeHeapRootsTask : public WorkerTask {
return false;
}

size_t merged(uint i) const { return _merge_stats.merged(i); }
G1MergeCardSetStats stats() {
return _cl.stats();
}
};

// Visitor for the log buffer entries to merge them into the card table.
@@ -1347,24 +1347,22 @@ class G1MergeHeapRootsTask : public WorkerTask {

G1FlushHumongousCandidateRemSets cl(_scan_state);
g1h->heap_region_iterate(&cl);
G1MergeCardSetStats stats = cl.stats();

for (uint i = 0; i < G1GCPhaseTimes::MergeRSContainersSentinel; i++) {
p->record_or_add_thread_work_item(merge_remset_phase, worker_id, cl.merged(i), i);
p->record_or_add_thread_work_item(merge_remset_phase, worker_id, stats.merged(i), i);
}
}
}

{
// 2. collection set
G1MergeCardSetStats stats;
{
G1MergeCardSetClosure merge(_scan_state);
G1ClearBitmapClosure clear(g1h);
G1CombinedClosure combined(&merge, &clear);
G1MergeCardSetClosure merge(_scan_state);
G1ClearBitmapClosure clear(g1h);
G1CombinedClosure combined(&merge, &clear);

g1h->collection_set_iterate_increment_from(&combined, nullptr, worker_id);
stats = merge.stats();
}
g1h->collection_set_iterate_increment_from(&combined, nullptr, worker_id);
G1MergeCardSetStats stats = merge.stats();

for (uint i = 0; i < G1GCPhaseTimes::MergeRSContainersSentinel; i++) {
p->record_or_add_thread_work_item(merge_remset_phase, worker_id, stats.merged(i), i);
6 changes: 4 additions & 2 deletions src/hotspot/share/runtime/fieldDescriptor.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2022, 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
@@ -102,7 +102,9 @@ void fieldDescriptor::reinitialize(InstanceKlass* ik, int index) {
if (_cp.is_null() || field_holder() != ik) {
_cp = constantPoolHandle(Thread::current(), ik->constants());
// _cp should now reference ik's constant pool; i.e., ik is now field_holder.
assert(field_holder() == ik, "must be already initialized to this class");
// If the class is a scratch class, the constant pool points to the original class,
// but that's ok because of constant pool merging.
assert(field_holder() == ik || ik->is_scratch_class(), "must be already initialized to this class");
}
FieldInfo* f = ik->field(index);
_access_flags = accessFlags_from(f->access_flags());
45 changes: 5 additions & 40 deletions src/java.desktop/share/classes/javax/swing/text/DefaultCaret.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -366,8 +366,6 @@ protected void moveCaret(MouseEvent e) {
}
}

private int savedBlinkRate = 0;
private boolean isBlinkRateSaved = false;
// --- FocusListener methods --------------------------

/**
@@ -381,21 +379,8 @@ protected void moveCaret(MouseEvent e) {
public void focusGained(FocusEvent e) {
if (component.isEnabled()) {
if (component.isEditable()) {
if (isBlinkRateSaved) {
setBlinkRate(savedBlinkRate);
savedBlinkRate = 0;
isBlinkRateSaved = false;
}
} else {
if (getBlinkRate() != 0) {
if (!isBlinkRateSaved) {
savedBlinkRate = getBlinkRate();
isBlinkRateSaved = true;
}
setBlinkRate(0);
}
setVisible(true);
}
setVisible(true);
setSelectionVisible(true);
updateSystemSelection();
}
@@ -1046,34 +1031,17 @@ public void setVisible(boolean e) {
* @see Caret#setBlinkRate
*/
public void setBlinkRate(int rate) {
if (rate < 0) {
throw new IllegalArgumentException("Invalid blink rate: " + rate);
}
if (rate != 0) {
if (component.isEditable()) {
if (flasher == null) {
flasher = new Timer(rate, handler);
}
flasher.setDelay(rate);
if (!flasher.isRunning()){
flasher.restart();
}
} else {
savedBlinkRate = rate;
isBlinkRateSaved = true;
if (flasher == null) {
flasher = new Timer(rate, handler);
}
flasher.setDelay(rate);
} else {
if (flasher != null) {
flasher.stop();
flasher.removeActionListener(handler);
flasher = null;
}
if (component.isEditable()) {
if (isBlinkRateSaved) {
savedBlinkRate = 0;
isBlinkRateSaved = false;
}
}
}
}

@@ -1085,9 +1053,6 @@ public void setBlinkRate(int rate) {
* @see Caret#getBlinkRate
*/
public int getBlinkRate() {
if (isBlinkRateSaved) {
return savedBlinkRate;
}
return (flasher == null) ? 0 : flasher.getDelay();
}

9 changes: 9 additions & 0 deletions test/hotspot/jtreg/runtime/CommandLine/PrintClasses.java
Original file line number Diff line number Diff line change
@@ -30,6 +30,15 @@
* @run main/othervm PrintClasses
*/

/*
* @test
* @bug 8298162
* @summary Test jcmd VM.classes with JFR
* @requires vm.hasJFR
* @library /test/lib
* @run main/othervm -XX:StartFlightRecording PrintClasses
*/

import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.JDKToolFinder;

2 changes: 2 additions & 0 deletions test/jdk/ProblemList.txt
Original file line number Diff line number Diff line change
@@ -661,6 +661,8 @@ javax/swing/JPopupMenu/6800513/bug6800513.java 7184956 macosx-all
javax/swing/JTabbedPane/8007563/Test8007563.java 8051591 generic-all
javax/swing/JTabbedPane/4624207/bug4624207.java 8064922 macosx-all
javax/swing/SwingUtilities/TestBadBreak/TestBadBreak.java 8160720 generic-all
javax/swing/text/DefaultCaret/HidingSelection/HidingSelectionTest.java 8194048 windows-all
javax/swing/text/DefaultCaret/HidingSelection/MultiSelectionTest.java 8213562 linux-all
javax/swing/JFileChooser/6798062/bug6798062.java 8146446 windows-all
javax/swing/JPopupMenu/4870644/bug4870644.java 8194130 macosx-all,linux-all
javax/swing/dnd/8139050/NativeErrorsInTableDnD.java 8202765 macosx-all,linux-all
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 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
@@ -21,17 +21,10 @@
* questions.
*/

import javax.swing.JFrame;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JTextField;
import javax.swing.MenuSelectionManager;
import javax.swing.SwingUtilities;
import java.awt.FlowLayout;
import java.awt.Point;
import java.awt.Robot;
import javax.swing.*;
import java.awt.*;
import java.awt.event.InputEvent;
import java.awt.image.BufferedImage;

/**
* @test
@@ -46,6 +39,7 @@ public class HidingSelectionTest {
private static JTextField field1;
private static JTextField field2;
private static JFrame frame;
private static Rectangle bounds;
private static JMenu menu;
private static JTextField anotherWindow;
private static Point menuLoc;
@@ -73,9 +67,17 @@ public static void main(String[] args) throws Exception {
Robot robot = new Robot();
robot.waitForIdle();
robot.delay(200);
SwingUtilities.invokeAndWait(() -> {
bounds = field2.getBounds();
bounds.setLocation(field2.getLocationOnScreen());
});
BufferedImage nosel = robot.createScreenCapture(bounds);

SwingUtilities.invokeAndWait(field2::requestFocus);
SwingUtilities.invokeAndWait(field2::selectAll);
robot.waitForIdle();
robot.delay(200);
BufferedImage sel = robot.createScreenCapture(bounds);

SwingUtilities.invokeAndWait(() -> {
menuLoc = menu.getLocationOnScreen();
@@ -87,7 +89,7 @@ public static void main(String[] args) throws Exception {
robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
robot.waitForIdle();
robot.delay(200);
if (!field2.getCaret().isSelectionVisible()) {
if (!biEqual(robot.createScreenCapture(bounds), sel)) {
throw new RuntimeException("Test fails: menu hides selection");
}

@@ -96,7 +98,7 @@ public static void main(String[] args) throws Exception {
SwingUtilities.invokeAndWait(field1::requestFocus);
robot.waitForIdle();
robot.delay(200);
if (field2.getCaret().isSelectionVisible()) {
if (!biEqual(robot.createScreenCapture(bounds), nosel)) {
throw new RuntimeException(
"Test fails: focus lost doesn't hide selection");
}
@@ -117,12 +119,35 @@ public static void main(String[] args) throws Exception {
SwingUtilities.invokeAndWait(anotherWindow::requestFocus);
robot.waitForIdle();
robot.delay(200);
if (!field2.getCaret().isSelectionVisible()) {
if (biEqual(robot.createScreenCapture(bounds), nosel)) {
throw new RuntimeException(
"Test fails: switch window hides selection");
}

SwingUtilities.invokeAndWait(anotherWindow::selectAll);
robot.waitForIdle();
robot.delay(200);
if (biEqual(robot.createScreenCapture(bounds), sel)) {
throw new RuntimeException(
"Test fails: selection ownership is lost selection is shown");
}

SwingUtilities.invokeLater(frame2::dispose);
SwingUtilities.invokeLater(frame::dispose);
}

static boolean biEqual(BufferedImage i1, BufferedImage i2) {
if (i1.getWidth() == i2.getWidth() &&
i1.getHeight() == i2.getHeight()) {
for (int x = 0; x < i1.getWidth(); x++) {
for (int y = 0; y < i1.getHeight(); y++) {
if (i1.getRGB(x, y) != i2.getRGB(x, y)) {
return false;
}
}
}
return true;
}
return false;
}
}
Loading