Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ public static String getSupportMethodName(BytecodeExceptionNode.BytecodeExceptio
case ILLEGAL_ARGUMENT_EXCEPTION_ARGUMENT_IS_NOT_AN_ARRAY -> "createNewArgumentIsNotArrayException";
case ASSERTION_ERROR_OBJECT -> "createNewAssertionErrorObject";
case ASSERTION_ERROR_NULLARY -> "createNewAssertionErrorNullary";
case UNSTRUCTURED_LOCKING -> "createNewIllegalMonitorStateException";

default -> throw GraalError.shouldNotReachHereUnexpectedValue(exceptionKind);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

package com.oracle.svm.hosted.webimage.util;

import java.lang.reflect.Method;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.Optional;
Expand Down Expand Up @@ -57,11 +58,18 @@ public class ReflectUtil {
private static synchronized UnmodifiableEconomicSet<String> getObjectMethodDescriptors(MetaAccessProvider metaAccess) {
if (objectMethodDescriptors == null) {
EconomicSet<String> descriptors = EconomicSet.create();
for (ResolvedJavaMethod declaredMethod : metaAccess.lookupJavaType(Object.class).getDeclaredMethods(false)) {
if (declaredMethod.isPublic()) {
descriptors.add(fullDescriptor(declaredMethod));
}
/*
* Reflection on the host java.lang.Object rather than
* ResolvedJavaType.getDeclaredMethods, because that returns an empty array for a type
* that is not linked yet and is never allowed to force linking. This set is computed
* once and cached for the rest of the build, so picking up an empty result would
* silently disable the java.lang.Object filter below for every later query, and which
* query lands here first depends on the order the parallel analysis happens to run in.
*/
for (Method declaredMethod : Object.class.getMethods()) {
descriptors.add(fullDescriptor(metaAccess.lookupJavaMethod(declaredMethod)));
}
GraalError.guarantee(!descriptors.isEmpty(), "Found no public methods on java.lang.Object");
objectMethodDescriptors = descriptors;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,11 @@ public static IllegalArgumentException createNewArgumentIsNotArrayException() {
return new IllegalArgumentException("Argument is not an array");
}

@NeverInline("outlining for smaller code size")
public static IllegalMonitorStateException createNewIllegalMonitorStateException() {
return new IllegalMonitorStateException("Unstructured locking encountered. Native Image enforces structured locking (JVMS 2.11.10)");
}

@NeverInline("outlining for smaller code size")
public static ArithmeticException createNewArithmeticException() {
return new ArithmeticException();
Expand Down