Skip to content

Commit 12ee8ca

Browse files
committed
Merge master HEAD into openj9-staging
Signed-off-by: J9 Build <[email protected]>
2 parents 7e10358 + 45bbb58 commit 12ee8ca

File tree

51 files changed

+396
-184
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+396
-184
lines changed

src/java.base/share/classes/java/lang/classfile/AttributeMapper.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -40,7 +40,7 @@
4040
* @since 22
4141
*/
4242
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
43-
public interface AttributeMapper<A> {
43+
public interface AttributeMapper<A extends Attribute<A>> {
4444

4545
/**
4646
* Attribute stability indicator

src/java.base/share/classes/java/lang/classfile/package-info.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@
147147
* ClassReader, int)} method for mapping from the classfile format
148148
* to an attribute instance, and the
149149
* {@link java.lang.classfile.AttributeMapper#writeAttribute(java.lang.classfile.BufWriter,
150-
* java.lang.Object)} method for mapping back to the classfile format. It also
150+
* java.lang.classfile.Attribute)} method for mapping back to the classfile format. It also
151151
* contains metadata including the attribute name, the set of classfile entities
152152
* where the attribute is applicable, and whether multiple attributes of the
153153
* same kind are allowed on a single entity.

src/java.base/share/classes/jdk/internal/classfile/impl/AttributeHolder.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public void writeTo(BufWriterImpl buf) {
5454
}
5555

5656
@SuppressWarnings("unchecked")
57-
<A> A get(AttributeMapper<A> am) {
57+
<A extends Attribute<A>> A get(AttributeMapper<A> am) {
5858
for (Attribute<?> a : attributes)
5959
if (a.attributeMapper() == am)
6060
return (A)a;

src/java.base/share/classes/jdk/internal/classfile/impl/BoundAttribute.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ public static List<Attribute<?>> readAttributes(AttributedElement enclosing, Cla
148148
mapper = customAttributes.apply(name);
149149
}
150150
if (mapper != null) {
151-
filled.add((Attribute<?>) Objects.requireNonNull(mapper.readAttribute(enclosing, reader, p)));
151+
filled.add(Objects.requireNonNull(mapper.readAttribute(enclosing, reader, p)));
152152
} else {
153153
AttributeMapper<UnknownAttribute> fakeMapper = new AttributeMapper<>() {
154154
@Override

src/java.base/share/classes/jdk/internal/classfile/impl/Util.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ public static MethodTypeDesc methodTypeSymbol(NameAndTypeEntry nat) {
224224
}
225225

226226
@SuppressWarnings("unchecked")
227-
private static <T> void writeAttribute(BufWriterImpl writer, Attribute<?> attr) {
227+
private static <T extends Attribute<T>> void writeAttribute(BufWriterImpl writer, Attribute<?> attr) {
228228
if (attr instanceof CustomAttribute<?> ca) {
229229
var mapper = (AttributeMapper<T>) ca.attributeMapper();
230230
mapper.writeAttribute(writer, (T) ca);

src/java.base/share/classes/jdk/internal/vm/Continuation.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -427,13 +427,15 @@ public boolean isPreempted() {
427427
* Pins the current continuation (enters a critical section).
428428
* This increments an internal semaphore that, when greater than 0, pins the continuation.
429429
*/
430+
@IntrinsicCandidate
430431
public static native void pin();
431432

432433
/**
433434
* Unpins the current continuation (exits a critical section).
434435
* This decrements an internal semaphore that, when equal 0, unpins the current continuation
435436
* if pinned with {@link #pin()}.
436437
*/
438+
@IntrinsicCandidate
437439
public static native void unpin();
438440

439441
/**

src/java.base/share/classes/module-info.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,8 @@
270270
jdk.internal.jvmstat,
271271
jdk.management,
272272
jdk.management.agent,
273-
jdk.internal.vm.ci;
273+
jdk.internal.vm.ci,
274+
jdk.jfr;
274275
exports jdk.internal.vm.annotation to
275276
java.instrument,
276277
jdk.internal.vm.ci,

src/java.base/unix/classes/sun/nio/ch/FileKey.java

+13-10
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2005, 2023, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -33,15 +33,18 @@
3333
*/
3434
public class FileKey {
3535

36-
private long st_dev; // ID of device
37-
private long st_ino; // Inode number
36+
private final long st_dev; // ID of device
37+
private final long st_ino; // Inode number
3838

39-
private FileKey() { }
39+
private FileKey(long st_dev, long st_ino) {
40+
this.st_dev = st_dev;
41+
this.st_ino = st_ino;
42+
}
4043

4144
public static FileKey create(FileDescriptor fd) throws IOException {
42-
FileKey fk = new FileKey();
43-
fk.init(fd);
44-
return fk;
45+
long finfo[] = new long[2];
46+
init(fd, finfo);
47+
return new FileKey(finfo[0], finfo[1]);
4548
}
4649

4750
@Override
@@ -59,10 +62,10 @@ public boolean equals(Object obj) {
5962
&& (this.st_ino == other.st_ino);
6063
}
6164

62-
private native void init(FileDescriptor fd) throws IOException;
63-
private static native void initIDs();
65+
private static native void init(FileDescriptor fd, long[] finfo)
66+
throws IOException;
6467

6568
static {
66-
initIDs();
69+
IOUtil.load();
6770
}
6871
}

src/java.base/unix/native/libnio/ch/FileKey.c

+8-16
Original file line numberDiff line numberDiff line change
@@ -30,29 +30,21 @@
3030
#include "nio_util.h"
3131
#include "sun_nio_ch_FileKey.h"
3232

33-
static jfieldID key_st_dev; /* id for FileKey.st_dev */
34-
static jfieldID key_st_ino; /* id for FileKey.st_ino */
35-
36-
37-
JNIEXPORT void JNICALL
38-
Java_sun_nio_ch_FileKey_initIDs(JNIEnv *env, jclass clazz)
39-
{
40-
CHECK_NULL(key_st_dev = (*env)->GetFieldID(env, clazz, "st_dev", "J"));
41-
CHECK_NULL(key_st_ino = (*env)->GetFieldID(env, clazz, "st_ino", "J"));
42-
}
43-
44-
4533
JNIEXPORT void JNICALL
46-
Java_sun_nio_ch_FileKey_init(JNIEnv *env, jobject this, jobject fdo)
34+
Java_sun_nio_ch_FileKey_init(JNIEnv* env, jclass clazz, jobject fdo,
35+
jlongArray finfo)
4736
{
4837
struct stat fbuf;
4938
int res;
39+
jlong deviceAndInode[2];
5040

51-
RESTARTABLE(fstat(fdval(env, fdo), &fbuf), res);
41+
int fd = fdval(env, fdo);
42+
RESTARTABLE(fstat(fd, &fbuf), res);
5243
if (res < 0) {
5344
JNU_ThrowIOExceptionWithLastError(env, "fstat failed");
5445
} else {
55-
(*env)->SetLongField(env, this, key_st_dev, (jlong)fbuf.st_dev);
56-
(*env)->SetLongField(env, this, key_st_ino, (jlong)fbuf.st_ino);
46+
deviceAndInode[0] = (jlong)fbuf.st_dev;
47+
deviceAndInode[1] = (jlong)fbuf.st_ino;
48+
(*env)->SetLongArrayRegion(env, finfo, 0, 2, deviceAndInode);
5749
}
5850
}

src/java.base/windows/classes/sun/nio/ch/FileKey.java

+14-10
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,21 @@
3333
*/
3434
public class FileKey {
3535

36-
private int dwVolumeSerialNumber;
37-
private int nFileIndexHigh;
38-
private int nFileIndexLow;
36+
private final int dwVolumeSerialNumber;
37+
private final int nFileIndexHigh;
38+
private final int nFileIndexLow;
3939

40-
private FileKey() { }
40+
private FileKey(int dwVolumeSerialNumber, int nFileIndexHigh,
41+
int nFileIndexLow) {
42+
this.dwVolumeSerialNumber = dwVolumeSerialNumber;
43+
this.nFileIndexHigh = nFileIndexHigh;
44+
this.nFileIndexLow = nFileIndexLow;
45+
}
4146

4247
public static FileKey create(FileDescriptor fd) throws IOException {
43-
FileKey fk = new FileKey();
44-
fk.init(fd);
45-
return fk;
48+
int finfo[] = new int[3];
49+
init(fd, finfo);
50+
return new FileKey(finfo[0], finfo[1], finfo[2]);
4651
}
4752

4853
@Override
@@ -60,11 +65,10 @@ public boolean equals(Object obj) {
6065
&& this.nFileIndexLow == other.nFileIndexLow;
6166
}
6267

63-
private native void init(FileDescriptor fd) throws IOException;
64-
private static native void initIDs();
68+
private static native void init(FileDescriptor fd, int[] finfo)
69+
throws IOException;
6570

6671
static {
6772
IOUtil.load();
68-
initIDs();
6973
}
7074
}

src/java.base/windows/native/libnio/ch/FileKey.c

+8-20
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2005, 2023, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -30,32 +30,20 @@
3030
#include "nio_util.h"
3131
#include "sun_nio_ch_FileKey.h"
3232

33-
static jfieldID key_volumeSN; /* id for FileKey.dwVolumeSerialNumber */
34-
static jfieldID key_indexHigh; /* id for FileKey.nFileIndexHigh */
35-
static jfieldID key_indexLow; /* id for FileKey.nFileIndexLow */
36-
37-
38-
JNIEXPORT void JNICALL
39-
Java_sun_nio_ch_FileKey_initIDs(JNIEnv *env, jclass clazz)
40-
{
41-
CHECK_NULL(key_volumeSN = (*env)->GetFieldID(env, clazz, "dwVolumeSerialNumber", "I"));
42-
CHECK_NULL(key_indexHigh = (*env)->GetFieldID(env, clazz, "nFileIndexHigh", "I"));
43-
CHECK_NULL(key_indexLow = (*env)->GetFieldID(env, clazz, "nFileIndexLow", "I"));
44-
}
45-
46-
4733
JNIEXPORT void JNICALL
48-
Java_sun_nio_ch_FileKey_init(JNIEnv *env, jobject this, jobject fdo)
34+
Java_sun_nio_ch_FileKey_init(JNIEnv *env, jclass clazz, jobject fdo, jintArray finfo)
4935
{
50-
HANDLE fileHandle = (HANDLE)(handleval(env, fdo));
36+
HANDLE fileHandle = (HANDLE)handleval(env, fdo);
5137
BOOL result;
5238
BY_HANDLE_FILE_INFORMATION fileInfo;
39+
jint info[3];
5340

5441
result = GetFileInformationByHandle(fileHandle, &fileInfo);
5542
if (result) {
56-
(*env)->SetIntField(env, this, key_volumeSN, fileInfo.dwVolumeSerialNumber);
57-
(*env)->SetIntField(env, this, key_indexHigh, fileInfo.nFileIndexHigh);
58-
(*env)->SetIntField(env, this, key_indexLow, fileInfo.nFileIndexLow);
43+
info[0] = (jint)fileInfo.dwVolumeSerialNumber;
44+
info[1] = (jint)fileInfo.nFileIndexHigh;
45+
info[2] = (jint)fileInfo.nFileIndexLow;
46+
(*env)->SetIntArrayRegion(env, finfo, 0, 3, info);
5947
} else {
6048
JNU_ThrowIOExceptionWithLastError(env, "GetFileInformationByHandle failed");
6149
}

src/java.compiler/share/classes/javax/annotation/processing/Filer.java

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2005, 2023, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -25,10 +25,8 @@
2525

2626
package javax.annotation.processing;
2727

28-
import javax.tools.JavaFileManager;
2928
import javax.tools.*;
3029
import javax.lang.model.element.Element;
31-
import javax.lang.model.element.TypeElement;
3230
import javax.lang.model.util.Elements;
3331
import java.io.IOException;
3432

src/java.compiler/share/classes/javax/lang/model/SourceVersion.java

-4
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,6 @@
2525

2626
package javax.lang.model;
2727

28-
import java.util.Collections;
29-
import java.util.Set;
30-
import java.util.HashSet;
31-
3228
/**
3329
* Source versions of the Java programming language.
3430
*

src/java.compiler/share/classes/javax/lang/model/element/Element.java

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2005, 2023, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -27,8 +27,6 @@
2727

2828

2929
import java.lang.annotation.Annotation;
30-
import java.lang.annotation.AnnotationTypeMismatchException;
31-
import java.lang.annotation.IncompleteAnnotationException;
3230
import java.util.List;
3331
import java.util.Set;
3432

src/java.compiler/share/classes/javax/lang/model/element/TypeElement.java

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2005, 2023, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -25,8 +25,6 @@
2525

2626
package javax.lang.model.element;
2727

28-
import jdk.internal.javac.PreviewFeature;
29-
3028
import java.util.List;
3129
import javax.lang.model.type.*;
3230
import javax.lang.model.util.*;

src/java.compiler/share/classes/javax/lang/model/element/VariableElement.java

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2005, 2022, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -25,8 +25,6 @@
2525

2626
package javax.lang.model.element;
2727

28-
import jdk.internal.javac.PreviewFeature;
29-
3028
import javax.lang.model.util.Elements;
3129
import javax.lang.model.type.TypeMirror;
3230
import javax.lang.model.type.TypeKind;

src/java.compiler/share/classes/javax/lang/model/type/TypeVariable.java

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2005, 2022, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -28,8 +28,6 @@
2828

2929
import javax.lang.model.element.Element;
3030
import javax.lang.model.element.TypeParameterElement;
31-
import javax.lang.model.util.Types;
32-
3331

3432
/**
3533
* Represents a type variable.

src/java.compiler/share/classes/javax/lang/model/type/TypeVisitor.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2005, 2022, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -25,7 +25,6 @@
2525

2626
package javax.lang.model.type;
2727

28-
import javax.lang.model.element.*;
2928
import javax.lang.model.util.*;
3029

3130
/**

src/java.compiler/share/classes/javax/lang/model/util/AbstractAnnotationValueVisitorPreview.java

-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
import jdk.internal.javac.PreviewFeature;
2929

3030
import static javax.lang.model.SourceVersion.*;
31-
import javax.lang.model.SourceVersion;
3231
import javax.annotation.processing.SupportedSourceVersion;
3332
import javax.annotation.processing.ProcessingEnvironment;
3433

src/java.compiler/share/classes/javax/lang/model/util/AbstractElementVisitorPreview.java

-3
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,6 @@
2929

3030
import javax.annotation.processing.SupportedSourceVersion;
3131
import javax.annotation.processing.ProcessingEnvironment;
32-
import javax.lang.model.SourceVersion;
33-
import javax.lang.model.element.ElementVisitor;
34-
import javax.lang.model.element.RecordComponentElement;
3532
import static javax.lang.model.SourceVersion.*;
3633

3734
/**

src/java.compiler/share/classes/javax/lang/model/util/AbstractTypeVisitor9.java

-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
package javax.lang.model.util;
2727

2828
import javax.annotation.processing.SupportedSourceVersion;
29-
import javax.lang.model.type.*;
3029
import javax.lang.model.SourceVersion;
3130
import static javax.lang.model.SourceVersion.*;
3231

0 commit comments

Comments
 (0)