Skip to content
This repository has been archived by the owner on Oct 23, 2024. It is now read-only.

Commit

Permalink
Merge upstream-jdk
Browse files Browse the repository at this point in the history
  • Loading branch information
corretto-github-robot committed May 29, 2024
2 parents b96ecce + ca393c8 commit bf2f493
Show file tree
Hide file tree
Showing 9 changed files with 96 additions and 13 deletions.
2 changes: 1 addition & 1 deletion make/devkit/createJMHBundle.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ rm -f *
fetchJar() {
url="https://repo.maven.apache.org/maven2/$1/$2/$3/$2-$3.jar"
if command -v curl > /dev/null; then
curl -O --fail $url
curl -OL --fail $url
elif command -v wget > /dev/null; then
wget $url
else
Expand Down
9 changes: 6 additions & 3 deletions src/hotspot/share/gc/shenandoah/shenandoahFullGC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -359,11 +359,13 @@ class ShenandoahPrepareForCompactionObjectClosure : public ObjectClosure {
_compact_point = _to_region->bottom();
}

// Object fits into current region, record new location:
// Object fits into current region, record new location, if object does not move:
assert(_compact_point + obj_size <= _to_region->end(), "must fit");
shenandoah_assert_not_forwarded(nullptr, p);
_preserved_marks->push_if_necessary(p, p->mark());
p->forward_to(cast_to_oop(_compact_point));
if (_compact_point != cast_from_oop<HeapWord*>(p)) {
_preserved_marks->push_if_necessary(p, p->mark());
p->forward_to(cast_to_oop(_compact_point));
}
_compact_point += obj_size;
}
};
Expand Down Expand Up @@ -845,6 +847,7 @@ class ShenandoahCompactObjectsClosure : public ObjectClosure {
if (p->is_forwarded()) {
HeapWord* compact_from = cast_from_oop<HeapWord*>(p);
HeapWord* compact_to = cast_from_oop<HeapWord*>(p->forwardee());
assert(compact_from != compact_to, "Forwarded object should move");
Copy::aligned_conjoint_words(compact_from, compact_to, size);
oop new_obj = cast_to_oop(compact_to);

Expand Down
1 change: 1 addition & 0 deletions src/hotspot/share/gc/z/z_globals.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
\
product(double, ZYoungCompactionLimit, 25.0, \
"Maximum allowed garbage in young pages") \
range(0, 100) \
\
product(double, ZCollectionIntervalMinor, -1, \
"Force Minor GC at a fixed time interval (in seconds)") \
Expand Down
5 changes: 3 additions & 2 deletions src/hotspot/share/prims/downcallLinker.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2020, 2024, 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
Expand Down Expand Up @@ -41,7 +41,8 @@ class DowncallLinker: AllStatic {
int captured_state_mask,
bool needs_transition);

static void capture_state(int32_t* value_ptr, int captured_state_mask);
// This is defined as JVM_LEAF which adds the JNICALL modifier.
static void JNICALL capture_state(int32_t* value_ptr, int captured_state_mask);

class StubGenerator : public StubCodeGenerator {
BasicType* _signature;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1140,9 +1140,7 @@ public final ForkJoinWorkerThread newThread(ForkJoinPool pool) {
boolean isCommon = (pool.workerNamePrefix == null);
@SuppressWarnings("removal")
SecurityManager sm = System.getSecurityManager();
if (sm == null)
return new ForkJoinWorkerThread(null, pool, true, false);
else if (isCommon)
if (sm != null && isCommon)
return newCommonWithACC(pool);
else
return newRegularWithACC(pool);
Expand Down
69 changes: 69 additions & 0 deletions test/jdk/java/awt/color/ICC_Profile/CustomCMMID.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
/*
* Copyright Amazon.com Inc. 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.
*/

import java.awt.color.ColorSpace;
import java.awt.color.ICC_Profile;
import java.util.Arrays;

/**
* @test
* @bug 8321489
* @summary tests that the cmm id is not ignored
*/
public final class CustomCMMID {

private static final byte[] JAVA_ID = {
(byte) 'j', (byte) 'a', (byte) 'v', (byte) 'a',
};

private static final int[] CS = {
ColorSpace.CS_CIEXYZ, ColorSpace.CS_GRAY, ColorSpace.CS_LINEAR_RGB,
ColorSpace.CS_PYCC, ColorSpace.CS_sRGB
};

public static void main(String[] args) {
for (int cs : CS) {
ICC_Profile p = createProfile(cs);
validate(p);
}
}

private static ICC_Profile createProfile(int type) {
byte[] data = ICC_Profile.getInstance(type).getData();
System.arraycopy(JAVA_ID, 0, data, ICC_Profile.icHdrCmmId,
JAVA_ID.length);
return ICC_Profile.getInstance(data);
}

private static void validate(ICC_Profile p) {
byte[] header = p.getData(ICC_Profile.icSigHead);
byte[] id = new byte[JAVA_ID.length];
System.arraycopy(header, ICC_Profile.icHdrCmmId, id, 0, JAVA_ID.length);

if (!java.util.Arrays.equals(id, JAVA_ID)) {
System.err.println("Expected: " + Arrays.toString(JAVA_ID));
System.err.println("Actual: " + Arrays.toString(id));
throw new RuntimeException("Wrong cmm id");
}
}
}
8 changes: 8 additions & 0 deletions test/jdk/java/util/concurrent/tck/ForkJoinPool9Test.java
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ public void testCommonPoolThreadContextClassLoader() throws Throwable {
assertSame(ForkJoinPool.commonPool(), ForkJoinTask.getPool());
Thread currentThread = Thread.currentThread();

ClassLoader preexistingContextClassLoader =
currentThread.getContextClassLoader();

Stream.of(systemClassLoader, null).forEach(cl -> {
if (randomBoolean())
// should always be permitted, without effect
Expand All @@ -95,6 +98,11 @@ public void testCommonPoolThreadContextClassLoader() throws Throwable {
() -> System.getProperty("foo"),
() -> currentThread.setContextClassLoader(
classLoaderDistinctFromSystemClassLoader));
else {
currentThread.setContextClassLoader(classLoaderDistinctFromSystemClassLoader);
assertSame(currentThread.getContextClassLoader(), classLoaderDistinctFromSystemClassLoader);
currentThread.setContextClassLoader(preexistingContextClassLoader);
}
// TODO ?
// if (haveSecurityManager
// && Thread.currentThread().getClass().getSimpleName()
Expand Down
4 changes: 2 additions & 2 deletions test/jdk/jdk/jfr/event/oldobject/TestSanityDefault.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 2024, 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
Expand Down Expand Up @@ -37,7 +37,7 @@
* @requires vm.hasJFR
* @library /test/lib /test/jdk
* @summary Purpose of this test is to run leak profiler without command line tweaks or WhiteBox hacks until we succeed
* @run main/othervm jdk.jfr.event.oldobject.TestSanityDefault
* @run main/othervm -Xmx1G jdk.jfr.event.oldobject.TestSanityDefault
*/
public class TestSanityDefault {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,10 @@ public void beforeIteration() throws IOException {
@Benchmark
public void inflaterInputStreamRead() throws IOException {
deflated.reset();
InflaterInputStream iis = new InflaterInputStream(deflated);
while (iis.read(inflated, 0, inflated.length) != -1);
// We close the InflaterInputStream to release underlying native resources of the Inflater.
// The "deflated" ByteArrayInputStream remains unaffected.
try (InflaterInputStream iis = new InflaterInputStream(deflated)) {
while (iis.read(inflated, 0, inflated.length) != -1);
}
}
}

0 comments on commit bf2f493

Please sign in to comment.