This commit is contained in:
Jesper Wilhelmsson 2023-01-11 21:50:42 +00:00
commit 33f3bd8fad
16 changed files with 79 additions and 45 deletions
src
hotspot/cpu
java.base/share/classes
java/lang
jdk/internal/foreign
java.desktop/share
classes
com/sun/imageio/plugins/tiff
javax/imageio/metadata/doc-files
native/libjavajpeg
jdk.compiler/share/classes/com/sun/tools/javac/comp
test

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2021, Red Hat Inc. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@ -505,7 +505,20 @@ class Address {
}
bool uses(Register reg) const {
return base() == reg || index() == reg;
switch (_mode) {
case literal:
case no_mode:
return false;
case base_plus_offset:
case base_plus_offset_reg:
case pre:
case post:
case post_reg:
return base() == reg || index() == reg;
default:
ShouldNotReachHere();
return false;
}
}
address target() const {

@ -836,9 +836,12 @@ void TemplateInterpreterGenerator::generate_fixed_frame(bool native_call) {
__ stp(r10, rscratch1, Address(sp, 4 * wordSize));
// Move SP out of the way
__ mov(sp, rscratch1);
} else {
__ mov(rscratch1, sp);
} else {
// Make sure there is room for the exception oop pushed in case method throws
// an exception (see TemplateInterpreterGenerator::generate_throw_exception())
__ sub(rscratch1, sp, 2 * wordSize);
__ stp(zr, rscratch1, Address(sp, 4 * wordSize));
__ mov(sp, rscratch1);
}
}

@ -776,8 +776,12 @@ void TemplateInterpreterGenerator::generate_fixed_frame(bool native_call) {
// Move SP out of the way
__ mv(sp, t0);
} else {
__ sd(sp, Address(sp, 5 * wordSize));
// Make sure there is room for the exception oop pushed in case method throws
// an exception (see TemplateInterpreterGenerator::generate_throw_exception())
__ sub(t0, sp, 2 * wordSize);
__ sd(t0, Address(sp, 5 * wordSize));
__ sd(zr, Address(sp, 4 * wordSize));
__ mv(sp, t0);
}
}

