Skip to content

Commit 526d816

Browse files
Fix graph scheduling segfaults for CEntryPoints.
1 parent dc94a20 commit 526d816

File tree

5 files changed

+215
-151
lines changed

5 files changed

+215
-151
lines changed

substratevm/src/com.oracle.svm.hosted.foreign/src/com/oracle/svm/hosted/foreign/UpcallStub.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,9 +218,15 @@ public StructuredGraph buildGraph(DebugContext debug, AnalysisMethod method, Hos
218218
arguments.addFirst(returnBuffer);
219219
}
220220

221-
/* Transfers to the Java-side stub; note that exceptions should be handled there. */
221+
/*
222+
* Transfers to the Java-side stub; note that exceptions should be handled there. We
223+
* explicitly disable inline for this call to prevent that operations floating to a point
224+
* where the base registers are not initialized yet.
225+
*/
222226
arguments.addFirst(mh);
223227
InvokeWithExceptionNode returnValue = kit.createJavaCallWithException(CallTargetNode.InvokeKind.Static, highLevelStub, arguments.toArray(ValueNode.EMPTY_ARRAY));
228+
returnValue.setUseForInlining(false);
229+
224230
kit.exceptionPart();
225231
kit.append(new DeadEndNode());
226232
kit.endInvokeWithException();

substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/cenum/CEnumCallWrapperMethod.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ private ValueNode createInvoke(AnalysisMethod method, HostedGraphKit kit, Analys
101101
if (method.getAnnotation(CEnumLookup.class) != null) {
102102
/* Call a method that converts the primitive value to a Java enum. */
103103
EnumInfo enumInfo = (EnumInfo) nativeLibraries.findElementInfo(returnType);
104-
return CInterfaceEnumTool.singleton().createInvokeLookupEnum(kit, returnType, enumInfo, arg);
104+
return CInterfaceEnumTool.singleton().createInvokeLookupEnum(kit, returnType, enumInfo, arg, true);
105105
} else if (method.getAnnotation(CEnumValue.class) != null) {
106106
/* Call a method that converts a Java enum to a primitive value. */
107107
ResolvedJavaType declaringType = method.getDeclaringClass();

substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/code/CCallStubMethod.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ private ValueNode adaptReturnValue(AnalysisMethod method, NativeLibraries native
143143
"Enum class %s needs a method that is annotated with @%s because it is used as the return type of a method annotated with @%s: %s.",
144144
declaredReturnType, CEnumLookup.class.getSimpleName(), getCorrespondingAnnotationName(), getOriginal());
145145

146-
return CInterfaceEnumTool.singleton().createInvokeLookupEnum(kit, declaredReturnType, enumInfo, value);
146+
return CInterfaceEnumTool.singleton().createInvokeLookupEnum(kit, declaredReturnType, enumInfo, value, true);
147147
}
148148

149149
private EnumInfo getEnumInfo(NativeLibraries nativeLibraries, AnalysisType type, boolean isReturnType) {

0 commit comments

Comments
 (0)