Skip to content
This repository was archived by the owner on Sep 19, 2023. It is now read-only.
Closed
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
4 changes: 2 additions & 2 deletions src/hotspot/share/jvmci/jvmciCompilerToVM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -701,8 +701,8 @@ C2V_VMENTRY_NULL(jobject, resolvePossiblyCachedConstantInPool, (JNIEnv* env, job
constantPoolHandle cp(THREAD, UNPACK_PAIR(ConstantPool, cp));
oop obj = cp->resolve_possibly_cached_constant_at(index, CHECK_NULL);
constantTag tag = cp->tag_at(index);
if (tag.is_dynamic_constant() || tag.is_dynamic_constant_in_error()) {
if (obj == Universe::the_null_sentinel()) {
if (tag.is_dynamic_constant()) {
if (obj == nullptr) {
return JVMCIENV->get_jobject(JVMCIENV->get_JavaConstant_NULL_POINTER());
}
BasicType bt = Signature::basic_type(cp->uncached_signature_ref_at(index));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@ public void test() throws Throwable {
long.class,
double.class,
String.class,
Object.class,
List.class
};

Expand All @@ -275,14 +276,20 @@ public void test() throws Throwable {
// with condy resolved via ConstantPool
Object expect = m.invoke(null);
Object actual;
if (lastConstant instanceof PrimitiveConstant) {
if (lastConstant == PrimitiveConstant.NULL_POINTER) {
actual = null;
} else if (lastConstant instanceof PrimitiveConstant) {
actual = ((PrimitiveConstant) lastConstant).asBoxedPrimitive();
} else {
actual = ((HotSpotObjectConstant) lastConstant).asObject(type);
}
Assert.assertEquals(actual, expect, m + ":");

testLookupBootstrapMethodInvocation(condyType, metaAccess, testClass, getTagAt);
if (type != Object.class) {
testLookupBootstrapMethodInvocation(condyType, metaAccess, testClass, getTagAt);
} else {
// StringConcatFactoryStringConcatFactory cannot accept null constants
}
}
}
}
Expand Down Expand Up @@ -347,6 +354,7 @@ private static void testLoadReferencedType(ResolvedJavaMethod method) {
@SuppressWarnings("unused") public static long getLongBSM (MethodHandles.Lookup l, String name, Class<?> type) { return Long.MAX_VALUE; }
@SuppressWarnings("unused") public static double getDoubleBSM (MethodHandles.Lookup l, String name, Class<?> type) { return Double.MAX_VALUE; }
@SuppressWarnings("unused") public static String getStringBSM (MethodHandles.Lookup l, String name, Class<?> type) { return "a string"; }
@SuppressWarnings("unused") public static Object getObjectBSM (MethodHandles.Lookup l, String name, Class<?> type) { return null; }
@SuppressWarnings("unused") public static List<?> getListBSM (MethodHandles.Lookup l, String name, Class<?> type) { return List.of("element"); }


Expand All @@ -359,6 +367,7 @@ private static void testLoadReferencedType(ResolvedJavaMethod method) {
public static long getLong () { return Long.MAX_VALUE; }
public static double getDouble () { return Double.MAX_VALUE; }
public static String getString () { return "a string"; }
public static Object getObject () { return null; }
public static List<?> getList () { return List.of("element"); }

public static boolean getBoolean(boolean v1, boolean v2) { return v1 || v2; }
Expand All @@ -370,6 +379,7 @@ private static void testLoadReferencedType(ResolvedJavaMethod method) {
public static long getLong (long v1, long v2) { return v1 ^ v2; }
public static double getDouble (double v1, double v2) { return v1 * v2; }
public static String getString (String v1, String v2) { return v1 + v2; }
public static Object getObject (Object v1, Object v2) { return null; }
public static List<?> getList (List<?> v1, List<?> v2) { return List.of(v1, v2); }
// @formatter:on
}