@ -1734,6 +1734,7 @@ public sealed interface MemorySegment permits AbstractMemorySegmentImpl {
* @throws IndexOutOfBoundsException when the access operation falls outside the <em>spatial bounds</em> of the
* memory segment.
* @throws UnsupportedOperationException if this segment is {@linkplain #isReadOnly() read-only}.
* @throws UnsupportedOperationException if {@code value} is not a {@linkplain #isNative() native} segment.
*/
@ForceInline
default void set(ValueLayout.OfAddress layout, long offset, MemorySegment value) {
@ -2079,6 +2080,7 @@ public sealed interface MemorySegment permits AbstractMemorySegmentImpl {
* @throws IndexOutOfBoundsException when the access operation falls outside the <em>spatial bounds</em> of the
* memory segment.
* @throws UnsupportedOperationException if this segment is {@linkplain #isReadOnly() read-only}.
* @throws UnsupportedOperationException if {@code value} is not a {@linkplain #isNative() native} segment.
*/
@ForceInline
default void setAtIndex(ValueLayout.OfAddress layout, long index, MemorySegment value) {

@ -7931,8 +7931,11 @@ assertEquals("boojum", (String) catTrace.invokeExact("boo", "jum"));
* {@code get} and {@code set} access modes will result in an {@code IllegalStateException}. If access is partially aligned,
* atomic access is only guaranteed with respect to the largest power of two that divides the GCD of {@code A} and {@code S}.
* <p>
* Finally, in all other cases, we say that a memory access operation is <em>misaligned</em>; in such cases an
* In all other cases, we say that a memory access operation is <em>misaligned</em>; in such cases an
* {@code IllegalStateException} is thrown, irrespective of the access mode being used.
* <p>
* Finally, if {@code T} is {@code MemorySegment} all write access modes throw {@link IllegalArgumentException}
* unless the value to be written is a {@linkplain MemorySegment#isNative() native} memory segment.
*
* @param layout the value layout for which a memory access handle is to be obtained.
* @return the new memory segment view var handle.

@ -38,6 +38,7 @@ import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.function.Supplier;
import jdk.internal.access.SharedSecrets;
import jdk.internal.foreign.abi.SharedUtils;
import jdk.internal.vm.annotation.ForceInline;
import static java.lang.foreign.ValueLayout.JAVA_BYTE;
@ -62,8 +63,8 @@ public final class Utils {
MethodType.methodType(boolean.class, byte.class));
BOOL_TO_BYTE = lookup.findStatic(Utils.class, "booleanToByte",
MethodType.methodType(byte.class, boolean.class));
ADDRESS_TO_LONG = lookup.findVirtual(MemorySegment.class, "address",
MethodType.methodType(long.class));
ADDRESS_TO_LONG = lookup.findStatic(SharedUtils.class, "unboxSegment",
MethodType.methodType(long.class, MemorySegment.class));
LONG_TO_ADDRESS_SAFE = lookup.findStatic(Utils.class, "longToAddressSafe",
MethodType.methodType(MemorySegment.class, long.class));
LONG_TO_ADDRESS_UNSAFE = lookup.findStatic(Utils.class, "longToAddressUnsafe",

@ -259,7 +259,7 @@ public final class SharedUtils {
}
}
static long unboxSegment(MemorySegment segment) {
public static long unboxSegment(MemorySegment segment) {
if (!segment.isNative()) {
throw new IllegalArgumentException("Heap segment not allowed: " + segment);
}

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 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
@ -78,8 +78,9 @@ import javax.imageio.ImageWriteParam;
* <tr>
* <td>Exif JPEG</td>
* <td>Exif-specific JPEG compression (see note following this table)</td>
* <td><a href="http://www.exif.org/Exif2-2.PDF">Exif 2.2 Specification</a>
* (PDF), section 4.5.5, "Basic Structure of Thumbnail Data"</td>
* <td><a href="https://www.cipa.jp/std/documents/e/DC-008-2012_E.pdf">
* Exif 2.3 Specification</a>
* (PDF), section 4.5.8, "Basic Structure of Thumbnail Data"</td>
* </table>
*
* <p>

@ -5,7 +5,7 @@
<title>TIFF Metadata Format Specification and Usage Notes</title>
</head>
<!--
Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2015, 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
@ -574,8 +574,9 @@ DEFLATE Compressed Data Format Specification</a></td>
<th scope="row">9</th>
<td>Exif JPEG</td>
<td>Exif-specific JPEG compression (see note following this table)</td>
<td><a href="http://www.exif.org/Exif2-2.PDF">Exif 2.2 Specification</a>
(PDF), section 4.5.5, "Basic Structure of Thumbnail Data"</td>
<td><a href="https://www.cipa.jp/std/documents/e/DC-008-2012_E.pdf">
Exif 2.3 Specification</a>
(PDF), section 4.5.8, "Basic Structure of Thumbnail Data"</td>
</tbody>
</table>
@ -739,7 +740,7 @@ color space is grayscale.</li>
be written as supplied.</p>
<p>If an Exif image is being written, the set of fields present and their
values will be modified such that the result is in accord with the Exif 2.2
values will be modified such that the result is in accord with the Exif 2.3
specification.</p>
<p>Setting up the image metadata to write to a TIFF stream may be simplified

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 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
@ -1614,7 +1614,8 @@ Java_com_sun_imageio_plugins_jpeg_JPEGImageReader_setSource
/*
* For EXIF images, the APP1 will appear immediately after the SOI,
* so it's safe to only look at the first marker in the list.
* (see http://www.exif.org/Exif2-2.PDF, section 4.7, page 58)
* (see https://www.cipa.jp/std/documents/e/DC-008-2012_E.pdf,
* section 4.7, page 83)
*/
#define IS_EXIF(c) \
(((c)->marker_list != NULL) && ((c)->marker_list->marker == JPEG_APP1))
@ -1715,7 +1716,8 @@ Java_com_sun_imageio_plugins_jpeg_JPEGImageReader_readImageHeader
* - we got JFIF image
* Must be YCbCr (see http://www.w3.org/Graphics/JPEG/jfif3.pdf, page 2)
* - we got EXIF image
* Must be YCbCr (see http://www.exif.org/Exif2-2.PDF, section 4.7, page 63)
* Must be YCbCr (see https://www.cipa.jp/std/documents/e/DC-008-2012_E.pdf,
* section 4.7, page 88)
* - something else
* Apply heuristical rules to identify actual colorspace.
*/

@ -2027,13 +2027,14 @@ public class Flow {
void letInit(DiagnosticPosition pos, VarSymbol sym) {
if (sym.adr >= firstadr && trackable(sym)) {
if ((sym.flags() & EFFECTIVELY_FINAL) != 0) {
if (inits.isMember(sym.adr) || !uninits.isMember(sym.adr)) {
//assignment targeting an effectively final variable makes the
//variable lose its status of effectively final if the variable
//is definitely assigned or _not_ definitively unassigned
if (!uninits.isMember(sym.adr)) {
//assignment targeting an effectively final variable
//makes the variable lose its status of effectively final
//if the variable is _not_ definitively unassigned
sym.flags_field &= ~EFFECTIVELY_FINAL;
} else {
uninit(sym);
}
uninit(sym);
}
else if ((sym.flags() & FINAL) != 0) {
if ((sym.flags() & PARAMETER) != 0) {

@ -1,5 +1,5 @@
#
# Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2018, 2023, 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
@ -38,5 +38,3 @@ serviceability/sa/TestJhsdbJstackMixed.java 8248675 linux-aarch64
serviceability/jvmti/VMObjectAlloc/VMObjectAllocTest.java 8288430 generic-all
gc/cslocker/TestCSLocker.java 8293289 generic-x64
compiler/c1/TestPrintC1Statistics.java 8298053 linux-aarch64

@ -1,5 +1,5 @@
/*
* Copyright (c) 2022, Arm Limited. All rights reserved.
* Copyright (c) 2022, 2023, Arm Limited. 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
@ -79,7 +79,7 @@ public class VectorGatherScatterTest {
ia[i] = i;
la[i] = RD.nextLong(25);
da[i] = RD.nextDouble(25.0);
m[i] = RD.nextBoolean();
m[i] = i % 2 == 0;
}
}
@ -102,6 +102,8 @@ public class VectorGatherScatterTest {
@IR(counts = { IRNode.LOAD_VECTOR_GATHER_MASKED, ">= 1" })
public static void testLoadGatherMasked() {
VectorMask<Long> mask = VectorMask.fromArray(L_SPECIES, m, 0);
// "mask" is guaranteed to be not alltrue, in case the masked
// gather load is optimized to the non-masked version.
LongVector av = LongVector.fromArray(L_SPECIES, la, 0, ia, 0, mask);
av.intoArray(lr, 0);
IntVector bv = IntVector.fromArray(I_SPECIES, ia, 0);
@ -132,6 +134,8 @@ public class VectorGatherScatterTest {
public static void testStoreScatterMasked() {
VectorMask<Double> mask = VectorMask.fromArray(D_SPECIES, m, 0);
DoubleVector av = DoubleVector.fromArray(D_SPECIES, da, 0);
// "mask" is guaranteed to be not alltrue, in case the masked
// scatter store is optimized to the non-masked version.
av.intoArray(dr, 0, ia, 0, mask);
IntVector bv = IntVector.fromArray(I_SPECIES, ia, 0);
bv.add(0).intoArray(ir, 0);

@ -29,6 +29,7 @@
import java.lang.foreign.Arena;
import java.lang.foreign.MemorySegment;
import java.lang.foreign.SegmentScope;
import java.lang.foreign.ValueLayout;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
@ -132,6 +133,22 @@ public class TestMemoryAccessInstance {
}
}
@Test(expectedExceptions = IllegalArgumentException.class,
expectedExceptionsMessageRegExp = ".*Heap segment not allowed.*")
public void badHeapSegmentSet() {
MemorySegment targetSegment = MemorySegment.allocateNative(ValueLayout.ADDRESS.byteSize(), SegmentScope.auto());
MemorySegment segment = MemorySegment.ofArray(new byte[]{ 0, 1, 2 });
targetSegment.set(ValueLayout.ADDRESS, 0, segment); // should throw
}
@Test(expectedExceptions = IllegalArgumentException.class,
expectedExceptionsMessageRegExp = ".*Heap segment not allowed.*")
public void badHeapSegmentSetAtIndex() {
MemorySegment targetSegment = MemorySegment.allocateNative(ValueLayout.ADDRESS.byteSize(), SegmentScope.auto());
MemorySegment segment = MemorySegment.ofArray(new byte[]{ 0, 1, 2 });
targetSegment.setAtIndex(ValueLayout.ADDRESS, 0, segment); // should throw
}
static final ByteOrder NE = ByteOrder.nativeOrder();
@DataProvider(name = "segmentAccessors")

@ -1,14 +0,0 @@
/*
* @test /nodynamiccopyright/
* @summary Verify for() loop variable not effectively final even if loop never increments
* @bug 8294461
* @compile/fail/ref=EffectivelyFinalLoopIncrement.out -XDrawDiagnostics EffectivelyFinalLoopIncrement.java
*/
class EffectivelyFinalLoopIncrement {
EffectivelyFinalLoopIncrement() {
for (int i = 0; i < 10; i++) {
Runnable r = () -> System.out.println(i); // variable i is NOT effectively final
break; // even though "i++" is never reached
}
}
}

@ -1,2 +0,0 @@
EffectivelyFinalLoopIncrement.java:10:51: compiler.err.cant.ref.non.effectively.final.var: i, (compiler.misc.lambda)
1 error