Skip to content

Commit

Permalink
Merge master jdk-11.0.23+2 into openj9-staging
Browse files Browse the repository at this point in the history
Signed-off-by: J9 Build <j9build@ca.ibm.com>
  • Loading branch information
j9build committed Feb 8, 2024
2 parents 15ef206 + 629828a commit d438a36
Show file tree
Hide file tree
Showing 31 changed files with 1,985 additions and 328 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 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
Expand Down Expand Up @@ -1290,7 +1290,10 @@ static boolean explicitAnnotationProcessingRequested(Options options) {
options.isSet(PROCESSOR_PATH) ||
options.isSet(PROCESSOR_MODULE_PATH) ||
options.isSet(PROC, "only") ||
options.isSet(PROC, "full") ||
options.isSet(A) ||
options.isSet(XPRINT);
// Skipping -XprintRounds and -XprintProcessorInfo
}

public void setDeferredDiagnosticHandler(Log.DeferredDiagnosticHandler deferredDiagnosticHandler) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2006, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2006, 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
Expand Down Expand Up @@ -81,6 +81,11 @@
* {@code handleOption} then calls {@link #process process} providing a suitable
* {@link OptionHelper} to provide access the compiler state.
*
*
* <p>Maintenance note: when adding new annotation processing related
* options, the list of options regarded as requesting explicit
* annotation processing in JavaCompiler should be updated.
*
* <p><b>This is NOT part of any supported API.
* If you write code that depends on this, you do so at your own
* risk. This code and its internal interfaces are subject to change
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ private void initializeJVMEventTypes() {
// annotations, such as Period and Threshold.
if (pEventType.hasPeriod()) {
pEventType.setEventHook(true);
if (!(Type.EVENT_NAME_PREFIX + "ExecutionSample").equals(type.getName())) {
if (!pEventType.isMethodSampling()) {
requestHooks.add(new RequestHook(pEventType));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -278,4 +278,8 @@ public boolean isCommitable() {
public int getStackTraceOffset() {
return stackTraceOffset;
}

public boolean isMethodSampling() {
return isMethodSampling;
}
}
22 changes: 11 additions & 11 deletions test/hotspot/jtreg/compiler/unsafe/UnsafeGetStableArrayElement.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 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
Expand Down Expand Up @@ -224,12 +224,12 @@ static void testMatched(Callable<?> c, Runnable setDefaultAction) throws Excepti
}

static void testMismatched(Callable<?> c, Runnable setDefaultAction) throws Exception {
testMismatched(c, setDefaultAction, false);
testMismatched(c, setDefaultAction, false, true);
}

static void testMismatched(Callable<?> c, Runnable setDefaultAction, boolean objectArray) throws Exception {
if (Compiler.isGraalEnabled() && !objectArray) {
// Graal will constant fold mismatched reads from primitive stable arrays
static void testMismatched(Callable<?> c, Runnable setDefaultAction, boolean objectArray, boolean aligned) throws Exception {
if (Compiler.isGraalEnabled() && !objectArray && aligned) {
// Graal will constant fold mismatched reads from primitive stable arrays, except unaligned ones
run(c, setDefaultAction, null);
} else {
run(c, null, setDefaultAction);
Expand Down Expand Up @@ -319,15 +319,15 @@ static void testUnsafeAccess() throws Exception {
testMatched( Test::testD_D, Test::changeD);

// Object[], aligned accesses
testMismatched(Test::testL_J, Test::changeL, true); // long & double are always as large as an OOP
testMismatched(Test::testL_D, Test::changeL, true);
testMismatched(Test::testL_J, Test::changeL, true, true); // long & double are always as large as an OOP
testMismatched(Test::testL_D, Test::changeL, true, true);
testMatched( Test::testL_L, Test::changeL);

// Unaligned accesses
testMismatched(Test::testS_U, Test::changeS);
testMismatched(Test::testC_U, Test::changeC);
testMismatched(Test::testI_U, Test::changeI);
testMismatched(Test::testJ_U, Test::changeJ);
testMismatched(Test::testS_U, Test::changeS, false, false);
testMismatched(Test::testC_U, Test::changeC, false, false);
testMismatched(Test::testI_U, Test::changeI, false, false);
testMismatched(Test::testJ_U, Test::changeJ, true, false);

// No way to reliably check the expected behavior:
// (1) OOPs change during GC;
Expand Down
1 change: 1 addition & 0 deletions test/hotspot/jtreg/gc/g1/ihop/TestIHOPErgo.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
* @requires !vm.flightRecorder
* @requires vm.opt.ExplicitGCInvokesConcurrent != true
* @requires vm.opt.MaxGCPauseMillis == "null"
* @requires vm.compMode != "Xcomp"
* @library /test/lib /
* @modules java.base/jdk.internal.misc
* @modules java.management
Expand Down
2 changes: 2 additions & 0 deletions test/hotspot/jtreg/gc/g1/ihop/TestIHOPStatic.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
* @requires vm.gc.G1
* @requires !vm.flightRecorder
* @requires vm.opt.ExplicitGCInvokesConcurrent != true
* @requires !vm.graal.enabled
* @requires vm.compMode != "Xcomp"
* @requires os.maxMemory > 1G
* @library /test/lib /
* @modules java.base/jdk.internal.misc
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
* Copyright (c) 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
* 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.
*
*/
/*
* This is a non-abstract class with an abstract method.
*
*/
super public class AbstractMethodClass
extends java/lang/Object
version 51:0 // Java 7 version
{

public Method "<init>":"()V"
stack 1 locals 1
{
aload_0;
invokespecial Method java/lang/Object."<init>":"()V";
return;
}

public abstract Method "abstractM":"()V";

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
/*
* Copyright (c) 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
* 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.
*
*/

/*
* @test
* @bug 8323243
* @summary Test that invocation of an abstract method from JNI works correctly
* @compile AbstractMethodClass.jasm
* @run main/othervm/native TestJNIAbstractMethod
*/

/**
* We are testing invocation of an abstract method from JNI - which should
* simply result in throwning AbstractMethodError. To invoke an abstract method
* we must have an instance method (as abstract static methods are illegal),
* but instantiating an abstract class is also illegal at the Java language
* level, so we have to use a custom jasm class that contains an abstract method
* declaration, but which is not itself declared as an abstract class.
*/
public class TestJNIAbstractMethod {

// Invokes an abstract method from JNI and throws AbstractMethodError.
private static native void invokeAbstractM(Class<?> AMclass,
AbstractMethodClass receiver);

static {
System.loadLibrary("JNIAbstractMethod");
}

public static void main(String[] args) {
AbstractMethodClass obj = new AbstractMethodClass();
try {
System.out.println("Attempting direct invocation via Java");
obj.abstractM();
throw new RuntimeException("Did not get AbstractMethodError from Java!");
} catch (AbstractMethodError expected) {
System.out.println("ok - got expected exception: " + expected);
}
try {
System.out.println("Attempting direct invocation via JNI");
invokeAbstractM(obj.getClass(), obj);
throw new RuntimeException("Did not get AbstractMethodError from JNI!");
} catch (AbstractMethodError expected) {
System.out.println("ok - got expected exception: " + expected);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
* Copyright (c) 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
* 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.
*
*/
#include <jni.h>
#include <stdio.h>
#include <stdlib.h>

JNIEXPORT void JNICALL Java_TestJNIAbstractMethod_invokeAbstractM(JNIEnv* env,
jclass this_cls,
jclass target_cls,
jobject receiver) {

jmethodID mid = (*env)->GetMethodID(env, target_cls, "abstractM", "()V");
if (mid == NULL) {
fprintf(stderr, "Error looking up method abstractM\n");
(*env)->ExceptionDescribe(env);
exit(1);
}

printf("Invoking abstract method ...\n");
(*env)->CallVoidMethod(env, receiver, mid); // Should raise exception

}
Loading

0 comments on commit d438a36

Please sign in to comment.