Skip to content
Merged
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
2 changes: 1 addition & 1 deletion ci.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@
}),
// tests with sandboxed backends for various modules (posix, sha3, compression, pyexpat, ...)
"python-unittest-sandboxed": gpgate_ee + platform_spec(no_jobs) + platform_spec({
"linux:amd64:jdk21" : daily + t("01:00:00") + provide(GPY_JVM21_STANDALONE),
"linux:amd64:jdk21" : tier2 + provide(GPY_JVM21_STANDALONE),
"linux:aarch64:jdk21" : daily + t("02:00:00") + provide(GPY_JVM21_STANDALONE),
"darwin:aarch64:jdk21" : daily + t("01:00:00") + provide(GPY_JVM21_STANDALONE),
"windows:amd64:jdk21" : daily + t("01:30:00") + provide(GPY_JVM21_STANDALONE),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1613,6 +1613,7 @@ private void generateNativeAccessSupport(Element[] origins) throws IOException {
lines.add("");
lines.add("public final class " + NATIVE_ACCESS_SUPPORT_IMPL_CLASS_NAME + " extends " + NATIVE_ACCESS_SUPPORT_CLASS_NAME + " {");
lines.add(" private static final MethodHandle OF_ADDRESS;");
lines.add(" private static final Class<? extends MemorySegment> NATIVE_MEMORY_SEGMENT_CLASS = MemorySegment.NULL.getClass();");
lines.add(" private static final boolean WINDOWS = PythonLanguage.getPythonOS() == PythonOS.PLATFORM_WIN32;");
lines.add(" private static final MemoryLayout CAPTURE_STATE_LAYOUT = Linker.Option.captureStateLayout();");
lines.add(" private static final VarHandle ERRNO = captureStateVarHandle(\"errno\");");
Expand All @@ -1633,7 +1634,7 @@ private void generateNativeAccessSupport(Element[] origins) throws IOException {
lines.add("");
lines.add(" private static MethodType createMethodType(boolean captureCallState, FunctionDescriptor functionDescriptor) {");
lines.add(" MethodType methodType = functionDescriptor.toMethodType().insertParameterTypes(0, long.class);");
lines.add(" return captureCallState ? methodType.insertParameterTypes(1, MemorySegment.class) : methodType;");
lines.add(" return captureCallState ? methodType.insertParameterTypes(1, Object.class) : methodType;");
lines.add(" }");
lines.add("");
lines.add(" @Override");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ private record NativeDowncallDesc(String name, NativeSimpleType returnType, List
}

private static final String CAPTURE_CALL_STATE_FIELD = "callState";
private static final String NATIVE_MEMORY_SEGMENT_CLASS_FIELD = "NATIVE_MEMORY_SEGMENT_CLASS";

@Override
public Set<String> getSupportedAnnotationTypes() {
Expand Down Expand Up @@ -141,7 +140,6 @@ private void generateInvoker(TypeElement invokerElement) throws IOException, Pro
lines.add("// Generated by annotation processor: " + getClass().getName());
lines.add("package " + packageName + ";");
lines.add("");
lines.add("import java.lang.foreign.MemorySegment;");
lines.add("import java.lang.invoke.MethodHandle;");
lines.add("import java.util.concurrent.atomic.AtomicLongArray;");
lines.add("import java.util.List;");
Expand All @@ -153,7 +151,6 @@ private void generateInvoker(TypeElement invokerElement) throws IOException, Pro
lines.add("import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;");
lines.add("");
lines.add("final class " + className + " extends " + invokerTypeRef + " {");
lines.add(" private static final Class<? extends MemorySegment> " + NATIVE_MEMORY_SEGMENT_CLASS_FIELD + " = MemorySegment.NULL.getClass();");
lines.add(" private final PythonContext context;");
lines.add(" private final AtomicLongArray cachedFunctions = new AtomicLongArray(" + downcalls.size() + ");");
lines.add(" private volatile NativeLibrary nativeLibrary;");
Expand Down Expand Up @@ -334,8 +331,7 @@ private static String invokeArgs(NativeDowncallDesc downcall) {
List<String> allArgs = new ArrayList<>();
allArgs.add("functionPointer");
if (downcall.captureCallState) {
String capturedCallState = String.format("%s.cast(%s.get())", NATIVE_MEMORY_SEGMENT_CLASS_FIELD, CAPTURE_CALL_STATE_FIELD);
allArgs.add(capturedCallState);
allArgs.add(CAPTURE_CALL_STATE_FIELD + ".get()");
}
allArgs.addAll(downcall.argumentNames);
return String.join(", ", allArgs);
Expand Down
Loading