-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CodeGen: implement the wide architecture set #356
Conversation
Cesium.Runtime/FPtr.cs
Outdated
namespace Cesium.Runtime; | ||
|
||
/// <summary>A class encapsulating a C function pointer.</summary> | ||
public readonly unsafe struct FPtr<TDelegate> where TDelegate : Delegate // TODO: Think about vararg and empty parameter list encoding. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe FuncPtr
?
Cesium.Runtime/CPtr.cs
Outdated
@@ -19,7 +19,7 @@ private CPtr(long value) | |||
|
|||
/// <summary>A class encapsulating an object pointer.</summary> | |||
/// <typeparam name="T">Type this pointer may be resolved to.</typeparam> | |||
public unsafe readonly struct CPtr<T> where T : unmanaged | |||
public readonly unsafe struct CPtr<T> where T : unmanaged |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And maybe VoidPtr
. I do like CPtr, but it sounds too broad for me. But that's just remark. I do have only vague feeling here.
26efe8c
to
9bbf919
Compare
3af1187
to
3833c05
Compare
That's taken from ForNeVeR#356 in attempt to take what's good and unblock other work if possible
That's taken from ForNeVeR#356 in attempt to take what's good and unblock other work if possible
That's taken from #356 in attempt to take what's good and unblock other work if possible
Not sure if somebody think about it, so I leave it. |
My general idea is to preserve the function pointers as function pointers, when possible. And fall back to various strange things (delegates or whatnot) when not. But importantly, not every function may be presented by a Cesium interop with native code is a bit of underspecified right now (and that's a pretty generous statement already), but it's a thing we'll want to get better at. Eventually. So, our current design should at least consider how it will work in the future. |
# Conflicts: # Cesium.CodeGen.Tests/ArchitectureDependentCodeTests.cs # Cesium.CodeGen.Tests/verified/ArchitectureDependentCodeTests.PointerArrayMemberAssign_arch=Bit32.verified.txt # Cesium.CodeGen.Tests/verified/ArchitectureDependentCodeTests.PointerArrayMemberAssign_arch=Bit64.verified.txt # Cesium.CodeGen.Tests/verified/ArchitectureDependentCodeTests.PointerArrayMemberAssign_arch=Dynamic.verified.txt # Cesium.CodeGen/Ir/BlockItems/FunctionDeclaration.cs # Cesium.CodeGen/Ir/BlockItems/FunctionDefinition.cs # Cesium.Runtime/RuntimeHelpers.cs # Cesium.Runtime/StdIoFunctions.cs # Cesium.Runtime/StdLibFunctions.cs # Cesium.Runtime/StringFunctions.cs # docs/architecture-sets.md # docs/type-system.md
# Conflicts: # Cesium.CodeGen/Ir/Expressions/FunctionCallExpression.cs
# Conflicts: # Cesium.Runtime/StdIoFunctions.cs
b36a109
to
72ced1b
Compare
# Conflicts: # Cesium.CodeGen/Contexts/Meta/FunctionInfo.cs
5db8e6e
to
28f1fe8
Compare
d4f274a
to
d76e339
Compare
Closes #354.
TODO
CPtr
for structure fieldsCFuncPtr
for function pointers in structure fieldsmain
(C|F|V)Ptr
from wide archlong
CPtr<T>
in codegen on Wide architectureCesium.CodeGen.Tests.ArchitectureDependentTypeTests.StructWithPointer
FPtr
on Wide architectureInteropType
, CLI imports should produce functions with interop types as argumentsInteropType
knows how to convert a normal type to CLI typeCodeGenNetInteropTests
: add actual run test forCPtr
interopCPtr<T>
typeCPtr
interopFPtr
interop__nint
Before merge
ToDo
*Ptr
interop (e.g. as a function return value, or by pointer)nint
/nuint
intolong
/ulong
on the Wide arch