Skip to content

Commit 362f60a

Browse files
committed
Merge master HEAD into openj9-staging
Signed-off-by: J9 Build <[email protected]>
2 parents 103af78 + 592961e commit 362f60a

File tree

44 files changed

+747
-155
lines changed

Some content is hidden

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

44 files changed

+747
-155
lines changed

src/java.base/share/classes/jdk/internal/foreign/abi/BindingSpecializer.java

+23-7
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
*/
2525
package jdk.internal.foreign.abi;
2626

27+
import java.lang.classfile.Annotation;
2728
import java.lang.classfile.ClassFile;
2829
import java.lang.classfile.CodeBuilder;
2930
import java.lang.classfile.Label;
@@ -46,10 +47,13 @@
4647
import jdk.internal.foreign.abi.Binding.ShiftRight;
4748
import jdk.internal.foreign.abi.Binding.VMLoad;
4849
import jdk.internal.foreign.abi.Binding.VMStore;
50+
import jdk.internal.vm.annotation.ForceInline;
4951
import sun.security.action.GetBooleanAction;
52+
import sun.security.action.GetIntegerAction;
5053
import sun.security.action.GetPropertyAction;
5154

5255
import java.io.IOException;
56+
import java.lang.classfile.attribute.RuntimeVisibleAnnotationsAttribute;
5357
import java.lang.constant.ClassDesc;
5458
import java.lang.constant.ConstantDesc;
5559
import java.lang.constant.DynamicConstantDesc;
@@ -77,6 +81,8 @@ public class BindingSpecializer {
7781
= GetPropertyAction.privilegedGetProperty("jdk.internal.foreign.abi.Specializer.DUMP_CLASSES_DIR");
7882
private static final boolean PERFORM_VERIFICATION
7983
= GetBooleanAction.privilegedGetProperty("jdk.internal.foreign.abi.Specializer.PERFORM_VERIFICATION");
84+
private static final int SCOPE_DEDUP_DEPTH
85+
= GetIntegerAction.privilegedGetProperty("jdk.internal.foreign.abi.Specializer.SCOPE_DEDUP_DEPTH", 2);
8086

8187
// Bunch of helper constants
8288
private static final int CLASSFILE_VERSION = ClassFileFormatVersion.latest().major();
@@ -99,6 +105,7 @@ public class BindingSpecializer {
99105
private static final ClassDesc CD_ValueLayout_OfFloat = referenceClassDesc(ValueLayout.OfFloat.class);
100106
private static final ClassDesc CD_ValueLayout_OfDouble = referenceClassDesc(ValueLayout.OfDouble.class);
101107
private static final ClassDesc CD_AddressLayout = referenceClassDesc(AddressLayout.class);
108+
private static final ClassDesc CD_ForceInline = referenceClassDesc(ForceInline.class);
102109

103110
private static final MethodTypeDesc MTD_NEW_BOUNDED_ARENA = MethodTypeDesc.of(CD_Arena, CD_long);
104111
private static final MethodTypeDesc MTD_NEW_EMPTY_ARENA = MethodTypeDesc.of(CD_Arena);
@@ -196,8 +203,9 @@ private static byte[] specializeHelper(MethodType leafType, MethodType callerMet
196203
clb.withFlags(ACC_PUBLIC + ACC_FINAL + ACC_SUPER)
197204
.withSuperclass(CD_Object)
198205
.withVersion(CLASSFILE_VERSION, 0)
199-
.withMethodBody(METHOD_NAME, methodTypeDesc(callerMethodType), ACC_PUBLIC | ACC_STATIC,
200-
cb -> new BindingSpecializer(cb, callerMethodType, callingSequence, abi, leafType).specialize());
206+
.withMethod(METHOD_NAME, methodTypeDesc(callerMethodType), ACC_PUBLIC | ACC_STATIC,
207+
mb -> mb.with(RuntimeVisibleAnnotationsAttribute.of(Annotation.of(CD_ForceInline)))
208+
.withCode(cb -> new BindingSpecializer(cb, callerMethodType, callingSequence, abi, leafType).specialize()));
201209
});
202210

203211
if (DUMP_CLASSES_DIR != null) {
@@ -502,11 +510,19 @@ private void emitAcquireScope() {
502510

503511
// start with 1 scope to maybe acquire on the stack
504512
assert curScopeLocalIdx != -1;
505-
boolean hasOtherScopes = curScopeLocalIdx != 0;
506-
for (int i = 0; i < curScopeLocalIdx; i++) {
513+
boolean hasLookup = false;
514+
515+
// Here we check if the current scope has not been already acquired.
516+
// To do that, we generate many comparisons (one per cached scope).
517+
// Note that we always skip comparisons against the very first cached scope
518+
// (as that is the function address, which typically belongs to another scope).
519+
// We also stop the comparisons at SCOPE_DEDUP_DEPTH, to keep a lid on the size
520+
// of the generated code.
521+
for (int i = 1; i < curScopeLocalIdx && i <= SCOPE_DEDUP_DEPTH; i++) {
507522
cb.dup() // dup for comparison
508523
.aload(scopeSlots[i])
509524
.if_acmpeq(skipAcquire);
525+
hasLookup = true;
510526
}
511527

512528
// 1 scope to acquire on the stack
@@ -516,10 +532,10 @@ private void emitAcquireScope() {
516532
cb.invokevirtual(CD_MemorySessionImpl, "acquire0", MTD_ACQUIRE0) // call acquire on the other
517533
.astore(nextScopeLocal); // store off one to release later
518534

519-
if (hasOtherScopes) { // avoid ASM generating a bunch of nops for the dead code
535+
if (hasLookup) { // avoid ASM generating a bunch of nops for the dead code
520536
cb.goto_(end)
521-
.labelBinding(skipAcquire)
522-
.pop(); // drop scope
537+
.labelBinding(skipAcquire)
538+
.pop(); // drop scope
523539
}
524540

525541
cb.labelBinding(end);

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,8 @@ public interface Elements {
8181
* @implSpec The default implementation of this method returns
8282
* {@code null}.
8383
*
84-
* @param name fully qualified package name, or an empty string for an unnamed package
8584
* @param module module relative to which the lookup should happen
85+
* @param name fully qualified package name, or an empty string for an unnamed package
8686
* @return the specified package, or {@code null} if it cannot be found
8787
* @see #getAllPackageElements
8888
* @since 9
@@ -167,8 +167,8 @@ default Set<? extends PackageElement> getAllPackageElements(CharSequence name) {
167167
* @implSpec The default implementation of this method returns
168168
* {@code null}.
169169
*
170-
* @param name the canonical name
171170
* @param module module relative to which the lookup should happen
171+
* @param name the canonical name
172172
* @return the named type element, or {@code null} if it cannot be found
173173
* @see #getAllTypeElements
174174
* @since 9

src/java.management/share/classes/javax/management/AttributeList.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1999, 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
@@ -182,9 +182,9 @@ public void add(Attribute object) {
182182
* size())} a RuntimeOperationsException should be raised, wrapping the
183183
* java.lang.IndexOutOfBoundsException thrown.
184184
*
185-
* @param object The <CODE>Attribute</CODE> object to be inserted.
186185
* @param index The position in the list where the new {@code Attribute}
187186
* object is to be inserted.
187+
* @param object The <CODE>Attribute</CODE> object to be inserted.
188188
*/
189189
public void add(int index, Attribute object) {
190190
try {
@@ -202,8 +202,8 @@ public void add(int index, Attribute object) {
202202
* out of range {@literal (index < 0 || index > size())} a RuntimeOperationsException
203203
* should be raised, wrapping the java.lang.IndexOutOfBoundsException thrown.
204204
*
205-
* @param object The value to which the attribute element should be set.
206205
* @param index The position specified.
206+
* @param object The value to which the attribute element should be set.
207207
*/
208208
public void set(int index, Attribute object) {
209209
try {
@@ -238,9 +238,9 @@ public boolean addAll(AttributeList list) {
238238
* RuntimeOperationsException should be raised, wrapping the
239239
* java.lang.IndexOutOfBoundsException thrown.
240240
*
241-
* @param list Elements to be inserted into the list.
242241
* @param index Position at which to insert the first element from the
243242
* <CODE>AttributeList</CODE> specified.
243+
* @param list Elements to be inserted into the list.
244244
*
245245
* @return true if this list changed as a result of the call.
246246
*

src/java.management/share/classes/javax/management/DefaultLoaderRepository.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1999, 2020, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1999, 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
@@ -80,8 +80,8 @@ public static Class<?> loadClass(String className)
8080
* is not found the method will throw a <CODE>ClassNotFoundException</CODE>
8181
* exception.
8282
*
83-
* @param className The name of the class to be loaded.
8483
* @param loader The class loader to be excluded.
84+
* @param className The name of the class to be loaded.
8585
*
8686
* @return the loaded class.
8787
*

src/java.management/share/classes/javax/management/MBeanConstructorInfo.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1999, 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
@@ -75,10 +75,10 @@ public MBeanConstructorInfo(String description, Constructor<?> constructor) {
7575
* Constructs an {@code MBeanConstructorInfo} object.
7676
*
7777
* @param name The name of the constructor.
78+
* @param description A human readable description of the constructor.
7879
* @param signature {@code MBeanParameterInfo} objects
7980
* describing the parameters(arguments) of the constructor. This
8081
* may be null with the same effect as a zero-length array.
81-
* @param description A human readable description of the constructor.
8282
*/
8383
public MBeanConstructorInfo(String name,
8484
String description,
@@ -90,10 +90,10 @@ public MBeanConstructorInfo(String name,
9090
* Constructs an {@code MBeanConstructorInfo} object.
9191
*
9292
* @param name The name of the constructor.
93+
* @param description A human readable description of the constructor.
9394
* @param signature {@code MBeanParameterInfo} objects
9495
* describing the parameters(arguments) of the constructor. This
9596
* may be null with the same effect as a zero-length array.
96-
* @param description A human readable description of the constructor.
9797
* @param descriptor The descriptor for the constructor. This may be null
9898
* which is equivalent to an empty descriptor.
9999
*

src/java.management/share/classes/javax/management/MBeanOperationInfo.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1999, 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
@@ -97,9 +97,9 @@ public class MBeanOperationInfo extends MBeanFeatureInfo implements Cloneable {
9797
* fields contributed by any annotations on the {@code Method}
9898
* object that contain the {@link DescriptorKey} meta-annotation.
9999
*
100+
* @param description A human readable description of the operation.
100101
* @param method The {@code java.lang.reflect.Method} object
101102
* describing the MBean operation.
102-
* @param description A human readable description of the operation.
103103
*/
104104
public MBeanOperationInfo(String description, Method method) {
105105
this(method.getName(),

src/java.management/share/classes/javax/management/MBeanServer.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1999, 2022, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1999, 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
@@ -622,11 +622,11 @@ public Object instantiate(String className, Object params[],
622622
* newly created object is not registered in the MBean server.</p>
623623
*
624624
* @param className The class name of the object to be instantiated.
625+
* @param loaderName The object name of the class loader to be used.
625626
* @param params An array containing the parameters of the
626627
* constructor to be invoked.
627628
* @param signature An array containing the signature of the
628629
* constructor to be invoked.
629-
* @param loaderName The object name of the class loader to be used.
630630
*
631631
* @return The newly instantiated object.
632632
*
@@ -711,10 +711,10 @@ default public ObjectInputStream deserialize(String className, byte[] data)
711711
*
712712
* @param className The name of the class whose class loader should be
713713
* used for the de-serialization.
714-
* @param data The byte array to be de-sererialized.
715714
* @param loaderName The name of the class loader to be used for
716715
* loading the specified class. If null, the MBean Server's class
717716
* loader will be used.
717+
* @param data The byte array to be de-sererialized.
718718
*
719719
* @implSpec This method throws {@link UnsupportedOperationException} by default.
720720
*

src/java.management/share/classes/javax/management/MBeanServerConnection.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2002, 2022, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2002, 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
@@ -278,11 +278,11 @@ public ObjectInstance createMBean(String className, ObjectName name,
278278
*
279279
* @param className The class name of the MBean to be instantiated.
280280
* @param name The object name of the MBean. May be null.
281+
* @param loaderName The object name of the class loader to be used.
281282
* @param params An array containing the parameters of the
282283
* constructor to be invoked.
283284
* @param signature An array containing the signature of the
284285
* constructor to be invoked.
285-
* @param loaderName The object name of the class loader to be used.
286286
*
287287
* @return An <CODE>ObjectInstance</CODE>, containing the
288288
* <CODE>ObjectName</CODE> and the Java class name of the newly

src/java.management/share/classes/javax/management/loading/ClassLoaderRepository.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2002, 2007, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2002, 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
@@ -100,10 +100,10 @@ public Class<?> loadClass(String className)
100100
* the same time. The {@link #loadClassBefore} method is
101101
* recommended to avoid the risk of deadlock.</p>
102102
*
103-
* @param className The name of the class to be loaded.
104103
* @param exclude The class loader to be excluded. May be null,
105104
* in which case this method is equivalent to {@link #loadClass
106105
* loadClass(className)}.
106+
* @param className The name of the class to be loaded.
107107
*
108108
* @return the loaded class.
109109
*
@@ -133,10 +133,10 @@ public Class<?> loadClassWithout(ClassLoader exclude,
133133
* search as soon as <code>stop</code> is reached, a potential
134134
* deadlock with concurrent class loading is avoided.</p>
135135
*
136-
* @param className The name of the class to be loaded.
137136
* @param stop The class loader at which to stop. May be null, in
138137
* which case this method is equivalent to {@link #loadClass(String)
139138
* loadClass(className)}.
139+
* @param className The name of the class to be loaded.
140140
*
141141
* @return the loaded class.
142142
*

src/java.management/share/classes/javax/management/loading/DefaultLoaderRepository.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2000, 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
@@ -88,8 +88,8 @@ public static Class<?> loadClass(String className)
8888
* is not found the method will throw a <CODE>ClassNotFoundException</CODE>
8989
* exception.
9090
*
91-
* @param className The name of the class to be loaded.
9291
* @param loader The class loader to be excluded.
92+
* @param className The name of the class to be loaded.
9393
*
9494
* @return the loaded class.
9595
*

src/java.management/share/classes/javax/management/modelmbean/ModelMBeanOperationInfo.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,9 @@ public class ModelMBeanOperationInfo extends MBeanOperationInfo
136136
* on the {@code Method} object that contain the {@link
137137
* DescriptorKey} meta-annotation.
138138
*
139+
* @param description A human readable description of the operation.
139140
* @param operationMethod The java.lang.reflect.Method object
140141
* describing the MBean operation.
141-
* @param description A human readable description of the operation.
142142
*/
143143

144144
public ModelMBeanOperationInfo(String description,
@@ -160,10 +160,10 @@ public ModelMBeanOperationInfo(String description,
160160
* contributed by any annotations on the {@code Method} object
161161
* that contain the {@link DescriptorKey} meta-annotation.
162162
*
163-
* @param operationMethod The java.lang.reflect.Method object
164-
* describing the MBean operation.
165163
* @param description A human readable description of the
166164
* operation.
165+
* @param operationMethod The java.lang.reflect.Method object
166+
* describing the MBean operation.
167167
* @param descriptor An instance of Descriptor containing the
168168
* appropriate metadata for this instance of the
169169
* ModelMBeanOperationInfo. If it is null a default

src/java.naming/share/classes/javax/naming/CompositeName.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1999, 2021, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1999, 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
@@ -485,9 +485,9 @@ public Name addAll(Name suffix)
485485
* new component are shifted up (away from index 0)
486486
* to accommodate the new components.
487487
*
488-
* @param n The non-null components to add.
489488
* @param posn The index in this name at which to add the new
490489
* components. Must be in the range [0,size()].
490+
* @param n The non-null components to add.
491491
* @return The updated CompositeName, not a new one. Cannot be null.
492492
* @throws InvalidNameException If n is not a composite name.
493493
* @throws ArrayIndexOutOfBoundsException
@@ -525,9 +525,9 @@ public Name add(String comp) throws InvalidNameException {
525525
* component are shifted up by one (away from index 0) to accommodate
526526
* the new component.
527527
*
528-
* @param comp The non-null component to add.
529528
* @param posn The index at which to add the new component.
530529
* Must be in the range [0,size()].
530+
* @param comp The non-null component to add.
531531
* @return The updated CompositeName, not a new one. Cannot be null.
532532
* @throws ArrayIndexOutOfBoundsException
533533
* If posn is outside the specified range.

src/java.naming/share/classes/javax/naming/CompoundName.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1999, 2021, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1999, 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
@@ -472,9 +472,9 @@ public Name addAll(Name suffix) throws InvalidNameException {
472472
* Implementation note: Currently the syntax properties of suffix
473473
* is not used or checked. They might be in the future.
474474
*
475-
* @param n The non-null components to add.
476475
* @param posn The index in this name at which to add the new
477476
* components. Must be in the range [0,size()].
477+
* @param n The non-null components to add.
478478
* @return The updated CompoundName, not a new one. Cannot be null.
479479
* @throws ArrayIndexOutOfBoundsException
480480
* If posn is outside the specified range.
@@ -512,9 +512,9 @@ public Name add(String comp) throws InvalidNameException{
512512
* component are shifted up by one (away from index 0)
513513
* to accommodate the new component.
514514
*
515-
* @param comp The non-null component to add.
516515
* @param posn The index at which to add the new component.
517516
* Must be in the range [0,size()].
517+
* @param comp The non-null component to add.
518518
* @throws ArrayIndexOutOfBoundsException
519519
* If posn is outside the specified range.
520520
* @return The updated CompoundName, not a new one. Cannot be null.

0 commit comments

Comments
 (0)